Support Philips DICOMs
Philips DICOMs don't crop edge tiles, so we must compute downsample from the pixelspacing tag. Additionally, compute level pixel dimensions from the base levels size and the level downsample.
If pixelspacing is not defined, fall back to using level pixel dimensions.
See https://github.com/ImagingDataCommons/libdicom/issues/79
DCO signed off :heavy_check_mark:
All commits have been signed off. You have certified to the terms of the Developer Certificate of Origin, version 1.1. In particular, you certify that this contribution has not been developed using information obtained under a non-disclosure agreement or other license terms that forbid you from contributing it under the GNU Lesser General Public License, version 2.1.
A quick POC hack, so a draft for now.
It seems to work, though we don't actually crop edge tiles, just report a smaller size.
Test Philips DICOM:
ftp://medical.nema.org/MEDICAL/Dicom/DataSets/WG26/WG26Connectathon2023_ECDP/DICOM/Philips/Case-E
With this PR I see:
openslide.level-count: 7
openslide.level[0].downsample: 1
openslide.level[0].height: 55296
openslide.level[0].tile-height: 1024
openslide.level[0].tile-width: 1024
openslide.level[0].width: 104448
openslide.level[1].downsample: 2
openslide.level[1].height: 27648
openslide.level[1].tile-height: 1024
openslide.level[1].tile-width: 1024
openslide.level[1].width: 52224
openslide.level[2].downsample: 4
openslide.level[2].height: 13824
openslide.level[2].tile-height: 1024
openslide.level[2].tile-width: 1024
openslide.level[2].width: 26112
openslide.level[3].downsample: 8
openslide.level[3].height: 6912
openslide.level[3].tile-height: 1024
openslide.level[3].tile-width: 1024
openslide.level[3].width: 13056
openslide.level[4].downsample: 16
openslide.level[4].height: 3456
openslide.level[4].tile-height: 1024
openslide.level[4].tile-width: 1024
openslide.level[4].width: 6528
openslide.level[5].downsample: 32
openslide.level[5].height: 1728
openslide.level[5].tile-height: 1024
openslide.level[5].tile-width: 1024
openslide.level[5].width: 3264
openslide.level[6].downsample: 64
openslide.level[6].height: 864
openslide.level[6].tile-height: 1024
openslide.level[6].tile-width: 1024
openslide.level[6].width: 1632
ie. all the levels are detected, cropped and downsampled correctly. vipsdisp is able to display the image quickly and without rendering errors during zoom.