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

MITK wrapper for a vtkLookupTable. More...

#include <mitkLookupTable.h>

Inheritance diagram for mitk::LookupTable:
Collaboration diagram for mitk::LookupTable:

Public Types

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

 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...
 
virtual LookupTable & operator= (const LookupTable &LookupTable)
 Copy assignment operator. 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 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...
 

Static Public Attributes

static std::vector< std::string > typenameList
 List of all predefined lookup table type names. More...
 

Protected Member Functions

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

vtkSmartPointer< vtkLookupTable > m_LookupTable
 
float m_Window
 
float m_Level
 
float m_Opacity
 
LookupTableType m_Type
 

Detailed Description

MITK wrapper for a vtkLookupTable.

Wraps a vtkLookupTable and provides convenience methods for creating predefined color lookup tables (grayscale, hot iron, jet, PET, etc.), modifying opacity values, and querying color mappings.

Note
To use this as an image property, wrap it in a mitk::LookupTableProperty and set the mitk::RenderingModeProperty to a mode that supports lookup tables (e.g. LOOKUPTABLE_COLOR). See the documentation of mitk::RenderingModeProperty and the test mitkImageVtkMapper2DLookupTableTest.cpp for examples.
See also
LookupTableProperty, RenderingModeProperty, TransferFunction

Definition at line 44 of file mitkLookupTable.h.

Member Typedef Documentation

◆ RawLookupTableType

Convenience typedef for the raw lookup table element type.

Definition at line 50 of file mitkLookupTable.h.

Member Enumeration Documentation

◆ LookupTableType

The LookupTableType enum for different predefined lookup tables.

  • GRAYSCALE Our default level-window (sometimes referred to as window-level by other sources) setup for a test image looks like this:
  • INVERSE_GRAYSCALE Inverse LookupTable of GRAYSCALE.
  • HOT_IRON A LookupTable for red colors.
  • JET A LookupTable for JET color rendering.
  • LEGACY_BINARY A LookupTable for binary images.
  • LEGACY_RAINBOW_COLOR A rainbow-like LookupTable.
  • MULTILABEL A LookupTable for multilabel images.
  • PET_COLOR A LookupTable for PET color rendering.
  • PET_20 A LookupTable for PET_20 color rendering.
  • PET_BLACK_WHITE A LookupTable for PET white to black color rendering.
  • TURBO An improved rainbow LookupTable for visualization.

The different LookupTableTypes can be applied in the MitkWorkbench via right-clicking on an image and choosing a color map.

Enumerator
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 

Definition at line 248 of file mitkLookupTable.h.

Constructor & Destructor Documentation

◆ LookupTable() [1/2]

mitk::LookupTable::LookupTable ( )

Default constructor. Builds a GRAYSCALE table by default.

◆ ~LookupTable()

mitk::LookupTable::~LookupTable ( )
override

Destructor.

◆ LookupTable() [2/2]

mitk::LookupTable::LookupTable ( const Self &  other)
protected

Member Function Documentation

◆ BuildGrayScaleLookupTable()

virtual void mitk::LookupTable::BuildGrayScaleLookupTable ( )
protectedvirtual

◆ BuildHotIronLookupTable()

virtual void mitk::LookupTable::BuildHotIronLookupTable ( )
protectedvirtual

◆ BuildInfernoLookupTable()

virtual void mitk::LookupTable::BuildInfernoLookupTable ( )
protectedvirtual

◆ BuildInverseGrayScaleLookupTable()

virtual void mitk::LookupTable::BuildInverseGrayScaleLookupTable ( )
protectedvirtual

◆ BuildJetLookupTable()

virtual void mitk::LookupTable::BuildJetLookupTable ( bool  transparent = false)
protectedvirtual

◆ BuildLegacyBinaryLookupTable()

virtual void mitk::LookupTable::BuildLegacyBinaryLookupTable ( )
protectedvirtual

◆ BuildLegacyRainbowColorLookupTable()

virtual void mitk::LookupTable::BuildLegacyRainbowColorLookupTable ( )
protectedvirtual

◆ BuildMagmaLookupTable()

virtual void mitk::LookupTable::BuildMagmaLookupTable ( )
protectedvirtual

◆ BuildMultiLabelLookupTable()

virtual void mitk::LookupTable::BuildMultiLabelLookupTable ( )
protectedvirtual

◆ BuildPET20LookupTable()

virtual void mitk::LookupTable::BuildPET20LookupTable ( )
protectedvirtual

◆ BuildPETBWLookupTable()

virtual void mitk::LookupTable::BuildPETBWLookupTable ( )
protectedvirtual

◆ BuildPETColorLookupTable()

virtual void mitk::LookupTable::BuildPETColorLookupTable ( )
protectedvirtual

◆ BuildPlasmaLookupTable()

virtual void mitk::LookupTable::BuildPlasmaLookupTable ( )
protectedvirtual

◆ BuildTurboLookupTable()

virtual void mitk::LookupTable::BuildTurboLookupTable ( )
protectedvirtual

◆ BuildViridisLookupTable()

virtual void mitk::LookupTable::BuildViridisLookupTable ( )
protectedvirtual

◆ ChangeOpacity()

virtual void mitk::LookupTable::ChangeOpacity ( int  index,
float  opacity 
)
virtual

Set the opacity (alpha) for a specific table entry.

Parameters
[in]indexZero-based index into the lookup table.
[in]opacityOpacity value between 0.0 (transparent) and 1.0 (opaque).

◆ ChangeOpacityForAll()

virtual void mitk::LookupTable::ChangeOpacityForAll ( float  opacity)
virtual

Set the opacity (alpha) for all entries in the table.

Parameters
[in]opacityOpacity value between 0.0 (transparent) and 1.0 (opaque).

◆ Clone()

Pointer mitk::LookupTable::Clone ( ) const

◆ CreateColorTransferFunction()

vtkSmartPointer<vtkColorTransferFunction> mitk::LookupTable::CreateColorTransferFunction ( )

Create a vtkColorTransferFunction from this lookup table.

Returns
Smart pointer to the new color transfer function.

◆ CreateGradientTransferFunction()

vtkSmartPointer<vtkPiecewiseFunction> mitk::LookupTable::CreateGradientTransferFunction ( )

Create a vtkPiecewiseFunction for gradient opacity from this lookup table.

Returns
Smart pointer to the new gradient transfer function.

◆ CreateOpacityTransferFunction()

vtkSmartPointer<vtkPiecewiseFunction> mitk::LookupTable::CreateOpacityTransferFunction ( )

Create a vtkPiecewiseFunction for opacity from this lookup table.

Returns
Smart pointer to the new opacity transfer function.

◆ GetActiveType()

virtual LookupTableType mitk::LookupTable::GetActiveType ( ) const
virtual

Get the currently active lookup table type.

Returns
The active LookupTableType enum value.

◆ GetActiveTypeAsString()

virtual std::string mitk::LookupTable::GetActiveTypeAsString ( ) const
virtual

Get the currently active lookup table type as a string.

Returns
The name of the active type.

◆ GetColor()

virtual void mitk::LookupTable::GetColor ( double  value,
double  rgb[3] 
)
virtual

Map a scalar value to an RGB color via the lookup table.

Wraps vtkLookupTable::GetColor().

Parameters
[in]valueThe scalar value to map.
[out]rgbArray of 3 doubles filled with RGB values in [0, 1].

◆ GetMultiLabelColor()

static void mitk::LookupTable::GetMultiLabelColor ( int  index,
double  rgb[3] 
)
static

RGB of the index-th MULTILABEL color, in [0,1].

Indices 0..GetMultiLabelColorCount()-1 are the curated palette; higher indices are algorithmically generated. The MULTILABEL lookup table and the label-color selection both draw their colors from here, so callers do not have to round-trip through the table.

Exceptions
mitk::Exceptionif index is negative.

◆ GetMultiLabelColorCount()

static int mitk::LookupTable::GetMultiLabelColorCount ( )
static

Number of curated colors in the MULTILABEL palette.

They occupy lookup-table slots 1..N (slot 0 is the transparent background); higher slots hold algorithmically generated colors. Derived from the color table, so callers never hardcode the count.

◆ GetRawLookupTable()

virtual RawLookupTableType* mitk::LookupTable::GetRawLookupTable ( ) const
virtual

Get the raw lookup table array from the wrapped vtkLookupTable.

Returns
Pointer to the raw RGBA byte array, or nullptr if not built.

◆ GetTableValue()

virtual void mitk::LookupTable::GetTableValue ( int  index,
double  rgba[4] 
)
virtual

Get the RGBA tuple at a specific table index.

Wraps vtkLookupTable::GetTableValue().

Parameters
[in]indexZero-based index into the table.
[out]rgbaArray of 4 doubles filled with RGBA values in [0, 1].

◆ GetVtkLookupTable()

virtual vtkSmartPointer<vtkLookupTable> mitk::LookupTable::GetVtkLookupTable ( ) const
virtual

Get the internally wrapped vtkLookupTable.

Returns
Smart pointer to the vtkLookupTable.

◆ mitkClassMacroItkParent()

mitk::LookupTable::mitkClassMacroItkParent ( LookupTable  ,
itk::DataObject   
)

◆ mitkCloneMacro()

mitk::LookupTable::mitkCloneMacro ( Self  )
protected

◆ New()

static Pointer mitk::LookupTable::New ( )
static

◆ operator!=()

virtual bool mitk::LookupTable::operator!= ( const LookupTable &  LookupTable) const
virtual

Compare two LookupTable objects for inequality.

Parameters
[in]LookupTableThe LookupTable to compare against.
Returns
True if the tables differ.

◆ operator=()

virtual LookupTable& mitk::LookupTable::operator= ( const LookupTable &  LookupTable)
virtual

Copy assignment operator.

Necessary because itk::Object makes operator= private.

Parameters
[in]LookupTableThe LookupTable to copy from.
Returns
Reference to this object.

Reimplemented in mitk::LabeledImageLookupTable.

◆ operator==()

virtual bool mitk::LookupTable::operator== ( const mitk::LookupTable &  LookupTable) const
virtual

Compare two LookupTable objects for equality.

Parameters
[in]LookupTableThe LookupTable to compare against.
Returns
True if both tables contain the same entries.

◆ PrintSelf()

void mitk::LookupTable::PrintSelf ( std::ostream &  os,
itk::Indent  indent 
) const
overrideprotected

◆ RequestedRegionIsOutsideOfTheBufferedRegion()

bool mitk::LookupTable::RequestedRegionIsOutsideOfTheBufferedRegion ( )
override

Check whether the requested region is outside the buffered region.

Returns
The result of VerifyRequestedRegion() negated.

◆ SetLevel()

virtual void mitk::LookupTable::SetLevel ( float  _arg)
virtual

◆ SetOpacity()

virtual void mitk::LookupTable::SetOpacity ( float  _arg)
virtual

◆ SetRequestedRegion()

void mitk::LookupTable::SetRequestedRegion ( const itk::DataObject *  data)
override

Set the requested region from another data object.

No-op for lookup tables since the region mechanism is not supported.

Parameters
[in]dataThe data object whose region would be copied (ignored).

◆ SetRequestedRegionToLargestPossibleRegion()

void mitk::LookupTable::SetRequestedRegionToLargestPossibleRegion ( )
override

Set the requested region to the largest possible region.

No-op for lookup tables since the requested-region mechanism is not supported.

◆ SetTableValue()

virtual void mitk::LookupTable::SetTableValue ( int  index,
double  rgba[4] 
)
virtual

Set the RGBA tuple at a specific table index.

Wraps vtkLookupTable::SetTableValue().

Parameters
[in]indexZero-based index into the table.
[in]rgbaArray of 4 doubles with RGBA values in [0, 1].

◆ SetType() [1/2]

virtual void mitk::LookupTable::SetType ( const LookupTableType  type)
virtual

Set the lookup table type by enum value.

Rebuilds the internal vtkLookupTable for the given type. Does nothing if the type is already active or if the type is not recognized.

Parameters
[in]typeThe desired LookupTableType enum value.

◆ SetType() [2/2]

virtual void mitk::LookupTable::SetType ( const std::string &  typeName)
virtual

Set the lookup table type by name string.

Looks up typeName in typenameList and delegates to SetType(LookupTableType). Does nothing if the name is not found.

Parameters
[in]typeNameCase-sensitive name of the lookup table type.

◆ SetVtkLookupTable()

virtual void mitk::LookupTable::SetVtkLookupTable ( vtkSmartPointer< vtkLookupTable >  lut)
virtual

Set the internal vtkLookupTable.

Parameters
[in]lutThe vtkLookupTable to wrap.

◆ SetWindow()

virtual void mitk::LookupTable::SetWindow ( float  _arg)
virtual

◆ UpdateOutputInformation()

void mitk::LookupTable::UpdateOutputInformation ( )
override

Update output information by querying the source object.

◆ VerifyRequestedRegion()

bool mitk::LookupTable::VerifyRequestedRegion ( )
override

Check whether the requested region is valid.

Always returns true because lookup tables are always processed as a whole.

Returns
True.

Member Data Documentation

◆ m_Level

float mitk::LookupTable::m_Level
protected

Definition at line 329 of file mitkLookupTable.h.

◆ m_LookupTable

vtkSmartPointer<vtkLookupTable> mitk::LookupTable::m_LookupTable
protected

Definition at line 326 of file mitkLookupTable.h.

◆ m_Opacity

float mitk::LookupTable::m_Opacity
protected

Definition at line 330 of file mitkLookupTable.h.

◆ m_Type

LookupTableType mitk::LookupTable::m_Type
protected

Definition at line 332 of file mitkLookupTable.h.

◆ m_Window

float mitk::LookupTable::m_Window
protected

Definition at line 328 of file mitkLookupTable.h.

◆ typenameList

std::vector<std::string> mitk::LookupTable::typenameList
static

List of all predefined lookup table type names.

Definition at line 269 of file mitkLookupTable.h.


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