napari / napari-tiff

A napari reader plugin for tiff images.
BSD 3-Clause "New" or "Revised" License
8 stars 4 forks source link

Provide extra metadata to napari layer as dictionary #27

Closed GenevieveBuckley closed 5 months ago

GenevieveBuckley commented 5 months ago

This PR searches for all *_metadata attributes found in the tifffile python object, and puts them in a dictionary that is passed into the napari layer.

Napari layer objects have a metadata attribute, which can hold a dictionary. Napari doesn't actually do anything with this dictionary, but it does get stored in the layer right beside the actual data, so it is possible for the user to look up the metadata (and possibly do something with it themselves later on).

TiffFile objects have a number of *_metadata attributes (for any given case, most will return None or an empty list/tuple):

Context: we've been discussing ome-tiff files and their related metadata. Seeing just how many other types of metadata could potentially be stored makes me think that a more generic solution like this one would be preferable to individually checking for 27 different types of possible metadata.