16-bit BW TIFFs saved with incorrect Orientation header

SaveImages incorrectly saves 16-bit single-channel TIFF files with an Orientation header indicating that the image should be rotated 90 degrees for display after opening. Preview and Finder (and other image editing utilities) respect this hint, so these images appear rotated. 8-bit TIFF and color 16-bit TIFF files are not affected. CellProfiler does not respect this hint, so it is an interoperability problem but does not affect routine CP use.

I’m using packaged r11710 on OS X 10.6.8.

I’ve attached a sample pipeline that generates a) a BW 16-bit TIFF that does exhibit this problem, b) a color 16-bit TIFF that does not, and c) a BW 8-bit TIFF that does not.

The tiffinfo utility shows that the difference is in the headers:

darkside:test tim$ tiffinfo *out*tiff
bwout16.tiff:
TIFF Directory at offset 0xea608 (960008)
  Image Width: 800 Image Length: 600
  Bits/Sample: 16
  Sample Format: unsigned integer
  Compression Scheme: None
  Photometric Interpretation: min-is-black
  Orientation: row 0 rhs, col 0 top                       <-- this is wrong
  Planar Configuration: single image plane
bwout8.tiff:
TIFF Directory at offset 0x8 (8)
  Image Width: 800 Image Length: 600
  Bits/Sample: 8
  Compression Scheme: None
  Photometric Interpretation: min-is-black
  Rows/Strip: 600
  Planar Configuration: single image plane
colorout.tiff:
TIFF Directory at offset 0x2bf208 (2880008)
  Image Width: 800 Image Length: 600
  Bits/Sample: 16
  Sample Format: unsigned integer
  Compression Scheme: None
  Photometric Interpretation: RGB color
  Samples/Pixel: 3
  Planar Configuration: separate image planes

thanks,
tim
tifftest.zip (869 KB)

GitHub issue 317. github.com/CellProfiler/CellProfiler/issues/317

This issue has been resolved in CellProfiler 2.1 and later, new releases of which can now be downloaded from http://cellprofiler.org.