|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
Abstract base class for transfer function editing canvases. More...
#include <QmitkTransferFunctionCanvas.h>


Public Member Functions | |
| QmitkTransferFunctionCanvas (QWidget *parent=nullptr, Qt::WindowFlags f={}) | |
| Construct the transfer function canvas. More... | |
| mitk::SimpleHistogram * | GetHistogram () |
| Get the associated histogram. More... | |
| void | SetHistogram (mitk::SimpleHistogram *histogram) |
| Set the histogram to display as background. More... | |
| double | GetMin () |
| Get the minimum scalar value of the data range. More... | |
| void | SetMin (double min) |
| Set the minimum scalar value and update the lower display bound. More... | |
| double | GetMax () |
| Get the maximum scalar value of the data range. More... | |
| void | SetMax (double max) |
| Set the maximum scalar value and update the upper display bound. More... | |
| double | GetLower () |
| Get the lower display bound. More... | |
| void | SetLower (double lower) |
| Set the lower display bound (visible range start). More... | |
| double | GetUpper () |
| Get the upper display bound. More... | |
| void | SetUpper (double upper) |
| Set the upper display bound (visible range end). More... | |
| void | mousePressEvent (QMouseEvent *mouseEvent) override |
| Handle mouse press: add or remove function points, select handles. More... | |
| void | paintEvent (QPaintEvent *e) override |
| Default paint event handler. More... | |
| virtual void | DoubleClickOnHandle (int handle)=0 |
| Called when a handle is double-clicked (e.g. to open a color dialog). More... | |
| void | mouseMoveEvent (QMouseEvent *mouseEvent) override |
| Handle mouse move: drag the grabbed handle. More... | |
| void | mouseReleaseEvent (QMouseEvent *mouseEvent) override |
| Handle mouse release: trigger repaint. More... | |
| void | mouseDoubleClickEvent (QMouseEvent *mouseEvent) override |
| Handle double-click on a handle. More... | |
| void | PaintHistogram (QPainter &p) |
| Paint the histogram as a background overlay. More... | |
| virtual int | GetNearHandle (int x, int y, unsigned int maxSquaredDistance=100)=0 |
| Find a handle near the given canvas position. More... | |
| virtual int | AddFunctionPoint (double x, double val)=0 |
| Add a function point at (x, val). More... | |
| virtual void | RemoveFunctionPoint (double x)=0 |
| Remove the function point at position x. More... | |
| virtual void | MoveFunctionPoint (int index, std::pair< double, double > pos)=0 |
| Move a function point to a new position. More... | |
| virtual double | GetFunctionX (int index)=0 |
| Get the x (scalar) value of a function point. More... | |
| virtual double | GetFunctionY (int index)=0 |
| Get the y (function) value of a function point. More... | |
| virtual int | GetFunctionSize ()=0 |
| Get the number of function points. More... | |
| std::pair< int, int > | FunctionToCanvas (std::pair< double, double > functionPoint) |
| Convert function coordinates to canvas pixel coordinates. More... | |
| std::pair< double, double > | CanvasToFunction (std::pair< int, int > canvasPoint) |
| Convert canvas pixel coordinates to function coordinates. More... | |
| void | keyPressEvent (QKeyEvent *e) override |
| Handle keyboard input for point manipulation (Delete, arrow keys). More... | |
| void | SetImmediateUpdate (bool state) |
| Enable or disable immediate rendering updates during interaction. More... | |
| std::pair< double, double > | ValidateCoord (std::pair< double, double > x) |
| Clamp coordinates to valid histogram range and [0, 1] for y. More... | |
| void | SetX (float x) |
| Set the x coordinate of the currently grabbed handle. More... | |
| void | SetY (float y) |
| Set the y coordinate of the currently grabbed handle. More... | |
| void | SetQLineEdits (QLineEdit *xEdit, QLineEdit *yEdit) |
| Connect QLineEdit widgets for displaying/editing the selected handle coordinates. More... | |
Public Attributes | |
| int | m_GrabbedHandle |
| Index of the currently grabbed (selected) handle, or -1. More... | |
| double | m_Lower |
| Lower display bound. More... | |
| double | m_Upper |
| Upper display bound. More... | |
| double | m_Min |
| Minimum data range value. More... | |
| double | m_Max |
| Maximum data range value. More... | |
| mitk::SimpleHistogram * | m_Histogram |
| The background histogram. More... | |
Protected Attributes | |
| bool | m_ImmediateUpdate |
| float | m_Range |
| bool | m_LineEditAvailable |
| QLineEdit * | m_XEdit |
| QLineEdit * | m_YEdit |
Abstract base class for transfer function editing canvases.
Provides common infrastructure for interactive editing of transfer function control points: mouse-based adding, removing, and dragging of handles, histogram background rendering, coordinate conversion, keyboard navigation, and optional QLineEdit binding for precise coordinate input.
Subclasses must implement the pure virtual methods that define the specific transfer function type (color vs. piecewise).
Definition at line 37 of file QmitkTransferFunctionCanvas.h.
| QmitkTransferFunctionCanvas::QmitkTransferFunctionCanvas | ( | QWidget * | parent = nullptr, |
| Qt::WindowFlags | f = {} |
||
| ) |
Construct the transfer function canvas.
| [in] | parent | The parent widget. |
| [in] | f | Window flags. |
|
pure virtual |
Add a function point at (x, val).
| [in] | x | The scalar position. |
| [in] | val | The function value. |
Implemented in QmitkPiecewiseFunctionCanvas, and QmitkColorTransferFunctionCanvas.
| std::pair<double, double> QmitkTransferFunctionCanvas::CanvasToFunction | ( | std::pair< int, int > | canvasPoint | ) |
Convert canvas pixel coordinates to function coordinates.
| [in] | canvasPoint | The (x, y) canvas pixel coordinates. |
|
pure virtual |
Called when a handle is double-clicked (e.g. to open a color dialog).
| [in] | handle | The index of the double-clicked handle. |
Implemented in QmitkPiecewiseFunctionCanvas, and QmitkColorTransferFunctionCanvas.
| std::pair<int, int> QmitkTransferFunctionCanvas::FunctionToCanvas | ( | std::pair< double, double > | functionPoint | ) |
Convert function coordinates to canvas pixel coordinates.
| [in] | functionPoint | The (x, y) function coordinates. |
|
pure virtual |
Get the number of function points.
Implemented in QmitkPiecewiseFunctionCanvas, and QmitkColorTransferFunctionCanvas.
Referenced by QmitkColorTransferFunctionCanvas::RemoveFunctionPoint(), and QmitkPiecewiseFunctionCanvas::RemoveFunctionPoint().
|
pure virtual |
Get the x (scalar) value of a function point.
| [in] | index | The point index. |
Implemented in QmitkPiecewiseFunctionCanvas, and QmitkColorTransferFunctionCanvas.
|
pure virtual |
Get the y (function) value of a function point.
| [in] | index | The point index. |
Implemented in QmitkColorTransferFunctionCanvas, and QmitkPiecewiseFunctionCanvas.
|
inline |
Get the associated histogram.
Definition at line 53 of file QmitkTransferFunctionCanvas.h.
|
inline |
Get the lower display bound.
Definition at line 97 of file QmitkTransferFunctionCanvas.h.
|
inline |
Get the maximum scalar value of the data range.
Definition at line 81 of file QmitkTransferFunctionCanvas.h.
|
inline |
Get the minimum scalar value of the data range.
Definition at line 65 of file QmitkTransferFunctionCanvas.h.
|
pure virtual |
Find a handle near the given canvas position.
| [in] | x | The x coordinate in canvas pixels. |
| [in] | y | The y coordinate in canvas pixels. |
| [in] | maxSquaredDistance | Maximum squared pixel distance. |
Implemented in QmitkPiecewiseFunctionCanvas, and QmitkColorTransferFunctionCanvas.
|
inline |
Get the upper display bound.
Definition at line 109 of file QmitkTransferFunctionCanvas.h.
|
override |
Handle keyboard input for point manipulation (Delete, arrow keys).
|
override |
Handle double-click on a handle.
|
override |
Handle mouse move: drag the grabbed handle.
|
override |
Handle mouse press: add or remove function points, select handles.
|
override |
Handle mouse release: trigger repaint.
|
pure virtual |
Move a function point to a new position.
| [in] | index | The index of the point. |
| [in] | pos | The new (x, y) position. |
Implemented in QmitkPiecewiseFunctionCanvas, and QmitkColorTransferFunctionCanvas.
|
override |
Default paint event handler.
| void QmitkTransferFunctionCanvas::PaintHistogram | ( | QPainter & | p | ) |
Paint the histogram as a background overlay.
| [in,out] | p | The QPainter to draw with. |
|
pure virtual |
Remove the function point at position x.
| [in] | x | The scalar position to remove. |
Implemented in QmitkPiecewiseFunctionCanvas, and QmitkColorTransferFunctionCanvas.
|
inline |
Set the histogram to display as background.
| [in] | histogram | The histogram. May be nullptr. |
Definition at line 59 of file QmitkTransferFunctionCanvas.h.
| void QmitkTransferFunctionCanvas::SetImmediateUpdate | ( | bool | state | ) |
Enable or disable immediate rendering updates during interaction.
| [in] | state | True to enable immediate updates. |
|
inline |
Set the lower display bound (visible range start).
| [in] | lower | The lower bound. |
Definition at line 103 of file QmitkTransferFunctionCanvas.h.
|
inline |
Set the maximum scalar value and update the upper display bound.
| [in] | max | The maximum value. |
Definition at line 87 of file QmitkTransferFunctionCanvas.h.
Referenced by QmitkColorTransferFunctionCanvas::SetColorTransferFunction(), and QmitkPiecewiseFunctionCanvas::SetPiecewiseFunction().
|
inline |
Set the minimum scalar value and update the lower display bound.
| [in] | min | The minimum value. |
Definition at line 71 of file QmitkTransferFunctionCanvas.h.
Referenced by QmitkColorTransferFunctionCanvas::SetColorTransferFunction(), and QmitkPiecewiseFunctionCanvas::SetPiecewiseFunction().
|
inline |
Connect QLineEdit widgets for displaying/editing the selected handle coordinates.
| [in] | xEdit | The line edit for the x coordinate. |
| [in] | yEdit | The line edit for the y coordinate. May be nullptr. |
Definition at line 280 of file QmitkTransferFunctionCanvas.h.
|
inline |
Set the upper display bound (visible range end).
| [in] | upper | The upper bound. |
Definition at line 115 of file QmitkTransferFunctionCanvas.h.
|
inline |
Set the x coordinate of the currently grabbed handle.
| [in] | x | The new x value. |
Definition at line 251 of file QmitkTransferFunctionCanvas.h.
References mitk::RenderingManager::GetInstance(), and mitk::RenderingManager::RequestUpdateAll().
|
inline |
Set the y coordinate of the currently grabbed handle.
| [in] | y | The new y value. |
Definition at line 265 of file QmitkTransferFunctionCanvas.h.
References mitk::RenderingManager::GetInstance(), and mitk::RenderingManager::RequestUpdateAll().
|
inline |
Clamp coordinates to valid histogram range and [0, 1] for y.
| [in] | x | The (x, y) coordinates to validate. |
Definition at line 232 of file QmitkTransferFunctionCanvas.h.
References mitk::SimpleHistogram::GetMax(), and mitk::SimpleHistogram::GetMin().
| int QmitkTransferFunctionCanvas::m_GrabbedHandle |
Index of the currently grabbed (selected) handle, or -1.
Definition at line 195 of file QmitkTransferFunctionCanvas.h.
| mitk::SimpleHistogram* QmitkTransferFunctionCanvas::m_Histogram |
The background histogram.
Definition at line 216 of file QmitkTransferFunctionCanvas.h.
|
protected |
Definition at line 288 of file QmitkTransferFunctionCanvas.h.
|
protected |
Definition at line 291 of file QmitkTransferFunctionCanvas.h.
| double QmitkTransferFunctionCanvas::m_Lower |
Lower display bound.
Definition at line 197 of file QmitkTransferFunctionCanvas.h.
| double QmitkTransferFunctionCanvas::m_Max |
Maximum data range value.
Definition at line 200 of file QmitkTransferFunctionCanvas.h.
| double QmitkTransferFunctionCanvas::m_Min |
Minimum data range value.
Definition at line 199 of file QmitkTransferFunctionCanvas.h.
|
protected |
Definition at line 289 of file QmitkTransferFunctionCanvas.h.
| double QmitkTransferFunctionCanvas::m_Upper |
Upper display bound.
Definition at line 198 of file QmitkTransferFunctionCanvas.h.
|
protected |
Definition at line 292 of file QmitkTransferFunctionCanvas.h.
|
protected |
Definition at line 293 of file QmitkTransferFunctionCanvas.h.