Medical Imaging Interaction Toolkit  2024.06.00
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 QmitkPointListModel_h
14 #define QmitkPointListModel_h
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
mitk::PointSet::PointIdentifier
DataType::PointIdentifier PointIdentifier
Definition: mitkPointSet.h:129
MITKQTWIDGETSEXT_EXPORT
#define MITKQTWIDGETSEXT_EXPORT
Definition: MitkQtWidgetsExtExports.h:15
QmitkPointListModel::m_PointSetNode
mitk::DataNode * m_PointSetNode
Definition: QmitkPointListModel.h:119
QmitkPointListModel::m_PointSetModifiedObserverTag
unsigned int m_PointSetModifiedObserverTag
Definition: QmitkPointListModel.h:120
mitkPointSet.h
QmitkPointListModel::m_TimeStep
int m_TimeStep
Definition: QmitkPointListModel.h:122
mitk::Point< ScalarType, 3 >
mitkDataNode.h
MitkQtWidgetsExtExports.h
mitk::PointSet
Data structure which stores a set of points.
Definition: mitkPointSet.h:71
QmitkPointListModel
Definition: QmitkPointListModel.h:22
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63
QmitkPointListModel::m_PointSetDeletedObserverTag
unsigned int m_PointSetDeletedObserverTag
Definition: QmitkPointListModel.h:121