gdcmRescaler.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __gdcmRescaler_h
00016 #define __gdcmRescaler_h
00017
00018 #include "gdcmTypes.h"
00019 #include "gdcmPixelFormat.h"
00020
00021 namespace gdcm
00022 {
00023
00043 class GDCM_EXPORT Rescaler
00044 {
00045 public:
00046 Rescaler():Intercept(0),Slope(1),PF(PixelFormat::UNKNOWN) {}
00047 ~Rescaler() {}
00048
00050 bool Rescale(char *out, const char *in, size_t n);
00051
00053 bool InverseRescale(char *out, const char *in, size_t n);
00054
00056 void SetIntercept(double i) { Intercept = i; }
00057
00059 void SetSlope(double s) { Slope = s; }
00060
00062 void SetPixelFormat(PixelFormat const & pf) { PF = pf; }
00063
00066 PixelFormat::ScalarType ComputeInterceptSlopePixelType();
00067
00070 void SetMinMaxForPixelType(double min, double max)
00071 {
00072 ScalarRangeMin = min;
00073 ScalarRangeMax = max;
00074 }
00075
00078 PixelFormat ComputePixelTypeFromMinMax();
00079
00080 protected:
00081 template <typename TIn>
00082 void RescaleFunctionIntoBestFit(char *out, const TIn *in, size_t n);
00083 template <typename TIn>
00084 void InverseRescaleFunctionIntoBestFit(char *out, const TIn *in, size_t n);
00085
00086 private:
00087 double Intercept;
00088 double Slope;
00089 PixelFormat PF;
00090 double ScalarRangeMin;
00091 double ScalarRangeMax;
00092 };
00093
00094 }
00095
00096 #endif //__gdcmRescaler_h