Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkTransferFunctionWidget Class Reference

Widget for editing the three components of a volume rendering transfer function. More...

#include <QmitkTransferFunctionWidget.h>

Inheritance diagram for QmitkTransferFunctionWidget:
Collaboration diagram for QmitkTransferFunctionWidget:

Public Slots

void SetXValueScalar (const QString text)
 Set the x value for the scalar opacity canvas from a line edit. More...
 
void SetYValueScalar (const QString text)
 Set the y value for the scalar opacity canvas from a line edit. More...
 
void SetXValueGradient (const QString text)
 Set the x value for the gradient opacity canvas from a line edit. More...
 
void SetYValueGradient (const QString text)
 Set the y value for the gradient opacity canvas from a line edit. More...
 
void SetXValueColor (const QString text)
 Set the x value for the color canvas from a line edit. More...
 
void OnUpdateCanvas ()
 Refresh all three canvases from the current transfer function data. More...
 
void UpdateRanges ()
 Update the visible ranges of all canvases from the range slider. More...
 
void UpdateStepSize ()
 Recalculate the range slider step size based on the current range. More...
 
void OnResetSlider ()
 Reset the range slider to its full extent. More...
 
void OnSpanChanged (double lower, double upper)
 Handle range slider span changes and update canvas ranges. More...
 

Public Member Functions

 QmitkTransferFunctionWidget (QWidget *parent=nullptr, Qt::WindowFlags f={})
 Construct the transfer function widget. More...
 
 ~QmitkTransferFunctionWidget () override
 Destructor. More...
 
void SetDataNode (mitk::DataNode *node, mitk::TimeStepType timestep=0, const mitk::BaseRenderer *renderer=nullptr)
 Set the data node whose transfer function to edit. More...
 
void SetScalarLabel (const QString &scalarLabel)
 Set the label text for the scalar axis on all three canvases. More...
 
void ShowScalarOpacityFunction (bool show)
 Show or hide the scalar opacity function canvas. More...
 
void ShowColorFunction (bool show)
 Show or hide the color function canvas. More...
 
void ShowGradientOpacityFunction (bool show)
 Show or hide the gradient opacity function canvas. More...
 
void SetScalarOpacityFunctionEnabled (bool enable)
 Enable or disable the scalar opacity function canvas. More...
 
void SetColorFunctionEnabled (bool enable)
 Enable or disable the color function canvas. More...
 
void SetGradientOpacityFunctionEnabled (bool enable)
 Enable or disable the gradient opacity function canvas. More...
 

Protected Attributes

std::unique_ptr< Ui::QmitkTransferFunctionWidget > m_Controls
 
mitk::TransferFunctionProperty::Pointer tfpToChange
 
mitk::SimpleHistogramCache histogramCache
 

Detailed Description

Widget for editing the three components of a volume rendering transfer function.

Provides interactive canvases for:

  • Scalar opacity (grayvalue to opacity mapping)
  • Color (grayvalue to RGB color mapping)
  • Gradient opacity (gradient magnitude to opacity mapping)

Includes a range slider for zooming into a subrange of the scalar domain. Each canvas shows the underlying histogram and supports adding, removing, and dragging control points.

See also
QmitkTransferFunctionGeneratorWidget, QmitkColorTransferFunctionCanvas, QmitkPiecewiseFunctionCanvas

Definition at line 55 of file QmitkTransferFunctionWidget.h.

Constructor & Destructor Documentation

◆ QmitkTransferFunctionWidget()

QmitkTransferFunctionWidget::QmitkTransferFunctionWidget ( QWidget *  parent = nullptr,
Qt::WindowFlags  f = {} 
)

Construct the transfer function widget.

Parameters
[in]parentThe parent widget.
[in]fWindow flags.

◆ ~QmitkTransferFunctionWidget()

QmitkTransferFunctionWidget::~QmitkTransferFunctionWidget ( )
override

Destructor.

Member Function Documentation

◆ OnResetSlider

void QmitkTransferFunctionWidget::OnResetSlider ( )
slot

Reset the range slider to its full extent.

◆ OnSpanChanged

void QmitkTransferFunctionWidget::OnSpanChanged ( double  lower,
double  upper 
)
slot

Handle range slider span changes and update canvas ranges.

Parameters
[in]lowerThe new lower bound.
[in]upperThe new upper bound.

◆ OnUpdateCanvas

void QmitkTransferFunctionWidget::OnUpdateCanvas ( )
slot

Refresh all three canvases from the current transfer function data.

◆ SetColorFunctionEnabled()

void QmitkTransferFunctionWidget::SetColorFunctionEnabled ( bool  enable)

Enable or disable the color function canvas.

Parameters
[in]enableTrue to enable.

◆ SetDataNode()

void QmitkTransferFunctionWidget::SetDataNode ( mitk::DataNode *  node,
mitk::TimeStepType  timestep = 0,
const mitk::BaseRenderer *  renderer = nullptr 
)

Set the data node whose transfer function to edit.

Retrieves or creates a "TransferFunction" property on the node and initializes the canvases with the function data and histogram.

Parameters
[in]nodeThe data node (must contain image data).
[in]timestepThe time step for multi-timepoint images.
[in]rendererOptional renderer for renderer-specific properties.

◆ SetGradientOpacityFunctionEnabled()

void QmitkTransferFunctionWidget::SetGradientOpacityFunctionEnabled ( bool  enable)

Enable or disable the gradient opacity function canvas.

Parameters
[in]enableTrue to enable.

◆ SetScalarLabel()

void QmitkTransferFunctionWidget::SetScalarLabel ( const QString &  scalarLabel)

Set the label text for the scalar axis on all three canvases.

Parameters
[in]scalarLabelThe axis label (e.g. "Grayvalue" or "HU").

◆ SetScalarOpacityFunctionEnabled()

void QmitkTransferFunctionWidget::SetScalarOpacityFunctionEnabled ( bool  enable)

Enable or disable the scalar opacity function canvas.

Parameters
[in]enableTrue to enable.

◆ SetXValueColor

void QmitkTransferFunctionWidget::SetXValueColor ( const QString  text)
slot

Set the x value for the color canvas from a line edit.

Parameters
[in]textThe x value as text.

◆ SetXValueGradient

void QmitkTransferFunctionWidget::SetXValueGradient ( const QString  text)
slot

Set the x value for the gradient opacity canvas from a line edit.

Parameters
[in]textThe x value as text.

◆ SetXValueScalar

void QmitkTransferFunctionWidget::SetXValueScalar ( const QString  text)
slot

Set the x value for the scalar opacity canvas from a line edit.

Parameters
[in]textThe x value as text.

◆ SetYValueGradient

void QmitkTransferFunctionWidget::SetYValueGradient ( const QString  text)
slot

Set the y value for the gradient opacity canvas from a line edit.

Parameters
[in]textThe y value as text.

◆ SetYValueScalar

void QmitkTransferFunctionWidget::SetYValueScalar ( const QString  text)
slot

Set the y value for the scalar opacity canvas from a line edit.

Parameters
[in]textThe y value as text.

◆ ShowColorFunction()

void QmitkTransferFunctionWidget::ShowColorFunction ( bool  show)

Show or hide the color function canvas.

Parameters
[in]showTrue to show.

◆ ShowGradientOpacityFunction()

void QmitkTransferFunctionWidget::ShowGradientOpacityFunction ( bool  show)

Show or hide the gradient opacity function canvas.

Parameters
[in]showTrue to show.

◆ ShowScalarOpacityFunction()

void QmitkTransferFunctionWidget::ShowScalarOpacityFunction ( bool  show)

Show or hide the scalar opacity function canvas.

Parameters
[in]showTrue to show.

◆ UpdateRanges

void QmitkTransferFunctionWidget::UpdateRanges ( )
slot

Update the visible ranges of all canvases from the range slider.

◆ UpdateStepSize

void QmitkTransferFunctionWidget::UpdateStepSize ( )
slot

Recalculate the range slider step size based on the current range.

Member Data Documentation

◆ histogramCache

mitk::SimpleHistogramCache QmitkTransferFunctionWidget::histogramCache
protected

Definition at line 177 of file QmitkTransferFunctionWidget.h.

◆ m_Controls

std::unique_ptr<Ui::QmitkTransferFunctionWidget> QmitkTransferFunctionWidget::m_Controls
protected

Definition at line 175 of file QmitkTransferFunctionWidget.h.

◆ tfpToChange

mitk::TransferFunctionProperty::Pointer QmitkTransferFunctionWidget::tfpToChange
protected

Definition at line 176 of file QmitkTransferFunctionWidget.h.


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