glencoesoftware/bioformats2raw

Conversion of image with large dimensions fails

Closed this issue · 3 comments

Hi all,

when trying to convert a single image with very large dimensions (47182x35387 px), bioformats2raw fails with the following error. This error is very informative, though. These very large dimensions require 64-bit addressing. Maybe there is incomplete support for that?

I'm on a Mac using the latest release. No extra options added. As I am preparing an upload for IDR, any help would be appreciated.

/opt/src/bioformats2raw-0.4.0/bin/bioformats2raw "${k}.pattern" "${k}.zarr"
Exception in thread "main" picocli.CommandLine$ExecutionException: Error while calling command (com.glencoesoftware.bioformats2raw.Converter@3427b02d): java.io.IOException: Restart interval and markers invalid
	at picocli.CommandLine.executeUserObject(CommandLine.java:1962)
	at picocli.CommandLine.access$1300(CommandLine.java:145)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
	at picocli.CommandLine$AbstractParseResultHandler.handleParseResult(CommandLine.java:2172)
	at picocli.CommandLine.parseWithHandlers(CommandLine.java:2550)
	at picocli.CommandLine.parseWithHandler(CommandLine.java:2485)
	at picocli.CommandLine.call(CommandLine.java:2761)
	at com.glencoesoftware.bioformats2raw.Converter.main(Converter.java:1808)
Caused by: java.io.IOException: Restart interval and markers invalid
	at loci.formats.services.JPEGTurboServiceImpl.initialize(JPEGTurboServiceImpl.java:222)
	at loci.formats.in.TileJPEGReader.reopenFile(TileJPEGReader.java:144)
	at loci.formats.in.TileJPEGReader.initFile(TileJPEGReader.java:121)
	at loci.formats.FormatReader.setId(FormatReader.java:1443)
	at loci.formats.DelegateReader.setId(DelegateReader.java:300)
	at loci.formats.in.JPEGReader.setId(JPEGReader.java:87)
	at loci.formats.ImageReader.setId(ImageReader.java:849)
	at loci.formats.ReaderWrapper.setId(ReaderWrapper.java:650)
	at loci.formats.DimensionSwapper.setId(DimensionSwapper.java:293)
	at loci.formats.FileStitcher$ExternalSeries.<init>(FileStitcher.java:1353)
	at loci.formats.FileStitcher.initFile(FileStitcher.java:980)
	at loci.formats.FileStitcher.setId(FileStitcher.java:925)
	at loci.formats.in.FilePatternReader.initFile(FilePatternReader.java:231)
	at loci.formats.FormatReader.setId(FormatReader.java:1443)
	at loci.formats.ImageReader.setId(ImageReader.java:849)
	at com.glencoesoftware.bioformats2raw.Converter.getBaseReaderClass(Converter.java:1756)
	at com.glencoesoftware.bioformats2raw.Converter.convert(Converter.java:501)
	at com.glencoesoftware.bioformats2raw.Converter.call(Converter.java:477)
	at com.glencoesoftware.bioformats2raw.Converter.call(Converter.java:92)
	at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
	... 9 more

That error message unfortunately doesn't surprise me, as very large JPEGs aren't well supported. Similar issues have been reported before (see https://trello.com/c/pVIlQ3Xe/327-jpeg-ioexception, ome/bioformats#3721), so it's unlikely this would be fixed quickly.

If you have the option of saving to a different format (e.g. tiled TIFF) in whichever software produced these JPEGs, that might work better. You could also try converting the JPEG to tiled TIFF with something like ImageMagick's convert command line tool.

I tried ImageMagick's convert tool before. I needed to save tiff-images in tiff64 format, i.e., something like this:

convert file.jpg tiff64:file.tif

I am getting many errors that look like this:
2022-03-14 20:52:40,580 [pool-1-thread-27] ERROR c.g.bioformats2raw.Converter - Failure processing chunk; resolution=0 plane=0 xx=3072 yy=2048 zz=0 width=1024 height=125 depth=1

Sadly. No difference when using JPEG or TIFF64...

I close this issue now as conversion with 64-bit TIFF file directly is working