ome / bioformats

Bio-Formats is a Java library for reading and writing data in life sciences image file formats. It is developed by the Open Microscopy Environment. Bio-Formats is released under the GNU General Public License (GPL); commercial licenses are available from Glencoe Software.
https://www.openmicroscopy.org/bio-formats
GNU General Public License v2.0
378 stars 241 forks source link

HCImage cxd: IllegalArgumentException: -20 must be neither null nor strictly negative #4133

Closed dominikl closed 6 months ago

dominikl commented 9 months ago

See https://forum.image.sc/t/importing-cxd-files-into-imagej/90085 .

"A cxd file acquired with HCImage version 5.0 is unable to import into imageJ by Bio-formats, while one acquired with version 4.8 is okay. HCImage person suggested that the problem arises due to version 5.0 cxd files having two Z Positions – Position_Z and Position_Z_Fine as attached below. Bio-formats gets confused, resulting in a negative Z count. Additionally, version 5.0 cxd files include additional metadata such as Frame averaging, Confocal scan, and Confocal zoom. These factors might potentially be the cause of the error."

I can confirm, with current bioformats, one sample image is fine:

Checking file format [Compix Simple-PCI]
Initializing reader
PCIReader initializing ../Data00042.cxd
Initialization took 0.124s
...

The other one fails:

Checking file format [Compix Simple-PCI]
Initializing reader
PCIReader initializing ../VASA_PC2FISH1.cxd
Exception in thread "main" java.lang.IllegalArgumentException: -20 must be neither null nor strictly negative.
    at ome.xml.model.primitives.NonNegativeInteger.<init>(NonNegativeInteger.java:48)
    at ome.xml.model.primitives.PositiveInteger.<init>(PositiveInteger.java:46)
    at loci.formats.MetadataTools.populatePixelsOnly(MetadataTools.java:312)
    at loci.formats.MetadataTools.populateMetadata(MetadataTools.java:262)
    at loci.formats.MetadataTools.populatePixels(MetadataTools.java:151)
    at loci.formats.MetadataTools.populatePixels(MetadataTools.java:116)
    at loci.formats.in.PCIReader.initFile(PCIReader.java:423)
...
imagesc-bot commented 9 months ago

This issue has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/importing-cxd-files-into-imagej/90085/4

dgault commented 9 months ago

Tested the provided sample files and have been able to reproduce the same issue with Bio-Formats 7.1.0. The issue does indeed seem to be linked to sizeZ being set to a negative value.

I have copied the sample files for this issue to inbox/imagesc-90085

imagesc-bot commented 9 months ago

This issue has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/importing-cxd-files-into-imagej/90085/5