From 0cca908db8fae7145a3eb24396d8714049a10194 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Thu, 21 Mar 2024 13:11:14 -0400 Subject: [PATCH] Use Pixel Spacing for SC only with SecondaryCaptureImagePlaneModule Default to the GetSpacingTagFromMediaStorage, which is Nominal Scanned Pixel Spacing for Secondary Capture. Only use Pixel Spacing (0028,0030) when the SecondaryCaptureImagePlaneModule flag has been enabled on ImageHelper. Add documentation to Set/GetSecondaryCaptureImagePlaneModule accordingly. --- .../gdcmImageHelper.cxx | 32 ++++++++----------- .../gdcmImageHelper.h | 4 +++ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx b/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx index 0648fe0ec..5ada802f4 100644 --- a/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx +++ b/Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx @@ -1400,7 +1400,20 @@ std::vector ImageHelper::GetSpacingValue(File const & f) MediaStorage ms; ms.SetFromFile(f); const DataSet& ds = f.GetDataSet(); - Tag spacingtag(0xffff,0xffff); + Tag spacingtag = GetSpacingTagFromMediaStorage(ms); + if( ms == MediaStorage::SecondaryCaptureImageStorage && SecondaryCaptureImagePlaneModule ) + { + if( ds.FindDataElement( Tag(0x0028,0x0030) ) ) + { + // Type 1C in 'SC Image' (for calibrated images) + spacingtag = Tag(0x0028,0x0030); + } + else if( ds.FindDataElement( Tag(0x0018,0x2010) ) ) + { + // Type 3 in 'SC Image' + spacingtag = Tag(0x0018,0x2010); + } + } if( ms == MediaStorage::EnhancedCTImageStorage || ms == MediaStorage::EnhancedMRImageStorage @@ -1463,23 +1476,6 @@ std::vector ImageHelper::GetSpacingValue(File const & f) return sp; } } - else if( ms == MediaStorage::SecondaryCaptureImageStorage ) - { - if( ds.FindDataElement( Tag(0x0028,0x0030) ) ) - { - // Type 1C in 'SC Image' (for calibrated images) - spacingtag = Tag(0x0028,0x0030); - } - else if( ds.FindDataElement( Tag(0x0018,0x2010) ) ) - { - // Type 3 in 'SC Image' - spacingtag = Tag(0x0018,0x2010); - } - } - else - { - spacingtag = GetSpacingTagFromMediaStorage(ms); - } if( spacingtag != Tag(0xffff,0xffff) && ds.FindDataElement( spacingtag ) && !ds.GetDataElement( spacingtag ).IsEmpty() ) { diff --git a/Source/MediaStorageAndFileFormat/gdcmImageHelper.h b/Source/MediaStorageAndFileFormat/gdcmImageHelper.h index 05f5aab1b..6dd4ac456 100644 --- a/Source/MediaStorageAndFileFormat/gdcmImageHelper.h +++ b/Source/MediaStorageAndFileFormat/gdcmImageHelper.h @@ -88,6 +88,10 @@ class GDCM_EXPORT ImageHelper /// Opt into Image Plane Module for Secondary Capture Image Storage /// Enable reading Image Position Patient (IPP) and Image Orientation Patient (IOP) /// for Secondary Capture Image Storage. + /// Also, pixel spacing will be based on a Pixel Spacing tag (0028,0x0030), if present, and fall + /// back to Nominal Scanned Pixel Spacing (0018,2010), if present, as described: + /// https://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.8.6.2.html#table_C.8-2 + /// https://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_10.7.html#table_10-10 static void SetSecondaryCaptureImagePlaneModule(bool); static bool GetSecondaryCaptureImagePlaneModule();