Visualize arrays stored in h5

Hi,
I know that hdf5 is just a container as discussed in here , however I think it can be a greate feature to have some kind of option to display 3d arrays in 3D slicer. The format is widely used in the machine learning community and I find my self duplicating data to common formats just to visualize it. As an example, there is also the xdmf format which can read the data array from h5 files and which can be visualized in paraview. Would it be difficult to add support for this?
Otherwise, is it possible to make a python pluggin for this purpose; if so what would be an example to start with?
Thanks!

Roger

Hi Roger -

Sure, that sounds pretty useful and doable in a few lines of python. I believe you can easily get a numpy array with contents of the h5 file and you can populate a vtkMRMLScalarVolumeNode with the data.

https://www.slicer.org/wiki/Documentation/Nightly/Developers/Python_scripting#Accessing_Volume_data_as_numpy_array

1 Like