Re: io plugin issue (8bits 16bits)
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. Neil On Dec 6, 12:32 am, Stéfan van der Walt <ste...@sun.ac.za> wrote:
On Mon, Dec 5, 2011 at 2:40 PM, Christoph Gohlke <cjgoh...@gmail.com> wrote:
skimage.io.use_plugin is somewhat broken (I think). It replaces all previously defined default imread, imwrite, and imshow functions, regardless whether a `kind` argument is provided. For example:
Between Chris and myself, we should have this fixed tonight. Follow along here:
https://github.com/scikits-image/scikits-image/pull/88https://github.com/sci...
PR90 provides a new function called "plugin_order", which allows the user to see under the hood which function skimage will try to use.
Cheers Stéfan
On Tue, Dec 6, 2011 at 07:52, Neil Yager <yager.neil@gmail.com> wrote:
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
Hi Neil On Mon, Dec 5, 2011 at 10:52 PM, Neil Yager <yager.neil@gmail.com> wrote:
Coincidentally, I also noticed the 16-bit tiff issue the other day, and started working on a fix.
Can you check the fixes we committed, and make sure they do the trick? To display the images properly, you'll also need https://github.com/scikits-image/scikits-image/pull/91 I'll commit that as soon as it has been reviewed by at least one other person. Thanks Stéfan
participants (3)
-
Neil Yager
-
Stéfan van der Walt
-
Thouis (Ray) Jones