Skip to content

Commit a991601

Browse files
committed
Make SecondaryCaptureImageStorage Image Plane Module opt-in
Make this feature opt-in per the discussion: malaterre#158
1 parent 70b2473 commit a991601

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx

+13-2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ namespace gdcm
4848
bool ImageHelper::ForceRescaleInterceptSlope = false;
4949
bool ImageHelper::PMSRescaleInterceptSlope = true;
5050
bool ImageHelper::ForcePixelSpacing = false;
51+
bool ImageHelper::SecondaryCaptureImagePlaneModule = false;
5152

5253
static bool GetOriginValueFromSequence(const DataSet& ds, const Tag& tfgs, std::vector<double> &ori)
5354
{
@@ -578,7 +579,7 @@ std::vector<double> ImageHelper::GetOriginValue(File const & f)
578579

579580
// else
580581
const Tag timagepositionpatient(0x0020, 0x0032);
581-
if( ds.FindDataElement( timagepositionpatient ) )
582+
if( (ms != MediaStorage::SecondaryCaptureImageStorage || SecondaryCaptureImagePlaneModule) && ds.FindDataElement( timagepositionpatient ) )
582583
{
583584
const DataElement& de = ds.GetDataElement( timagepositionpatient );
584585
Attribute<0x0020,0x0032> at = {{0,0,0}}; // default value if empty
@@ -730,7 +731,7 @@ std::vector<double> ImageHelper::GetDirectionCosinesValue(File const & f)
730731
}
731732

732733
dircos.resize( 6 );
733-
if( !GetDirectionCosinesFromDataSet(ds, dircos) )
734+
if( (ms == MediaStorage::SecondaryCaptureImageStorage && !SecondaryCaptureImagePlaneModule) || !GetDirectionCosinesFromDataSet(ds, dircos) )
734735
{
735736
dircos[0] = 1;
736737
dircos[1] = 0;
@@ -774,6 +775,16 @@ bool ImageHelper::GetForcePixelSpacing()
774775
return ForcePixelSpacing;
775776
}
776777

778+
void ImageHelper::SetSecondaryCaptureImagePlaneModule(bool b)
779+
{
780+
SecondaryCaptureImagePlaneModule = b;
781+
}
782+
783+
bool ImageHelper::GetSecondaryCaptureImagePlaneModule()
784+
{
785+
return SecondaryCaptureImagePlaneModule;
786+
}
787+
777788
bool GetRescaleInterceptSlopeValueFromDataSet(const DataSet& ds, std::vector<double> & interceptslope)
778789
{
779790
Attribute<0x0028,0x1052> at1;

Source/MediaStorageAndFileFormat/gdcmImageHelper.h

+7
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ class GDCM_EXPORT ImageHelper
8585
static void SetForcePixelSpacing(bool);
8686
static bool GetForcePixelSpacing();
8787

88+
/// Opt into Image Plane Module for Secondary Capture Image Storage
89+
/// Enable reading Image Position Patient (IPP) and Image Orientation Patient (IOP)
90+
/// for Secondary Capture Image Storage.
91+
static void SetSecondaryCaptureImagePlaneModule(bool);
92+
static bool GetSecondaryCaptureImagePlaneModule();
93+
8894
/// This function checks tags (0x0028, 0x0010) and (0x0028, 0x0011) for the
8995
/// rows and columns of the image in pixels (as opposed to actual distances).
9096
/// The output is {col , row}
@@ -156,6 +162,7 @@ class GDCM_EXPORT ImageHelper
156162
static bool ForceRescaleInterceptSlope;
157163
static bool PMSRescaleInterceptSlope;
158164
static bool ForcePixelSpacing;
165+
static bool SecondaryCaptureImagePlaneModule;
159166
};
160167

161168
} // end namespace gdcm

0 commit comments

Comments
 (0)