Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::LabeledImageLookupTable Class Reference

Lookup table for 2D rendering of labeled (segmented) images. More...

#include <mitkLabeledImageLookupTable.h>

Inheritance diagram for mitk::LabeledImageLookupTable:
Collaboration diagram for mitk::LabeledImageLookupTable:

Public Types

typedef unsigned char LabelType
 
- Public Types inherited from mitk::LookupTable
enum  LookupTableType {
  GRAYSCALE , INVERSE_GRAYSCALE , HOT_IRON , JET ,
  JET_TRANSPARENT , PLASMA , INFERNO , VIRIDIS ,
  MAGMA , LEGACY_BINARY , LEGACY_RAINBOW_COLOR , MULTILABEL ,
  PET_COLOR , PET_20 , PET_BLACK_WHITE , TURBO
}
 The LookupTableType enum for different predefined lookup tables. More...
 
typedef unsigned char RawLookupTableType
 Convenience typedef for the raw lookup table element type. More...
 

Public Member Functions

 mitkClassMacro (LabeledImageLookupTable, LookupTable)
 
Pointer Clone () const
 
LabeledImageLookupTable & operator= (const LookupTable &other) override
 Assignment from a generic LookupTable. More...
 
virtual void SetColorForLabel (const LabelType &label, const double &r, const double &g, const double &b, const double a=1.0)
 Set the RGBA color for a given label. More...
 
virtual double * GetColorForLabel (const LabelType &label)
 Get the RGBA color assigned to a given label. More...
 
mitk::LevelWindow GetLevelWindow ()
 Get the LevelWindow settings required for correct 2D color mapping. More...
 
- Public Member Functions inherited from mitk::LookupTable
 mitkClassMacroItkParent (LookupTable, itk::DataObject)
 
Pointer Clone () const
 
virtual vtkSmartPointer< vtkLookupTable > GetVtkLookupTable () const
 Get the internally wrapped vtkLookupTable. More...
 
virtual RawLookupTableType * GetRawLookupTable () const
 Get the raw lookup table array from the wrapped vtkLookupTable. More...
 
virtual void SetVtkLookupTable (vtkSmartPointer< vtkLookupTable > lut)
 Set the internal vtkLookupTable. More...
 
virtual void ChangeOpacityForAll (float opacity)
 Set the opacity (alpha) for all entries in the table. More...
 
virtual void ChangeOpacity (int index, float opacity)
 Set the opacity (alpha) for a specific table entry. More...
 
virtual void GetColor (double value, double rgb[3])
 Map a scalar value to an RGB color via the lookup table. More...
 
virtual void GetTableValue (int index, double rgba[4])
 Get the RGBA tuple at a specific table index. More...
 
virtual void SetTableValue (int index, double rgba[4])
 Set the RGBA tuple at a specific table index. More...
 
virtual void SetWindow (float _arg)
 
virtual void SetLevel (float _arg)
 
virtual void SetOpacity (float _arg)
 
virtual bool operator== (const mitk::LookupTable &LookupTable) const
 Compare two LookupTable objects for equality. More...
 
virtual bool operator!= (const LookupTable &LookupTable) const
 Compare two LookupTable objects for inequality. More...
 
void UpdateOutputInformation () override
 Update output information by querying the source object. More...
 
void SetRequestedRegionToLargestPossibleRegion () override
 Set the requested region to the largest possible region. More...
 
bool RequestedRegionIsOutsideOfTheBufferedRegion () override
 Check whether the requested region is outside the buffered region. More...
 
bool VerifyRequestedRegion () override
 Check whether the requested region is valid. More...
 
void SetRequestedRegion (const itk::DataObject *data) override
 Set the requested region from another data object. More...
 
 LookupTable ()
 Default constructor. Builds a GRAYSCALE table by default. More...
 
 ~LookupTable () override
 Destructor. More...
 
vtkSmartPointer< vtkColorTransferFunction > CreateColorTransferFunction ()
 Create a vtkColorTransferFunction from this lookup table. More...
 
vtkSmartPointer< vtkPiecewiseFunction > CreateOpacityTransferFunction ()
 Create a vtkPiecewiseFunction for opacity from this lookup table. More...
 
vtkSmartPointer< vtkPiecewiseFunction > CreateGradientTransferFunction ()
 Create a vtkPiecewiseFunction for gradient opacity from this lookup table. More...
 
virtual void SetType (const LookupTableType type)
 Set the lookup table type by enum value. More...
 
virtual void SetType (const std::string &typeName)
 Set the lookup table type by name string. More...
 
virtual LookupTableType GetActiveType () const
 Get the currently active lookup table type. More...
 
virtual std::string GetActiveTypeAsString () const
 Get the currently active lookup table type as a string. More...
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from mitk::LookupTable
static Pointer New ()
 
static int GetMultiLabelColorCount ()
 Number of curated colors in the MULTILABEL palette. More...
 
static void GetMultiLabelColor (int index, double rgb[3])
 RGB of the index-th MULTILABEL color, in [0,1]. More...
 

Protected Member Functions

 LabeledImageLookupTable ()
 
 LabeledImageLookupTable (const LabeledImageLookupTable &other)
 
 ~LabeledImageLookupTable () override
 
virtual void GenerateRandomColor (double &r, double &g, double &b)
 
virtual double GenerateRandomNumber ()
 
 mitkCloneMacro (LabeledImageLookupTable)
 
- Protected Member Functions inherited from mitk::LookupTable
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 
 LookupTable (const Self &other)
 
 mitkCloneMacro (Self)
 
virtual void BuildGrayScaleLookupTable ()
 
virtual void BuildLegacyBinaryLookupTable ()
 
virtual void BuildLegacyRainbowColorLookupTable ()
 
virtual void BuildInverseGrayScaleLookupTable ()
 
virtual void BuildHotIronLookupTable ()
 
virtual void BuildPlasmaLookupTable ()
 
virtual void BuildInfernoLookupTable ()
 
virtual void BuildViridisLookupTable ()
 
virtual void BuildMagmaLookupTable ()
 
virtual void BuildJetLookupTable (bool transparent=false)
 
virtual void BuildPETColorLookupTable ()
 
virtual void BuildPET20LookupTable ()
 
virtual void BuildPETBWLookupTable ()
 
virtual void BuildMultiLabelLookupTable ()
 
virtual void BuildTurboLookupTable ()
 

Protected Attributes

mitk::LevelWindow m_LevelWindow
 
- Protected Attributes inherited from mitk::LookupTable
vtkSmartPointer< vtkLookupTable > m_LookupTable
 
float m_Window
 
float m_Level
 
float m_Opacity
 
LookupTableType m_Type
 

Additional Inherited Members

- Static Public Attributes inherited from mitk::LookupTable
static std::vector< std::string > typenameList
 List of all predefined lookup table type names. More...
 

Detailed Description

Lookup table for 2D rendering of labeled (segmented) images.

Supports images with up to 256 unsigned labels (0–255). Label 0 is treated as background and is fully transparent by default. All other labels are initialized with random colors.

For correct color mapping in 2D renderers, use the level/window settings returned by GetLevelWindow().

See also
LookupTable

Definition at line 37 of file mitkLabeledImageLookupTable.h.

Member Typedef Documentation

◆ LabelType

The data type for a label. Currently only images with labels in the range [0,255] are supported.

Definition at line 55 of file mitkLabeledImageLookupTable.h.

Constructor & Destructor Documentation

◆ LabeledImageLookupTable() [1/2]

mitk::LabeledImageLookupTable::LabeledImageLookupTable ( )
protected

Default constructor. Protected to prevent "normal" creation

◆ LabeledImageLookupTable() [2/2]

mitk::LabeledImageLookupTable::LabeledImageLookupTable ( const LabeledImageLookupTable &  other)
protected

◆ ~LabeledImageLookupTable()

mitk::LabeledImageLookupTable::~LabeledImageLookupTable ( )
overrideprotected

Virtual destructor

Member Function Documentation

◆ Clone()

Pointer mitk::LabeledImageLookupTable::Clone ( ) const

◆ GenerateRandomColor()

virtual void mitk::LabeledImageLookupTable::GenerateRandomColor ( double &  r,
double &  g,
double &  b 
)
protectedvirtual

Generates a random rgb color value. Values for rgb are in the range [0,1]

◆ GenerateRandomNumber()

virtual double mitk::LabeledImageLookupTable::GenerateRandomNumber ( )
protectedvirtual

Generates a radnom number drawn from a uniform distribution in the range [0,1].

◆ GetColorForLabel()

virtual double* mitk::LabeledImageLookupTable::GetColorForLabel ( const LabelType &  label)
virtual

Get the RGBA color assigned to a given label.

Parameters
[in]labelThe label value.
Returns
Pointer to a four-element RGBA array with components in [0, 1].

◆ GetLevelWindow()

mitk::LevelWindow mitk::LabeledImageLookupTable::GetLevelWindow ( )
inline

Get the LevelWindow settings required for correct 2D color mapping.

When visualizing labeled images in 2D, use these level/window settings to ensure that scalar values are mapped to the correct colors.

Returns
The configured LevelWindow.

Definition at line 92 of file mitkLabeledImageLookupTable.h.

◆ mitkClassMacro()

mitk::LabeledImageLookupTable::mitkClassMacro ( LabeledImageLookupTable  ,
LookupTable   
)

Standard mitk typedefs are generated by the mitkClassMacro

◆ mitkCloneMacro()

mitk::LabeledImageLookupTable::mitkCloneMacro ( LabeledImageLookupTable  )
protected

◆ New()

static Pointer mitk::LabeledImageLookupTable::New ( )
static

Make this object constructable by the ::New() Method.

◆ operator=()

LabeledImageLookupTable& mitk::LabeledImageLookupTable::operator= ( const LookupTable &  other)
overridevirtual

Assignment from a generic LookupTable.

Parameters
[in]otherThe lookup table to copy from.
Returns
Reference to this object.

Reimplemented from mitk::LookupTable.

◆ SetColorForLabel()

virtual void mitk::LabeledImageLookupTable::SetColorForLabel ( const LabelType &  label,
const double &  r,
const double &  g,
const double &  b,
const double  a = 1.0 
)
virtual

Set the RGBA color for a given label.

Parameters
[in]labelThe pixel value used as a label in the image.
[in]rRed component in [0, 1].
[in]gGreen component in [0, 1].
[in]bBlue component in [0, 1].
[in]aAlpha component in [0, 1]. Default is 1.0 (fully opaque).

Member Data Documentation

◆ m_LevelWindow

mitk::LevelWindow mitk::LabeledImageLookupTable::m_LevelWindow
protected

Definition at line 119 of file mitkLabeledImageLookupTable.h.


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