Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Modules/IO/GDCM/test/Baseline/Lily.mha.cid
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bafkreidhatfhe2gdne5k5pyw2rfvnuu3qmedytq7mrdjckmw6zrc5x3srq
bafkreih4irpsshtdat5dvqmkdmgzguaol6qmz5mrskxtxmvjvrawuy32bq
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bafkreibzdrcgqyc3xtkxqh7rfpxf5oji35b2g5yujsaiwxltp3kwmxbixe
14 changes: 14 additions & 0 deletions Modules/IO/GDCM/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,20 @@ itk_add_test(
${ITK_TEST_OUTPUT_DIR}/itkGDCMImageIOTest4.mha
${ITK_TEST_OUTPUT_DIR}/itkGDCMImageIOTest4Rescaled.dcm
${ITK_TEST_OUTPUT_DIR}/itkGDCMImageIOTest4Rescaled.mha)
itk_add_test(
NAME
itkGDCMImageIOSecondaryCaptureSpacingTest
COMMAND
ITKIOGDCMTestDriver
--compare
DATA{Baseline/itkGDCMImageIOSecondaryCaptureSpacingTestBaseline.mha}
${ITK_TEST_OUTPUT_DIR}/itkGDCMImageIOSecondaryCaptureSpacingTest.mha
itkGDCMImageIOTest
DATA{Input/image_slice0.dcm}
${ITK_TEST_OUTPUT_DIR}/itkGDCMImageIOSecondaryCaptureSpacingTest.dcm
${ITK_TEST_OUTPUT_DIR}/itkGDCMImageIOSecondaryCaptureSpacingTest.mha
${ITK_TEST_OUTPUT_DIR}/itkGDCMImageIOSecondaryCaptureSpacingTestRescaled.dcm
${ITK_TEST_OUTPUT_DIR}/itkGDCMImageIOSecondaryCaptureSpacingTestRescaled.mha)
itk_add_test(
NAME
itkGDCMImageIOTest5
Expand Down
1 change: 1 addition & 0 deletions Modules/IO/GDCM/test/Input/image_slice0.dcm.cid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bafkreigjtwunwnt7ilfegmhub73amtuyzdueyzj6ykftp7usibs57b2aya
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