scifio / scifio

SCientific Image Format Input & Output: a flexible, extensible framework for image I/O. *EXPERIMENTAL* All API is subject to change, so depend at your own risk! See also @openmicroscopy/bioformats.
http://scif.io/
BSD 2-Clause "Simplified" License
94 stars 37 forks source link

Writing tiffs or ome.tiffs writes incorrect calibration data #325

Open dietzc opened 8 years ago

dietzc commented 8 years ago

Writing an ImgPluswith calibrated axis as tiff or ome.tiff and reading it back in with the ImgOpener does not preserve calibration of the source image.

mduser commented 8 years ago

I am pretty new to SCIFIO but I think you probably mean these lines in the TIFFFormat.Writer class (around line 1640)

ifd.put(IFD.RESOLUTION_UNIT, 3);
ifd.put(IFD.X_RESOLUTION, new TiffRational((long) (physicalSizeX * 1000 * 10000), 1000));
ifd.put(IFD.Y_RESOLUTION, new TiffRational((long) (physicalSizeY * 1000 * 10000), 1000));

The resolution is set without considering what unit the calibrated axes do really have and the 10000 leads me to the assumption the unit is always considered in µm and therefore the resolution is transferred into cm?