-
-
Notifications
You must be signed in to change notification settings - Fork 668
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
BUG: Get image geometry from GDCM Secondary Capture #4111
BUG: Get image geometry from GDCM Secondary Capture #4111
Conversation
Secondary capture images can have pixel spacing and image orientation, but the GDCM code explicitly ignored these values (whereas DCMTK code read them). Per David Clunie (@dclunie) the editor of the standard, it was clarified in CP-586 that PixelSpacing is the correct place to store the best known value (e.g. one that has been corrected for distortion) while other fields like the NominalScannedPixelSpacing, which GDCM used before this commit, if stored at all should have the uncorrected values. For these reasons this commit makes the default behavior of GDCM for SC match what it would do if SC images were MR or CT in terms of handling the image geometry, which is a better default than the previos behavior. https://dicom.nema.org/medical/dicom/Final/cp586_ft.pdf Fixes InsightSoftwareConsortium#4109
IMHO, the idea to read IPP/IOP/PixelSpacing from the SecondaryCaptureImageStorage is good, there are many such data sets (they can be considered Extended Secondary Capture), but it should be done in GDCM or documented that the changes have to be re-applied after every GDCM update. Image Position (Patient) should be updated here, otherwise it will be always ITK/Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx Line 580 in cdbbdf9
Edit: The change is the reason for failed tests, BTW
because the PR does not read NominalScannedPixelSpacing (0018,2010). In fact, both, (0018,2010) Type 3 and (0028,0030) Type 1C, are valid for SC Image module. I am afraid that ignoring (0018,2010) is not the best way too. Edit: CC: @malaterre Please look at this post Edit: Probably it should work if both spacing attributes will be read for SC Image and (0028,0030) will have higher priority, if both are available. |
Very good point! I wasn't sure how ITK interacts with the upstream repository and mostly wanted this change to go into Slicer's fork, but yes, coming up with the best conforming solution in GDCM makes good sense and then it can work its way into ITK and then Slicer.
Yes, I interpreted CP 586 as saying that PixelSpacing is the preferred way to express the true value. It might make sense to have a fallback to look for one of the other spacing tags if PixelSpacing is missing, but it felt like an obscure corner case and I didn't see any easy way to restructure the code since I'm not familiar with it. I agree with your other points @issakomi and would be happy to see a better implementation of this that covers more cases. Let's see if @malaterre or others have suggestions on how best to approach this. |
Add patches to GDCM for reading pixel spacing, image orientation patient, image position patient, from DICOM secondary capture datasets in: malaterre/GDCM#167 which are based on GDCM `release`. xref: - malaterre/GDCM#158 - InsightSoftwareConsortium#4109 - Slicer/Slicer#7089 - InsightSoftwareConsortium#4111
Superceded by #4521 |
Secondary capture images can have pixel spacing and image orientation, but the GDCM code explicitly ignored these values (whereas DCMTK code read them).
Per David Clunie (@dclunie) the editor of the standard, it was clarified in CP-586 that PixelSpacing is the correct place to store the best known value (e.g. one that has been corrected for distortion) while other fields like the NominalScannedPixelSpacing, which GDCM used before this commit, if stored at all should have the uncorrected values.
For these reasons this commit makes the default behavior of GDCM for SC match what it would do if SC images were MR or CT in terms of handling the image geometry, which is a better default than the previos behavior.
https://dicom.nema.org/medical/dicom/Final/cp586_ft.pdf
Fixes #4109