Skip to content

Meta data use cases #501

Closed
Closed

Description

@almarklein

See #362 for the meta-data overview issue.

The purpose of this issue is to collect (real and hypothetical) use cases that we should consider. We should decide how we want imageio to work in these cases. Then as the metadata plan converges, we can look here to test whether it covers everything adequately.

Please submit use cases here on how one could want to use meta data. Let's number them to refer to them easily.

Activity

  1. almarklein commented on Jan 28, 2020

    @almarklein
    MemberAuthor

    Use case 1

    See #371

    • User reads jpeg data which has exif flag set, so imageio rotates the data.
    • User writes data providing the original meta data.

    Imageio should discard the exif flag, so it should somehow know that it is invalid.

  2. almarklein commented on Jan 28, 2020

    @almarklein
    MemberAuthor

    Use case 2

    See #455

    • User reads jpeg data which has exif flag set, so imageio rotates the data.
    • User wants to know whether the EXIF flag was originally present.

    This means that to solve use case 1, we cannot simply discard the exif flag (as #371 proposes); we should somehow invalidate it.

  3. almarklein commented on Jan 28, 2020

    @almarklein
    MemberAuthor

    Use case 3

    • User reads an image that has nonunit/nonzero sampling and origin.
    • User crops the image by slicing in numpy.
    • User writes data back, providing the meta data to get the sampling correct. But now the origin will be off.

    I think that this is the responsibility of the user. In theory imageio could store the original shape of the array in the metadata, and compare it when writing so see that it does not match up ... but this might a slippery slope.

    The part where "the user crops the image" can be seen as a generalization of "the user applies an imageio function". In the latter case skimage could do something, but perhaps it should not, because the user can break things easily by just manipulating the array.

  4. almarklein commented on Jan 28, 2020

    @almarklein
    MemberAuthor

    Use case 4

    • User reads only the meta data
    • User reads image + meta data

    They should be the same. This is just another argument along with use-case 2 that we cannot change the original metadata.

  5. jni commented on Feb 23, 2020

    @jni
    Contributor

    I feel like this can and should come after implementing metadata reading. Every one of these cases is a slippery slope, actually. The rotated flag suffers from the same issue as origin/slicing, namely, that all sorts of things can happen between reading and writing. Worrying about how to process metadata can paralyze us for another 2+ years. =)

  6. almarklein commented on Mar 2, 2020

    @almarklein
    MemberAuthor

    I'm not out to automagically make all use-cases work out of the box. But I hope to find a way to avoid (most) unexpected scenario's, e.g. by categorizing metadata, or allow plugins to marking fields in some way.

  7. miketaormina commented on May 2, 2021

    @miketaormina

    I hope this isn't too esoteric of a use case and that this thread is an appropriate place for it.

    I frequently read metadata from tif files (as OME-Tiff) that have been generated by the Micro-Manager microscope control software that is built on ImageJ. Because the tifffile.py package is quite efficient but poorly version controlled, I have taken to accessing certain parts of the metadata via Imageio's internal version (plugins._tifffile.TiffFile.micromanager_metadata) which is susceptible to a failure at lines 8050-8065, which check the "MicroManager display header," for reasons I can't actually reproduce consistently. As far as I can tell, setting the contrast sliders on these images can put the metadata into a state that tifffile can't handle. Commenting out these lines resolves the issue for me since I don't care about having those specific components of the metadata, but this could of course be handled more appropriately as an exception that doesn't kill the loading of the rest of the metadata.

    Perhaps this isn't really a metadata issue, but more of a TiffFile or MicroManager one, but I'm a little bit curious:

    1. If there is a lot of use of MicroManager and its metadata in the Imagio community
    2. If the TiffFile package is problematic for others
    3. If the _tifffile component of the plugins module is something that this community is changing/developing independent of the original source.
  8. FirefoxMetzger commented on May 3, 2021

    @FirefoxMetzger
    Contributor
    1. If there is a lot of use of MicroManager and its metadata in the Imagio community

    I actually don't know. Maybe someone else has more insight :)

    1. If the TiffFile package is problematic for others

    Sometimes there are bugs, then we fix them, then there are fewer bugs 🚀 😄
    We have labels to keep track of plugin-specific issues, and you can find the one for tifffile here:
    plugin: tifffile

    1. If the _tifffile component of the plugins module is something that this community is changing/developing independent of the original source.

    No, we are not developing the tifffile backend independently. The vendored version may have some differences compared to the same version available "upstream", but those differences are mainly internal and aimed at reducing 3d party dependencies; for example, our version does LZW decompression in pure python. This has performance implications but is easier to install on diverse platforms. Feature-wise it should be the same if you compare it to the same version, and upstream should offer more features if you look at their latest version. If you have an existing installation of tifffile, then we will prefer that one over our vendored version.

    In the future, we have plans to stop shipping backends together with imageio, and instead plan to depend directly on upstream projects. This means that at some point, our vendored _tifffile.py will disappear.

  9. FirefoxMetzger commented on Feb 10, 2022

    @FirefoxMetzger
    Contributor

    closed via #739

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions