bigdataviewer / bigdataviewer-core

ImgLib2-based viewer for registered SPIM stacks and more
BSD 2-Clause "Simplified" License
33 stars 35 forks source link

8-bit hdf5 are read as 16-bit #128

Open K-Meech opened 2 years ago

K-Meech commented 2 years ago

Opening an 8-bit image written to hdf5 with the fiji plugin under Plugins > BigDataViewer > Export Current Image as XML/HDF5 like so:

SpimData spimData = new XmlIoSpimData().load( xmlPath )
BdvFunctions.show(spimData)

gives UnsignedShortType (16-bit) imgLoaders inside, rather than UnsignedByteType (8-bit). This is not the case for converting and loading n5 via 'Export Current Image as XML/N5'.

Would it be possible to change this part: https://github.com/bigdataviewer/bigdataviewer-core/blob/master/src/main/java/bdv/img/hdf5/Hdf5ImageLoader.java#L378 to be more like the n5 equivalent https://github.com/bigdataviewer/bigdataviewer-core/blob/master/src/main/java/bdv/img/n5/N5ImageLoader.java#L200? This would make the images easier to handle in any downstream processing.

mkitti commented 2 years ago

Have you tried loading HDF5 files via N5-viewer rather than directly as HDF5. This would use https://github.com/saalfeldlab/n5-hdf5 ?