glencoesoftware/bioformats2raw

ND2 to OMETIFF conversion error

Closed this issue · 3 comments

Hello.
I want to convert this ND2 file to OMETIFF

http://hpc.nih.gov/~roys5/Round1-Slot_01-Slide_01-Region_1-Stitched-Focused.nd2

I used the following command to convert it to zarr format, and will subsequently use the raw2ometiff command to convert that to OMETIFF.

bioformats2raw -c null -h 1024 -w 1024 --max_workers 12 --no-nested -r 8 --target-min-size 1024 -p Round1-Slot_01-Slide_01-Region_1-Stitched-Focused.nd2 ./tmp.9Wv2qAFbw0

While the bioformats2raw command as listed above works on different types of images, this particular ND2, obtained from Nikon BioPipeline, fails to convert. This is the output error message,

OpenJDK 64-Bit Server VM warning: You have loaded library /tmp/opencv_openpnp2927618696987574973/nu/pattern/opencv/linux/x86_64/libopencv_java342.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
Exception in thread "main" picocli.CommandLine$ExecutionException: Error while calling command (com.glencoesoftware.bioformats2raw.Converter@15d9bc04): java.lang.NegativeArraySizeException
	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.lang.NegativeArraySizeException
	at loci.common.RandomAccessInputStream.readString(RandomAccessInputStream.java:632)
	at loci.formats.in.NativeND2Reader.initFile(NativeND2Reader.java:582)
	at loci.formats.FormatReader.setId(FormatReader.java:1443)
	at loci.formats.DelegateReader.setId(DelegateReader.java:291)
	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

Any help is appreciated.

Thanks for reporting this and providing an example file, @snehashis-roy. I can reproduce the same error message, but I also can't open the .nd2 file in Nikon's NIS Elements viewer. Are you able to open it in the original acquisition software?

Thanks for reporting this and providing an example file, @snehashis-roy. I can reproduce the same error message, but I also can't open the .nd2 file in Nikon's NIS Elements viewer. Are you able to open it in the original acquisition software?

We are able to open and work on these images in full version of Nikon Elements 5.3 and 5.4.

This is ultimately a bug in the underlying Bio-Formats library, and not specific to bioformats2raw. ome/bioformats#3932 proposes a fix; once that is included in a Bio-Formats release we'll just need to update bioformats2raw to use it.