Bayer-Group / tiffslide

TiffSlide - cloud native openslide-python replacement based on tifffile
Other
82 stars 12 forks source link

Adds hamamatsu tags on slide properties for .ndpi #48

Closed stergioc closed 1 year ago

stergioc commented 1 year ago

Hi,

I made a few modifications at the parse_hamamatsu function in order to add all the hamamatsu tags on the properties of a NDPI tiffslide.

The reason is that in order to properly map NDPA annotations on the slide, apart from the mpp two additional offset related tags are necessary. Specifically:

Tag Description
65422 XOffsetFromSlideCentre
65423 YOffsetFromSlideCentre

(table retrieved from the OpenSlide format description here)

In this pull request I added these extra tags as additional properties of the tiffslide with a naming scheme as such:
md[f'hamamatsu.{tag.name}']=tag.value

stergioc commented 1 year ago

Hey @ap--, thanks for the feedback. I changed the function to just iterate over few selected tags by using a mapping dictionary, in case a tag is missing no property is created. This way, additional tags can be easily mapped if necessary. In the latest version, I am also using the md['hamamatsu.SourceLens'] (tag: 65421) to also set the md['tiffslide.objective-power']

ap-- commented 1 year ago

Thank you so much for your contribution! ❤️