Skip to content

Commit

Permalink
Use Pixel Spacing for SC only with SecondaryCaptureImagePlaneModule
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thewtex authored and malaterre committed Mar 25, 2024
1 parent 2abdfcf commit 0cca908
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
32 changes: 14 additions & 18 deletions Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,20 @@ std::vector<double> 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
Expand Down Expand Up @@ -1463,23 +1476,6 @@ std::vector<double> 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() )
{
Expand Down
4 changes: 4 additions & 0 deletions Source/MediaStorageAndFileFormat/gdcmImageHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 0cca908

Please sign in to comment.