Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkInitialValuesModel.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 QmitkInitialValuesModel_h
14 #define QmitkInitialValuesModel_h
15 
16 #include <QAbstractTableModel>
17 
20 #include <mitkDataNode.h>
22 
23 #include <MitkModelFitUIExports.h>
24 
25 
42 class MITKMODELFITUI_EXPORT QmitkInitialValuesModel : public QAbstractTableModel
43 {
44  Q_OBJECT
45 
46 public:
51  QmitkInitialValuesModel(QObject* parent = nullptr);
52 
54  ~QmitkInitialValuesModel() override {};
55 
71 
81 
97  void addInitialParameterImage(const mitk::DataNode* node, mitk::ModelTraitsInterface::ParametersType::size_type paramIndex);
98 
106  bool hasValidInitialValues() const;
107 
115 
125 
136 
146  Qt::ItemFlags flags(const QModelIndex& index) const override;
147 
158  QVariant data(const QModelIndex& index, int role) const override;
159 
170  QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
171 
177  int rowCount(const QModelIndex& parent = QModelIndex()) const override;
178 
184  int columnCount(const QModelIndex& parent = QModelIndex()) const override;
185 
198  bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
199 
204  bool isModified();
205 
206 private:
207  int valueType(const QModelIndex& index) const;
208 
212 
213  typedef std::map<mitk::ModelTraitsInterface::ParametersType::size_type, mitk::DataNode::ConstPointer> ImageMapType;
214  ImageMapType m_ParameterImageMap;
215 
217  bool m_modified;
218 
219 };
220 
221 #endif
#define MITKMODELFITUI_EXPORT
Qt table model for defining and editing initial parameter values of a model fit.
mitk::InitialParameterizationDelegateBase::Pointer getInitialParametrizationDelegate() const
Creates and returns a delegate representing the full initial parameterization.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of parameters (rows).
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
Returns header data for the specified section.
bool isModified()
Indicates whether the model content has been modified since the last setInitialValues() call.
QmitkInitialValuesModel(QObject *parent=nullptr)
Constructs a QmitkInitialValuesModel.
bool hasValidInitialValues() const
Checks whether all initial values are valid.
~QmitkInitialValuesModel() override
Destructor.
void setInitialValues(const mitk::ModelTraitsInterface::ParameterNamesType &names, const mitk::ModelTraitsInterface::ParametersType values, const mitk::ModelTraitsInterface::ParamterUnitMapType units)
Sets the parameter names, default values, and units.
mitk::ModelTraitsInterface::ParametersType getInitialValues() const
Returns the current scalar initial values.
void resetInitialParameterImage()
Clears all image-based parameter assignments.
Qt::ItemFlags flags(const QModelIndex &index) const override
Returns item flags for the given model index.
QVariant data(const QModelIndex &index, int role) const override
Returns data for the given index and role.
void setInitialValues(const mitk::ModelTraitsInterface::ParameterNamesType &names)
Sets the parameter names with all initial values defaulting to zero.
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of columns (always 4).
void addInitialParameterImage(const mitk::DataNode *node, mitk::ModelTraitsInterface::ParametersType::size_type paramIndex)
Assigns an image as the initial value source for a specific parameter.
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Sets data for a given index.
Central node class of the MITK data tree, associating a data object with properties and mappers.
Definition: mitkDataNode.h:72
std::map< ParameterNameType, std::string > ParamterUnitMapType
Map type associating parameter names to their unit strings.
itk::Array< ParameterValueType > ParametersType
Type representing a vector of parameter values.
std::vector< ParameterNameType > ParameterNamesType
Type for a list of parameter names.