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

FEAT: tifffile v3 #914

Merged
merged 27 commits into from
Dec 27, 2022
Merged

FEAT: tifffile v3 #914

merged 27 commits into from
Dec 27, 2022

Conversation

FirefoxMetzger
Copy link
Contributor

@FirefoxMetzger FirefoxMetzger commented Nov 29, 2022

Closes: #818, #437 (must be closed manually)

This PR updates the tifffile plugin to use the v3 plugin API. It still needs some documentation, but I want to park it here so that interested parties can give feedback :)

@FirefoxMetzger
Copy link
Contributor Author

Note to self: This PR needs updating to use index=... instead of index=None when bulk reading.

@lschr
Copy link
Contributor

lschr commented Nov 30, 2022

Thanks for this!

When looking through the code, I found a possible inconsistency: in metadata, it seems like index refers to the page, while in all other methods, index refers to the series and page refers to the page.

@FirefoxMetzger
Copy link
Contributor Author

@ishr Yes, that's true. I have to dig a bit further into tifffile to see if and how series-level metadata is handled and then update TifffilePlugin.metadata.

@FirefoxMetzger
Copy link
Contributor Author

Okay, now everything should be implemented and documented. What is still missing is to get full code coverage and then a final review.

@lschr
Copy link
Contributor

lschr commented Dec 1, 2022

Awesome!

It seems like the documentation of properties() is not quite right though. What is described as behavior for index=None is actually true for index=Ellipsis.

@FirefoxMetzger
Copy link
Contributor Author

Oh yes, good catch. The documentation also needs to update to index=... instead of index=None

@FirefoxMetzger
Copy link
Contributor Author

@mkcor I know you have been using tifffile a lot, so this might be interesting for you. I've written a v3 plugin for tifffile to expose all its "new" features in ImageIO. Feel free to give it a try and tell me what you think :)

The PR is ready and I will merge towards the end of the week unless anything major pops up.

@FirefoxMetzger FirefoxMetzger merged commit 4658049 into imageio:master Dec 27, 2022
@FirefoxMetzger FirefoxMetzger deleted the tifffile-v3 branch December 27, 2022 09:53
@mlt
Copy link

mlt commented Mar 1, 2023

I'm getting a regression with metadata description field containing XML (Open Microscopy Environment). I can navigate metadata dict alright with v2 but not with v3 & immeta :(

ValueError                                Traceback (most recent call last)
Cell In[13], line 12
     10 image_rgb = iio.imread(filename)
     11 # meta = image_rgb.meta
---> 12 meta = iio.immeta(filename)
     13 fig = plt.figure()
     14 ax = fig.gca()

File ~\miniconda3\envs\scikit-env\lib\site-packages\imageio\v3.py:250, in immeta(uri, index, plugin, extension, exclude_applied, **kwargs)
    247     call_kwargs["index"] = index
    249 with imopen(uri, "r", **plugin_kwargs) as img_file:
--> 250     metadata = img_file.metadata(**call_kwargs)
    252 return metadata

File ~\miniconda3\envs\scikit-env\lib\site-packages\imageio\plugins\tifffile_v3.py:307, in TifffilePlugin.metadata(self, index, page, exclude_applied)
    305                 metadata.update(flavor_metadata[0])
    306             else:
--> 307                 metadata.update(flavor_metadata)
    308 else:
    309     # tifffile may return a TiffFrame instead of a page
    310     target = target.keyframe

ValueError: dictionary update sequence element #0 has length 1; 2 is required

@FirefoxMetzger
Copy link
Contributor Author

@mlt Interesting find. Could you create a dedicated issue for that?

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.

imageio v3 api reads all pages of a multipage TIFF at once
3 participants