GDCM: gdcmImageHelper.h Source File

GDCM 3.2.8

gdcmImageHelper.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13=========================================================================*/
14#ifndef GDCMIMAGEHELPER_H
15#define GDCMIMAGEHELPER_H
16
17#include "gdcmTypes.h"
18#include "gdcmTag.h"
19#include <vector>
20#include "gdcmPixelFormat.h"
21#include "gdcmPhotometricInterpretation.h"
22#include "gdcmSmartPointer.h"
23#include "gdcmLookupTable.h"
24
25namespace gdcm
26{
27
28class MediaStorage;
29class DataSet;
30class File;
31class Image;
32class Pixmap;
33class ByteValue;
34
35// minimal struct:
36 struct RealWorldValueMappingContent {
37 double RealWorldValueIntercept;
38 double RealWorldValueSlope;
39 // http://dicom.nema.org/MEDICAL/DICOM/2014c/output/chtml/part16/sect_CID_7181.html
40 std::string CodeValue;
41 std::string CodeMeaning;
42};
43
59 class GDCM_EXPORT ImageHelper
60{
61public:
68 static void SetForceRescaleInterceptSlope(bool);
69 static bool GetForceRescaleInterceptSlope();
70
76 static void SetPMSRescaleInterceptSlope(bool);
77 static bool GetPMSRescaleInterceptSlope();
78
85 static void SetForcePixelSpacing(bool);
86 static bool GetForcePixelSpacing();
87
92 static void SetSecondaryCaptureImagePlaneModule(bool);
93 static bool GetSecondaryCaptureImagePlaneModule();
94
98 static std::vector<unsigned int> GetDimensionsValue(const File& f);
99 static void SetDimensionsValue(File& f, const Pixmap & img);
100
103 static PixelFormat GetPixelFormatValue(const File& f);
104
109 static std::vector<double> GetRescaleInterceptSlopeValue(File const & f);
110 static void SetRescaleInterceptSlopeValue(File & f, const Image & img);
111
112 // read only for now
113 static bool GetRealWorldValueMappingContent(File const & f, RealWorldValueMappingContent & rwvmc);
114
116 static std::vector<double> GetOriginValue(File const & f);
117 static void SetOriginValue(DataSet & ds, const Image & img);
118
121 static std::vector<double> GetDirectionCosinesValue(File const & f);
127 // FIXME: There is a major issue for image with multiple IOP (eg. Enhanced * Image Storage).
128 static void SetDirectionCosinesValue(DataSet & ds, const std::vector<double> & dircos);
129
131 static std::vector<double> GetSpacingValue(File const & f);
133 static void SetSpacingValue(DataSet & ds, const std::vector<double> & spacing);
134
136 static bool ComputeSpacingFromImagePositionPatient(const std::vector<double> &imageposition, std::vector<double> & spacing);
137
138 static bool GetDirectionCosinesFromDataSet(DataSet const & ds, std::vector<double> & dircos);
139
140 //functions to get more information from a file
141 //useful for the stream image reader, which fills in necessary image information
142 //distinctly from the reader-style data input
143 static PhotometricInterpretation GetPhotometricInterpretationValue(File const& f);
144 //returns the configuration of colors in a plane, either RGB RGB RGB or RRR GGG BBB
145 static unsigned int GetPlanarConfigurationValue(const File& f);
146
148 static SmartPointer<LookupTable> GetLUT(File const& f);
149
150 // Moved from PixampReader to here. Generally used for photometric interpretation.
151 static const ByteValue* GetPointerFromElement(Tag const &tag, File const& f);
152
154 static MediaStorage ComputeMediaStorageFromModality(const char *modality,
155 unsigned int dimension = 2, PixelFormat const & pf = PixelFormat(),
156 PhotometricInterpretation const & pi = PhotometricInterpretation(),
157 double rescaleintercept = 0, double rescaleslope = 1 );
158
159protected:
160 static Tag GetSpacingTagFromMediaStorage(MediaStorage const &ms);
161 static Tag GetZSpacingTagFromMediaStorage(MediaStorage const &ms);
162
163private:
164 static bool ForceRescaleInterceptSlope;
165 static bool PMSRescaleInterceptSlope;
166 static bool ForcePixelSpacing;
167 static bool SecondaryCaptureImagePlaneModule;
168};
169
170} // end namespace gdcm
171
172#endif // GDCMIMAGEHELPER_H
gdcm::ByteValue
Class to represent binary value (array of bytes).
Definition gdcmByteValue.h:36
gdcm::DataSet
Class to represent a Data Set (which contains Data Elements).
Definition gdcmDataSet.h:56
gdcm::File
a DICOM File
Definition gdcmFile.h:34
gdcm::ImageHelper
ImageHelper (internal class, not intended for user level).
Definition gdcmImageHelper.h:60
gdcm::ImageHelper::GetPixelFormatValue
static PixelFormat GetPixelFormatValue(const File &f)
gdcm::ImageHelper::GetOriginValue
static std::vector< double > GetOriginValue(File const &f)
Set/Get Origin (IPP) from/to a file.
gdcm::ImageHelper::GetPMSRescaleInterceptSlope
static bool GetPMSRescaleInterceptSlope()
gdcm::ImageHelper::GetRescaleInterceptSlopeValue
static std::vector< double > GetRescaleInterceptSlopeValue(File const &f)
gdcm::ImageHelper::SetDirectionCosinesValue
static void SetDirectionCosinesValue(DataSet &ds, const std::vector< double > &dircos)
gdcm::ImageHelper::SetOriginValue
static void SetOriginValue(DataSet &ds, const Image &img)
gdcm::ImageHelper::GetDirectionCosinesFromDataSet
static bool GetDirectionCosinesFromDataSet(DataSet const &ds, std::vector< double > &dircos)
gdcm::ImageHelper::ComputeSpacingFromImagePositionPatient
static bool ComputeSpacingFromImagePositionPatient(const std::vector< double > &imageposition, std::vector< double > &spacing)
DO NOT USE.
gdcm::ImageHelper::GetSpacingTagFromMediaStorage
static Tag GetSpacingTagFromMediaStorage(MediaStorage const &ms)
gdcm::ImageHelper::GetPhotometricInterpretationValue
static PhotometricInterpretation GetPhotometricInterpretationValue(File const &f)
gdcm::ImageHelper::SetDimensionsValue
static void SetDimensionsValue(File &f, const Pixmap &img)
gdcm::ImageHelper::GetRealWorldValueMappingContent
static bool GetRealWorldValueMappingContent(File const &f, RealWorldValueMappingContent &rwvmc)
gdcm::ImageHelper::GetDimensionsValue
static std::vector< unsigned int > GetDimensionsValue(const File &f)
gdcm::ImageHelper::SetSpacingValue
static void SetSpacingValue(DataSet &ds, const std::vector< double > &spacing)
gdcm::ImageHelper::GetDirectionCosinesValue
static std::vector< double > GetDirectionCosinesValue(File const &f)
gdcm::ImageHelper::GetPlanarConfigurationValue
static unsigned int GetPlanarConfigurationValue(const File &f)
gdcm::ImageHelper::GetZSpacingTagFromMediaStorage
static Tag GetZSpacingTagFromMediaStorage(MediaStorage const &ms)
gdcm::ImageHelper::GetSecondaryCaptureImagePlaneModule
static bool GetSecondaryCaptureImagePlaneModule()
gdcm::ImageHelper::SetSecondaryCaptureImagePlaneModule
static void SetSecondaryCaptureImagePlaneModule(bool)
gdcm::ImageHelper::SetForcePixelSpacing
static void SetForcePixelSpacing(bool)
gdcm::ImageHelper::GetSpacingValue
static std::vector< double > GetSpacingValue(File const &f)
Set/Get Spacing from/to a File.
gdcm::ImageHelper::GetPointerFromElement
static const ByteValue * GetPointerFromElement(Tag const &tag, File const &f)
gdcm::ImageHelper::GetLUT
static SmartPointer< LookupTable > GetLUT(File const &f)
returns the lookup table of an image file
gdcm::ImageHelper::ComputeMediaStorageFromModality
static MediaStorage ComputeMediaStorageFromModality(const char *modality, unsigned int dimension=2, PixelFormat const &pf=PixelFormat(), PhotometricInterpretation const &pi=PhotometricInterpretation(), double rescaleintercept=0, double rescaleslope=1)
Moved from MediaStorage here, since we need extra info stored in PixelFormat & PhotometricInterpretat...
gdcm::ImageHelper::SetForceRescaleInterceptSlope
static void SetForceRescaleInterceptSlope(bool)
gdcm::ImageHelper::SetPMSRescaleInterceptSlope
static void SetPMSRescaleInterceptSlope(bool)
gdcm::ImageHelper::GetForceRescaleInterceptSlope
static bool GetForceRescaleInterceptSlope()
gdcm::ImageHelper::GetForcePixelSpacing
static bool GetForcePixelSpacing()
gdcm::ImageHelper::SetRescaleInterceptSlopeValue
static void SetRescaleInterceptSlopeValue(File &f, const Image &img)
gdcm::Image
Image.
Definition gdcmImage.h:47
gdcm::MediaStorage
MediaStorage.
Definition gdcmMediaStorage.h:44
gdcm::PhotometricInterpretation
Class to represent an PhotometricInterpretation.
Definition gdcmPhotometricInterpretation.h:29
gdcm::PixelFormat
PixelFormat.
Definition gdcmPixelFormat.h:46
gdcm::Pixmap
Pixmap class.
Definition gdcmPixmap.h:33
gdcm::SmartPointer
Class for Smart Pointer.
Definition gdcmSmartPointer.h:40
gdcm::Tag
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element).
Definition gdcmTag.h:39
gdcmLookupTable.h
gdcmPhotometricInterpretation.h
gdcmPixelFormat.h
gdcmSmartPointer.h
gdcmTag.h
gdcmTypes.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21
gdcm::RealWorldValueMappingContent
Definition gdcmImageHelper.h:36
gdcm::RealWorldValueMappingContent::RealWorldValueSlope
double RealWorldValueSlope
Definition gdcmImageHelper.h:38
gdcm::RealWorldValueMappingContent::RealWorldValueIntercept
double RealWorldValueIntercept
Definition gdcmImageHelper.h:37
gdcm::RealWorldValueMappingContent::CodeValue
std::string CodeValue
Definition gdcmImageHelper.h:40
gdcm::RealWorldValueMappingContent::CodeMeaning
std::string CodeMeaning
Definition gdcmImageHelper.h:41