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

Encapsulates 3D visualization properties which are forwarded to VTK for color mapping. More...

#include <mitkMaterial.h>

Inheritance diagram for mitk::Material:
Collaboration diagram for mitk::Material:

Public Types

enum  InterpolationType { Flat , Gouraud , Phong }
 
enum  RepresentationType { Points , Wireframe , Surface }
 
typedef itk::RGBPixel< double > Color
 

Public Member Functions

 mitkClassMacroItkParent (Material, itk::Object)
 
 mitkNewMacro1Param (Material, const Material &)
 Copy constructor. More...
 
virtual bool Assignable (const Material &other) const
 Check whether the given material can be assigned to this one. More...
 
virtual Material & operator= (const Material &other)
 Assignment operator. Copies all properties from the other material. More...
 
virtual void SetColor (Color color)
 Set the material color in RGB space. More...
 
virtual void SetColor (double red, double green, double blue)
 Set the material color in RGB space. More...
 
virtual void SetColorCoefficient (double coefficient)
 Set an attenuation coefficient for the color. More...
 
virtual void SetSpecularColor (Color color)
 Set the specular color. More...
 
virtual void SetSpecularColor (double red, double green, double blue)
 Set the specular color using RGB components. More...
 
virtual void SetSpecularCoefficient (double specularCoefficient)
 Set the specular coefficient which controls the shininess of the object together with the specular power. More...
 
virtual void SetSpecularPower (double specularPower)
 Set the specular power which controls the shininess of the object together with the specular coefficient. More...
 
virtual void SetOpacity (double opacity)
 Set the opacity of the material. More...
 
virtual void SetInterpolation (InterpolationType interpolation)
 Set the surface interpolation method of the object. More...
 
virtual void SetRepresentation (RepresentationType representation)
 Set the surface representation method of the object. More...
 
virtual void SetLineWidth (float lineWidth)
 Set the width of a Line. More...
 
virtual Color GetColor () const
 Get the color of the material. More...
 
virtual double GetColorCoefficient () const
 Get the color coefficient of the material. More...
 
virtual Color GetSpecularColor () const
 Get the specular color of the material. More...
 
virtual double GetSpecularCoefficient () const
 Get the specular coefficient used for rendering. More...
 
virtual double GetSpecularPower () const
 Get the specular power. More...
 
virtual double GetOpacity () const
 Get the opacity of the material. More...
 
virtual InterpolationType GetInterpolation () const
 Get the interpolation method used for rendering. More...
 
virtual RepresentationType GetRepresentation () const
 Get the representation type used for rendering. More...
 
virtual int GetVtkInterpolation () const
 Get the interpolation method as a VTK constant. More...
 
virtual int GetVtkRepresentation () const
 Get the representation type as a VTK constant. More...
 
virtual float GetLineWidth () const
 Get the line width used for wireframe rendering. More...
 
virtual void Initialize (const Material &property)
 Fill the current material with the properties of the given material. More...
 
virtual bool operator== (const Material &property) const
 Comparison operator which uses the member variables for comparison. More...
 
void PrintSelf (std::ostream &os, itk::Indent) const override
 Print the material properties to the given output stream. More...
 
virtual void SetName (std::string _arg)
 Set an optional name which may be associated with the material property. More...
 
virtual std::string GetName () const
 Get the name associated with the material property. More...
 

Static Public Member Functions

static Pointer New ()
 Create a new Material with default values. More...
 
static Pointer New (Color color, double opacity=1.0f)
 Create a new Material with the given color and opacity. More...
 
static Pointer New (double red, double green, double blue, double opacity=1.0f)
 Create a new Material with the given RGB color components and opacity. More...
 
static Pointer New (double red, double green, double blue, double colorCoefficient, double specularCoefficient, double specularPower, double opacity)
 Create a new Material with full control over color and lighting properties. More...
 
static Pointer New (Color color, double colorCoefficient, double specularCoefficient, double specularPower, double opacity)
 Create a new Material with the given color and lighting properties. More...
 
static Pointer New (const Material &property, double red, double green, double blue, double opacity=1.0, std::string name="")
 Copy constructor with color and opacity override. More...
 

Protected Member Functions

 Material ()
 Default constructor. More...
 
 Material (Color color, double opacity=1.0f)
 Constructor with color and opacity. More...
 
 Material (double red, double green, double blue, double opacity=1.0f)
 Constructor with RGB components and opacity. More...
 
 Material (double red, double green, double blue, double colorCoefficient, double specularCoefficient, double specularPower, double opacity)
 Constructor with full control over color and lighting properties. More...
 
 Material (Color color, double colorCoefficient, double specularCoefficient, double specularPower, double opacity)
 Constructor with color and lighting properties. More...
 
 Material (const Material &property)
 Copy constructor. More...
 
 Material (const Material &property, double red, double green, double blue, double opacity=1.0, std::string name="")
 Copy constructor with color and opacity override. More...
 
virtual void InitializeStandardValues ()
 Initialize all member variables to standard default values. More...
 
virtual void Update ()
 Re-apply all current property values, triggering Modified(). More...
 

Protected Attributes

std::string m_Name
 
Color m_Color
 
Color m_SpecularColor
 
double m_ColorCoefficient
 
double m_SpecularCoefficient
 
double m_SpecularPower
 
double m_Opacity
 
float m_LineWidth
 
InterpolationType m_Interpolation
 
RepresentationType m_Representation
 

Detailed Description

Encapsulates 3D visualization properties which are forwarded to VTK for color mapping.

This includes color, specular coefficient and power, opacity, interpolation type (flat, gouraud, phong) and representation (points, wireframe or surface).

See also
vtkProperty

Definition at line 35 of file mitkMaterial.h.

Member Typedef Documentation

◆ Color

typedef itk::RGBPixel<double> mitk::Material::Color

Definition at line 40 of file mitkMaterial.h.

Member Enumeration Documentation

◆ InterpolationType

Enumerator
Flat 
Gouraud 
Phong 

Definition at line 42 of file mitkMaterial.h.

◆ RepresentationType

Enumerator
Points 
Wireframe 
Surface 

Definition at line 49 of file mitkMaterial.h.

Constructor & Destructor Documentation

◆ Material() [1/7]

mitk::Material::Material ( )
protected

Default constructor.

Materials are set to the following default values: Color (0.5, 0.5, 0.5), color coefficient 1.0, specular color (1.0, 1.0, 1.0), specular coefficient 1.0, specular power 10, opacity 1.0, interpolation Gouraud, representation Surface.

◆ Material() [2/7]

mitk::Material::Material ( Color  color,
double  opacity = 1.0f 
)
protected

Constructor with color and opacity.

All values besides the given ones are set to defaults as described in the default constructor.

Parameters
[in]colorthe material color in RGB. Each RGB value should be in the range [0..1].
[in]opacitythe opacity of the material. 0.0 means fully transparent and 1.0 means solid.

◆ Material() [3/7]

mitk::Material::Material ( double  red,
double  green,
double  blue,
double  opacity = 1.0f 
)
protected

Constructor with RGB components and opacity.

All values besides the given ones are set to defaults as described in the default constructor.

Parameters
[in]redthe red component of the material color (range [0..1]).
[in]greenthe green component of the material color (range [0..1]).
[in]bluethe blue component of the material color (range [0..1]).
[in]opacitythe opacity of the material. 0.0 means fully transparent and 1.0 means solid.

◆ Material() [4/7]

mitk::Material::Material ( double  red,
double  green,
double  blue,
double  colorCoefficient,
double  specularCoefficient,
double  specularPower,
double  opacity 
)
protected

Constructor with full control over color and lighting properties.

All values besides the given ones are set to defaults as described in the default constructor.

Parameters
[in]redthe red component of the material color (range [0..1]).
[in]greenthe green component of the material color (range [0..1]).
[in]bluethe blue component of the material color (range [0..1]).
[in]colorCoefficienta scaling factor for the color coefficient which will be multiplied with each color component (range [0..1]).
[in]specularCoefficientcontrols in combination with the specular power how shiny the material will appear (range [0..1]).
[in]specularPowercontrols in combination with the specular coefficient how shiny the material will appear (range [0..inf]).
[in]opacitythe opacity of the material. 0.0 means fully transparent and 1.0 means solid.

◆ Material() [5/7]

mitk::Material::Material ( Color  color,
double  colorCoefficient,
double  specularCoefficient,
double  specularPower,
double  opacity 
)
protected

Constructor with color and lighting properties.

All values besides the given ones are set to defaults as described in the default constructor.

Parameters
[in]colorthe material color in RGB. Each RGB value should be in the range [0..1].
[in]colorCoefficienta scaling factor for the color coefficient which will be multiplied with each color component (range [0..1]).
[in]specularCoefficientcontrols in combination with the specular power how shiny the material will appear (range [0..1]).
[in]specularPowercontrols in combination with the specular coefficient how shiny the material will appear (range [0..inf]).
[in]opacitythe opacity of the material. 0.0 means fully transparent and 1.0 means solid.

◆ Material() [6/7]

mitk::Material::Material ( const Material &  property)
protected

Copy constructor.

◆ Material() [7/7]

mitk::Material::Material ( const Material &  property,
double  red,
double  green,
double  blue,
double  opacity = 1.0,
std::string  name = "" 
)
protected

Copy constructor with color and opacity override.

The values are copied from the given property and afterwards the values provided for red, green, blue, and opacity are written into the object.

Member Function Documentation

◆ Assignable()

virtual bool mitk::Material::Assignable ( const Material &  other) const
virtual

Check whether the given material can be assigned to this one.

Parameters
[in]otherthe Material to check for assignability.
Returns
True if the other material is of compatible type.

◆ GetColor()

virtual Color mitk::Material::GetColor ( ) const
virtual

Get the color of the material.

Returns
The material color as an RGB pixel.

◆ GetColorCoefficient()

virtual double mitk::Material::GetColorCoefficient ( ) const
virtual

Get the color coefficient of the material.

Returns
The color coefficient in the range [0..1].

◆ GetInterpolation()

virtual InterpolationType mitk::Material::GetInterpolation ( ) const
virtual

Get the interpolation method used for rendering.

Returns
The interpolation type (Flat, Gouraud, or Phong).

◆ GetLineWidth()

virtual float mitk::Material::GetLineWidth ( ) const
virtual

Get the line width used for wireframe rendering.

Returns
The line width in screen units.

◆ GetName()

virtual std::string mitk::Material::GetName ( ) const
virtual

Get the name associated with the material property.

◆ GetOpacity()

virtual double mitk::Material::GetOpacity ( ) const
virtual

Get the opacity of the material.

Returns
The opacity in the range [0..1].

◆ GetRepresentation()

virtual RepresentationType mitk::Material::GetRepresentation ( ) const
virtual

Get the representation type used for rendering.

Returns
The representation type (Points, Wireframe, or Surface).

◆ GetSpecularCoefficient()

virtual double mitk::Material::GetSpecularCoefficient ( ) const
virtual

Get the specular coefficient used for rendering.

Returns
The specular coefficient in the range [0..1].

◆ GetSpecularColor()

virtual Color mitk::Material::GetSpecularColor ( ) const
virtual

Get the specular color of the material.

Returns
The specular color in RGB values, each in the range [0..1].

◆ GetSpecularPower()

virtual double mitk::Material::GetSpecularPower ( ) const
virtual

Get the specular power.

Returns
The specular power, ranging from 0 to infinity.

◆ GetVtkInterpolation()

virtual int mitk::Material::GetVtkInterpolation ( ) const
virtual

Get the interpolation method as a VTK constant.

Returns
The VTK interpolation constant (VTK_FLAT, VTK_GOURAUD, or VTK_PHONG).

◆ GetVtkRepresentation()

virtual int mitk::Material::GetVtkRepresentation ( ) const
virtual

Get the representation type as a VTK constant.

Returns
The VTK representation constant (VTK_POINTS, VTK_WIREFRAME, or VTK_SURFACE).

◆ Initialize()

virtual void mitk::Material::Initialize ( const Material &  property)
virtual

Fill the current material with the properties of the given material.

Parameters
[in]propertythe Material whose properties should be copied into this material.

◆ InitializeStandardValues()

virtual void mitk::Material::InitializeStandardValues ( )
protectedvirtual

Initialize all member variables to standard default values.

◆ mitkClassMacroItkParent()

mitk::Material::mitkClassMacroItkParent ( Material  ,
itk::Object   
)

◆ mitkNewMacro1Param()

mitk::Material::mitkNewMacro1Param ( Material  ,
const Material &   
)

Copy constructor.

◆ New() [1/6]

static Pointer mitk::Material::New ( void  )
inlinestatic

Create a new Material with default values.

Materials are set to the following default values: Color (0.5, 0.5, 0.5), color coefficient 1.0, specular color (1.0, 1.0, 1.0), specular coefficient 1.0, specular power 10, opacity 1.0, interpolation Gouraud, representation Surface.

Returns
Smart pointer to the newly created Material.

Definition at line 66 of file mitkMaterial.h.

◆ New() [2/6]

static Pointer mitk::Material::New ( Color  color,
double  colorCoefficient,
double  specularCoefficient,
double  specularPower,
double  opacity 
)
inlinestatic

Create a new Material with the given color and lighting properties.

All values besides the given ones are set to defaults as described in the default constructor.

Parameters
[in]colorthe material color in RGB. Each RGB value should be in the range [0..1].
[in]colorCoefficienta scaling factor for the color coefficient which will be multiplied with each color component (range [0..1]).
[in]specularCoefficientcontrols in combination with the specular power how shiny the material will appear (range [0..1]).
[in]specularPowercontrols in combination with the specular coefficient how shiny the material will appear (range [0..inf]).
[in]opacitythe opacity of the material. 0.0 means fully transparent and 1.0 means solid.
Returns
Smart pointer to the newly created Material.

Definition at line 162 of file mitkMaterial.h.

◆ New() [3/6]

static Pointer mitk::Material::New ( Color  color,
double  opacity = 1.0f 
)
inlinestatic

Create a new Material with the given color and opacity.

All values besides the given ones are set to defaults as described in the default constructor.

Parameters
[in]colorthe material color in RGB. Each RGB value should be in the range [0..1].
[in]opacitythe opacity of the material. 0.0 means fully transparent and 1.0 means solid.
Returns
Smart pointer to the newly created Material.

Definition at line 85 of file mitkMaterial.h.

◆ New() [4/6]

static Pointer mitk::Material::New ( const Material &  property,
double  red,
double  green,
double  blue,
double  opacity = 1.0,
std::string  name = "" 
)
inlinestatic

Copy constructor with color and opacity override.

The values are copied from the given property and afterwards the values provided for red, green, blue, and opacity are written into the object.

Parameters
[in]propertythe source Material to copy from.
[in]redthe red component of the material color (range [0..1]).
[in]greenthe green component of the material color (range [0..1]).
[in]bluethe blue component of the material color (range [0..1]).
[in]opacitythe opacity of the material. 0.0 means fully transparent and 1.0 means solid.
[in]namean optional name to associate with this material.
Returns
Smart pointer to the newly created Material.

Definition at line 188 of file mitkMaterial.h.

◆ New() [5/6]

static Pointer mitk::Material::New ( double  red,
double  green,
double  blue,
double  colorCoefficient,
double  specularCoefficient,
double  specularPower,
double  opacity 
)
inlinestatic

Create a new Material with full control over color and lighting properties.

All values besides the given ones are set to defaults as described in the default constructor.

Parameters
[in]redthe red component of the material color (range [0..1]).
[in]greenthe green component of the material color (range [0..1]).
[in]bluethe blue component of the material color (range [0..1]).
[in]colorCoefficienta scaling factor for the color coefficient which will be multiplied with each color component (range [0..1]).
[in]specularCoefficientcontrols in combination with the specular power how shiny the material will appear (range [0..1]).
[in]specularPowercontrols in combination with the specular coefficient how shiny the material will appear (range [0..inf]).
[in]opacitythe opacity of the material. 0.0 means fully transparent and 1.0 means solid.
Returns
Smart pointer to the newly created Material.

Definition at line 131 of file mitkMaterial.h.

◆ New() [6/6]

static Pointer mitk::Material::New ( double  red,
double  green,
double  blue,
double  opacity = 1.0f 
)
inlinestatic

Create a new Material with the given RGB color components and opacity.

All values besides the given ones are set to defaults as described in the default constructor.

Parameters
[in]redthe red component of the material color (range [0..1]).
[in]greenthe green component of the material color (range [0..1]).
[in]bluethe blue component of the material color (range [0..1]).
[in]opacitythe opacity of the material. 0.0 means fully transparent and 1.0 means solid.
Returns
Smart pointer to the newly created Material.

Definition at line 105 of file mitkMaterial.h.

◆ operator=()

virtual Material& mitk::Material::operator= ( const Material &  other)
virtual

Assignment operator. Copies all properties from the other material.

Parameters
[in]otherthe Material to copy from.
Returns
Reference to this material.

◆ operator==()

virtual bool mitk::Material::operator== ( const Material &  property) const
virtual

Comparison operator which uses the member variables for comparison.

Parameters
[in]propertythe Material to compare with.
Returns
True if all properties are equal.

◆ PrintSelf()

void mitk::Material::PrintSelf ( std::ostream &  os,
itk::Indent   
) const
override

Print the material properties to the given output stream.

Parameters
[in]osthe output stream.

◆ SetColor() [1/2]

virtual void mitk::Material::SetColor ( Color  color)
virtual

Set the material color in RGB space.

The RGB components have to be in the range [0..1].

Parameters
[in]colorthe new color of the material.

◆ SetColor() [2/2]

virtual void mitk::Material::SetColor ( double  red,
double  green,
double  blue 
)
virtual

Set the material color in RGB space.

The RGB components have to be in the range [0..1].

Parameters
[in]redthe red component of the material color (range [0..1]).
[in]greenthe green component of the material color (range [0..1]).
[in]bluethe blue component of the material color (range [0..1]).

◆ SetColorCoefficient()

virtual void mitk::Material::SetColorCoefficient ( double  coefficient)
virtual

Set an attenuation coefficient for the color.

A value of 0 results in a black object. Valid range is [0..1].

Parameters
[in]coefficientthe color attenuation coefficient.

◆ SetInterpolation()

virtual void mitk::Material::SetInterpolation ( InterpolationType  interpolation)
virtual

Set the surface interpolation method of the object.

Valid interpolation types are Flat, Gouraud and Phong.

Parameters
[in]interpolationthe interpolation method used for rendering of surfaces.

◆ SetLineWidth()

virtual void mitk::Material::SetLineWidth ( float  lineWidth)
virtual

Set the width of a Line.

The width is expressed in screen units. The default is 1.0.

Parameters
[in]lineWidththe new line width in screen units.

◆ SetName()

virtual void mitk::Material::SetName ( std::string  _arg)
virtual

Set an optional name which may be associated with the material property.

Please note that this name is NOT forwarded to the data tree node as the node name.

◆ SetOpacity()

virtual void mitk::Material::SetOpacity ( double  opacity)
virtual

Set the opacity of the material.

Controls how transparent the object appears. Valid range is [0..1], where 0 means fully transparent and 1 means a solid surface.

Parameters
[in]opacitythe new opacity of the material.

◆ SetRepresentation()

virtual void mitk::Material::SetRepresentation ( RepresentationType  representation)
virtual

Set the surface representation method of the object.

Valid representation types are Points, Wireframe and Surface.

Parameters
[in]representationthe representation method used for rendering of surfaces.

◆ SetSpecularCoefficient()

virtual void mitk::Material::SetSpecularCoefficient ( double  specularCoefficient)
virtual

Set the specular coefficient which controls the shininess of the object together with the specular power.

Parameters
[in]specularCoefficientthe new specular coefficient. Valid range is [0..1].

◆ SetSpecularColor() [1/2]

virtual void mitk::Material::SetSpecularColor ( Color  color)
virtual

Set the specular color.

Parameters
[in]colorthe specular color in RGB. Each RGB value should be in the range [0..1].

◆ SetSpecularColor() [2/2]

virtual void mitk::Material::SetSpecularColor ( double  red,
double  green,
double  blue 
)
virtual

Set the specular color using RGB components.

Parameters
[in]redthe red component of the specular color (range [0..1]).
[in]greenthe green component of the specular color (range [0..1]).
[in]bluethe blue component of the specular color (range [0..1]).

◆ SetSpecularPower()

virtual void mitk::Material::SetSpecularPower ( double  specularPower)
virtual

Set the specular power which controls the shininess of the object together with the specular coefficient.

Parameters
[in]specularPowerthe new specular power. Valid range is [0..inf].

◆ Update()

virtual void mitk::Material::Update ( )
protectedvirtual

Re-apply all current property values, triggering Modified().

Member Data Documentation

◆ m_Color

Color mitk::Material::m_Color
protected

Definition at line 520 of file mitkMaterial.h.

◆ m_ColorCoefficient

double mitk::Material::m_ColorCoefficient
protected

Definition at line 524 of file mitkMaterial.h.

◆ m_Interpolation

InterpolationType mitk::Material::m_Interpolation
protected

Definition at line 534 of file mitkMaterial.h.

◆ m_LineWidth

float mitk::Material::m_LineWidth
protected

Definition at line 532 of file mitkMaterial.h.

◆ m_Name

std::string mitk::Material::m_Name
protected

Definition at line 518 of file mitkMaterial.h.

◆ m_Opacity

double mitk::Material::m_Opacity
protected

Definition at line 530 of file mitkMaterial.h.

◆ m_Representation

RepresentationType mitk::Material::m_Representation
protected

Definition at line 536 of file mitkMaterial.h.

◆ m_SpecularCoefficient

double mitk::Material::m_SpecularCoefficient
protected

Definition at line 526 of file mitkMaterial.h.

◆ m_SpecularColor

Color mitk::Material::m_SpecularColor
protected

Definition at line 522 of file mitkMaterial.h.

◆ m_SpecularPower

double mitk::Material::m_SpecularPower
protected

Definition at line 528 of file mitkMaterial.h.


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