Skip to content

FEAT: improps and immeta - #739

Merged
FirefoxMetzger merged 21 commits into
imageio:masterfrom
FirefoxMetzger:feat-image-props
Feb 10, 2022
Merged

FirefoxMetzger merged 21 commits into
imageio:masterfrom
FirefoxMetzger:feat-image-props

Conversation

@FirefoxMetzger

@FirefoxMetzger FirefoxMetzger commented Jan 26, 2022 •

Copy link
Copy Markdown
Contributor

Closes: #362 #382 #501 #502 #503

This PR adds two new functions to the v3 API: iio.improps and iio.immeta. improps returns a ImageProperties object which contains standardized metadata, and immeta returns a dict object that contains format-specific metadata.

It also adds a imageio.core.v3_plugin_api.PluginV3 class that documents the plugin-side API for v3 plugins.

Further, I added implementations for metadata and properties to the v3 pillow plugin to support the newly added functions. For this plugin, reading of properties happens (as far as I know) without touching pixel data.

@almarklein @jni strike one ⚾ 🎉

Still pending:

  • implement properties and metadata for legacy_plugin_wrapper (this will likely touch pixel data in the process)
  • implement immeta wrapper around imopen
  • spacing in ImageProperties (@almarklein where is it stored? Do you have an example image I can test with?)

@FirefoxMetzger

Copy link
Copy Markdown
Contributor Author

blocked by #740

@almarklein

almarklein commented Jan 28, 2022 •

Copy link
Copy Markdown
Member

Do you have an example image I can test with?

The Dicom images specify it, for sure. The dicom plugin currently puts "sampling" in its metadata:

# Set shape and sampling
self._info["shape"] = shape
self._info["sampling"] = sampling

@FirefoxMetzger

Copy link
Copy Markdown
Contributor Author

The Dicom images specify it, for sure.

Nice. that sorts out one plugin. I was hoping for something that is loaded by pillow (and potentially one for ffmpeg and tifffile), because those seem to be our major plugins. At least if we go by the number of issues that we receive for each plugin.

@FirefoxMetzger

Copy link
Copy Markdown
Contributor Author

@almarklein RTR.

I have decided to only add superficial support for wrapped legacy plugins at this stage. This means it won't crash if you call immeta or improps with legacy plugins, but it won't use the most efficient approach either. I will change this incrementally as I iterate over plugins to update them to v3.

Comment thread imageio/core/v3_plugin_api.py Resolved
Co-authored-by: Almar Klein <[email protected]>
@FirefoxMetzger

Copy link
Copy Markdown
Contributor Author

@almarklein I take it that you approving the PR means you are happy with the changes otherwise and I can merge this after CI has passed?

@almarklein

Copy link
Copy Markdown
Member

Yes!

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.

META ISSUE: Revisit how imageio provides and handles meta data

2 participants