[SCIFIO] T1dSavingImagePlanes breaks when changing from PNG to TIFF
Curtis Rueden
ctrueden at wisc.edu
Fri Jan 16 17:37:40 CST 2015
Hi Michael,
Sorry for the long delay in reply.
> Our TIFF files use the PAGE_NAME TIFF TIFF tag to give a name to each
> of the channel names. Is this information accessible through the
> SCIFIO?
Looking at the current source, it seems the SCIFIO TIFF reader does put the
PageName entries into the generic metadata table [1], but it doesn't yet
"do the right thing" and preserve them as plane labels (i.e., what ImageJ
calls "slice labels").
I filed an issue for it:
https://github.com/scifio/scifio/issues/243
Regards,
Curtis
[1]
https://github.com/scifio/scifio/blob/scifio-0.19.0/src/main/java/io/scif/formats/TIFFFormat.java#L884-L886
On Wed, Dec 3, 2014 at 12:40 PM, Michael Ellis <michael.ellis at dsuk.biz>
wrote:
> Curtis, many thanks.
>
> Whilst I’m on the subject of TIFF I experimented with using the TIFF
> specific reader/parser.
>
> Our TIFF files use the PAGE_NAME TIFF TIFF tag to give a name to each of
> the channel names. Is this information accessible through the SCIFIO?
>
> Many thanks — Michael Ellis
>
> On 3 Dec 2014, at 18:26, Curtis Rueden <ctrueden at wisc.edu> wrote:
>
> Hi Michael,
>
> > I’m curious though because I didn’t think PNG files could handle
> > anything other than 2D images.
>
> SCIFIO writes the APNG format [1] when there are multiple planes.
>
> > So I try to open the SCIFIOTutorial.png in ImageJ and I see only a
> > single plane image.
>
> Standard PNG readers (including ImageJ 1.x's built-in PNG reader) will
> read only the first plane. Did you try with File > Import > Image... which
> uses SCIFIO when opening?
>
> > 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).
>
> Thanks for the report. I can confirm this bug. I filed an issue for it:
> https://github.com/scifio/scifio/issues/236
>
> > So how do I save a X,Y,Channels image in TIFF format with SCIFIO?
>
> Once that issue is resolved, things should work!
>
> Regards,
> Curtis
>
> [1] https://en.wikipedia.org/wiki/APNG
>
> On Wed, Dec 3, 2014 at 5:20 AM, Michael Ellis <michael.ellis at dsuk.biz>
> wrote:
>
>> 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.
>>
>>
>>
>>
>> _______________________________________________
>> SCIFIO mailing list
>> SCIFIO at scif.io
>> http://scif.io/mailman/listinfo/scifio
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://scif.io/pipermail/scifio/attachments/20150116/0b9446f3/attachment-0002.html>
More information about the SCIFIO
mailing list