GDCM  2.2.6
gdcmRescaler.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 GDCMRESCALER_H
15 #define GDCMRESCALER_H
16 
17 #include "gdcmTypes.h"
18 #include "gdcmPixelFormat.h"
19 
20 namespace gdcm
21 {
22 
69 {
70 public:
71  Rescaler():Intercept(0),Slope(1),PF(PixelFormat::UNKNOWN),TargetScalarType(PixelFormat::UNKNOWN), ScalarRangeMin(0), ScalarRangeMax(0), UseTargetPixelType(false) {}
72  ~Rescaler() {}
73 
75  bool Rescale(char *out, const char *in, size_t n);
76 
78  bool InverseRescale(char *out, const char *in, size_t n);
79 
81  void SetIntercept(double i) { Intercept = i; }
82  double GetIntercept() const { return Intercept; }
83 
85  void SetSlope(double s) { Slope = s; }
86  double GetSlope() const { return Slope; }
87 
92  void SetTargetPixelType( PixelFormat const & targetst );
93 
95  void SetUseTargetPixelType(bool b);
96 
98  void SetPixelFormat(PixelFormat const & pf) { PF = pf; }
99 
102  PixelFormat::ScalarType ComputeInterceptSlopePixelType();
103 
106  void SetMinMaxForPixelType(double min, double max)
107  {
108  ScalarRangeMin = min;
109  ScalarRangeMax = max;
110  }
111 
114  PixelFormat ComputePixelTypeFromMinMax();
115 
116 protected:
117  template <typename TIn>
118  void RescaleFunctionIntoBestFit(char *out, const TIn *in, size_t n);
119  template <typename TIn>
120  void InverseRescaleFunctionIntoBestFit(char *out, const TIn *in, size_t n);
121 
122 private:
123  double Intercept; // 0028,1052
124  double Slope; // 0028,1053
125  PixelFormat PF;
126  PixelFormat::ScalarType TargetScalarType;
127  double ScalarRangeMin;
128  double ScalarRangeMax;
129  bool UseTargetPixelType;
130 };
131 
132 } // end namespace gdcm
133 
134 #endif //GDCMRESCALER_H
ScalarType
Definition: gdcmPixelFormat.h:42
double GetIntercept() const
Definition: gdcmRescaler.h:82
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
~Rescaler()
Definition: gdcmRescaler.h:72
void SetIntercept(double i)
Set Intercept: used for both direct&amp;inverse transformation.
Definition: gdcmRescaler.h:81
void SetMinMaxForPixelType(double min, double max)
Definition: gdcmRescaler.h:106
void SetPixelFormat(PixelFormat const &pf)
Set Pixel Format of input data.
Definition: gdcmRescaler.h:98
Rescale class This class is meant to apply the linear transform of Stored Pixel Value to Real World V...
Definition: gdcmRescaler.h:68
void SetSlope(double s)
Set Slope: user for both direct&amp;inverse transformation.
Definition: gdcmRescaler.h:85
PixelFormat.
Definition: gdcmPixelFormat.h:36
double GetSlope() const
Definition: gdcmRescaler.h:86
Rescaler()
Definition: gdcmRescaler.h:71

Generated on Sat Dec 21 2013 05:56:17 for GDCM by doxygen 1.8.5
SourceForge.net Logo