Slicer 5.4
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
qMRMLSortFilterSegmentsProxyModel.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
4 Queen's University, Kingston, ON, Canada. All Rights Reserved.
5
6 See COPYRIGHT.txt
7 or http://www.slicer.org/copyright/copyright.txt for details.
8
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14
15 This file was originally developed by Kyle Sunderland, PerkLab, Queen's University
16 and was supported through CANARIE's Research Software Program, and Cancer
17 Care Ontario.
18
19==============================================================================*/
20
21#ifndef __qMRMLSortFilterSegmentsProxyModel_h
22#define __qMRMLSortFilterSegmentsProxyModel_h
23
24// Segmentation includes
25#include "qSlicerSegmentationsModuleWidgetsExport.h"
26
27// Qt includes
28#include <QSortFilterProxyModel>
29
30// CTK includes
31#include <ctkVTKObject.h>
32#include <ctkPimpl.h>
33
34class qMRMLSortFilterSegmentsProxyModelPrivate;
35class QStandardItem;
37class vtkMRMLScene;
38
40class Q_SLICER_MODULE_SEGMENTATIONS_WIDGETS_EXPORT qMRMLSortFilterSegmentsProxyModel : public QSortFilterProxyModel
41{
42 Q_OBJECT
43 QVTK_OBJECT
44
46 Q_PROPERTY(bool filterEnabled READ filterEnabled WRITE setFilterEnabled)
48 Q_PROPERTY(QString nameFilter READ nameFilter WRITE setNameFilter)
50 Q_PROPERTY(QString textFilter READ textFilter WRITE setTextFilter)
51
52public:
53 typedef QSortFilterProxyModel Superclass;
54 qMRMLSortFilterSegmentsProxyModel(QObject *parent=nullptr);
56
58 Q_INVOKABLE vtkMRMLSegmentationNode* segmentationNode()const;
59
62 Q_INVOKABLE void setHideSegments(const QStringList& segmentIDs);
63 Q_INVOKABLE QStringList hideSegments()const;
64
65 bool filterEnabled()const;
66 QString nameFilter()const;
67 QString textFilter()const;
68
73 Q_INVOKABLE bool showStatus(int status) const;
74
76 Q_INVOKABLE QString segmentIDFromIndex(const QModelIndex& index)const;
77
79 Q_INVOKABLE QModelIndex indexFromSegmentID(QString segmentID, int column=0)const;
80
84 bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent)const override;
85
87 virtual bool filterAcceptsItem(QString segmentID)const;
88
90 Qt::ItemFlags flags(const QModelIndex & index)const override;
91
96 Q_INVOKABLE void setShowStatus(int status, bool shown);
97
98public slots:
99 void setFilterEnabled(bool filterEnabled);
100 void setNameFilter(QString filter);
101 void setTextFilter(QString filter);
102
103signals:
106 void filterModified();
107
108protected:
109 QStandardItem* sourceItem(const QModelIndex& index)const;
110
111protected:
112 QScopedPointer<qMRMLSortFilterSegmentsProxyModelPrivate> d_ptr;
113
114private:
115 Q_DECLARE_PRIVATE(qMRMLSortFilterSegmentsProxyModel);
116 Q_DISABLE_COPY(qMRMLSortFilterSegmentsProxyModel);
117};
118
119#endif
A set of MRML Nodes that supports serialization and undo/redo.
MRML node containing segmentations.