Skip to content

Commit

Permalink
BUG: Check for Secondary Capture spacing following DICOM Part 3 Sect …
Browse files Browse the repository at this point in the history
…A.8.1.3

Following the Secondary Capture Image IOD Module Note:

> If Image Position (Patient) (0020,0032) and Image Orientation (Patient) (0020,0037) (from the Image Plane M  odule) are present, then the values of Pixel Spacing (0028,0030) (from the Image Plane Module and the Basic Pixel   Spacing Calibration Macro included from the SC Image Module) are intended to be used for 3D spatial computations  , rather than any values of Nominal Scanned Pixel Spacing (0018,2010) (from the SC Image Module), which may also   be present.

However, we make sure to throw a warning in `ImageHelper::GetSpacingTagFromMediaStorage` when the tag for a S  econdary Capture MediaStorage is requested and SecondaryCaptureImagePlaneModule is enabled because returning a si  ngle tag is insufficient for this requirement. This function should not be called on this type of media storage.

Pushed upstream here: malaterre/GDCM#170

Co-authored-by: Mihail Isakov <[email protected]>
Co-authored-by: Mathieu Malaterre <[email protected]>
Co-authored-by: Steve Pieper <[email protected]>
  • Loading branch information
4 people authored and hjmjohnson committed Apr 12, 2024
1 parent a2447ab commit c23d6c7
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1278,6 +1278,9 @@ Tag ImageHelper::GetSpacingTagFromMediaStorage(MediaStorage const &ms)
if( ImageHelper::SecondaryCaptureImagePlaneModule ) {
// Make SecondaryCaptureImagePlaneModule act as ForcePixelSpacing
// This is different from Basic Pixel Spacing Calibration Macro Attributes
//
// Per the note: https://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_A.8.html#sect_A.8.1.3
gdcmWarningMacro( "FIXME: Multiple tags can identify Secondary Capture spacing. This function should not be used for Secondary Capture data." );
t = Tag(0x0028,0x0030);
} else {
t = Tag(0x0018,0x2010);
Expand Down Expand Up @@ -1471,7 +1474,25 @@ std::vector<double> ImageHelper::GetSpacingValue(File const & f)
}
}

Tag spacingtag = GetSpacingTagFromMediaStorage(ms);
Tag spacingtag = Tag(0xffff,0xffff);
if( ms == MediaStorage::SecondaryCaptureImageStorage && SecondaryCaptureImagePlaneModule )
{
// See the note: https://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_A.8.html#sect_A.8.1.3
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() )
{
const DataElement& de = ds.GetDataElement( spacingtag );
Expand Down

0 comments on commit c23d6c7

Please sign in to comment.