[SCIFIO] T1dSavingImagePlanes breaks when changing from PNG to TIFF
Michael Ellis
michael.ellis at dsuk.biz
Wed Dec 3 05:20:44 CST 2014
T1dSavingImagePlanes saves a fake image “8bit-signed&pixelType=int8&lengths=50,50,3,5,7&axes=X,Y,Z,Channel,Time.fake” as a png file.
I run the program and it completes without errors.
I’m curious though because I didn’t think PNG files could handle anything other than 2D images. So I try to open the SCIFIOTutorial.png
in ImageJ and I see only a single plane image. There are no warnings or errors when saving the file to suggest that there is any loss of fidelity. Is
that the intention?
Anyway, I know TIFF files can support multiple channels, so I change SCIFIOTutorial.png to SCIFIOTutorial.tif and run the program. I get the following exception:
Exception in thread "main" io.scif.FormatException: Buffer too small (got 2500, expected 12500).
at io.scif.util.FormatTools.checkBufferSize(FormatTools.java:665)
at io.scif.util.FormatTools.checkPlaneForWriting(FormatTools.java:610)
at io.scif.AbstractWriter.checkParams(AbstractWriter.java:121)
at io.scif.formats.TIFFFormat$Writer.savePlane(TIFFFormat.java:1291)
at io.scif.formats.TIFFFormat$Writer.writePlane(TIFFFormat.java:1399)
at io.scif.AbstractWriter.savePlane(AbstractWriter.java:168)
at io.scif.AbstractWriter.savePlane(AbstractWriter.java:159)
at io.scif.tutorials.core.T1dSavingImagePlanes.main(T1dSavingImagePlanes.java:75)
Now this is most unexpected, because I would have assumed the TIFF format was able to store the images with at least the same fidelity as PNG.
OK I know TIFF can save files of 3 dimensions, so I change the fake images to “8bit-signed&pixelType=int8&lengths=50,50,7&axes=X,Y,Channel.fake”
Again I get and exception.
OK, how about a 2D image, “8bit-signed&pixelType=int8&lengths=50,50&axes=X,Y.fake”?
And that finally works.
So how do I save a X,Y,Channels image in TIFF format with SCIFIO?
Thanks for any help.
— Michael Ellis
Digital Scientific UK Ltd.
More information about the SCIFIO
mailing list