Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 393161f

Browse files
committedMar 15, 2024·
Make SecondaryCaptureImageStorage Image Plane Module opt-in
Make this feature opt-in per the discussion: malaterre#158
1 parent 24c89af commit 393161f

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
{
@@ -577,7 +578,7 @@ std::vector<double> ImageHelper::GetOriginValue(File const & f)
577578

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

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

777+
void ImageHelper::SetSecondaryCaptureImagePlaneModule(bool b)
778+
{
779+
SecondaryCaptureImagePlaneModule = b;
780+
}
781+
782+
bool ImageHelper::GetSecondaryCaptureImagePlaneModule()
783+
{
784+
return SecondaryCaptureImagePlaneModule;
785+
}
786+
776787
bool GetRescaleInterceptSlopeValueFromDataSet(const DataSet& ds, std::vector<double> & interceptslope)
777788
{
778789
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)
Please sign in to comment.