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

#include <mitkRenderingModeProperty.h>

Inheritance diagram for mitk::RenderingModeProperty:
Collaboration diagram for mitk::RenderingModeProperty:

Public Types

enum  ImageRenderingMode { LOOKUPTABLE_LEVELWINDOW_COLOR , COLORTRANSFERFUNCTION_LEVELWINDOW_COLOR , LOOKUPTABLE_COLOR , COLORTRANSFERFUNCTION_COLOR }
 Enumeration of available image rendering modes. More...
 
- Public Types inherited from mitk::EnumerationProperty
typedef unsigned int IdType
 Unsigned integer type used as unique enumeration value identifier. More...
 
typedef std::map< IdType, std::string > EnumIdsContainerType
 Map type storing id-to-name mappings. More...
 
typedef std::map< std::string, IdType > EnumStringsContainerType
 Map type storing name-to-id mappings. More...
 
typedef EnumIdsContainerType::const_iterator EnumConstIterator
 Const iterator type for iterating over enumeration values. More...
 

Public Member Functions

 mitkClassMacro (RenderingModeProperty, EnumerationProperty)
 
Pointer Clone () const
 
 mitkNewMacro1Param (RenderingModeProperty, const IdType &)
 
 mitkNewMacro1Param (RenderingModeProperty, const std::string &)
 
virtual int GetRenderingMode ()
 Returns the current rendering mode as an integer. More...
 
BaseProperty & operator= (const BaseProperty &property)
 Assign a property value to this instance. More...
 
- Public Member Functions inherited from mitk::EnumerationProperty
 mitkClassMacro (EnumerationProperty, BaseProperty)
 
Pointer Clone () const
 
virtual bool SetValue (const std::string &name)
 Set the current value of the enumeration by name. More...
 
virtual bool SetValue (const IdType &id)
 Set the current value of the enumeration by id. More...
 
virtual IdType GetValueAsId () const
 Get the id of the currently selected enumeration value. More...
 
std::string GetValueAsString () const override
 Get the name of the currently selected enumeration value. More...
 
virtual void Clear ()
 Remove all enumeration values and reset the current selection. More...
 
virtual EnumIdsContainerType::size_type Size () const
 Get the number of defined enumeration values. More...
 
virtual EnumConstIterator Begin () const
 Get an iterator to the first enumeration value. More...
 
virtual EnumConstIterator End () const
 Get an iterator past the last enumeration value. More...
 
virtual std::string GetEnumString (const IdType &id) const
 Get the name string for a given enumeration id. More...
 
virtual IdType GetEnumId (const std::string &name) const
 Get the id for a given enumeration name. More...
 
virtual bool IsValidEnumerationValue (const IdType &id) const
 Check whether a given id corresponds to a valid enumeration value. More...
 
virtual bool IsValidEnumerationValue (const std::string &name) const
 Check whether a given name corresponds to a valid enumeration value. More...
 
const EnumIdsContainerType & GetEnumIds () const
 Get a const reference to the id-to-name map. More...
 
const EnumStringsContainerType & GetEnumStrings () const
 Get a const reference to the name-to-id map. More...
 
EnumIdsContainerType & GetEnumIds ()
 Get a mutable reference to the id-to-name map. More...
 
EnumStringsContainerType & GetEnumStrings ()
 Get a mutable reference to the name-to-id map. More...
 
bool ToJSON (nlohmann::json &j) const override
 Serialize the current enumeration value to JSON. More...
 
bool FromJSON (const nlohmann::json &j) override
 Deserialize the enumeration value from JSON. More...
 
EnumerationProperty & operator= (const EnumerationProperty &)=delete
 
BaseProperty & operator= (const BaseProperty &property)
 Assign a property value to this instance. More...
 
- Public Member Functions inherited from mitk::BaseProperty
 mitkClassMacroItkParent (BaseProperty, itk::Object)
 
Pointer Clone () const
 
bool operator== (const BaseProperty &property) const
 Compare two properties for equality. More...
 
BaseProperty & operator= (const BaseProperty &property)
 Assign a property value to this instance. More...
 
bool AssignProperty (const BaseProperty &property)
 Assign a property value to this instance and report success. More...
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from mitk::EnumerationProperty
static Pointer New ()
 

Protected Member Functions

 RenderingModeProperty ()
 
 RenderingModeProperty (const IdType &value)
 
 RenderingModeProperty (const std::string &value)
 
 RenderingModeProperty (const RenderingModeProperty &other)
 
bool AddEnum (const std::string &name, const IdType &id) override
 
virtual void AddRenderingModes ()
 
 mitkCloneMacro (RenderingModeProperty)
 
- Protected Member Functions inherited from mitk::EnumerationProperty
 EnumerationProperty ()
 
 EnumerationProperty (const EnumerationProperty &)
 
bool IsEqual (const BaseProperty &property) const override
 
bool Assign (const BaseProperty &property) override
 
 mitkCloneMacro (Self)
 
- Protected Member Functions inherited from mitk::BaseProperty
 BaseProperty ()
 
 BaseProperty (const BaseProperty &other)
 
 ~BaseProperty () override
 

Additional Inherited Members

- Static Public Attributes inherited from mitk::BaseProperty
static const std::string VALUE_CANNOT_BE_CONVERTED_TO_STRING
 Default return value for properties that cannot be converted to a string. More...
 

Detailed Description

Encapsulates the enumeration for rendering modes. The property human-readable name (which is used in the mitkWorkbench inside the Property View) is "Image Rendering.Mode". This property affects rendering of images and is used inside the mitkImageVtkMapper2D to define which rendering mode is applied to images. Valid values are:

  • LOOKUPTABLE_LEVELWINDOW_COLOR: A lookup table, level window and color will be applied to the image. As lookup table, the table object supplied by the property "LookupTable" will be used. As default, we apply a GRAYSCALE mitk::LookupTable. Note, if you want to use a former rainbow-like lookup table, set the mitk::LookupTableProperty to use a LEGACY_RAINBOW_COLOR type mitk::LookupTable. Our default setup using the GRAYSCALE mitk::LookupTable for a test image looks like this:
    This image can be reproduced with the mitkImageVtkMapper2DColorTest or mitkImageVtkMapper2DLevelWindowTest. If "Image Rendering.Mode" is set to LOOKUPTABLE_LEVELWINDOW_COLOR inside the mitkWorkbench, the level window slider will change the rendering of the image. That means it will change the values of an internally used default lookup table. Note, the level window slider changes the property "levelwindow" which modifies the range of the internally used lookup table. This mode will apply the "color" property. The default color is white. If you change the "color" property to yellow, the test image will be rendered like this:
    This image can be reproduced with the mitkImageVtkMapper2DColorTest. Our test image with a lookup table mapping everything from red to blue looks like this:
    This image can be reproduced with the mitkImageVtkMapper2DLookupTableTest. Check this test code for an example how to apply a lookup table to an image.
    Note
    Changing a lookup table via the "levelwindow" property can be unintuitive and unwanted since the level window slider will overwrite the range of the lookup table. Use LOOKUPTABLE_COLOR if you don't want your lookuptable to be influenced by the "levelwindow" property.
  • COLORTRANSFERFUNCTION_LEVELWINDOW_COLOR: A color transfer function, level window and color will be applied to the image. Very similar mode to LOOKUPTABLE_LEVELWINDOW_COLOR. Instead of the lookup table a color transfer function will be used. Color transfer functions are useful to colorize floating point images and allow sometimes more flexibility than a lookup table. The "Image Rendering.Transfer Function" property defines the transfer function. Our test image with a transfer function mapping everything from to red, green and blue looks like this:
    This image can be reproduced with the mitkImageVtkMapper2DTransferFunctionTest. Check the test code for an example how to define a transfer function for an image. This transfer function will be influenced by the property "levelwindow" and the actor will be colored by the "color" property.
    Note
    Changing a transfer function table via the "levelwindow" property can be unintuitive and unwanted since the level window slider will overwrite the.Use COLORTRANSFERFUNCTION_COLOR if you don't want your transfer function to be influenced by the level window.
  • LOOKUPTABLE_COLOR: A lookup table and color will be applied to the image. Similar mode to LOOKUPTABLE_LEVELWINDOW_COLOR, except that the "levelwindow" property will not modify the range of the lookup table.
  • COLORTRANSFERFUNCTION_COLOR: A color trans ferfunction and color will be applied to the image. Similar mode to COLORTRANSFERFUNCTION_LEVELWINDOW_COLOR, except that the "levelwindow" property will not modify the range of the transfer function.

The order is given by the names (e.g. LOOKUPTABLE_COLOR applies first a lookup table and next a color). Currently, there is no GUI (in mitkWorkbench) support for controlling lookup tables or transfer functions. This has to be done by the programmer. Color and level window are controlled by color widget and level window slider. Currently, the color is always applied. We do not set the color to white, if the user changes the mode. We assume that users who change the mode know that a previously set color will still be applied (on top of the respective mode). See VTK documentation for examples how to use vtkTransferfunction and vtkLookupTable.

See also
EnumerationProperty

Definition at line 87 of file mitkRenderingModeProperty.h.

Member Enumeration Documentation

◆ ImageRenderingMode

Enumeration of available image rendering modes.

Note
Never change this without adaptation of mitkLevelWindowManagerTest::VerifyRenderingModes and mitkLevelWindowManagerTest::TestLevelWindowSliderVisibility!
Enumerator
LOOKUPTABLE_LEVELWINDOW_COLOR 

Lookup table + level window + color (default).

COLORTRANSFERFUNCTION_LEVELWINDOW_COLOR 

Color transfer function + level window + color.

LOOKUPTABLE_COLOR 

Lookup table + color (level window does not affect lookup table).

COLORTRANSFERFUNCTION_COLOR 

Color transfer function + color (level window does not affect transfer function).

Definition at line 106 of file mitkRenderingModeProperty.h.

Constructor & Destructor Documentation

◆ RenderingModeProperty() [1/4]

mitk::RenderingModeProperty::RenderingModeProperty ( )
protected

Sets rendering type to default (VTK_RAY_CAST_COMPOSITE_FUNCTION).

◆ RenderingModeProperty() [2/4]

mitk::RenderingModeProperty::RenderingModeProperty ( const IdType &  value)
protected

Constructor. Sets rendering type to the given value.

◆ RenderingModeProperty() [3/4]

mitk::RenderingModeProperty::RenderingModeProperty ( const std::string &  value)
protected

Constructor. Sets rendering type to the given value.

◆ RenderingModeProperty() [4/4]

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

Member Function Documentation

◆ AddEnum()

bool mitk::RenderingModeProperty::AddEnum ( const std::string &  name,
const IdType &  id 
)
overrideprotectedvirtual

this function is overridden as protected, so that the user may not add additional invalid rendering types.

Reimplemented from mitk::EnumerationProperty.

◆ AddRenderingModes()

virtual void mitk::RenderingModeProperty::AddRenderingModes ( )
protectedvirtual

Adds the default enumeration types.

◆ Clone()

Pointer mitk::RenderingModeProperty::Clone ( ) const

◆ GetRenderingMode()

virtual int mitk::RenderingModeProperty::GetRenderingMode ( )
virtual

Returns the current rendering mode as an integer.

Returns
The current ImageRenderingMode value.

◆ mitkClassMacro()

mitk::RenderingModeProperty::mitkClassMacro ( RenderingModeProperty  ,
EnumerationProperty   
)

◆ mitkCloneMacro()

mitk::RenderingModeProperty::mitkCloneMacro ( RenderingModeProperty  )
protected

◆ mitkNewMacro1Param() [1/2]

mitk::RenderingModeProperty::mitkNewMacro1Param ( RenderingModeProperty  ,
const IdType &   
)

◆ mitkNewMacro1Param() [2/2]

mitk::RenderingModeProperty::mitkNewMacro1Param ( RenderingModeProperty  ,
const std::string &   
)

◆ New()

static Pointer mitk::RenderingModeProperty::New ( )
static

◆ operator=()

BaseProperty& mitk::BaseProperty::operator=

Assign a property value to this instance.

Performs a polymorphic assignment from the given property. The assignment succeeds only if the source and target properties are of the same type. The subclass-specific Assign() method is called to perform the actual value copy.

Subclasses must implement Assign(const BaseProperty&) and call the superclass Assign method for proper handling. The copy assignment operator of the subclass should be disabled and the base class operator should be made visible using "using" statements.

Parameters
[in]propertyThe property whose value should be assigned to this instance.
Returns
A reference to this property.
See also
AssignProperty
Assign

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