Repository navigation
Description
Following up on a discussion started in scikit-image/scikit-image#5036,
I'd like to consider an alternative API for imageio. How to apply this is another discussion; let's first dream up an ideal API :)
TLDR
# Get object that can be used to read/write image and meta data.
# The mode arg can be used to specify read/write mode, as well as the expected dimensionality.
# Default is "greedy"
r = imopen(filename, mode='read/write greedy/image/volume')
# The short way to read an image
# im = imopen(...).read() -> actually this is bad, as it may keep files open on pypy
with imopen(...) as r:
im = r.read()
# maybe a shorthand
im = imread(...)
# Read image and meta data
with imopen(...) as r:
meta = r.get_meta()
im = r.read(index=None)
# Read a volume or fail
vol = imopen(..., mode='rv').read()
# Iterate over 2D images
for im, meta in imopen(... mode='ri').iter():
passUse-cases
Let's start by explaining some use-cases of data that a user might encounter.
A single image:
____________
|______1_____|
A stack of images. E.g. a Tiff, a small gif, or Dicom (3D medical data):
____________
|______1_____|
|______2_____|
|______3_____|
A BIG stack of images. E.g. an mp4. The precise number of elements is likely not known, and it may we streaming data (e.g. from a webcam). The total data may be too big to fit in RAM, and the preferred way to load it would be to stream it (with an iterator) or to specify a frame with an index. A plugin may want to prevent the user from reading the data all at once.
____________
|______1_____|
|______2_____|
|______...___|
|______n_____|
Multiple stacks of images. This can happen with e.g. Tiff and Dicom. Let's assume / hope that this is about the most complex kind of data we can get. The stacks may have different shapes.
____________
|______1_____|
|______2_____|
|______3_____|
__________
|_____1____|
|_____2____|
|_____3____|
|_____4____|
What Imageio currently does
imread: get (only) the first 2D image.mimread: get a list of all 2D images in the dataset.volread: get the first 3D image.mvolread: get all 3D images.get_reader(): an object that allows streaming the data:get_data(index),get_next_data(),iter_data(). These return 2D or 3D images depending on amodeargument when creating the reader object.
In short, the user specifies what kind of data is expected, and this is expressed to the underlying plugin using a mode (or hint).
What (I think) we need
In scikit-image/scikit-image#5036 the need was expressed to be able to just imread(), and get a 3D or 2D image, whatever is in the dataset. This is useful in data exploration and e.g. when using Napari, which will be fine with whatever you give it :)
However, I also think we should allow the user to express an expectation. E.g. when reading video, you probably don't want to stack all images in a single array.
Further, there is an increasing need to be able to read (standardized) metadata from the images. At the same time, most users probably don't need it, so an API that always returns metadata may be too verbose.
Proposed API
I propose a function imopen() that returns an object (as described in #562) that can be used to read or write data. This function has a mode arument, that can be specified to r(ead) or w(rite), but also to specify the expected dimensionality: g(reedy) is the default, i(mage), v(olume). The returned reader object has a simple API with ~4 functions.
r = imopen(... mode='read/write greedy/image/volume')-> returns a format object.r.get_meta(index=None)-> get metadata of whole file or of specified frame.r.read(index=None)-> Returnim, for the given index, or the next image if index=None.r.write(im, meta)-> for writing.r.iter()-> returns a generator that produces(im, meta)tuples.
So ...
imopen(...).read()gives whatever is in the dataset (mode='greedy' by default).imopen(... mode='image').read()gives the first image.imopen(... mode='volume').read()gives a volume or fails.[im for im, meta in imopen(...mode='image').iter()]gives a list of images.
Questions
Is imopen(...).read() too verbose? We can off-course wrap this in a convenience function, and I think this is exactly what skimage.io.imread() would call.
When you are interested in meta-data, would you rather:
im, meta = imopen(...).read()which may be nice, but verbose when you don't want metadata, or:
with imopen(...) as r:
meta = r.get_meta()
im = r.read()Is there a better term for "greedy"?
Activity
FirefoxMetzger commentedon Nov 2, 2020
Three thoughts:
(1) Is there a particular reason why you propose
imopen(...)instead of leaning on python'sopen(...)and then pass the file object into a functional API? (Not familiar with this codebase) I could imagine something like(2) Might be implied and I failed to read between the lines: I wouldn't use
g/i/v, but the longergreedy,volume,imagefor clarity.(3) If we introduce a new class like
imopen, the class could represent the image as a list of lists (lazy-loaded) and define the slice operator that loads a (possibly n-dimensional) ROI of the image as an array-like. Slices would also apply along the stack dimension, the time dimension, or any other dimension people might use. If there are missing values for any pixel (for example because the images in a .tiff have different dimensions),imopencan raise an exception (default) or fill those with a given value, e.g.fill=np.nan.slice(a, None, b)would interpret theNoneforstopaslen(sublist)wheresublistis given bystartof the previous slices. Something likeimg = iio.imopen(filename)[5, 350:, 62::2]would be interpreted asWe could then use this slicing mechanic to legacy support current
imageiofunctions andskimage.imread:To allow the prior knowledge for
volreadandmvolreadto be discovered,imopenmight exposeimopen(...).len(dim)(horrible API, please improve). It takes adim-tuple and returns the length of the sublist at that location.There might be even better python trickery available if
imopen(...).__getitem__returns a newimopenobject and defers loading untilnp.asarray(imopen(...))is called, which then loads the required ROI (or fails). I didn't really think about how the handle ownership of the IO object, but that appears solvable at first glance.almarklein commentedon Nov 4, 2020
Thanks for the feedback!
Yes. I did not explain this above, but what
imopenwould do is select the right format/plugin (however you call it), given the filename/uri. It then returns the format object which will handle the actual reading/writing. I chose the name imopen, so that one could dofrom imageio import imopen.Good point, I agree. I will update the examples.
Interesting idea! I don't fully follow it yet :) and I have some remarks. I think it would be valuable to see what the examples at the top post would look like with this approach.
You seem to suggest that the index is 3 dimensional:
r[z/slice, y, x], but for data containing multiple volumes (or multiple stacks of images) you'd need 4, I think:r[stack, z/slice, y, x]. That would make reading an imager[0, 0,...].What would be the API to obtain meta data?
Note that for some formats the number of images is not known (e.g. getting the exact number of frames in a video file is either a guess, or very slow). That's why I am aiming for an iterator to iterate over images/volumes. I'm not sure how this would fit in?
almarklein commentedon Nov 4, 2020
A bit of background: the core of imageio is responsible for basically two things:
FirefoxMetzger commentedon Nov 4, 2020
I gave it a bit more thought, and I think
imopen.__getitem__is indeed a fun idea, but it should return a newimopenobject. The concept would be analogous to numpy views. To get actual numpy data ato_numpy()function alapandaswould make a lot of sense.The user-facing API could be quite simple:
I don't know if I understand the problem. If the stack and volume dimension run along separate axes, then indexing becomes even easier. Could you elaborate your concern a bit more?
imopen(...).metadata()This has the advantage that many formats store some metadata in the front or back of the image, andseek+readcan be much faster if we only want metadata.You could explicitly implement the
__iter__method that could return a generator if the size isn't known.almarklein commentedon Nov 4, 2020
Let's take a small step back :) The main thing to achieve here, is an API that provides both 1) a way to read the data in the file in the highest possible dimensionality, and 2) read data in an expected dimensionality, regardless of how it's organized in the file.
For the index-API to work, the first index should not simply refer to the first dimension of the data, because:
The alternative, I think, is to predefine the indices, so the first refers to the outermost dimension that we assume (the list of volumes), and the second refers to the image in that stack/volume:
But if I'm honest, I am not sold on this :) The idea to use an array-like API for reading image data is interesting, but image io is different from slicing/processing the image data, and they don't need the same API. Also because I don't think there is much advantage for being able to read a subrectangle within an image, since in most formats the data is compressed per-image anyway, so I don't expect a performance benefit.
almarklein commentedon Nov 4, 2020
Perhaps there are ideas that we can take away from the index-API. As an alternative to using the mode arguments to specify the expected dimensionality, we could do something like this:
FirefoxMetzger commentedon Nov 5, 2020
This one somehow strikes me as odd. What I understand here, is that the aim is to create an abstraction over file types. Regardless of how the image is stored. After the image is loaded by
imageio, the dimensions will be in a predefined order with an expected meaning to each axis. I'm not sure how we would guarantee that. Will we reorganize dimensions if necessary? Are we constraining ourselves to a limited set of output formats? If so, which ones?I can see how this has merit for formats that are popular now (
.jpg,.pngor.tiff), but what about more esoteric ones? You mentioned reading video as image stacks earlier; how will this fit into the read/volume/iter API? What would be the expected dimensionality for an RGBD video stream or stereo video? I feel enforcing an expected dimensionality across file formats is us being opinionated where we don't have to be.I think it's much cleaner (and easier) to return the data in the dimensionality and order given by the file and let the user do the standardization/reshaping. They have the domain knowledge on how they want to consume the image, so let's not try and guess.
Yes! I think this is exactly the strength of this approach; you seem to think of it as a weakness. Could you explain why?
If images are stacked along the last dimension (interleaved image stacks!?), one would do
imopen(...)[..., 3].to_numpy(). Arguably inefficient to load, but the solution here is to have the user change the image format if performance is a concern :)For me, the reason I like this approach is that it keeps the simple use cases simple. "I want to load a
.jpg" ->imopen(...jpg).to_numpy(), "I want to read a volume from a.tiffcontaining a single volume" ->imopen(...tiff).to_numpy(), "I want to load all images in a.gif" ->imopen(...gif).to_numpy(). Reading your first aim for the API, I think we are likely to agree on this part.What is missing is how to let users select the first image from stacks, sequences, etc. (to support the previous imread and volread). If they should not be phased out, is it possible to generalize them? Maybe we can allow users to select an arbitrary image/volume from a stack or sequence? Maybe we can allow users to do both at the same time and select a specific image from a specific volume directly? How about adding a time dimension? Maybe it is easier at this point to think of nd-images. Could we allow users to select elements along dimensions of an nd-image? What about multiple elements along dimensions? At this point,
slicebecomes an obvious choice. I assume that you have a different view on this though; would be interesting to learn where we differ.I would actually prefer the
mode=API in comparison. What willimopen(...).volume.read()do for a.pngimage? Presumably, it will throw an exception, but why does a class have a method that is only valid in some cases, but not others? To me, this sounds like a candidate for inheritance and OOP. At this point, it sounds a bit like relabelingimread,volread,mimread, ... and adding a genericread(highest dimension) to it.Tangent: How would
imopen(...).read()handle the case of stacked differently sized volumes?Edit: Oh, almost forgot:
I agree, for many formats, there will be no large speed gain. You will likely have to read most of the image and IO will be the performance bottleneck. When reading ROI, you will get speed advantages from fewer transitions between the C and python layer though. Instead of doing two rounds, one to load the full image and a second to slice it, you can do both in a single pass down to C. For some formats, however, there will be a performance advantage in not having to read the entire file, and if reading a small area of many files fast (e.g. checking a watermark) is your use case then the proposed API can accommodate you almost naturally and without change.
What you will get in all cases is memory benefits. The read call knows the shape it has to load and can simply discard all the data it doesn't need to fulfill the request and only keep the relevant pixels. This can be useful for CV on embedded devices, mobile phones, robots, etc.
lschr commentedon Nov 6, 2020
I just created #564, which I intended as an alternative interface to imageio. This may be relevant for this discussion as well.
almarklein commentedon Nov 7, 2020
About expressing the expected dimensionality.
It took me a while to reply because I had to contemplate this. The thing is that it is currently a part of imageio, and it plays a role in different parts, and I found that I cannot yet oversee whether/how it would work without it. I'll try to list the problems that I foresee:
1 - file formats are (sometimes) messy
I'm not sure if I agree ... file formats are messy ... and if a plugin knows the intention of the user, it could be more capable of returning something sensible. Anyway, that has been one of the arguments at the time. Maybe it's not so much needed as I thought at the time? I don't know. We can try.
2 - you don't know what you'll get
Well, it's arguably confusing. You read one tiff and get a 2D array, you read another and get a 3D array. Plus it makes the code less readable.
3 - protect users when reading large files
The current
imageio.mimread()protects users from reading a large number of images from e.g. a movie, bringing your machine to its knees by forcing it to use the swap file.I think it would make sense that plugins may disallow reading the whole file at once, forcing to use
.read(index)or the iter API. That should at least make the potential problem more obvious to the user. So I suppose this could work.4 - plugin selection
The
modeis used during the plugin selection process. E.g. the Pillow plugin can read .gif, but not animated .gif - there is another plugin for that.Without a
mode, plugins are thus more strictly bound to the extension. This might mean they'd need to be more aware of each other and delegate to other plugins as needed. Maybe this is for the better, but I can't be sure.In summary, I'm starting to see how things could look like without
mode, but I am not fully convinced that we can pull it off. Maybe we should try, and add the mode argument if we find out we kinda need it?Imread returning partial data is a problem
I can see how
imread()returning a fraction of the data (a 2d image, if the data in the file is actually 3D) is confusing. So in any case, that's something we should probably fix.One possibility (for the API proposed at the first post) could be:
I think it should fail, forcing the user to specify an index, or use the iterator approach.
Indexing API
I have thought about it, but I believe a function-based (file-like) API is more appropriate. I think that mimicking an array API is potentially confusing to users, and adds complexity for plugins. Further, a plugin can give it's
read()method more arguments to allow more fine-grained control, which you cannot do with indexing.I do not follow. All current plugins are written in pure Python, so any slicing would be done with numpy anyway. In any case, I believe that any performance benefit is marginal, while it adds complexity - all plugins would need to support it! So I feel quite strongly against this ROI thing.
Note that what
imopenreturns is a plugin object. We specify what it must be able to do, but special formats can add more API for certain things. This applies to reading ROI's, stereo video, and other esoteric stuff :)FirefoxMetzger commentedon Nov 8, 2020
Hmm ... many things to think about. A few questions (in no particular order):
imageiois not just expected to return an image but an image in a quite specific/restricted format. Was this an explicit design choice or did it grow like that? Is there some documentation on what the API should and should not return?mode=<something>for my specific image, and will it be easy to see which mode I should use? Can good documentation alone (how to make it easily accessible?) solve this?imageiomainly as a low-level library and not so much as a user-facing app; I would aim for "fail spectacularly and noisily on misuse". That said, an option could be amaxsize='4GB'argument? What do you think?stackdimension?almarklein commentedon Nov 9, 2020
It's more of a gut feeling. The plugins now do have this information, and I am not sure what it'd look like without it. Thinking of Dicom and Tiff in particular. It could be fine though!
With sensible I meant "something that makes sense to the user". If the user is able to express their expectation it's easier to match that than when the plugin code must make a guess. I suppose in most cases this comes down to returning the data in the highest possible dimension, but as mentioned for performance, a plugin could decide to limit that in some cases.
Not really. For images a Numpy array shaped NxM or NxMxC (with C 1, 2 ,3, or 4). (There is an open issue whether we expect RGB (as opposed to e.g. HSV), but that's a different topic: :D )
That would depend on the field. In such cases one would probably do some data-exploration when receiving new data anyway. So reading "greedy" might even be better, I suppose. My remaining point is readabilty:
(edited the below, I refered to "imshow", but meant "imread")
That is a really good question. In the current API, the mode is expressed with toplevel functions (imread, volread etc), making things very explicit, because a user is forced to use one of these functions. If
imread)would have raised an exception instead of "dropping data", this would already have made a huge difference, I think.The risk with a
modeparameter is that it's much less visible, making it's use less obvious. Maybe this is fine, if the default way to load an image works for most. But maybe we can change how it is expressed. This needs thought.I suppose the fact of having
mimread()makes the need higher. Note that onlymimread()andmvolread()have this option. If users are forced to do something likeims = [x[0] for x in iter], the potential problem is much more obvious. Plus the plugin cannot know whether process (and then drop) each frame, or keep everything in memory. So I think I'd prefer not to have amaxsizeargument in this case.See e.g. https://imageio.readthedocs.io/en/stable/plugins.html and https://github.com/imageio/imageio/blob/master/imageio/core/format.py#L666
Yes, I meant ROIs for x and y specifically. With respect to being able to select individual frames we're on the same page :)
I think the data layouts at the top are a good start. I'll add some variations for files being large in a particular dimension.
FirefoxMetzger commentedon Nov 12, 2020
@almarklein Thank you for such a detailed response.
I read up on the plugin documentation and took a stroll through some of the implementations. The plugins I checked seem to all load the entire image, with exception of
tifffile, which allows akey=Nargument to select a slice of width 1 along the first dimension of the array (which strongly looks like the C-API leaking into python). This would mean that most APIs load the full image/volume/etc. and then discard some of the data before returning the desired type of image to the user. Perhaps I missed the ones that excel with the reading modes (volread, imread, iter) introduced by theimageioAPI?The current documentation also seems to suggest this, by only specifying to implement
plugin._get_data(index)without specifying explicitly what index is supposed to mean. I suppose it means to read theindex-th image in the file if present orindex-th volume if it contains multiple volumes? What if the format supports both? What if the format only supports a single image, doesn'tindex=0become redundant andindex!=0non-sensical? Which also makes me wonder, how doesimageiofulfill avolreadcall?It appears that
imread/volread/iteris a split specifically introduced byimageio. For the most part, plugin libraries that I checked seem to do:read() # reads the entire image. There is the odd case (liketifffile) which adds some partial indexing to address memory constraints on some systems, but this seems much less common. Their approach (blindly read everything) seems to be working quite well. Why are we introducing specialization here, and why is this specialization the default (and only) way to interact with an image file? There must be something I am missing because the more I look at it, the less I understand it.I read your updated top-level post again. For the last use-case (multiple volumes) I thought that this comes from the ability of TIFF to store multiple images of different sizes. When I checked the
tifffile.pydocumentation it seemed as if they always load the entire image into a single nd-array. Do you know how this works with multiple volumes? My initial thought was that it seems impossible to create your use-case with that, but maybe it has to do with the magickey=property? Which other formats can produce this use-case?Reading your answers again, I was thinking that the main thing you object to in my suggestion isn't so much the slicing, but the fact that the returned shape of the image/volume is unknown until the object is returned. Is this consistency the reason why you have such a strong view on splitting
imreadandvolread? Could you explain why trading convenience for consistency, in this case, is worth doing?almarklein commentedon Nov 16, 2020
I think you were looking at the vendored code for
tifffile.py. The imageio tifffile plugin's read method is here, and you can see it uses the mode parameter to determine what the index means.I think Tifffile and Dicom are the only plugins that currently use the mode parameter. Naturally by far the most formats are 2D.
Then it uses the
modeto see whether volread or imread was used.Yes.
It will first try to select an appropriate plugin. In this process, plugins that do not support volumes are skipped. If no plugin was found, an error is raised.
The goal of imageio includes support for video and streaming data. To support that goal an (some form of) iter api is needed. It might be that the imread() / volread() split is not actually needed. I'm open to trying it without it :)
You can access each page (i.e. image) individually and call
asarraryon that. Also see the link to the tiffule plugin above.Actually, I object to the slicing API. As for the imread/volread separation - or the use of a mode parameter - I'm less certain by now.
What about going with the API proposed at the top, but dropping the mode parameter (except for r/w), and see how this holds up?
FirefoxMetzger commentedon Nov 16, 2020
Thanks again for the answers! Sorry, if my last comment was too harsh. I tend to get a bit critical and inquisitive when I am confused; I'm meaning no offense. I think I have a better sense of how things work under the hood now, so our discussion has definitely helped me.
Ok, then the slicing API is off the table.
I like the direction of the API in your top comment. If we try to challenge it a bit more: Do we really need an
imopenobject? The current (imread/volread) API is functional and this would introduce an object-oriented element to the API, mixing both styles (like animreadconvenience forimopen(...).read()). Could something like this be cleaner?Edit: If a plugin doesn't support a certain mode (like
imiterfor .jpg, orimwrite) they couldraise IOError. Though, I guess this is already taken care of by plugin selection itself.almarklein commentedon Nov 17, 2020
No offense taken! I must admit that I was a bit frustrated at times - this started as an effort to bring skimage and imageio closer, which should (eventually) make maintaining imageio easier. But here we are discussion a brand new API, and some quite fundamental properties of the current implementation of imageio :) Sorry if this made my come across as blunt sometimes.
The
modething has been part of imageo for so long that it's hard for me to see it without, even though it's too long ago to remember all the arguments for it at the time. If we can indeed pull this off without de mode parameter, that would simply things quite a bit! Anyway, it's good that we had this discussion, so thanks for that!Yesterday I was thinking of an API nearly the same as what you outline above :)
The thing that bothers me with the proposal in the top post, is that for this to work safely, we should really promote the use of a
withstatement. I initially thought we could promoteimopen(...).read()for simple cases, but we cannot, because on pypy this notation does not guarantee (at all) that the imopen object is closed, which may mean that the physical file stays open. However, the use of awithstatement arguably makes the API more complex (and take twice as many lines in most cases).The API you propose above feels nice and simple, but it has shortcomings:
imopenobject is that you get exactly the plugin object, which could offer additional functionality (API calls), giving more freedom for special formats.imread(index=i).I may overestimate the usefulness of the former - I don't think any of the current plugins actually do this. Also they could support additional kwargs for imread. Maybe there may be solutions for the latter?
Maybe we should start a new issue outlining these two proposals and ask for input from others too.
FirefoxMetzger commentedon Nov 17, 2020
I may not fully understand what additional functionality you have in mind. I'm sure you already thought about basic plumbing like:
If you mean custom methods on
imopen, have you thought about allowing plugins to use a custom namespace like;Opening the file twice for metadata and image data is an explicit choice because I think the case of not caring about metadata is much more common than needing metadata. If a user only wants metadata, e.g., for warehousing, then it can be much faster to not have to read the entire image on a lot of files; though I don't think many plugins support this currently (but they might!). For cases where a user wants both, metadata and image data, this API choice is indeed suboptimal, especially for a lot of files. We could think of
Not sure if this makes things a little redundant though. In the case of
imiterit might be wasteful to return the same metadata each time.Reading 4 specific images from a file is not a primary use-case listed in the top post :P If we want to do that, we are steering close to the slicing API. The current API returns/yields nd-images ... you would only need a single call
almarklein commentedon Nov 18, 2020
Yeah, that's what I meant. But I don't think it's a strong argument, because we can have
kwargsin imread, like you mentioned.I realized an important shortcoming: wrapper API's like @lschr's array-like interface would not be possible ...
I'm starting to think that we cannot have a single API. We can discern at least 3 API's:
imopenAPI to provide access to a plugin object. This seems to be an API offering complete functionality, and is still quite concise, but requires awith-statement in most cases.imopen), is more friendly and covers the need of 80-90% of users.imopen). Convenient for lazy loading, but probably more for advanced users.Each of these have their strengths. I think we need
imopenas a basis, but alsoimreadbecause forcing thewith-statement on all users is not the way to go.What do you think? If this sounds good, let's start a new discussion on where each API should live ... and how to deal with backwards compatibility.
lschr commentedon Nov 18, 2020
I think it is best (as suggested and as it is now) to have a low-level API offering maximum flexibility (possibly at the cost of unease (?) of use) plus, on top of that, high-level API(s) covering most use cases. The current documentation also makes it very clear which one is which 👍.
That being said, @almarklein 's suggestions should be easy to implement (unless I am missing something):
imopen(…, mode="r")would be basically the same asget_readeris nowimopen(…, mode="w")<->get_writerimread(…, mode="ri")<->imreadimread(…, mode="rI")<->mimreadTo keep backward compatibility for some time, one could (for instance) implement the old API as a wrapper around the new API and emit a
DeprecationWarning. The deprecated package provides a convenient way of doing this (I think; never have used it since I prefer not to pull in another package just for this).FirefoxMetzger commentedon Nov 18, 2020
Not sure I follow. Do you mean the ability to subclass the "API object" and specialize it?
Either way, it is a nice idea to have multiple APIs depending on the use-case. I am a bit worried that this proliferation could lead to a long-term maintenance headache, especially if we need/want to change
imopenin the future. This is not something we have to worry about now though. Let's go with this idea and discuss where things should live. Do we do this here or in a new issue?Random proposal: Have
imopenand the array API live inimageio.advancedand the easy API live in the main namespaceimageio.almarklein commentedon Nov 19, 2020
I meant that there is no longer an open reader object to wrap, so lazy loading is not possible (or very inefficient).
I was just composing a new issue, but as I wrote it, I felt an unease, because I was basically listing 4 API's: the imopen, the new imread, the array-like, and the current imageio API (for backwards compatibility). This is a bit ... overwhelming.
This leads me to the following:
imopenplus theimreadconvenience functions as a single API.almarklein commentedon Nov 19, 2020
Let's continue in #569