Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ImageIOReader for images with channels and reordered axes #430

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jstriebel
Copy link

This fixes the ImageIOReader to recognize channels and report them correctl in images.sizes. Also, the frame_shape implementation is removed, since it did not account for reordered axes via bundle_axes. It would be great if a @soft-matter maintainer could add a test-case, e.g. using scifio-test.jp2 from https://samples.scif.io/test-jpeg2000.zip.

The current behavior looks like this:

>>> import pims
>>> = pims.open("scifio-test.jp2")
>>> p.shape  # correct
(1, 500, 500, 3)
>>> p[0].shape  # also correct
(500, 500, 3)
>>> p.sizes  # c missing!
{'x': 500, 'y': 500, 't': 1}
>>> p.bundle_axes="cxy"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jonathan/.cache/pypoetry/virtualenvs/webknossos--lLCZL8U-py3.9/lib/python3.9/site-packages/pims/base_frames.py", line 524, in bundle_axes
    raise ValueError("axes %r do not exist" % invalid)
ValueError: axes ['c'] do not exist
# and even after setting up the c axis, the shape is not corrected:
>>> p._init_axis("c", 3)
>>> p.bundle_axes="cyx"
>>> p.shape  # should be 1,3,500,500
(1, 500, 500, 3)

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.

None yet

1 participant