gdcmRescaler.h
Go to the documentation of this file.
/*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef GDCMRESCALER_H
#define GDCMRESCALER_H
#include "gdcmTypes.h"
#include "gdcmPixelFormat.h"
namespace gdcm
{
class GDCM_EXPORT Rescaler
{
public:
Rescaler():Intercept(0),Slope(1),PF(PixelFormat::UNKNOWN),TargetScalarType(PixelFormat::UNKNOWN), ScalarRangeMin(0), ScalarRangeMax(0), UseTargetPixelType(false) {}
~Rescaler() = default;
bool Rescale(char *out, const char *in, size_t n);
bool InverseRescale(char *out, const char *in, size_t n);
void SetIntercept(double i) { Intercept = i; }
double GetIntercept() const { return Intercept; }
void SetSlope(double s) { Slope = s; }
double GetSlope() const { return Slope; }
void SetTargetPixelType( PixelFormat const & targetst );
void SetUseTargetPixelType(bool b);
void SetPixelFormat(PixelFormat const & pf) { PF = pf; }
PixelFormat::ScalarType ComputeInterceptSlopePixelType();
void SetMinMaxForPixelType(double min, double max);
PixelFormat ComputePixelTypeFromMinMax();
protected:
template <typename TIn>
void RescaleFunctionIntoBestFit(char *out, const TIn *in, size_t n);
template <typename TIn>
void InverseRescaleFunctionIntoBestFit(char *out, const TIn *in, size_t n);
private:
double Intercept; // 0028,1052
double Slope; // 0028,1053
PixelFormat PF;
PixelFormat::ScalarType TargetScalarType;
double ScalarRangeMin;
double ScalarRangeMax;
bool UseTargetPixelType;
};
} // end namespace gdcm
#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