# gdcm::Rescaler Class Reference

Rescale class. More...

`#include <gdcmRescaler.h>`

Collaboration diagram for gdcm::Rescaler:
[legend]

List of all members.

## Public Member Functions

| Rescaler ()
| ~Rescaler ()
PixelFormat::ScalarType | ComputeInterceptSlopePixelType ()
PixelFormat | ComputePixelTypeFromMinMax ()
bool | InverseRescale (char *out, const char *in, size_t n)
| Inverse transform.
bool | Rescale (char *out, const char *in, size_t n)
| Direct transform.
void | SetIntercept (double i)
| Set Intercept: used for both direct&inverse transformation.
void | SetMinMaxForPixelType (double min, double max)
void | SetPixelFormat (PixelFormat const &pf)
| Set Pixel Format of input data.
void | SetSlope (double s)
| Set Slope: user for both direct&inverse transformation.

## Protected Member Functions

template<typename TIn >
void | InverseRescaleFunctionIntoBestFit (char *out, const TIn *in, size_t n)
template<typename TIn >
void | RescaleFunctionIntoBestFit (char *out, const TIn *in, size_t n)

## Detailed Description

Rescale class.

Warning:
  internally any time a floating point value is found either in the Rescale Slope or the Rescale Intercept it is assumed that the best matching output pixel type if FLOAT64 in previous implementation it was FLOAT32. Because VR:DS is closer to a 64bits floating point type FLOAT64 is thus a best matching pixel type for the floating point transformation.

Example: Let say input is FLOAT64, and we want UINT16 as ouput, we would doM

Rescaler ir; ir.SetIntercept( 0 ); ir.SetSlope( 5.6789 ); ir.SetPixelFormat( FLOAT64 ); ir.SetMinMaxForPixelType( ((PixelFormat)UINT16).GetMin(), ((PixelFormat)UINT16).GetMax() ); ir.InverseRescale(output,input,numberofbytes );

Note:
  handle floating point transformation back and forth to integer properly (no loss)

## Constructor & Destructor Documentation

gdcm::Rescaler::Rescaler | ( |  | ) | `[inline]`

gdcm::Rescaler::~Rescaler | ( |  | ) | `[inline]`

## Member Function Documentation

PixelFormat::ScalarType gdcm::Rescaler::ComputeInterceptSlopePixelType | ( |  | ) |

Compute the Pixel Format of the output data Used for direct transformation

PixelFormat gdcm::Rescaler::ComputePixelTypeFromMinMax | ( |  | ) |

Compute the Pixel Format of the output data Used for inverse transformation

bool gdcm::Rescaler::InverseRescale | ( | char * | out,
|  | const char * | in,
|  | size_t | n |
| ) |  |  |

Inverse transform.

template<typename TIn >

void gdcm::Rescaler::InverseRescaleFunctionIntoBestFit | ( | char * | out,
|  | const TIn * | in,
|  | size_t | n |
| ) |  |  | `[inline, protected]`

bool gdcm::Rescaler::Rescale | ( | char * | out,
|  | const char * | in,
|  | size_t | n |
| ) |  |  |

Direct transform.

template<typename TIn >

void gdcm::Rescaler::RescaleFunctionIntoBestFit | ( | char * | out,
|  | const TIn * | in,
|  | size_t | n |
| ) |  |  | `[inline, protected]`

void gdcm::Rescaler::SetIntercept | ( | double | i | ) | `[inline]`

Set Intercept: used for both direct&inverse transformation.

void gdcm::Rescaler::SetMinMaxForPixelType | ( | double | min,
|  | double | max |
| ) |  |  | `[inline]`

Set target interval for output data. A best match will be computed (if possible) Used for inverse transformation

void gdcm::Rescaler::SetPixelFormat | ( | PixelFormat const & | pf | ) | `[inline]`

Set Pixel Format of input data.

void gdcm::Rescaler::SetSlope | ( | double | s | ) | `[inline]`

Set Slope: user for both direct&inverse transformation.

The documentation for this class was generated from the following file:

- gdcmRescaler.h