-
Notifications
You must be signed in to change notification settings - Fork 65
Description
Problem:
By running the easy_start examples, I found that the major issue with pyprocess's current reporting is that the reports show plots by embedding locally saved images into an HTML template. Most of the browsers these days have a security feature which prevents loading locally saved images through HTML. As a result, even though pypreprocess creates and saves the plots on the disk properly, they do not appear in the HTML reports at all.
The HTML reports actually mention this issue - "RENDERING OF QA THUMBNAILS IS ENSURED BY LOCAL JQUERY SCRIPTS. THIS MAY NOT BE POSSIBLE ON CHROME DUE TO FILE-ACCESS RESTRICTIONS!"
Solutions:
-
In Google Chrome browser, this security feature can be disabled by running a terminal command
google-chrome --allow-file-access-from-fileson Linux. A browser window would open now and loading the HTML report in this window would render all the thumbnails and plots properly. -
Reporting in nilearn provides another (more efficient) solution. It bypasses this security feature by creating SVG URLs from matplotlib figure objects and then embeds those SVG URLs into the HTML reports. This means that the plots are not saved as raster images on the disk at all and the browsers simply render them as vector graphics whenever HTML reports are opened up. This could be implemented for pypreprocess as well. But that could be a bit complicated because there are several functions and class methods in pypreprocess named
generate_x_thumbnails(where x = various preprocessing steps such as realignment, segmentation etc.) which:- plot and save images corresponding to each preprocessing step
- implement various event handlers which ensure that correct images are being plotted according to the provided input
- create clickable thumbnail objects for each plot that are eventually added to HTML reports
If we were to implement nilearn-style reporting, iii. would be completely useless and could be removed. But i. and ii. would still be important and adapting these two to nilearn-style reporting would be a bit complex.