ilastik / ilastik4ij

ImageJ plugins to run ilastik workflows
MIT License
22 stars 17 forks source link

Hdf5DataSetReader does not seem to properly set Axes of ImgPlus #26

Closed tischi closed 4 years ago

tischi commented 4 years ago

The way you construct the ImgPlus in the Hdf5DataSetReader is like this: https://github.com/ilastik/ilastik4ij/blob/master/src/main/java/org/ilastik/ilastik4ij/hdf5/Hdf5DataSetReader.java#L130

If I read an image, e.g. like this

ImgPlus< R > probabilitiesInput = new Hdf5DataSetReader( probabilitiesInputImagePath, "exported_data", "tzyxc", new LogServiceWrapper( ij.log() ), ij.status() ).read();

And write it again using the Hdf5DataSetWriter, I get errors here: https://github.com/ilastik/ilastik4ij/blob/master/src/main/java/org/ilastik/ilastik4ij/hdf5/Hdf5DataSetWriter.java#L275 with dimensionIndex = -1, indicating that it cannot determine the dimension.

My feeling is that in the Hdf5DataSetReader you should maybe use another constructor for the ImgPlus, specifying the axes order.

tischi commented 4 years ago

...indeed constructing the image like this fixes the bugs:

ImgPlus<T> result = new ImgPlus<>(img, Paths.get(filename, dataset).toString(), new AxisType[]{ Axes.X, Axes.Y, Axes.CHANNEL, Axes.Z, Axes.TIME });

This change will be part of our refactoring branch.

k-dominik commented 4 years ago

awesome @tischi, thanks for fixing this! It would be great if you can use either one of the "closing" keyword together with this issue number (e.g. fixes @26) in a commit, or add it to the to the PR description.

wolny commented 4 years ago

Nice catch @tischi. This got fixed in https://github.com/ilastik/ilastik4ij/pull/24