GDCM 2.2.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions
gdcm::Rescaler Class Reference

Rescale class This class is meant to apply the linear transform of Stored Pixel Value to Real World Value. This is mostly found in CT or PET dataset, where the value are stored using one type, but need to be converted to another scale using a linear transform. There are basically two cases: In CT: the linear transform is generally integer based. E.g. the Stored Pixel Type is unsigned short 12bits, but to get Hounsfield unit, one need to apply the linear transform:

So the best scalar to store the Real World Value will be 16 bits signed type. More...

`#include <gdcmRescaler.h>`

List of all members.

## Public Member Functions

| Rescaler ()
| ~Rescaler ()
PixelFormat::ScalarType | ComputeInterceptSlopePixelType ()
PixelFormat | ComputePixelTypeFromMinMax ()
double | GetIntercept () const
double | GetSlope () const
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.
void | SetTargetPixelType (PixelFormat const &targetst)
void | SetUseTargetPixelType (bool b)
| Override default behavior of Rescale.

## 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 This class is meant to apply the linear transform of Stored Pixel Value to Real World Value. This is mostly found in CT or PET dataset, where the value are stored using one type, but need to be converted to another scale using a linear transform. There are basically two cases: In CT: the linear transform is generally integer based. E.g. the Stored Pixel Type is unsigned short 12bits, but to get Hounsfield unit, one need to apply the linear transform:

So the best scalar to store the Real World Value will be 16 bits signed type.

In PET: the linear transform is generally floating point based. Since the dynamic range can be quite high, the Rescale Slope / Rescale Intercept can be changing throughout the Series. So it is important to read all linear transform and deduce the best Pixel Type only at the end (when all the images to be read have been parsed).

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 is 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 do:

      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)

See also:
  Unpacker12Bits

## 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

double gdcm::Rescaler::GetIntercept | ( |  | ) | const`[inline]`

double gdcm::Rescaler::GetSlope | ( |  | ) | const`[inline]`

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
| ) |  | `[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
| ) |  | `[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.

void gdcm::Rescaler::SetTargetPixelType | ( | PixelFormat const & | targetst | ) |

By default (when UseTargetPixelType is false), a best matching Target Pixel Type is computed. However user can override this auto selection by switching UseTargetPixelType:true and also specifying the specifix Target Pixel Type

void gdcm::Rescaler::SetUseTargetPixelType | ( | bool | b | ) |

Override default behavior of Rescale.

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

- gdcmRescaler.h