Bio-Formats ICS writer bug?

Hello, @dgault @s.besson

I am trying in Fiji to save a 3D image to .ics with the Bio-Formats Exporter and am getting this error:

(Fiji Is Just) ImageJ 2.0.0-rc-69/1.52p; Java 1.8.0_202 [64-bit]; Mac OS X 10.14.6; 156MB of 7422MB (2%)
 
java.lang.NullPointerException
	at loci.formats.out.ICSWriter.setId(ICSWriter.java:263)
	at loci.formats.FormatWriter.changeOutputFile(FormatWriter.java:122)
	at loci.plugins.out.Exporter.run(Exporter.java:806)
	at loci.plugins.LociExporter.run(LociExporter.java:75)
	at ij.plugin.filter.PlugInFilterRunner.processOneImage(PlugInFilterRunner.java:266)
	at ij.plugin.filter.PlugInFilterRunner.<init>(PlugInFilterRunner.java:114)
	at ij.IJ.runUserPlugIn(IJ.java:232)
	at ij.IJ.runPlugIn(IJ.java:193)
	at ij.Executer.runCommand(Executer.java:137)
	at ij.Executer.run(Executer.java:66)
	at java.lang.Thread.run(Thread.java:748)

It starts to do something, writing below file, but then it crashes with above error.

1 Like

@Christian_Tischer I can confirm your observation (on MacOS) when trying to save the Bat Cochlea Volume sample image via Bio-Formats Exporter.

Interestingly, this seems to try writing ICS version 2.0 now, whereas in the past I’ve been using it to save ICS 1.0 files.

I was also trying to save to ICS 1.0 format by providing a filename ending on .ids, but this produces the same error and writes a zero-byte .ids file in addition to the incomplete .ics file you reported.


As a workaround, you can use #scifio to write ics/ids files.

  • Via the menu: File > Export > Image…
  • In a script:
    #@ Dataset img
    #@ DatasetIOService io
    
    io.save(img, "/path/to/image.ics")
    

Both methods worked fine in my tests just now.


EDIT:

Looking at the line in the source code where the NullPointerException occurs:

… this seems to be caused by missing spatial calibration metadata. And indeed, after setting some value for pixel width and height in Image > Properties…, saving the Bat Cochlea Volume sample image works just fine.

So another workaround (in addition to the above using SCIFIO) is to specify pixel calibration before saving :tada: :slightly_smiling_face:

2 Likes

Thank you for reporting the issue. I have opened a fix in https://github.com/ome/bioformats/pull/3466 which will hopefully be included in the patch release.

1 Like

See also: