InsightSoftwareConsortium / itkwidgets

An elegant Python interface for visualization on the web platform to interactively generate insights into multidimensional images, point sets, and geometry.
https://itkwidgets.readthedocs.io/
Apache License 2.0
586 stars 83 forks source link

From numpy array to ITK #81

Closed vianamp closed 6 years ago

vianamp commented 6 years ago

Hi guys.

Thanks for this awesome effort. ITKwidgets have been very useful in my research.

I was wondering if there is a way to view an image stored as a numpy array instead of ITK image. Is there any easy conversion between these two types? Otherwise I always have to save my images an open them with ITK..

Thanks a lot.

thewtex commented 6 years ago

Hi @vianamp ,

Thanks for the support! Great to hear it has been helpful.

Yes, there is automatic support for NumPy arrays -- you can directly pass in a NumPy array to the view function.

See, e.g. the example:

https://mybinder.org/v2/gh/InsightSoftwareConsortium/itk-jupyter-widgets/master?filepath=examples/NumPyArray.ipynb

CC: @fbudin69500