Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitk::TransferFunction Class Reference

The TransferFunction class A wrapper class for VTK scalar opacity, gradient opacity, and color transfer functions.Holds a copy of each of the three standard VTK transfer functions (scalar opacity, gradient opacity, color) and provides an interface for manipulating their control points. Each original function can be retrieved by a Get() method. More...

#include <mitkTransferFunction.h>

Inheritance diagram for mitk::TransferFunction:
Collaboration diagram for mitk::TransferFunction:

Public Types

typedef std::vector< std::pair< double, double > > ControlPoints
 
typedef std::vector< std::pair< double, itk::RGBPixel< double > > > RGBControlPoints
 
typedef TransferFunction Self
 
typedef itk::DataObject Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 

Public Member Functions

virtual std::vector< std::string > GetClassHierarchy () const
 
virtual const char * GetClassName () const
 
Pointer Clone () const
 
virtual void SetMin (int _arg)
 Get/Set min/max of transfer function range for initialization. More...
 
virtual void SetMax (int _arg)
 Get/Set min/max of transfer function range for initialization. More...
 
virtual int GetMin ()
 Get/Set min/max of transfer function range for initialization. More...
 
virtual int GetMax ()
 Get/Set min/max of transfer function range for initialization. More...
 
virtual vtkPiecewiseFunction * GetScalarOpacityFunction ()
 Get/Set wrapped vtk transfer function. More...
 
virtual vtkPiecewiseFunction * GetGradientOpacityFunction ()
 Get/Set wrapped vtk transfer function. More...
 
virtual vtkColorTransferFunction * GetColorTransferFunction ()
 Get/Set wrapped vtk transfer function. More...
 
virtual void SetColorTransferFunction (vtkSmartPointer< vtkColorTransferFunction > _arg)
 
virtual const HistogramGenerator::HistogramTypeGetHistogram ()
 Get histogram used for transfer function initialization. More...
 
void InitializeByMitkImage (const mitk::Image *image)
 Initialize transfer function based on the histogram of an mitk::Image. More...
 
void InitializeByItkHistogram (const itk::Statistics::Histogram< double > *histogram)
 Initialize transfer function based on the specified histogram. More...
 
void InitializeHistogram (const mitk::Image *image)
 Initialize the internal histogram and min/max range based on the specified mitk::Image. More...
 
void SetScalarOpacityPoints (TransferFunction::ControlPoints points)
 Insert control points and values into the scalar opacity transfer function. More...
 
void SetGradientOpacityPoints (TransferFunction::ControlPoints points)
 Insert control points and values into the gradient opacity transfer function. More...
 
void SetRGBPoints (TransferFunction::RGBControlPoints rgbpoints)
 Insert control points and RGB values into the color transfer function. More...
 
void AddScalarOpacityPoint (double x, double value)
 Add a single control point to the scalar opacity transfer function. More...
 
void AddGradientOpacityPoint (double x, double value)
 Add a single control point to the gradient opacity transfer function. More...
 
void AddRGBPoint (double x, double r, double g, double b)
 Add a single control point to the color opacity transfer function. More...
 
TransferFunction::ControlPointsGetScalarOpacityPoints ()
 Get a copy of the scalar opacity transfer function control-points. More...
 
TransferFunction::ControlPointsGetGradientOpacityPoints ()
 Get a copy of the gradient opacity transfer function control-points. More...
 
TransferFunction::RGBControlPointsGetRGBPoints ()
 Get a copy of the color transfer function control-points. More...
 
int RemoveScalarOpacityPoint (double x)
 Remove the specified control point from the scalar opacity transfer function. More...
 
int RemoveGradientOpacityPoint (double x)
 Remove the specified control point from the gradient opacity transfer function. More...
 
int RemoveRGBPoint (double x)
 Remove the specified control point from the color transfer function. More...
 
void ClearScalarOpacityPoints ()
 Removes all control points from the scalar opacity transfer function. More...
 
void ClearGradientOpacityPoints ()
 Removes all control points from the gradient opacity transfer function. More...
 
void ClearRGBPoints ()
 Removes all control points from the color transfer function. More...
 
bool operator== (Self &other)
 

Static Public Member Functions

static const char * GetStaticNameOfClass ()
 
static Pointer New ()
 

Protected Member Functions

 TransferFunction ()
 
virtual ~TransferFunction ()
 
 TransferFunction (const TransferFunction &other)
 
virtual itk::LightObject::Pointer InternalClone () const override
 
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 

Protected Attributes

vtkSmartPointer< vtkPiecewiseFunction > m_ScalarOpacityFunction
 
vtkSmartPointer< vtkPiecewiseFunction > m_GradientOpacityFunction
 
vtkSmartPointer< vtkColorTransferFunction > m_ColorTransferFunction
 
int m_Min
 
int m_Max
 
mitk::HistogramGenerator::HistogramType::ConstPointer m_Histogram
 

Detailed Description

The TransferFunction class A wrapper class for VTK scalar opacity, gradient opacity, and color transfer functions.

Holds a copy of each of the three standard VTK transfer functions (scalar opacity, gradient opacity, color) and provides an interface for manipulating their control points. Each original function can be retrieved by a Get() method.

Note
Currently, transfer function initialization based on histograms or computed-tomography-presets is also provided by this class, but will likely be separated into a specific initializer class.
If you want to use this as a property for an mitk::Image, make sure to use the mitk::TransferFunctionProperty and set the mitk::RenderingModeProperty to a mode which supports transfer functions (e.g. COLORTRANSFERFUNCTION_COLOR). Make sure to check the documentation of the mitk::RenderingModeProperty. For a code example how to use the mitk::TransferFunction check the mitkImageVtkMapper2DTransferFunctionTest.cpp in Core.

Definition at line 59 of file mitkTransferFunction.h.

Member Typedef Documentation

typedef std::vector<std::pair<double, double> > mitk::TransferFunction::ControlPoints

Definition at line 62 of file mitkTransferFunction.h.

typedef std::vector<std::pair<double, itk::RGBPixel<double> > > mitk::TransferFunction::RGBControlPoints

Definition at line 63 of file mitkTransferFunction.h.

typedef itk::DataObject mitk::TransferFunction::Superclass

Definition at line 65 of file mitkTransferFunction.h.

Constructor & Destructor Documentation

mitk::TransferFunction::TransferFunction ( )
protected
mitk::TransferFunction::~TransferFunction ( )
protectedvirtual

Definition at line 61 of file mitkTransferFunction.cpp.

mitk::TransferFunction::TransferFunction ( const TransferFunction other)
protected

Member Function Documentation

void mitk::TransferFunction::AddGradientOpacityPoint ( double  x,
double  value 
)

Add a single control point to the gradient opacity transfer function.

Definition at line 141 of file mitkTransferFunction.cpp.

References m_GradientOpacityFunction.

Referenced by SetGradientOpacityPoints().

void mitk::TransferFunction::AddRGBPoint ( double  x,
double  r,
double  g,
double  b 
)

Add a single control point to the color opacity transfer function.

Definition at line 146 of file mitkTransferFunction.cpp.

References m_ColorTransferFunction.

Referenced by SetRGBPoints().

void mitk::TransferFunction::AddScalarOpacityPoint ( double  x,
double  value 
)

Add a single control point to the scalar opacity transfer function.

Definition at line 140 of file mitkTransferFunction.cpp.

References m_ScalarOpacityFunction.

Referenced by SetScalarOpacityPoints().

void mitk::TransferFunction::ClearGradientOpacityPoints ( )

Removes all control points from the gradient opacity transfer function.

Definition at line 195 of file mitkTransferFunction.cpp.

References m_GradientOpacityFunction.

void mitk::TransferFunction::ClearRGBPoints ( )

Removes all control points from the color transfer function.

Definition at line 196 of file mitkTransferFunction.cpp.

References m_ColorTransferFunction.

void mitk::TransferFunction::ClearScalarOpacityPoints ( )

Removes all control points from the scalar opacity transfer function.

Definition at line 194 of file mitkTransferFunction.cpp.

References m_ScalarOpacityFunction.

Pointer mitk::TransferFunction::Clone ( ) const
virtual std::vector<std::string> mitk::TransferFunction::GetClassHierarchy ( ) const
inlinevirtual

Definition at line 65 of file mitkTransferFunction.h.

virtual const char* mitk::TransferFunction::GetClassName ( ) const
virtual
virtual vtkColorTransferFunction* mitk::TransferFunction::GetColorTransferFunction ( )
virtual

Get/Set wrapped vtk transfer function.

Referenced by mitk::TransferFunctionPropertySerializer::Serialize().

virtual vtkPiecewiseFunction* mitk::TransferFunction::GetGradientOpacityFunction ( )
virtual

Get/Set wrapped vtk transfer function.

TransferFunction::ControlPoints & mitk::TransferFunction::GetGradientOpacityPoints ( )

Get a copy of the gradient opacity transfer function control-points.

Definition at line 164 of file mitkTransferFunction.cpp.

References m_GradientOpacityFunction.

Referenced by mitk::TransferFunctionPropertySerializer::Serialize().

virtual const HistogramGenerator::HistogramType* mitk::TransferFunction::GetHistogram ( )
virtual

Get histogram used for transfer function initialization.

Referenced by InitializeByItkHistogram(), InitializeByMitkImage(), and InitializeHistogram().

virtual int mitk::TransferFunction::GetMax ( )
virtual

Get/Set min/max of transfer function range for initialization.

virtual int mitk::TransferFunction::GetMin ( )
virtual

Get/Set min/max of transfer function range for initialization.

TransferFunction::RGBControlPoints & mitk::TransferFunction::GetRGBPoints ( )

Get a copy of the color transfer function control-points.

Definition at line 177 of file mitkTransferFunction.cpp.

References m_ColorTransferFunction.

virtual vtkPiecewiseFunction* mitk::TransferFunction::GetScalarOpacityFunction ( )
virtual

Get/Set wrapped vtk transfer function.

TransferFunction::ControlPoints & mitk::TransferFunction::GetScalarOpacityPoints ( )

Get a copy of the scalar opacity transfer function control-points.

Definition at line 151 of file mitkTransferFunction.cpp.

References m_ScalarOpacityFunction.

Referenced by mitk::TransferFunctionPropertySerializer::Serialize().

static const char* mitk::TransferFunction::GetStaticNameOfClass ( )
inlinestatic

Definition at line 65 of file mitkTransferFunction.h.

void mitk::TransferFunction::InitializeByItkHistogram ( const itk::Statistics::Histogram< double > *  histogram)

Initialize transfer function based on the specified histogram.

Definition at line 197 of file mitkTransferFunction.cpp.

References GetHistogram(), m_Histogram, m_Max, and m_Min.

void mitk::TransferFunction::InitializeByMitkImage ( const mitk::Image image)

Initialize transfer function based on the histogram of an mitk::Image.

Definition at line 223 of file mitkTransferFunction.cpp.

References GetHistogram(), m_ColorTransferFunction, m_GradientOpacityFunction, m_Histogram, m_Max, m_Min, m_ScalarOpacityFunction, and mitk::HistogramGenerator::New().

void mitk::TransferFunction::InitializeHistogram ( const mitk::Image image)

Initialize the internal histogram and min/max range based on the specified mitk::Image.

Definition at line 250 of file mitkTransferFunction.cpp.

References GetHistogram(), m_Histogram, m_Max, m_Min, and mitk::HistogramGenerator::New().

itk::LightObject::Pointer mitk::TransferFunction::InternalClone ( ) const
overrideprotectedvirtual

Definition at line 272 of file mitkTransferFunction.cpp.

bool mitk::TransferFunction::operator== ( Self other)
void mitk::TransferFunction::PrintSelf ( std::ostream &  os,
itk::Indent  indent 
) const
overrideprotected
int mitk::TransferFunction::RemoveGradientOpacityPoint ( double  x)

Remove the specified control point from the gradient opacity transfer function.

Definition at line 192 of file mitkTransferFunction.cpp.

References m_GradientOpacityFunction.

int mitk::TransferFunction::RemoveRGBPoint ( double  x)

Remove the specified control point from the color transfer function.

Definition at line 193 of file mitkTransferFunction.cpp.

References m_ColorTransferFunction.

int mitk::TransferFunction::RemoveScalarOpacityPoint ( double  x)

Remove the specified control point from the scalar opacity transfer function.

Definition at line 191 of file mitkTransferFunction.cpp.

References m_ScalarOpacityFunction.

virtual void mitk::TransferFunction::SetColorTransferFunction ( vtkSmartPointer< vtkColorTransferFunction >  _arg)
virtual
void mitk::TransferFunction::SetGradientOpacityPoints ( TransferFunction::ControlPoints  points)

Insert control points and values into the gradient opacity transfer function.

Definition at line 122 of file mitkTransferFunction.cpp.

References AddGradientOpacityPoint(), and m_GradientOpacityFunction.

virtual void mitk::TransferFunction::SetMax ( int  _arg)
virtual

Get/Set min/max of transfer function range for initialization.

virtual void mitk::TransferFunction::SetMin ( int  _arg)
virtual

Get/Set min/max of transfer function range for initialization.

void mitk::TransferFunction::SetRGBPoints ( TransferFunction::RGBControlPoints  rgbpoints)

Insert control points and RGB values into the color transfer function.

Definition at line 131 of file mitkTransferFunction.cpp.

References AddRGBPoint(), and m_ColorTransferFunction.

void mitk::TransferFunction::SetScalarOpacityPoints ( TransferFunction::ControlPoints  points)

Insert control points and values into the scalar opacity transfer function.

Definition at line 113 of file mitkTransferFunction.cpp.

References AddScalarOpacityPoint(), and m_ScalarOpacityFunction.

Member Data Documentation

vtkSmartPointer<vtkColorTransferFunction> mitk::TransferFunction::m_ColorTransferFunction
protected
vtkSmartPointer<vtkPiecewiseFunction> mitk::TransferFunction::m_GradientOpacityFunction
protected
mitk::HistogramGenerator::HistogramType::ConstPointer mitk::TransferFunction::m_Histogram
protected

Specified or calculated histogram (used for initialization)

Definition at line 183 of file mitkTransferFunction.h.

Referenced by InitializeByItkHistogram(), InitializeByMitkImage(), and InitializeHistogram().

int mitk::TransferFunction::m_Max
protected

Current range of transfer function (used for initialization)

Definition at line 180 of file mitkTransferFunction.h.

Referenced by InitializeByItkHistogram(), InitializeByMitkImage(), InitializeHistogram(), operator==(), and PrintSelf().

int mitk::TransferFunction::m_Min
protected

Current range of transfer function (used for initialization)

Definition at line 177 of file mitkTransferFunction.h.

Referenced by InitializeByItkHistogram(), InitializeByMitkImage(), InitializeHistogram(), operator==(), and PrintSelf().

vtkSmartPointer<vtkPiecewiseFunction> mitk::TransferFunction::m_ScalarOpacityFunction
protected

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