Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef mitkQMAPAlgorithmModel_h
18 #define mitkQMAPAlgorithmModel_h
19 
20 #include <QAbstractTableModel>
21 #include <QStringList>
22 
23 //MITK
25 
26 // MatchPoint
27 #include <mapRegistrationAlgorithmBase.h>
28 #include <mapMetaPropertyAlgorithmInterface.h>
29 
30 namespace mitk
31 {
42 class MITKMATCHPOINTREGISTRATION_EXPORT QMAPAlgorithmModel : public QAbstractTableModel
43 {
44  Q_OBJECT
45 
46  public:
47  QMAPAlgorithmModel(QObject *parent = NULL);
48  virtual ~QMAPAlgorithmModel() {};
49 
50  void SetAlgorithm(map::algorithm::RegistrationAlgorithmBase *pAlgorithm);
51  void SetAlgorithm(map::algorithm::facet::MetaPropertyAlgorithmInterface *pMetaInterface);
52 
53  virtual Qt::ItemFlags flags(const QModelIndex &index) const;
54  virtual QVariant data(const QModelIndex &index, int role) const;
55  virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
56  virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
57  virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
58  virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
59 
60 
61 private:
62  void UpdateMetaProperties() const ;
63 
67  QVariant GetPropertyValue(const map::algorithm::MetaPropertyInfo* pInfo, int role) const;
68 
69  template <typename TValueType> bool CheckCastAndSetProp(const map::algorithm::MetaPropertyInfo* pInfo, const QVariant& value);
70 
71  bool SetPropertyValue(const map::algorithm::MetaPropertyInfo* pInfo, const QVariant& value);
72 
73  map::algorithm::facet::MetaPropertyAlgorithmInterface *m_pMetaInterface;
74  mutable map::algorithm::facet::MetaPropertyAlgorithmInterface::MetaPropertyVectorType m_MetaProperties;
75 };
76 
77 };
78 
79 #endif // mitkQMAPAlgorithmModel_h
80 
DataCollection - Class to facilitate loading/accessing structured data.
#define MITKMATCHPOINTREGISTRATION_EXPORT