Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkTransferFunctionWidget.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QmitkTransferFunctionWidget_h
14 #define QmitkTransferFunctionWidget_h
15 
17 
18 #include <mitkCommon.h>
19 
20 #include <QWidget>
21 
22 #include <mitkDataNode.h>
23 #include <mitkSimpleHistogram.h>
25 
26 #include <QPushButton>
27 #include <QSlider>
28 #include <memory>
29 
30 namespace mitk
31 {
32  class BaseRenderer;
33 }
34 
35 namespace Ui
36 {
38 }
39 
56 {
57  Q_OBJECT
58 
59 public:
65  QmitkTransferFunctionWidget(QWidget *parent = nullptr, Qt::WindowFlags f = {});
66 
69 
80  void SetDataNode(mitk::DataNode *node, mitk::TimeStepType timestep = 0, const mitk::BaseRenderer *renderer = nullptr);
81 
86  void SetScalarLabel(const QString &scalarLabel);
87 
92  void ShowScalarOpacityFunction(bool show);
93 
98  void ShowColorFunction(bool show);
99 
105 
111 
116  void SetColorFunctionEnabled(bool enable);
117 
123 
124 public slots:
129  void SetXValueScalar(const QString text);
130 
135  void SetYValueScalar(const QString text);
136 
141  void SetXValueGradient(const QString text);
142 
147  void SetYValueGradient(const QString text);
148 
153  void SetXValueColor(const QString text);
154 
157 
159  void UpdateRanges();
160 
163 
166 
172  void OnSpanChanged(double lower, double upper);
173 
174 protected:
175  std::unique_ptr<Ui::QmitkTransferFunctionWidget> m_Controls;
176  mitk::TransferFunctionProperty::Pointer tfpToChange;
178 };
179 
180 #endif
#define MITKQTWIDGETSEXT_EXPORT
Widget for editing the three components of a volume rendering transfer function.
~QmitkTransferFunctionWidget() override
Destructor.
void OnUpdateCanvas()
Refresh all three canvases from the current transfer function data.
QmitkTransferFunctionWidget(QWidget *parent=nullptr, Qt::WindowFlags f={})
Construct the transfer function widget.
void SetYValueGradient(const QString text)
Set the y value for the gradient opacity canvas from a line edit.
void SetScalarOpacityFunctionEnabled(bool enable)
Enable or disable the scalar opacity function canvas.
mitk::TransferFunctionProperty::Pointer tfpToChange
void UpdateStepSize()
Recalculate the range slider step size based on the current range.
void SetDataNode(mitk::DataNode *node, mitk::TimeStepType timestep=0, const mitk::BaseRenderer *renderer=nullptr)
Set the data node whose transfer function to edit.
std::unique_ptr< Ui::QmitkTransferFunctionWidget > m_Controls
void SetXValueScalar(const QString text)
Set the x value for the scalar opacity canvas from a line edit.
void OnResetSlider()
Reset the range slider to its full extent.
void SetXValueGradient(const QString text)
Set the x value for the gradient opacity canvas from a line edit.
void SetYValueScalar(const QString text)
Set the y value for the scalar opacity canvas from a line edit.
void SetGradientOpacityFunctionEnabled(bool enable)
Enable or disable the gradient opacity function canvas.
void SetXValueColor(const QString text)
Set the x value for the color canvas from a line edit.
void ShowScalarOpacityFunction(bool show)
Show or hide the scalar opacity function canvas.
mitk::SimpleHistogramCache histogramCache
void ShowColorFunction(bool show)
Show or hide the color function canvas.
void ShowGradientOpacityFunction(bool show)
Show or hide the gradient opacity function canvas.
void OnSpanChanged(double lower, double upper)
Handle range slider span changes and update canvas ranges.
void UpdateRanges()
Update the visible ranges of all canvases from the range slider.
void SetColorFunctionEnabled(bool enable)
Enable or disable the color function canvas.
void SetScalarLabel(const QString &scalarLabel)
Set the label text for the scalar axis on all three canvases.
Organizes the rendering process.
Central node class of the MITK data tree, associating a data object with properties and mappers.
Definition: mitkDataNode.h:72
Cache for SimpleHistogram objects to avoid redundant recomputation.
Find image slices visible on a given plane.
std::size_t TimeStepType
Type for time step indices (non-negative integers starting from 0).