Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkIsoDoseLevelSetModel Class Reference

Table model for viewing and editing the contents of an mitk::IsoDoseLevelSet. More...

#include <QmitkIsoDoseLevelSetModel.h>

Inheritance diagram for QmitkIsoDoseLevelSetModel:
Collaboration diagram for QmitkIsoDoseLevelSetModel:

Public Slots

void setReferenceDose (double newReferenceDose)
 Sets the reference dose used for absolute/relative conversion. More...
 
void setShowAbsoluteDose (bool showAbsoluteDose)
 Sets whether dose values should be displayed as absolute (Gy) or relative (%). More...
 
void setVisibilityEditOnly (bool onlyVisibility)
 Sets whether the model allows editing only the visibility columns. More...
 

Public Member Functions

 QmitkIsoDoseLevelSetModel (QObject *parent=nullptr)
 Constructor. More...
 
 ~QmitkIsoDoseLevelSetModel () override
 Destructor. More...
 
void setIsoDoseLevelSet (mitk::IsoDoseLevelSet *pSet)
 Sets the iso dose level set managed by this model and resets the modified flag. More...
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 Returns item flags for the given index. More...
 
QVariant data (const QModelIndex &index, int role) const override
 Returns data for the given index and role. More...
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const override
 Returns header data for the given section, orientation, and role. More...
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 Returns the number of iso dose levels in the set. More...
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 Returns the number of columns (always 4). More...
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 Sets data at the given index for the given role. More...
 
bool getShowAbsoluteDose () const
 Returns whether dose values are displayed as absolute values. More...
 
mitk::DoseValueAbs getReferenceDose () const
 Returns the current reference dose. More...
 
bool getVisibilityEditOnly () const
 Returns whether the model allows editing only visibility columns. More...
 
void switchVisibilityIsoLines (bool activate)
 Sets the iso line visibility for all levels. More...
 
void switchVisibilityColorWash (bool activate)
 Sets the color wash visibility for all levels. More...
 
void invertVisibilityIsoLines ()
 Inverts the iso line visibility of all levels. More...
 
void invertVisibilityColorWash ()
 Inverts the color wash visibility of all levels. More...
 
void swapVisibility ()
 Swaps the iso line and color wash visibility for all levels. More...
 
void addLevel ()
 Adds a new iso dose level at the end of the set. More...
 
void deleteLevel (const QModelIndex &index)
 Deletes the iso dose level at the given model index. More...
 
bool isModified ()
 Checks whether the model content has been modified since the last setIsoDoseLevelSet() call. More...
 

Detailed Description

Table model for viewing and editing the contents of an mitk::IsoDoseLevelSet.

This model exposes an IsoDoseLevelSet as a 4-column table with columns for:

  • Column 0: Color (Qt::EditRole returns QColor)
  • Column 1: Dose value (absolute in Gy or relative in %)
  • Column 2: Iso line visibility (boolean)
  • Column 3: Color wash visibility (boolean)

Use the specialized delegates QmitkDoseColorDelegate, QmitkDoseValueDelegate, and QmitkDoseVisualStyleDelegate for proper rendering and editing in views.

See also
QmitkDoseColorDelegate
QmitkDoseValueDelegate
QmitkDoseVisualStyleDelegate
mitk::IsoDoseLevelSet

Definition at line 41 of file QmitkIsoDoseLevelSetModel.h.

Constructor & Destructor Documentation

◆ QmitkIsoDoseLevelSetModel()

QmitkIsoDoseLevelSetModel::QmitkIsoDoseLevelSetModel ( QObject *  parent = nullptr)
explicit

Constructor.

Parameters
[in]parentOptional parent QObject.

◆ ~QmitkIsoDoseLevelSetModel()

QmitkIsoDoseLevelSetModel::~QmitkIsoDoseLevelSetModel ( )
inlineoverride

Destructor.

Definition at line 53 of file QmitkIsoDoseLevelSetModel.h.

Member Function Documentation

◆ addLevel()

void QmitkIsoDoseLevelSetModel::addLevel ( )

Adds a new iso dose level at the end of the set.

The new level has a dose value slightly above the current maximum (or 0.01 if the set is empty), default color, and both visibility flags set to true.

◆ columnCount()

int QmitkIsoDoseLevelSetModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const
override

Returns the number of columns (always 4).

Parameters
[in]parentThe parent index.
Returns
4 (color, dose value, iso line visibility, color wash visibility).

◆ data()

QVariant QmitkIsoDoseLevelSetModel::data ( const QModelIndex &  index,
int  role 
) const
override

Returns data for the given index and role.

Parameters
[in]indexThe model index to query.
[in]roleThe Qt role for the data request.
Returns
The requested data as QVariant.

◆ deleteLevel()

void QmitkIsoDoseLevelSetModel::deleteLevel ( const QModelIndex &  index)

Deletes the iso dose level at the given model index.

Parameters
[in]indexThe model index of the level to delete. Invalid indices are ignored.

◆ flags()

Qt::ItemFlags QmitkIsoDoseLevelSetModel::flags ( const QModelIndex &  index) const
override

Returns item flags for the given index.

Parameters
[in]indexThe model index to query.
Returns
The Qt::ItemFlags for the given index.

◆ getReferenceDose()

mitk::DoseValueAbs QmitkIsoDoseLevelSetModel::getReferenceDose ( ) const

Returns the current reference dose.

Returns
The reference dose in Gy.

◆ getShowAbsoluteDose()

bool QmitkIsoDoseLevelSetModel::getShowAbsoluteDose ( ) const

Returns whether dose values are displayed as absolute values.

Returns
True if absolute dose display mode is active.

◆ getVisibilityEditOnly()

bool QmitkIsoDoseLevelSetModel::getVisibilityEditOnly ( ) const

Returns whether the model allows editing only visibility columns.

Returns
True if dose value and color columns are read-only.

◆ headerData()

QVariant QmitkIsoDoseLevelSetModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const
override

Returns header data for the given section, orientation, and role.

Parameters
[in]sectionThe column section index.
[in]orientationThe header orientation (only horizontal is supported).
[in]roleThe Qt role for the data request.
Returns
The header text as QVariant.

◆ invertVisibilityColorWash()

void QmitkIsoDoseLevelSetModel::invertVisibilityColorWash ( )

Inverts the color wash visibility of all levels.

◆ invertVisibilityIsoLines()

void QmitkIsoDoseLevelSetModel::invertVisibilityIsoLines ( )

Inverts the iso line visibility of all levels.

◆ isModified()

bool QmitkIsoDoseLevelSetModel::isModified ( )

Checks whether the model content has been modified since the last setIsoDoseLevelSet() call.

Returns
True if modifications have been made.

◆ rowCount()

int QmitkIsoDoseLevelSetModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
override

Returns the number of iso dose levels in the set.

Parameters
[in]parentThe parent index (must be invalid for table models).
Returns
The number of rows (iso dose levels).

◆ setData()

bool QmitkIsoDoseLevelSetModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
override

Sets data at the given index for the given role.

Modifies the underlying IsoDoseLevelSet by cloning the affected level, updating the changed field, and reinserting it (which re-sorts the set).

Parameters
[in]indexThe model index to modify.
[in]valueThe new value as QVariant.
[in]roleThe Qt role (only Qt::EditRole is handled).
Returns
True if the data was successfully set.

◆ setIsoDoseLevelSet()

void QmitkIsoDoseLevelSetModel::setIsoDoseLevelSet ( mitk::IsoDoseLevelSet *  pSet)

Sets the iso dose level set managed by this model and resets the modified flag.

Parameters
[in]pSetThe IsoDoseLevelSet to display and edit. If nullptr, no action is taken.

◆ setReferenceDose

void QmitkIsoDoseLevelSetModel::setReferenceDose ( double  newReferenceDose)
slot

Sets the reference dose used for absolute/relative conversion.

Parameters
[in]newReferenceDoseThe new reference dose in Gy. Must be positive.
Exceptions
mitk::Exceptionif newReferenceDose is zero or negative.

◆ setShowAbsoluteDose

void QmitkIsoDoseLevelSetModel::setShowAbsoluteDose ( bool  showAbsoluteDose)
slot

Sets whether dose values should be displayed as absolute (Gy) or relative (%).

Parameters
[in]showAbsoluteDoseIf true, values are shown in Gy; otherwise in percent.

◆ setVisibilityEditOnly

void QmitkIsoDoseLevelSetModel::setVisibilityEditOnly ( bool  onlyVisibility)
slot

Sets whether the model allows editing only the visibility columns.

Parameters
[in]onlyVisibilityIf true, dose value and color columns become read-only.

◆ swapVisibility()

void QmitkIsoDoseLevelSetModel::swapVisibility ( )

Swaps the iso line and color wash visibility for all levels.

◆ switchVisibilityColorWash()

void QmitkIsoDoseLevelSetModel::switchVisibilityColorWash ( bool  activate)

Sets the color wash visibility for all levels.

Parameters
[in]activateIf true, all color washes are made visible; if false, all are hidden.

◆ switchVisibilityIsoLines()

void QmitkIsoDoseLevelSetModel::switchVisibilityIsoLines ( bool  activate)

Sets the iso line visibility for all levels.

Parameters
[in]activateIf true, all iso lines are made visible; if false, all are hidden.

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