Medical Imaging Interaction Toolkit  2018.4.99-f51274ea
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 (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 QMITK_POINTLIST_MODEL_H_INCLUDED
14 #define QMITK_POINTLIST_MODEL_H_INCLUDED
15 
17 #include <QAbstractListModel>
18 
19 #include "mitkDataNode.h"
20 #include "mitkPointSet.h"
21 
22 class MITKQTWIDGETSEXT_EXPORT QmitkPointListModel : public QAbstractListModel
23 {
24  Q_OBJECT
25 
26 public:
27  QmitkPointListModel(mitk::DataNode * = nullptr, int t = 0, QObject *parent = nullptr);
28  ~QmitkPointListModel() override;
29 
30  Qt::ItemFlags flags(const QModelIndex &) const override;
31 
33  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
34 
36  QVariant data(const QModelIndex &index, int role) const override;
37 
39  QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
40 
42  void SetPointSetNode(mitk::DataNode *pointSetNode);
43 
45  mitk::PointSet *GetPointSet() const;
46 
47  // which point set to work on
48  mitk::DataNode *GetPointSetNode() const;
49 
51  void SetTimeStep(int t);
52 
54  int GetTimeStep() const;
55 
57  void OnPointSetChanged(const itk::EventObject &e);
58 
60  void OnPointSetDeleted(const itk::EventObject &e);
61 
77  bool GetPointForModelIndex(const QModelIndex &index,
80 
93  bool GetModelIndexForPointID(mitk::PointSet::PointIdentifier id, QModelIndex &index) const;
94 
95 public slots:
96 
97  void MoveSelectedPointUp();
98 
99  void MoveSelectedPointDown();
100 
101  void RemoveSelectedPoint();
102 
103 signals:
104 
108  void SignalUpdateSelection();
109 
110 protected:
112  void ObserveNewPointSet(mitk::DataNode *pointSetNode);
113 
114  // initially checks if there is a PointSet as data in the DataNode.
115  // returns PointSet if so and nullptr if other data is set to node
116  mitk::PointSet *CheckForPointSetInNode(mitk::DataNode *node) const;
117 
118 protected:
123 };
124 
125 #endif
#define MITKQTWIDGETSEXT_EXPORT
unsigned int m_PointSetDeletedObserverTag
DataType::PointIdentifier PointIdentifier
Definition: mitkPointSet.h:133
Data structure which stores a set of points. Superclass of mitk::Mesh.
Definition: mitkPointSet.h:75
unsigned int m_PointSetModifiedObserverTag
mitk::DataNode * m_PointSetNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57