GDCM 3.0.24
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
20namespace gdcm
21{
22
69{
70public:
71 Rescaler():Intercept(0),Slope(1),PF(PixelFormat::UNKNOWN),TargetScalarType(PixelFormat::UNKNOWN), ScalarRangeMin(0), ScalarRangeMax(0), UseTargetPixelType(false) {}
72 ~Rescaler() = default;
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
96
98 void SetPixelFormat(PixelFormat const & pf) { PF = pf; }
99
103
106 void SetMinMaxForPixelType(double min, double max);
107
111
112protected:
113 template <typename TIn>
114 void RescaleFunctionIntoBestFit(char *out, const TIn *in, size_t n);
115 template <typename TIn>
116 void InverseRescaleFunctionIntoBestFit(char *out, const TIn *in, size_t n);
117
118private:
119 double Intercept; // 0028,1052
120 double Slope; // 0028,1053
121 PixelFormat PF;
122 PixelFormat::ScalarType TargetScalarType;
123 double ScalarRangeMin;
124 double ScalarRangeMax;
125 bool UseTargetPixelType;
126};
127
128} // end namespace gdcm
129
130#endif //GDCMRESCALER_H
PixelFormat.
Definition gdcmPixelFormat.h:46
ScalarType
Definition gdcmPixelFormat.h:51
Rescale class.
Definition gdcmRescaler.h:69
~Rescaler()=default
PixelFormat ComputePixelTypeFromMinMax()
void SetTargetPixelType(PixelFormat const &targetst)
bool Rescale(char *out, const char *in, size_t n)
Direct transform.
Rescaler()
Definition gdcmRescaler.h:71
double GetIntercept() const
Definition gdcmRescaler.h:82
double GetSlope() const
Definition gdcmRescaler.h:86
PixelFormat::ScalarType ComputeInterceptSlopePixelType()
void RescaleFunctionIntoBestFit(char *out, const TIn *in, size_t n)
void SetUseTargetPixelType(bool b)
Override default behavior of Rescale.
void SetSlope(double s)
Set Slope: user for both direct&inverse transformation.
Definition gdcmRescaler.h:85
bool InverseRescale(char *out, const char *in, size_t n)
Inverse transform.
void SetMinMaxForPixelType(double min, double max)
void SetPixelFormat(PixelFormat const &pf)
Set Pixel Format of input data.
Definition gdcmRescaler.h:98
void SetIntercept(double i)
Set Intercept: used for both direct&inverse transformation.
Definition gdcmRescaler.h:81
void InverseRescaleFunctionIntoBestFit(char *out, const TIn *in, size_t n)
#define GDCM_EXPORT
Definition gdcmWin32.h:34
Definition gdcmASN1.h:21