Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse philips tiff mettadata #80

Merged
merged 2 commits into from
Nov 29, 2023
Merged

Conversation

erikogabrielsson
Copy link
Contributor

Fix for #77
Took inspiration from the philps tiff metadata parser from OpenTile.

Not sure how to write a good test for this without a test file? Got this from the file I had locally available:

...
 'tiffslide.vendor': 'PHILIPS',
...
 'tiffslide.mpp-x': 0.25,
 'tiffslide.mpp-y': 0.25,
...

@ap--
Copy link
Collaborator

ap-- commented Nov 29, 2023

Thanks @erikogabrielsson for your contribution!

I tested locally with a few philips tiff files. Looks good!

@ap-- ap-- merged commit 93f9e25 into Bayer-Group:main Nov 29, 2023
8 of 9 checks passed
Copy link
Contributor

@kaczmarj kaczmarj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There may be a bug in this, where mpp x and y are flipped.

float(element.strip('"')) * 1000
for element in pixel_spacing_attribute.split(' ')
]
mpp_x, mpp_y = pixel_spacings[0], pixel_spacings[1]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erikogabrielsson @ap-- i think x and y need to be reversed here. openslide's website says the following:

openslide.mpp-x
    calculated as 1000 * philips.DICOM_PIXEL_SPACING[1]
openslide.mpp-y
    calculated as 1000 * philips.DICOM_PIXEL_SPACING[0] 

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct. Per DICOM specifications the first value is the row spacing and the second value the column spacing,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i submitted a fix in #81

kaczmarj added a commit to kaczmarj/tiffslide that referenced this pull request Nov 30, 2023
According to the DICOM spec, the first value is row mpp and second is column mpp.

> Physical distance in the imaging target (patient, specimen, or phantom) between the centers of each pixel, specified by a numeric pair - adjacent row spacing (delimiter) adjacent column spacing in mm. See Section 10.7.1.3 for further explanation of the value order.

source: https://dicom.innolitics.com/ciods/vl-whole-slide-microscopy-image/vl-whole-slide-microscopy-image-multi-frame-functional-groups/52009230/00289110/00280030

Related to Bayer-Group#80 (review)
@erikogabrielsson erikogabrielsson deleted the philips branch November 30, 2023 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants