DCMTK: IODCIELabUtil Class Reference

DCMTK Version 3.6.9 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
Static Public Member Functions | Static Public Attributes | Static Protected Member Functions | List of all members
IODCIELabUtil Class Reference

Class supporting color space conversions from and to CIELab. More...

## Static Public Member Functions
static void | dicomLab2RGB (double &R, double &G, double &B, double LDicom, double aDicom, double bDicom)
| Convert CIELab color representation as found in DICOM to sRGB value representation.
static void | rgb2DicomLab (double &LDicom, double &aDicom, double &bDicom, double R, double G, double B)
| Convert sRGB color representation to CIELab color representation as found in DICOM.
static void | dicomlab2Lab (double &L, double &a, double &b, double LDicom, double aDicom, double bDicom)
| Convert CIELab color representation as found in DICOM to CIELab representation.
static void | lab2DicomLab (double &LDicom, double &aDicom, double &bDicom, double L, double a, double b)
| Convert CIELab color representation to CIELab color representation found in DICOM.
static void | rgb2Lab (double &L, double &a, double &b, double R, double G, double B)
| Convert sRGB color representation to CIELab representation.
static void | rgb2Xyz (double &X, double &Y, double &Z, double R, double G, double B)
| Convert sRGB color representation to CIE XYZ representation.
static void | xyz2Lab (double &L, double &a, double &b, double X, double Y, double Z)
| Convert CIELAB XYZ color representation to CIELab representation.
static void | lab2Rgb (double &R, double &G, double &B, double L, double a, double b)
| Convert CIELab color representation to sRGB representation.
static void | lab2Xyz (double &X, double &Y, double &Z, double L, double a, double b)
| Convert CIELab color representation to CIE XYZ representation.
static void | xyz2Rgb (double &R, double &G, double &B, double X, double Y, double Z)
| Convert CIE XYZ color representation to sRGB representation.

## Static Public Attributes
static const double | D65_WHITEPOINT_X
| D65 standard lightpoint X component for conversion from CIEXYZ to CIELab.
static const double | D65_WHITEPOINT_Y
| D65 standard lightpoint Y component for conversion from CIEXYZ to CIELab.
static const double | D65_WHITEPOINT_Z
| D65 standard lightpoint Z component for conversion from CIEXYZ to CIELab.

## Static Protected Member Functions
static double | gammaCorrection (double n)
| Perform sRGB gamma correction, transforms R to R'.
static double | invGammaCorrection (double n)
| Perform inverse sRGB gamma correction, transforms R' to R.
static double | labf (double n)
| CIE L*a*b* f function (used to convert XYZ to L*a*b*)
static double | labfInv (double n)
| CIE L*a*b* inverse f function.
static double | min2 (double a, double b)
| Get the minimum of two numbers.
static double | min3 (double a, double b, double c)
| Get the minimum of three numbers.

## Detailed Description

Class supporting color space conversions from and to CIELab.

In some IODs DICOM stores CIELab color values which must often be converted to RGB for display or other purposes. This is supported by the functions dicomLab2RGB() and rgb2DicomLab(). The CIELab value range in DICOM is [0,65535] for all three values. The RGB value range in this class is [0;1]. Further functions are available in order to convert between RGB, "normal" CIELab value range as well as CIEXYZ. The class uses double floating point precision for calculations.

## Member Function Documentation

## ◆ dicomlab2Lab()

static void IODCIELabUtil::dicomlab2Lab | ( | double & | L,
|  | double & | a,
|  | double & | b,
|  | double | LDicom,
|  | double | aDicom,
|  | double | bDicom )
| static

Convert CIELab color representation as found in DICOM to CIELab representation.

See DICOM part 3 for details.

Parameters

  L | Output CIELab luminance component with 0 <= L <= 100
  a | Output CIELab "a" component (red<->green) with -127 <= a <= 128
  b | Output CIELab "b" component (blue<->yellow) with -127 <= b <= 128
  LDicom | Input CIELab luminance component with 0 <= L <= 65535 as found in DICOM
  aDicom | Input CIELab "a" component (red<->green) with 0 <= a <= 65535 as found in DICOM
  bDicom | Input CIELab "b" component (blue<->yellow) with 0 <= b <= 65535 as found in DICOM

## ◆ dicomLab2RGB()

static void IODCIELabUtil::dicomLab2RGB | ( | double & | R,
|  | double & | G,
|  | double & | B,
|  | double | LDicom,
|  | double | aDicom,
|  | double | bDicom )
| static

Convert CIELab color representation as found in DICOM to sRGB value representation.

See DICOM part 3 for details.

Parameters

  R | Output sRGB "R" component (red) with 0 <= R <= 1
  G | Output sRGB "G" component (green) with 0 <= G <= 1
  B | Output sRGB "R" component (blue) with 0 <= B <= 1
  LDicom | Input DICOM CIELab luminance component with 0 <= L <= 65535
  aDicom | Input DICOM CIELab "a" component (red<->green) with 0 <= a <= 65535
  bDicom | Input DICOM CIELab "b" component (blue<->yellow) with 0 <= a <= 65535

## ◆ gammaCorrection()

static double IODCIELabUtil::gammaCorrection | ( | double | n | ) |
| staticprotected

Perform sRGB gamma correction, transforms R to R'.

Parameters

  n | The value to correct

Returns
  The gamma-corrected value

## ◆ invGammaCorrection()

static double IODCIELabUtil::invGammaCorrection | ( | double | n | ) |
| staticprotected

Perform inverse sRGB gamma correction, transforms R' to R.

Parameters

  n | The value to invert

Returns
  The gamma-inverted value

## ◆ lab2DicomLab()

static void IODCIELabUtil::lab2DicomLab | ( | double & | LDicom,
|  | double & | aDicom,
|  | double & | bDicom,
|  | double | L,
|  | double | a,
|  | double | b )
| static

Convert CIELab color representation to CIELab color representation found in DICOM.

See DICOM part 3 for details.

Parameters

  LDicom | Output CIELab luminance component with 0 <= L <= 65535 as found in DICOM
  aDicom | Output CIELab "a" component (red<->green) with 0 <= a <= 65535 as found in DICOM
  bDicom | Output CIELab "b" component (blue<->yellow) with 0 <= b <= 65535 as found in DICOM
  L | Input CIELab luminance component with 0 <= L <= 100
  a | Input CIELab "a" component (red<->green) with -127 <= a <= 128
  b | Input CIELab "b" component (blue<->yellow) with -127 <= b <= 128

## ◆ lab2Rgb()

static void IODCIELabUtil::lab2Rgb | ( | double & | R,
|  | double & | G,
|  | double & | B,
|  | double | L,
|  | double | a,
|  | double | b )
| static

Convert CIELab color representation to sRGB representation.

Parameters

  R | Output sRGB "R" component (red) with 0 <= R <= 1
  G | Output sRGB "G" component (green) with 0 <= G <= 1
  B | Output sRGB "R" component (blue) with 0 <= B <= 1
  L | Input CIELab luminance component with 0 <= L <= 100
  a | Input CIELab "a" component (red<->green) with -127 <= a <= 128
  b | Input CIELab "b" component (blue<->yellow) with -127 <= b <= 128

## ◆ lab2Xyz()

static void IODCIELabUtil::lab2Xyz | ( | double & | X,
|  | double & | Y,
|  | double & | Z,
|  | double | L,
|  | double | a,
|  | double | b )
| static

Convert CIELab color representation to CIE XYZ representation.

Parameters

  X | Output CIELab XYZ "X" component with 0 <= X <= 1
  Y | Output CIELab XYZ "Y" component with 0 <= Y <= 1
  Z | Output CIELab XYZ "Z" component with 0 <= Z <= 1
  L | Input CIELab luminance component with 0 <= L <= 100
  a | Input CIELab "a" component (red<->green) with -127 <= a <= 128
  b | Input CIELab "b" component (blue<->yellow) with -127 <= b <= 128

## ◆ labf()

static double IODCIELabUtil::labf | ( | double | n | ) |
| staticprotected

CIE L*a*b* f function (used to convert XYZ to L*a*b*)

Parameters

  n | value to convert

Returns
  The converted value

## ◆ labfInv()

static double IODCIELabUtil::labfInv | ( | double | n | ) |
| staticprotected

CIE L*a*b* inverse f function.

Parameters

  n | The value to compute the inverse for

Returns
  The resulting inverse

## ◆ min2()

static double IODCIELabUtil::min2 | ( | double | a,
|  | double | b )
| staticprotected

Get the minimum of two numbers.

Parameters

  a | First number
  b | Second number

Returns
  The minimum of a, b. a if a and b are equal.

## ◆ min3()

static double IODCIELabUtil::min3 | ( | double | a,
|  | double | b,
|  | double | c )
| staticprotected

Get the minimum of three numbers.

Parameters

  a | First number
  b | Second number
  c | Third number

Returns
  The minimum of a, b and c. If a value occurs more than once, then preference order then a is preferred if possible, b otherwise

## ◆ rgb2DicomLab()

static void IODCIELabUtil::rgb2DicomLab | ( | double & | LDicom,
|  | double & | aDicom,
|  | double & | bDicom,
|  | double | R,
|  | double | G,
|  | double | B )
| static

Convert sRGB color representation to CIELab color representation as found in DICOM.

See DICOM part 3 for details.

Parameters

  LDicom | Output CIELab luminance component with 0 <= L <= 65535 as found in DICOM
  aDicom | Output CIELab "a" component (red<->green) with 0 <= a <= 65535 as found in DICOM
  bDicom | Output CIELab "b" component (blue<->yellow) with 0 <= b <= 65535 as found in DICOM
  R | Input sRGB "R" component (red) with 0 <= R <= 1
  G | Input sRGB "G" component (green) with 0 <= G <= 1
  B | Input sRGB "R" component (blue) with 0 <= B <= 1

## ◆ rgb2Lab()

static void IODCIELabUtil::rgb2Lab | ( | double & | L,
|  | double & | a,
|  | double & | b,
|  | double | R,
|  | double | G,
|  | double | B )
| static

Convert sRGB color representation to CIELab representation.

Parameters

  L | Output CIELab luminance component with 0 <= L <= 100
  a | Output CIELab "a" component (red<->green) with -127 <= a <= 128
  b | Output CIELab "b" component (blue<->yellow) with -127 <= b <= 128
  R | Input sRGB "R" component (red) with 0 <= R <= 1
  G | Input sRGB "G" component (green) with 0 <= G <= 1
  B | Input sRGB "R" component (blue) with 0 <= B <= 1

## ◆ rgb2Xyz()

static void IODCIELabUtil::rgb2Xyz | ( | double & | X,
|  | double & | Y,
|  | double & | Z,
|  | double | R,
|  | double | G,
|  | double | B )
| static

Convert sRGB color representation to CIE XYZ representation.

Parameters

  X | Output CIELab XYZ "X" component with 0 <= X <= 1
  Y | Output CIELab XYZ "Y" component with 0 <= Y <= 1
  Z | Output CIELab XYZ "Z" component with 0 <= Z <= 1
  R | Input sRGB "R" component (red) with 0 <= R <= 1
  G | Input sRGB "G" component (green) with 0 <= G <= 1
  B | Input sRGB "R" component (blue) with 0 <= B <= 1

## ◆ xyz2Lab()

static void IODCIELabUtil::xyz2Lab | ( | double & | L,
|  | double & | a,
|  | double & | b,
|  | double | X,
|  | double | Y,
|  | double | Z )
| static

Convert CIELAB XYZ color representation to CIELab representation.

Parameters

  L | Output CIELab luminance component with 0 <= L <= 100
  a | Output CIELab "a" component (red<->green) with -127 <= a <= 128
  b | Output CIELab "b" component (blue<->yellow) with -127 <= b <= 128
  X | Input CIELab XYZ "X" component with 0 <= X <= 1
  Y | Input CIELab XYZ "Y" component with 0 <= Y <= 1
  Z | Input CIELab XYZ "Z" component with 0 <= Z <= 1

## ◆ xyz2Rgb()

static void IODCIELabUtil::xyz2Rgb | ( | double & | R,
|  | double & | G,
|  | double & | B,
|  | double | X,
|  | double | Y,
|  | double | Z )
| static

Convert CIE XYZ color representation to sRGB representation.

Parameters

  R | Output sRGB "R" component (red) with 0 <= R <= 1
  G | Output sRGB "G" component (green) with 0 <= G <= 1
  B | Output sRGB "R" component (blue) with 0 <= B <= 1
  X | Output CIELab XYZ "X" component with 0 <= X <= 1
  Y | Output CIELab XYZ "Y" component with 0 <= Y <= 1
  Z | Output CIELab XYZ "Z" component with 0 <= Z <= 1

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

- dcmiod/include/dcmtk/dcmiod/cielabutil.h

Generated on Sat Mar 1 2025 for DCMTK Version 3.6.9 by Doxygen 1.13.2