Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkFitPlotDataModel Class Reference

Qt table model for displaying the curve values of a ModelFitPlotData instance. More...

#include <QmitkFitPlotDataModel.h>

Inheritance diagram for QmitkFitPlotDataModel:
Collaboration diagram for QmitkFitPlotDataModel:

Public Types

using FitVectorType = std::vector< mitk::modelFit::ModelFitInfo::ConstPointer >
 Vector type holding const pointers to ModelFitInfo instances. More...
 

Public Slots

void SetPlotData (const mitk::ModelFitPlotData *data)
 Sets the plot data to display. More...
 
void SetXName (const std::string &xName)
 Sets the display name for the x-axis column header. More...
 

Public Member Functions

 QmitkFitPlotDataModel (QObject *parent=nullptr)
 Constructs a QmitkFitPlotDataModel. More...
 
 ~QmitkFitPlotDataModel () override
 Destructor. More...
 
const mitk::ModelFitPlotData * GetPlotData () const
 Returns a pointer to the currently stored plot data. More...
 
const std::string & GetXName () const
 Returns the display name for the x-axis. More...
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 Returns item flags for the given model index (read-only). 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 specified section. More...
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 Returns the number of data points (rows) in the plot data. More...
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 Returns the number of columns. More...
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 Sets data for a given index (currently always returns false; model is read-only). More...
 

Protected Member Functions

std::pair< std::string, const mitk::PlotDataCurve * > GetCurveByColumn (int col) const
 Retrieves the curve name and pointer for the given column index. More...
 
std::pair< bool, mitk::ModelFitPlotData::PositionalCollectionMap::value_type > GetPositionalCurvePoint (const mitk::PlotDataCurve *curve) const
 Determines whether the given curve belongs to a positional collection. More...
 

Detailed Description

Qt table model for displaying the curve values of a ModelFitPlotData instance.

This model presents the numerical data behind model fit plot curves in a tabular form. Column 0 is the sample index, column 1 is the x-axis value, and subsequent columns correspond to individual plot curves (current position, positional, and static plots). Interpolated signal curves are automatically excluded from the column layout.

See also
QmitkFitPlotDataWidget
mitk::ModelFitPlotData

Definition at line 33 of file QmitkFitPlotDataModel.h.

Member Typedef Documentation

◆ FitVectorType

using QmitkFitPlotDataModel::FitVectorType = std::vector<mitk::modelFit::ModelFitInfo::ConstPointer>

Vector type holding const pointers to ModelFitInfo instances.

Definition at line 39 of file QmitkFitPlotDataModel.h.

Constructor & Destructor Documentation

◆ QmitkFitPlotDataModel()

QmitkFitPlotDataModel::QmitkFitPlotDataModel ( QObject *  parent = nullptr)

Constructs a QmitkFitPlotDataModel.

Parameters
[in]parentOptional parent QObject.

◆ ~QmitkFitPlotDataModel()

QmitkFitPlotDataModel::~QmitkFitPlotDataModel ( )
inlineoverride

Destructor.

Definition at line 48 of file QmitkFitPlotDataModel.h.

Member Function Documentation

◆ columnCount()

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

Returns the number of columns.

Equals 2 (index + x-axis) plus the number of non-interpolated curves across current position, positional, and static plot collections.

Parameters
[in]parentThe parent model index.
Returns
The number of columns. Returns 0 if parent is valid.

◆ data()

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

Returns data for the given index and role.

Column 0 returns the row index, column 1 returns the x-axis value, and remaining columns return the y-value of the corresponding curve at the given row.

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

◆ flags()

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

Returns item flags for the given model index (read-only).

Parameters
[in]indexThe model index to query.
Returns
The item flags.

◆ GetCurveByColumn()

std::pair<std::string, const mitk::PlotDataCurve*> QmitkFitPlotDataModel::GetCurveByColumn ( int  col) const
protected

Retrieves the curve name and pointer for the given column index.

Searches through current position plots, positional plots, and static plots (skipping interpolated signal curves) to find the curve matching the column.

Parameters
[in]colThe column index (0-based, accounting for index and x-axis columns).
Returns
A pair of the curve name and a pointer to the PlotDataCurve.

◆ GetPlotData()

const mitk::ModelFitPlotData* QmitkFitPlotDataModel::GetPlotData ( ) const

Returns a pointer to the currently stored plot data.

Returns
Pointer to the internal ModelFitPlotData instance.

◆ GetPositionalCurvePoint()

std::pair<bool, mitk::ModelFitPlotData::PositionalCollectionMap::value_type> QmitkFitPlotDataModel::GetPositionalCurvePoint ( const mitk::PlotDataCurve *  curve) const
protected

Determines whether the given curve belongs to a positional collection.

Parameters
[in]curvePointer to the curve to look up.
Returns
A pair where the first element indicates whether the curve was found in a positional collection, and the second element is the positional collection entry.

◆ GetXName()

const std::string& QmitkFitPlotDataModel::GetXName ( ) const

Returns the display name for the x-axis.

Returns
Const reference to the x-axis name string.

◆ headerData()

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

Returns header data for the specified section.

Column 0 header is "#", column 1 is the x-axis name, and remaining columns show the curve name optionally annotated with the positional collection name.

Parameters
[in]sectionThe column index.
[in]orientationThe header orientation.
[in]roleThe Qt item data role.
Returns
The header data as QVariant.

◆ rowCount()

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

Returns the number of data points (rows) in the plot data.

All curves are assumed to have the same number of data points.

Parameters
[in]parentThe parent model index.
Returns
The number of rows.

◆ setData()

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

Sets data for a given index (currently always returns false; model is read-only).

Parameters
[in]indexThe model index.
[in]valueThe value to set.
[in]roleThe Qt item data role.
Returns
Always false.

◆ SetPlotData

void QmitkFitPlotDataModel::SetPlotData ( const mitk::ModelFitPlotData *  data)
slot

Sets the plot data to display.

Makes a deep copy of the provided data and triggers a full model reset.

Parameters
[in]dataPointer to the ModelFitPlotData to copy and display.

◆ SetXName

void QmitkFitPlotDataModel::SetXName ( const std::string &  xName)
slot

Sets the display name for the x-axis column header.

Triggers a full model reset.

Parameters
[in]xNameThe name to display in the x-axis column header.

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