-
Notifications
You must be signed in to change notification settings - Fork 12
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
Conversation
Thanks @erikogabrielsson for your contribution! I tested locally with a few philips tiff files. Looks good! |
There was a problem hiding this 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] |
There was a problem hiding this comment.
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]
There was a problem hiding this comment.
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,
There was a problem hiding this comment.
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
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)
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: