nipy / niwidgets

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

ENH: add initial streamline widget #4

Closed satra closed 6 years ago

satra commented 7 years ago

added a streamline widget. usage example here: https://nbviewer.jupyter.org/urls/dl.dropbox.com/s/oukfh9agca5k9im/streamlines.ipynb

this requires a few changes to ipyvolume that i will be submitting as a PR shortly.

additional things to consider:

satra commented 7 years ago

needs: https://github.com/maartenbreddels/ipyvolume/pull/72

janfreyberg commented 7 years ago

any chance you could make a .trk file available to try this out?

satra commented 7 years ago

@janfreyberg - here you go:

https://www.dropbox.com/s/dbexuhk7fsawvox/streamlines.trk?dl=0

janfreyberg commented 7 years ago

Thanks.

For some reason I can't get it to work - it doesn't work with ipyvolume from pypi but even if I install from your repo with the fix it's throwing errors. I'll wait until your fix is merged and try it out then!

satra commented 7 years ago
$ wget https://github.com/satra/ipyvolume/archive/enh/line-visibility-control.zip

unzip and cd to the ipyvolume folder

$ pip install -e .
$ jupyter nbextension install --py --symlink --sys-prefix ipyvolume
$ jupyter nbextension enable --py --sys-prefix ipyvolume

note these last steps set up ipyvolume in dev mode and requires nodejs. and any jupyter instance needs to be restarted for this to take effect.

arokem commented 7 years ago

I tried following this and am getting:


D-173-250-183-82:~  $jupyter nbextension install --py --symlink --sys-prefix ipyvolume
Traceback (most recent call last):
  File "/Users/arokem/anaconda3/bin/jupyter-nbextension", line 11, in <module>
    load_entry_point('notebook', 'console_scripts', 'jupyter-nbextension')()
  File "/Users/arokem/anaconda3/lib/python3.5/site-packages/jupyter_core/application.py", line 267, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/Users/arokem/anaconda3/lib/python3.5/site-packages/traitlets/config/application.py", line 658, in launch_instance
    app.start()
  File "/Users/arokem/anaconda3/lib/python3.5/site-packages/notebook/nbextensions.py", line 900, in start
    super(NBExtensionApp, self).start()
  File "/Users/arokem/anaconda3/lib/python3.5/site-packages/jupyter_core/application.py", line 256, in start
    self.subapp.start()
  File "/Users/arokem/anaconda3/lib/python3.5/site-packages/notebook/nbextensions.py", line 678, in start
    self.install_extensions()
  File "/Users/arokem/anaconda3/lib/python3.5/site-packages/notebook/nbextensions.py", line 657, in install_extensions
    **kwargs
  File "/Users/arokem/anaconda3/lib/python3.5/site-packages/notebook/nbextensions.py", line 211, in install_nbextension_python
    m, nbexts = _get_nbextension_metadata(module)
  File "/Users/arokem/anaconda3/lib/python3.5/site-packages/notebook/nbextensions.py", line 1034, in _get_nbextension_metadata
    m = import_item(module)
  File "/Users/arokem/anaconda3/lib/python3.5/site-packages/traitlets/utils/importstring.py", line 42, in import_item
    return __import__(parts[0])
  File "/Users/arokem/source/ipyvolume/ipyvolume/__init__.py", line 10, in <module>
    from .pylab import *
  File "/Users/arokem/source/ipyvolume/ipyvolume/pylab.py", line 362, in <module>
    size_selected=1, size=1, connected=True, visible_markers=False,
  File "/Users/arokem/source/ipyvolume/ipyvolume/pylab.py", line 25, in _docsubst
    f.__doc__ = f.__doc__.format(**_doc_snippets)
KeyError: 'visible_lines'

Any ideas?

satra commented 7 years ago

@arokem - hold on based on a conversion on ipyvolume i sent some updates that i didn't test. perhaps those are inappropriate. give me a minute to check.

satra commented 7 years ago

@arokem - try now - you will have to wget the zip file again.

arokem commented 7 years ago

Yep - installing/enabling seems to work now! Thanks!

satra commented 7 years ago

@janfreyberg, @arokem - this does require ipyvolume master, but it works well now at scale.

once this branch is installed together with ipyvolume master, you can test with:

https://www.dropbox.com/s/oukfh9agca5k9im/streamlines.ipynb?dl=0

https://www.dropbox.com/s/dbexuhk7fsawvox/streamlines.trk?dl=0

satra commented 7 years ago

@arokem - with this new mechanism, it would not take much work to refactor to draw bundles.

janfreyberg commented 7 years ago

Thanks, will test this ASAP. Any idea yet when the required changes will be released by ipyvolume?

janfreyberg commented 7 years ago

Working great for me, awesome!

image

Two thoughts I have:

satra commented 7 years ago

@janfreyberg - thanks for the review. those suggestions are great. whenever i get some time next, i'll add those in together with @arokem's suggestions.

satra commented 6 years ago

@arokem and @janfreyberg - finally got to this. should have all the pieces in place now.

satra commented 6 years ago

@arokem and @janfreyberg - any chance this can be reviewed soon.

arokem commented 6 years ago

Did your changes make it upstream to current ipyvolume?

satra commented 6 years ago

Did your changes make it upstream to current ipyvolume?

yes