napari / napari-tiff

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

Read scale info from ome-xml embedded in ome-tiffs #37

Open jni opened 1 month ago

jni commented 1 month ago

See this image.sc thread for more info.

As explained by @will-moore here, The path to the scale values is: OME (root?) / Image / Pixels / PhysicalSize{X,Y,Z}. It also includes units, which can be added to the layer information since napari/napari#6979.

We should probably depend on ome-types to make parsing of the xml easier.

imagesc-bot commented 1 month ago

This issue has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/metadata-in-tiff-to-define-axes-scales/103705/8

Czaki commented 1 month ago

relevant code in PartSeg https://github.com/4DNucleome/PartSeg/blob/24978a5f2a2602ad42770f8b1d360252c64e4990/package/PartSegImage/image_reader.py#L627-L631:

            self.shift = [
                meta_data["Pixels"]["Plane"][0][f"Position{x}"]
                * name_to_scalar[meta_data["Pixels"]["Plane"][0][f"Position{x}Unit"]]
                for x in ["Z", "Y", "X"]
            ]