GDCM: gdcmRescaler.h Source File

GDCM 3.2.11

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
68 class GDCM_EXPORT Rescaler
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
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
110 PixelFormat ComputePixelTypeFromMinMax();
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
gdcm::PixelFormat
PixelFormat.
Definition gdcmPixelFormat.h:46
gdcm::PixelFormat::ScalarType
ScalarType
Definition gdcmPixelFormat.h:51
gdcm::Rescaler::~Rescaler
~Rescaler()=default
gdcm::Rescaler::ComputePixelTypeFromMinMax
PixelFormat ComputePixelTypeFromMinMax()
gdcm::Rescaler::SetTargetPixelType
void SetTargetPixelType(PixelFormat const &targetst)
gdcm::Rescaler::Rescale
bool Rescale(char *out, const char *in, size_t n)
Direct transform.
gdcm::Rescaler::Rescaler
Rescaler()
Definition gdcmRescaler.h:71
gdcm::Rescaler::GetIntercept
double GetIntercept() const
Definition gdcmRescaler.h:82
gdcm::Rescaler::GetSlope
double GetSlope() const
Definition gdcmRescaler.h:86
gdcm::Rescaler::ComputeInterceptSlopePixelType
PixelFormat::ScalarType ComputeInterceptSlopePixelType()
gdcm::Rescaler::RescaleFunctionIntoBestFit
void RescaleFunctionIntoBestFit(char *out, const TIn *in, size_t n)
gdcm::Rescaler::SetUseTargetPixelType
void SetUseTargetPixelType(bool b)
Override default behavior of Rescale.
gdcm::Rescaler::SetSlope
void SetSlope(double s)
Set Slope: user for both direct&inverse transformation.
Definition gdcmRescaler.h:85
gdcm::Rescaler::InverseRescale
bool InverseRescale(char *out, const char *in, size_t n)
Inverse transform.
gdcm::Rescaler::SetMinMaxForPixelType
void SetMinMaxForPixelType(double min, double max)
gdcm::Rescaler::SetPixelFormat
void SetPixelFormat(PixelFormat const &pf)
Set Pixel Format of input data.
Definition gdcmRescaler.h:98
gdcm::Rescaler::SetIntercept
void SetIntercept(double i)
Set Intercept: used for both direct&inverse transformation.
Definition gdcmRescaler.h:81
gdcm::Rescaler::InverseRescaleFunctionIntoBestFit
void InverseRescaleFunctionIntoBestFit(char *out, const TIn *in, size_t n)
gdcmPixelFormat.h
gdcmTypes.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21