GDCM 2.2.1

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

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
25 namespace gdcm
26 {
27
28 class MediaStorage;
29 class DataSet;
30 class File;
31 class Image;
32 class ByteValue;
48 class GDCM_EXPORT ImageHelper
49 {
50 public:
56 static void SetForceRescaleInterceptSlope(bool);
57 static bool GetForceRescaleInterceptSlope();
58
65 static void SetForcePixelSpacing(bool);
66 static bool GetForcePixelSpacing();
67
71 static std::vector<unsigned int> GetDimensionsValue(const File& f);
72 static void SetDimensionsValue(File& f, const Image & img);
73
76 static PixelFormat GetPixelFormatValue(const File& f);
77
82 static std::vector<double> GetRescaleInterceptSlopeValue(File const & f);
83 static void SetRescaleInterceptSlopeValue(File & f, const Image & img);
84
86 static std::vector<double> GetOriginValue(File const & f);
87 static void SetOriginValue(DataSet & ds, const Image & img);
88
91 static std::vector<double> GetDirectionCosinesValue(File const & f);
97 // FIXME: There is a major issue for image with multiple IOP (eg. Enhanced * Image Storage).
98 static void SetDirectionCosinesValue(DataSet & ds, const std::vector<double> & dircos);
99
101 static std::vector<double> GetSpacingValue(File const & f);
102 static void SetSpacingValue(DataSet & ds, const std::vector<double> & spacing);
103
105 static bool ComputeSpacingFromImagePositionPatient(const std::vector<double> &imageposition, std::vector<double> & spacing);
106
107 static bool GetDirectionCosinesFromDataSet(DataSet const & ds, std::vector<double> & dircos);
108
109 //functions to get more information from a file
110 //useful for the stream image reader, which fills in necessary image information
111 //distinctly from the reader-style data input
112 static PhotometricInterpretation GetPhotometricInterpretationValue(File const& f);
113 //returns the configuration of colors in a plane, either RGB RGB RGB or RRR GGG BBB
114 static unsigned int GetPlanarConfigurationValue(const File& f);
115
116 //returns the lookup table of an image file
117 static SmartPointer<LookupTable> GetLUT(File const& f);
118
120 static const ByteValue* GetPointerFromElement(Tag const &tag, File const& f);
121
122 protected:
123 static Tag GetSpacingTagFromMediaStorage(MediaStorage const &ms);
124 static Tag GetZSpacingTagFromMediaStorage(MediaStorage const &ms);
125
126 private:
127 static bool ForceRescaleInterceptSlope;
128 static bool ForcePixelSpacing;
129 };
130
131 } // end namespace gdcm
132
133 #endif // GDCMIMAGEHELPER_H