Skip to content

Extending ImageSequence reader when only imageio (but not skimage/matplotlib) is installed#365

Closed
GenevieveBuckley wants to merge 5 commits intosoft-matter:mainfrom
GenevieveBuckley:issue-363
Closed

Extending ImageSequence reader when only imageio (but not skimage/matplotlib) is installed#365
GenevieveBuckley wants to merge 5 commits intosoft-matter:mainfrom
GenevieveBuckley:issue-363

Conversation

@GenevieveBuckley
Copy link
Copy Markdown
Contributor

Closes #363

Adds a fallback path to imageio imread for pims/image_sequence.py

This is a "nice to have" extension of the current capabilities, aimed at allowing a lightweight minimal-ish set of pims dependencies that can cover most of the basic use cases (eg tifffile and imageio) without requiring more heavyweight dependencies like scikit-image/matplotlib are also installed.

@nkeim
Copy link
Copy Markdown
Contributor

nkeim commented Jun 30, 2020

The problem is in image_reader.py, which defines a PIMS class to read a single frame (I forget why we have this). Once both image_sequence.py and image_reader.py are updated we should be good to go!

@GenevieveBuckley
Copy link
Copy Markdown
Contributor Author

Once both image_sequence.py and image_reader.py are updated we should be good to go!

This is the build log after adding an imageio fallback path to image_reader.py: https://travis-ci.org/github/soft-matter/pims/jobs/703756047

I haven't dug deeply into the errors yet, but I think it's something to do with the plugin= kwarg being passed into imread.

@GenevieveBuckley
Copy link
Copy Markdown
Contributor Author

Also, should we consider making the order of preference for imread go: scikit-image > imageio > matplotlib, given the warning about "imread() works differently between scikit-image and matplotlib? "We don't require users to have scikit-image, but if we fall back to matplotlib, make sure the user is aware of the consequences." Any opinion here @nkeim ?

@GenevieveBuckley
Copy link
Copy Markdown
Contributor Author

FYI: TestImageSequenceNaturalSorting is failing locally if imageio imread is used (because of the plugin= kwarg).

I've pushed an update to skip this test class for now while we sort the other stuff out, but this either needs to be fixed, or for a new test to be added covering the same functionality with imageio.

@nkeim
Copy link
Copy Markdown
Contributor

nkeim commented Jul 1, 2020

Great catch, @GenevieveBuckley ! Yes, assuming that imageio's imread is more similar to scikit-image's, we definitely want to prefer it over matplotlib's.

@tacaswell
Copy link
Copy Markdown
Member

I think this is obsoleted by #392 which removes Matplotlib as a reader all together and adds a hard dependency on imageio.

Thank you for this @GenevieveBuckley and sorry we did not get it merged 2 years ago.

@tacaswell tacaswell closed this Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend ImageSequence reader to run when imageio (but not skimage/matplotlib) is installed

3 participants