GDCM 3.0.24
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"
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:
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
60{
61public:
70
76 static void SetPMSRescaleInterceptSlope(bool);
78
85 static void SetForcePixelSpacing(bool);
86 static bool GetForcePixelSpacing();
87
94
98 static std::vector<unsigned int> GetDimensionsValue(const File& f);
99 static void SetDimensionsValue(File& f, const Pixmap & img);
100
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
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
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
149
150 // Moved from PixampReader to here. Generally used for photometric interpretation.
151 static const ByteValue* GetPointerFromElement(Tag const &tag, File const& f);
152
155 unsigned int dimension = 2, PixelFormat const & pf = PixelFormat(),
157 double rescaleintercept = 0, double rescaleslope = 1 );
158
159protected:
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
Class to represent binary value (array of bytes)
Definition gdcmByteValue.h:35
Class to represent a Data Set (which contains Data Elements)
Definition gdcmDataSet.h:56
a DICOM File
Definition gdcmFile.h:34
ImageHelper (internal class, not intended for user level)
Definition gdcmImageHelper.h:60
static PixelFormat GetPixelFormatValue(const File &f)
static std::vector< double > GetOriginValue(File const &f)
Set/Get Origin (IPP) from/to a file.
static bool GetPMSRescaleInterceptSlope()
static std::vector< double > GetRescaleInterceptSlopeValue(File const &f)
static void SetDirectionCosinesValue(DataSet &ds, const std::vector< double > &dircos)
static void SetOriginValue(DataSet &ds, const Image &img)
static bool GetDirectionCosinesFromDataSet(DataSet const &ds, std::vector< double > &dircos)
static bool ComputeSpacingFromImagePositionPatient(const std::vector< double > &imageposition, std::vector< double > &spacing)
DO NOT USE.
static Tag GetSpacingTagFromMediaStorage(MediaStorage const &ms)
static PhotometricInterpretation GetPhotometricInterpretationValue(File const &f)
static void SetDimensionsValue(File &f, const Pixmap &img)
static bool GetRealWorldValueMappingContent(File const &f, RealWorldValueMappingContent &rwvmc)
static std::vector< unsigned int > GetDimensionsValue(const File &f)
static void SetSpacingValue(DataSet &ds, const std::vector< double > &spacing)
static std::vector< double > GetDirectionCosinesValue(File const &f)
static unsigned int GetPlanarConfigurationValue(const File &f)
static Tag GetZSpacingTagFromMediaStorage(MediaStorage const &ms)
static bool GetSecondaryCaptureImagePlaneModule()
static void SetSecondaryCaptureImagePlaneModule(bool)
static void SetForcePixelSpacing(bool)
static std::vector< double > GetSpacingValue(File const &f)
Set/Get Spacing from/to a File.
static const ByteValue * GetPointerFromElement(Tag const &tag, File const &f)
static SmartPointer< LookupTable > GetLUT(File const &f)
returns the lookup table of an image file
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...
static void SetForceRescaleInterceptSlope(bool)
static void SetPMSRescaleInterceptSlope(bool)
static bool GetForceRescaleInterceptSlope()
static bool GetForcePixelSpacing()
static void SetRescaleInterceptSlopeValue(File &f, const Image &img)
Image.
Definition gdcmImage.h:47
MediaStorage.
Definition gdcmMediaStorage.h:44
Class to represent an PhotometricInterpretation.
Definition gdcmPhotometricInterpretation.h:29
PixelFormat.
Definition gdcmPixelFormat.h:46
Pixmap class.
Definition gdcmPixmap.h:33
Class for Smart Pointer.
Definition gdcmSmartPointer.h:40
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element).
Definition gdcmTag.h:39
#define GDCM_EXPORT
Definition gdcmWin32.h:34
Definition gdcmASN1.h:21
Definition gdcmImageHelper.h:36
double RealWorldValueSlope
Definition gdcmImageHelper.h:38
double RealWorldValueIntercept
Definition gdcmImageHelper.h:37
std::string CodeValue
Definition gdcmImageHelper.h:40
std::string CodeMeaning
Definition gdcmImageHelper.h:41