Medical Imaging Interaction Toolkit  2018.4.99-3e3f1a6e
Medical Imaging Interaction Toolkit
mitkQMAPAlgorithmModel.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 mitkQMAPAlgorithmModel_h
14 #define mitkQMAPAlgorithmModel_h
15 
16 #include <QAbstractTableModel>
17 #include <QStringList>
18 
19 //MITK
21 
22 // MatchPoint
23 #include <mapRegistrationAlgorithmBase.h>
24 #include <mapMetaPropertyAlgorithmInterface.h>
25 
26 namespace mitk
27 {
38 class MITKMATCHPOINTREGISTRATION_EXPORT QMAPAlgorithmModel : public QAbstractTableModel
39 {
40  Q_OBJECT
41 
42  public:
43  QMAPAlgorithmModel(QObject *parent = nullptr);
44  virtual ~QMAPAlgorithmModel() {};
45 
46  void SetAlgorithm(map::algorithm::RegistrationAlgorithmBase *pAlgorithm);
47  void SetAlgorithm(map::algorithm::facet::MetaPropertyAlgorithmInterface *pMetaInterface);
48 
49  virtual Qt::ItemFlags flags(const QModelIndex &index) const;
50  virtual QVariant data(const QModelIndex &index, int role) const;
51  virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
52  virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
53  virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
54  virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
55 
56 
57 private:
58  void UpdateMetaProperties() const ;
59 
63  QVariant GetPropertyValue(const map::algorithm::MetaPropertyInfo* pInfo, int role) const;
64 
65  template <typename TValueType> bool CheckCastAndSetProp(const map::algorithm::MetaPropertyInfo* pInfo, const QVariant& value);
66 
67  bool SetPropertyValue(const map::algorithm::MetaPropertyInfo* pInfo, const QVariant& value);
68 
69  map::algorithm::facet::MetaPropertyAlgorithmInterface *m_pMetaInterface;
70  mutable map::algorithm::facet::MetaPropertyAlgorithmInterface::MetaPropertyVectorType m_MetaProperties;
71 };
72 
73 };
74 
75 #endif // mitkQMAPAlgorithmModel_h
76 
DataCollection - Class to facilitate loading/accessing structured data.
#define MITKMATCHPOINTREGISTRATION_EXPORT