nipy / niwidgets

Neuroimaging widgets for jupyter notebooks
http://www.nipy.org/niwidgets
Other
84 stars 34 forks source link

more efficient figure updates, 4D image functionality #3

Closed bilgelm closed 6 years ago

bilgelm commented 6 years ago

Interactive figure updates in _default_plotter now only change the data in the existing figure rather than regenerate the entire figure handle. Added 4D image functionality to _default_plotter. TODO: account for image orientation

(niwidget_surface.py is what we had at the end of NHW; Melanie might have an updated version of this.)

janfreyberg commented 6 years ago

Looks great, it's much smoother!

Any idea why it's producing one static version of the figure on first call?

image

janfreyberg commented 6 years ago

@bilgelm I just merged @melanieganz's surface_widget branch, could you pull from master again to clear up the conflicts?

bilgelm commented 6 years ago

@janfreyberg not sure why the widget produces two images on the first call. will take a look at the surface viz code.

melanieganz commented 6 years ago

@bilgelm were you able to figure out the visualization of two figures issue?

janfreyberg commented 6 years ago

@melanieganz @bilgelm I think I've figured out why - it only happens when %matplotlib inline is used in the notebook. Adding plt.ioff() before the widget creation and plt.ion() afterwards prevents matplotlib from drawing the figure inline, and means only the widget component gets drawn.

@bilgelm, can you allow me push access to this pull request (see here)? I'll push my fixes (plus some minor re-organisation of the code) and merge then.

bilgelm commented 6 years ago

Sorry for taking a long time to get back! I resolved the conflicts. @melanieganz the surface widget is working beautifully (my installation must have been wrong when I tried it out last time). @janfreyberg good catch with %matplotlib inline. This PR is set to "Allow edits from maintainers" so you should be able to push - let me know if there are issues. You've probably already fixed the bug that prevents NiftiWidget's _custom_plotter from working.