Exception reading tiff

Tags: #<Tag:0x00007fd5423851c0> #<Tag:0x00007fd542385058> #<Tag:0x00007fd542384d60> #<Tag:0x00007fd542384c20> #<Tag:0x00007fd542384a18>



I don’t remember who deals with tiff files but I have had some recent issues reading files created using HCImage 2. I can read them but I get messages like this (below) for every image. I also ran into problems where my script for processing files stops after reading about 720 files. I guess it stops once it hits a limit in message or something.

I also uploaded same the image (in Fiji).


SimplePCITiffReader initializing E:\data\24-8103-xxxxx\image0_00021.tif
Reading IFDs
Populating metadata
Reading IFDs
Populating metadata
java.io.IOException: io.scif.img.ImgIOException: java.io.IOException: 26: bad line
	at io.scif.services.DefaultDatasetIOService.open(DefaultDatasetIOService.java:134)
	at io.scif.services.DefaultDatasetIOService.open(DefaultDatasetIOService.java:109)
	at io.scif.io.DatasetIOPlugin.open(DatasetIOPlugin.java:75)
	at io.scif.io.DatasetIOPlugin.open(DatasetIOPlugin.java:50)
	at net.imagej.legacy.plugin.DefaultLegacyOpener.open(DefaultLegacyOpener.java:135)
	at net.imagej.legacy.DefaultLegacyHooks.interceptDragAndDropFile(DefaultLegacyHooks.java:363)
	at ij.plugin.DragAndDrop.openFile(DragAndDrop.java)
	at ij.plugin.DragAndDrop.run(DragAndDrop.java:159)
	at java.lang.Thread.run(Thread.java:745)
Caused by: io.scif.img.ImgIOException: java.io.IOException: 26: bad line
	at io.scif.img.ImgOpener.createReader(ImgOpener.java:571)
	at io.scif.img.ImgOpener.openImgs(ImgOpener.java:145)
	at io.scif.services.DefaultDatasetIOService.open(DefaultDatasetIOService.java:124)
	... 8 more
Caused by: java.io.IOException: 26: bad line
	at loci.common.IniParser.parseINI(IniParser.java:180)
	at loci.formats.in.SimplePCITiffReader.initStandardMetadata(SimplePCITiffReader.java:161)
	at loci.formats.in.BaseTiffReader.initMetadata(BaseTiffReader.java:98)
	at loci.formats.in.BaseTiffReader.initFile(BaseTiffReader.java:577)
	at loci.formats.FormatReader.setId(FormatReader.java:1426)
	at loci.formats.ImageReader.setId(ImageReader.java:835)
	at io.scif.bf.BioFormatsFormat$Parser.typedParse(BioFormatsFormat.java:424)
	at io.scif.bf.BioFormatsFormat$Parser.typedParse(BioFormatsFormat.java:406)
	at io.scif.AbstractParser.parse(AbstractParser.java:253)
	at io.scif.AbstractParser.parse(AbstractParser.java:336)
	at io.scif.AbstractParser.parse(AbstractParser.java:52)
	at io.scif.AbstractReader.setSource(AbstractReader.java:270)
	at io.scif.services.DefaultInitializeService.initializeReader(DefaultInitializeService.java:90)
	at io.scif.img.ImgOpener.createReader(ImgOpener.java:562)
	... 10 more


Sorry for the delay in reply, @Adam_Webb.

From the stack trace, you are opening the TIFF file using the SCIFIO library.

Firstly, as a workaround, you can try to disable SCIFIO (Edit :arrow_forward: Options :arrow_forward: ImageJ2) and see if that makes a difference.

However, this is likely a bug in SCIFIO which we should address. Would you be willing to submit a sample non-working file via the Help :arrow_forward: Upload Sample Image command? (The file will not be made public, merely sent to the ImageJ developer team.) And let us know if/when you upload it what the filename is? Edit: I see that you already uploaded it. Thanks! Investigating now.


OK, so if I was paying more attention I would have noticed that this is a bug in Bio-Formats which is called from SCIFIO when the SCIFIO feature is enabled (io.scif is SCIFIO; loci.formats and loci.common are Bio-Formats). You can definitely work around it by disabling the SCIFIO feature in the ImageJ2 options as I mentioned before.

I tested with SCIFIO’s own TIFF reader, and the bug does not occur. It also does not occur with the ImageJ 1.x TIFF reader.

Anyway, I fixed the bug in Bio-Formats and filed a PR with the fix: openmicroscopy/bioformats#2537.


I hadn’t thought of dropping back to the older reader. It worked fine.
I also have files that the old one doesn’t handle (12-bit compressed tiff) that the new one does. Thus are the joys of working with commercial software. Oh well, thanks for looking into it.