2009/10/9 Stéfan van der Walt <stefan@sun.ac.za>

Hey Ralph

2009/10/9 Ralf Gommers <ralf.gommers@googlemail.com>:
>> where all PNGs are access only as necessary, and are cached once
>> they've been read from disk.  You can also index into or iterate over
>> an ImageCollection (yielding the image arrays).  It sounds like a
>> multi-image could be interpreted as an ImageCollection.
>
> That sounds like a good option. Let me know if you want me to test it / work
> on it / send you some multi-image files.

I'd appreciate it if you could investigate a bit further.  The code I
was referring to is at

http://bazaar.launchpad.net/~stefanv/supreme/main/annotate/head%3A/supreme/misc/io.py

As you can see, it is very simplistic.  It also returns a bunch of
Image objects, that we don't need.  But the basic idea is there: a
container over which you can iterate, that loads images on demand and
keeps a cache as necessary.  I've never played with loading of
multi-layer images, so I hope you can get something going.

Thanks Stefan, that was a useful start. I added a MultiImg class which is quite similar to your ImgCollection. There are enough differences between a multi-image file and a collection of single image files to justify creating a separate class I think. The code is here:

http://github.com/rgommers/scikits.image/blob/imgcollection/scikits/image/io/io.py

It works with my multi-frame TIFF files (only PIL trunk, not 1.1.6), and once I figure out how to create a correct TIFF header/file (does anyone have code for this?) I can add a self-contained example and tests.

Things that would be useful to add:
- caching a configurable number of frames (now 1 or all)
- a dtype keyword
- switch to the new IO plugin system once it's ready
- add a MultiImgCollection
- what else?

Questions:
- do you want to keep the Image class in that form? It seems either a plain ndarray or ndarray + tags dict is enough.
- can I remove the EXIF stuff or move it to a subclass of Image? I don't think it belongs in the base Image class.
- should imread be moved into io.py?

I'd appreciate any feedback on the basic design and new feature suggestions.

Cheers,
Ralf




Cheers
Stéfan