Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkPointListModel.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 QMITK_POINTLIST_MODEL_H_INCLUDED
18 #define QMITK_POINTLIST_MODEL_H_INCLUDED
19 
21 #include <QAbstractListModel>
22 
23 #include "mitkDataNode.h"
24 #include "mitkPointSet.h"
25 
26 class MITKQTWIDGETSEXT_EXPORT QmitkPointListModel : public QAbstractListModel
27 {
28  Q_OBJECT
29 
30 public:
31  QmitkPointListModel(mitk::DataNode * = NULL, int t = 0, QObject *parent = 0);
33 
34  Qt::ItemFlags flags(const QModelIndex &) const override;
35 
37  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
38 
40  QVariant data(const QModelIndex &index, int role) const override;
41 
43  QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
44 
46  void SetPointSetNode(mitk::DataNode *pointSetNode);
47 
49  mitk::PointSet *GetPointSet() const;
50 
51  // which point set to work on
52  mitk::DataNode *GetPointSetNode() const;
53 
55  void SetTimeStep(int t);
56 
58  int GetTimeStep() const;
59 
61  void OnPointSetChanged(const itk::EventObject &e);
62 
64  void OnPointSetDeleted(const itk::EventObject &e);
65 
81  bool GetPointForModelIndex(const QModelIndex &index,
84 
97  bool GetModelIndexForPointID(mitk::PointSet::PointIdentifier id, QModelIndex &index) const;
98 
99 public slots:
100 
101  void MoveSelectedPointUp();
102 
103  void MoveSelectedPointDown();
104 
105  void RemoveSelectedPoint();
106 
107 signals:
108 
112  void SignalUpdateSelection();
113 
114 protected:
116  void ObserveNewPointSet(mitk::DataNode *pointSetNode);
117 
118  // initially checks if there is a PointSet as data in the DataNode.
119  // returns PointSet if so and NULL if other data is set to node
120  mitk::PointSet *CheckForPointSetInNode(mitk::DataNode *node) const;
121 
122 protected:
127 };
128 
129 #endif
#define MITKQTWIDGETSEXT_EXPORT
unsigned int m_PointSetDeletedObserverTag
DataType::PointIdentifier PointIdentifier
Definition: mitkPointSet.h:135
Data structure which stores a set of points. Superclass of mitk::Mesh.
Definition: mitkPointSet.h:79
unsigned int m_PointSetModifiedObserverTag
mitk::DataNode * m_PointSetNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66