You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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. =)
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.
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:
If there is a lot of use of MicroManager and its metadata in the Imagio community
If the TiffFile package is problematic for others
If the _tifffile component of the plugins module is something that this community is changing/developing independent of the original source.
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 :)
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
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.
Activity
almarklein commentedon Jan 28, 2020
Use case 1
See #371
Imageio should discard the exif flag, so it should somehow know that it is invalid.
almarklein commentedon Jan 28, 2020
Use case 2
See #455
This means that to solve use case 1, we cannot simply discard the exif flag (as #371 proposes); we should somehow invalidate it.
almarklein commentedon Jan 28, 2020
Use case 3
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.
almarklein commentedon Jan 28, 2020
Use case 4
They should be the same. This is just another argument along with use-case 2 that we cannot change the original metadata.
jni commentedon Feb 23, 2020
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. =)
almarklein commentedon Mar 2, 2020
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.
miketaormina commentedon May 2, 2021
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.pypackage 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 thattifffilecan'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
TiffFileor MicroManager one, but I'm a little bit curious:_tifffilecomponent of thepluginsmodule is something that this community is changing/developing independent of the original source.FirefoxMetzger commentedon May 3, 2021
I actually don't know. Maybe someone else has more insight :)
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
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.pywill disappear.FirefoxMetzger commentedon Feb 10, 2022
closed via #739