On Tue, Dec 6, 2011 at 07:52, Neil Yager
Coincidentally, I also noticed the 16-bit tiff issue the other day, and started working on a fix. I was using an approach based on this:
http://stackoverflow.com/questions/7684695/numpy-array-of-an-i16-image-file
Changing the last line of imread in pil_plugin to:
return np.array(im.getdata()).reshape(im.size[::-1])
fixes that specific problems, but causes others (e.g. can't load colour images). At that point I got side-tracked by something else, so I'm not sure if it's a good fix.
The CellProfiler project used to use PIL, though we've moved to bioformats. The (potentially) stale code for dealing with TIF and other images is here: https://raw.github.com/thouis/CellProfiler/master/cellprofiler/modules/loadi... (search for load_using_PIL). For color images, we end up using matplotlib.image.pil_to_array(), located in this file: https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/image.py As I said, our code is potentially stale, and some parts may not be needed or even functional. But it has had the benefit of having been tested on a fairly wide variety of formats. If you're looking for potentially problematic images, you might snoop around our the CellProfiler examples: https://svn.broadinstitute.org/CellProfiler/trunk/ExampleImages/ Ray Jones