Skip to content

Commit

Permalink
ENH: Enable SecondaryCaptureImagePlaneModel in GDCM
Browse files Browse the repository at this point in the history
This enables support for reading image orientation patient and image
position patient from DICOM secondary capture images.

This addresses needs such as reading Visible Human DICOM color images in
3D Slicer:

  NA-MIC/ProjectWeek#875

and reading highdicom derived secondary capture DICOM in ITK-Snap:

  ImagingDataCommons/highdicom#247

Update the RGB tests' baseline that were using a .png baseline because they now
output spatial metadata.
  • Loading branch information
thewtex committed Mar 25, 2024
1 parent 193a2ed commit f545dd8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Modules/IO/GDCM/src/itkGDCMImageIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ GDCMImageIO::Read(void * pointer)
inputFileStream.close();

itkAssertInDebugAndIgnoreInReleaseMacro(gdcm::ImageHelper::GetForceRescaleInterceptSlope());
// Secondary capture image orientation patient and image position patient support
itkAssertInDebugAndIgnoreInReleaseMacro(gdcm::ImageHelper::GetSecondaryCaptureImagePlaneModule());
gdcm::ImageReader reader;
reader.SetFileName(m_FileName.c_str());
if (!reader.Read())
Expand Down Expand Up @@ -454,6 +456,8 @@ GDCMImageIO::InternalReadImageInformation()

// In general this should be relatively safe to assume
gdcm::ImageHelper::SetForceRescaleInterceptSlope(true);
// Secondary capture image orientation patient and image position patient support
gdcm::ImageHelper::SetSecondaryCaptureImagePlaneModule(true);

gdcm::ImageReader reader;
reader.SetFileName(m_FileName.c_str());
Expand Down
1 change: 1 addition & 0 deletions Modules/IO/GDCM/test/Baseline/Lily.mha.cid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bafkreidhatfhe2gdne5k5pyw2rfvnuu3qmedytq7mrdjckmw6zrc5x3srq
2 changes: 1 addition & 1 deletion Modules/IO/GDCM/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ function(AddComplianceTest fileName)
--compareCoordinateTolerance
0.001
--compare
DATA{Baseline/Lily.png}
DATA{Baseline/Lily.mha}
${ITK_TEST_OUTPUT_DIR}/itkGDCM_ComplianceTestRGB_${fileName}.mha
itkGDCMImageReadWriteTest
DATA{Input/Lily/${fileName}.dcm}
Expand Down
1 change: 1 addition & 0 deletions Modules/IO/ImageBase/src/itkIOConfigure.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#cmakedefine ITK_SUPPORTS_WCHAR_T_FILENAME_CSTYLEIO
#cmakedefine ITK_SUPPORTS_WCHAR_T_FILENAME_IOSTREAMS_CONSTRUCTORS
#cmakedefine ITK_SUPPORTS_FDSTREAM_HPP
#cmakedefine ITK_USE_SYSTEM_GDCM

/*
* Enable the pre-registration of factories for specific image file formats
Expand Down

0 comments on commit f545dd8

Please sign in to comment.