{"action":"created","issue":{"url":"https://api.github.com/repos/nilearn/nilearn/issues/1766","repository_url":"https://api.github.com/repos/nilearn/nilearn","labels_url":"https://api.github.com/repos/nilearn/nilearn/issues/1766/labels{/name}","comments_url":"https://api.github.com/repos/nilearn/nilearn/issues/1766/comments","events_url":"https://api.github.com/repos/nilearn/nilearn/issues/1766/events","html_url":"https://github.com/nilearn/nilearn/pull/1766","id":364740701,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4ODUzNTc5","number":1766,"title":"switch from papaya to brainsprite in plotting.view_stat_map","user":{"login":"pbellec","id":1670887,"node_id":"MDQ6VXNlcjE2NzA4ODc=","avatar_url":"https://avatars3.githubusercontent.com/u/1670887?v=4","gravatar_id":"","url":"https://api.github.com/users/pbellec","html_url":"https://github.com/pbellec","followers_url":"https://api.github.com/users/pbellec/followers","following_url":"https://api.github.com/users/pbellec/following{/other_user}","gists_url":"https://api.github.com/users/pbellec/gists{/gist_id}","starred_url":"https://api.github.com/users/pbellec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pbellec/subscriptions","organizations_url":"https://api.github.com/users/pbellec/orgs","repos_url":"https://api.github.com/users/pbellec/repos","events_url":"https://api.github.com/users/pbellec/events{/privacy}","received_events_url":"https://api.github.com/users/pbellec/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2018-09-28T04:53:45Z","updated_at":"2018-10-09T14:09:20Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/nilearn/nilearn/pulls/1766","html_url":"https://github.com/nilearn/nilearn/pull/1766","diff_url":"https://github.com/nilearn/nilearn/pull/1766.diff","patch_url":"https://github.com/nilearn/nilearn/pull/1766.patch"},"body":"I really love the new 3D interactive viewer (`plotting.view_stat_map`), but the notebooks it is producing are huge. In this PR, I am proposing to switch from papaya to brainsprite, which is a js library I developed for the exact purpose of embedding lightweight 3D viewers in html pages (http://github.com/simexp/brainsprite.js).\r\n\r\nThe first difference with papaya is that it is using a jpg or a png containing all sagital slices of a volume as well as json metadata to store the brain images. That tend to be quite smaller than a nifti (depending on the numerical precision of the nifti). That also means that brainsprite can render brains with core html5 features, and no dependencies. So the brainsprite library weighs 15kb (500 lines...), as opposed to 2Mb for the current papaya html template. I have attached two brain viewers embedded in jupyter notebooks. The [Papaya-based notebook](http://nbviewer.jupyter.org/github/pbellec/misc/blob/master/example_view_stat_map_papaya.ipynb) is 12Mb, while the [brainsprite-based notebook](http://nbviewer.jupyter.org/github/pbellec/misc/blob/master/example_view_stat_map_brainsprite.ipynb) is 500kb. Again, this reflects a core difference in design: papaya is a full brain viewer app, featuring nifti reading as well as colorbar etc. Brainsprite is a minimal, fast brain viewer working from a pre-generated sprite.\r\n\r\nWhich makes a transition with the second point: all the action for the generation of the brain volume happens in python. There is a new function called save_sprite that generates the brain sprite as well as the json meta data. It relies on matplotlib, as well as nilearn's own functions. In particular, thresholding and colormap generation are all done with nilearn's code. Resampling as well. This means that it will be easier to maintain and evolve for nilearn's developpers. The current version replicates all the arguments of plot_stat_map, including draw_cross, annotate, cut_coords and a few other (with a few as bonus, such as opacity).\r\n\r\nThis PR is far from polished, there are a few oustanding issues, [here](https://github.com/brainsprite/brainsprite.py/issues). I also need to look into the doc and testing. Finally, I dumped some functions in `html_stat_map.py` which should probably live elsewhere. But I think it is time to get feedback, and in particular I'd like to know if there is an interest in merging this PR at all...  "},"comment":{"url":"https://api.github.com/repos/nilearn/nilearn/issues/comments/428206717","html_url":"https://github.com/nilearn/nilearn/pull/1766#issuecomment-428206717","issue_url":"https://api.github.com/repos/nilearn/nilearn/issues/1766","id":428206717,"node_id":"MDEyOklzc3VlQ29tbWVudDQyODIwNjcxNw==","user":{"login":"jeromedockes","id":9196501,"node_id":"MDQ6VXNlcjkxOTY1MDE=","avatar_url":"https://avatars3.githubusercontent.com/u/9196501?v=4","gravatar_id":"","url":"https://api.github.com/users/jeromedockes","html_url":"https://github.com/jeromedockes","followers_url":"https://api.github.com/users/jeromedockes/followers","following_url":"https://api.github.com/users/jeromedockes/following{/other_user}","gists_url":"https://api.github.com/users/jeromedockes/gists{/gist_id}","starred_url":"https://api.github.com/users/jeromedockes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeromedockes/subscriptions","organizations_url":"https://api.github.com/users/jeromedockes/orgs","repos_url":"https://api.github.com/users/jeromedockes/repos","events_url":"https://api.github.com/users/jeromedockes/events{/privacy}","received_events_url":"https://api.github.com/users/jeromedockes/received_events","type":"User","site_admin":false},"created_at":"2018-10-09T14:09:20Z","updated_at":"2018-10-09T14:09:20Z","author_association":"CONTRIBUTOR","body":"> I think I am going to revert to a fixed width / height for now, and simply adapt these numbers for brainsprite\r\n\r\nI think that's a good idea, making the displays responsive and replacing papaya with brainsprite are independent improvements"}}
{"actor":{"display_login":"jeromedockes"}}