openmicroscopy/bioformats — pull request #679 by LeeKamentsky (2013-08-30 15:53:22+00:00)
Title: Multi-plane flex file with factor and no compression only reads first pl...

Hi all,
Another problem here, involving the flex file below:
https://svn.broadinstitute.org/CellProfiler/trunk/TestImages/RLM1%20SSN3%20300308%20008015000.flex

This is an 8-plane .tif which has some multiplication factors in it that exercise some of the more hairy code paths in FlexReader.java. You can see the problem if you run ImageInfo.java with the arguments:

-autoscale -fast -no-upgrade -no-group "RLM SSN3 20300308 2000801500.flex"

and

-format Tiff -autoscale -fast -no-upgrade -no-group "RLM SSN3 20300308 2000801500.flex"

The first will display two planes and they are identical whereas the second displays 8 planes all of which are different. You can use the -series switch to display series 0-3 and see that the planes are identical. The problem is that the multiplication factor is 3, which means that the FlexReader outputs an image of type UINT16 and it uses the first IFD to read all 8 planes.

I've simplified the code a bit (I hope) and I hope what I've done isn't too much more of a hack than what's there already. The idea is to use the first IFD as a template for reading the remaining planes by adjusting the strip or tile offsets. I also corrected some logical errors in the section that expands pixel values.

--Lee