Float 32 bits tif file cannot be opened on ImageJ

Hi everybody and in particular @Wayne and the @ilastik_team,

I generated a 32 bits tiff probability map exported from ilastik:
tif32bitsproblem.tif (268.6 KB)

Weirdly, I cannot open it on ImageJ. I get the error message ImageJ can only open 8 and 16 bit/channel images (32), which comes from the TiffDecoder class. However the image is a float 32 bits image, which should be opened by ImageJ without any problem…

I can open the file by using Bio-Formats, and resave it in tiff (still in 32 bits float). The resaved file can then be opened successfully with IJ: tif32bitsresavedok.tif (1.2 MB)

I’d like to avoid using Bio-Formats, because this would add a dependency and some complexity in the code of a plugin, so:

  • What is the reason for the wrong opening ?
  • Is there an easy fix which would allow to open this file with new ImagePlus(nameOfTheFile); ?



The TIFF support of ImageJ 1.x is known (and intended) to be incomplete, but very performant (for those files that work :wink: ). See also:

Did you try using #scifio by default? It worked fine for me with your sample file.
You could use it as simple as this:

#@ IOService io
image = io.open(myfile)

Hi @NicoKiaru,

you can safely export the ilastik probability maps to uint8, without loss in accuracy. Internally, per default, ilastik uses 100 trees that vote for each pixel, so there should only be 100 steps. Nice side effect is that this results in files that are four times smaller :sun_with_face:

1 Like

Thank you @k-dominik and @imagejan!

SciFIO did the trick. And it’s indeed very good to know regarding the probability map.