WIP: Derive baseclass from imageio#273
Conversation
|
I fixed the tests fails that appeared due to an added dependency to Via imageio, PIMS picks up two additional required deps: Pillow and olefile. edit: I'll push the commits on Monday |
c14f6f1 to
d76002b
Compare
|
Interesting. I am 👍 on going this route. From my point of view the interesting thing about pims is the lazy fancy slicing. If we can solve the file dispatch / loading problem by becoming an imageio plugin all the better! |
|
I agree that we should take this route @tacaswell. I am however not completely content with the implementation in this PR, as it involves a custom I thought of another route: if we would reimplement all our readers as imageio plugins, we'd lose all the fancy/lazy slicing capabilities. To recover that functionality, we want to wrap the imageio readers, something like:
However, we will lose knowledge of frame shape, pixel dtypes, and dimension names as they are not supported by default in imageio. These can however be guessed by reading the first frame, which is actually what happens already in many of our readers. Preferably, we could give Either way, I am in favour of only making one wrapper that is dimensionality-aware, based on If we decide on something, we should discuss with someone at imageio. |
|
That suggestion is moving the readers from being 'is-a' to 'has-a' in relation to the 'get-me-one-and-only-one' frame readers at the bottom which is also a step forward (I think). There is a bunch of complexity in PIMS because I was thinking about streaming data from day-job related things, but that can probably all be dropped with no loss of actually use 😈 (as we do not actually use it in that way). |
|
👍 |
|
@danielballan @tacaswell I implemented the imageio plugin based architecture as described above. The implementation is surprisingly simple! In this example, Now, For the more advanced readers of PIMS that are already aware of the dimensions (for example, Thoughts? |
| author="PIMS Contributors", | ||
| install_requires=['slicerator>=0.9.7', 'six>=1.8', 'numpy>=1.7'], | ||
| install_requires=['slicerator>=0.9.7', 'six>=1.8', 'numpy>=1.7', | ||
| 'pillow', 'imageio'], |
There was a problem hiding this comment.
👍 for making imageio a hard dependency. I see that it, in turn, only requires numpy and pillow as required deps: https://github.com/imageio/imageio/blob/master/setup.py#L212
pims/base_frames.py
Outdated
| # TODO pass the dimension-awareness through this field | ||
| try: | ||
| info = self.rdr._get_pims_info() | ||
| if not isinstance(info, dict): |
There was a problem hiding this comment.
I'm not sure I follow this. Why wouldn't info be a dict?
There was a problem hiding this comment.
Not sure what I was thinking, I will remove it when implementing the wrapping of readers that are already ND
|
I like the encapsulation approach. I left a comment and a question inline. |
30ec61b to
03d773f
Compare
|
I just pushed the rebase of a dimension aware reader ( |
This is still work in progress. To make use of the imageio plugin architecture, I derived a new baseclass called
PimsFormatand implementedTiffStack_tifffilebased on that as an example.To save some work, I dropped the
as_gray,dtypeandprocess_funckwargs. Also I renamed thepixel_typetodtypeand I added theshapeproperty.It still has the N-dimensional functionality and the lazy slicing, as well as the fancy IPython display. The reader is accessible using
imageio.get_reader(<filename>, 'TIFF_tifffile')