Slicer 5.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
qMRMLSegmentsTableView.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Program: 3D Slicer
4
5 Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
6 Queen's University, Kingston, ON, Canada. All Rights Reserved.
7
8 See COPYRIGHT.txt
9 or http://www.slicer.org/copyright/copyright.txt for details.
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16
17 This file was originally developed by Csaba Pinter, PerkLab, Queen's University
18 and was supported through the Applied Cancer Research Unit program of Cancer Care
19 Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care
20
21==============================================================================*/
22
23#ifndef __qMRMLSegmentsTableView_h
24#define __qMRMLSegmentsTableView_h
25
26// Segmentations includes
27#include "qSlicerSegmentationsModuleWidgetsExport.h"
28
29// MRMLWidgets includes
30#include "qMRMLWidget.h"
31
32// CTK includes
33#include <ctkPimpl.h>
34#include <ctkVTKObject.h>
35
37class qMRMLSegmentsTableViewPrivate;
39class QContextMenuEvent;
40class QItemSelection;
41class QStandardItem;
42class QStringList;
43class QTableWidgetItem;
44class QTableView;
45class vtkMRMLNode;
46class vtkSegment;
47
48class Q_SLICER_MODULE_SEGMENTATIONS_WIDGETS_EXPORT qMRMLSegmentsTableView : public qMRMLWidget
49{
50 Q_OBJECT
51 QVTK_OBJECT
52
53public:
54 Q_PROPERTY(int selectionMode READ selectionMode WRITE setSelectionMode)
55 Q_PROPERTY(bool headerVisible READ headerVisible WRITE setHeaderVisible)
56 Q_PROPERTY(bool visibilityColumnVisible READ visibilityColumnVisible WRITE setVisibilityColumnVisible)
57 Q_PROPERTY(bool colorColumnVisible READ colorColumnVisible WRITE setColorColumnVisible)
58 Q_PROPERTY(bool opacityColumnVisible READ opacityColumnVisible WRITE setOpacityColumnVisible)
59 Q_PROPERTY(bool statusColumnVisible READ statusColumnVisible WRITE setStatusColumnVisible)
60 Q_PROPERTY(bool layerColumnVisible READ layerColumnVisible WRITE setLayerColumnVisible)
61 Q_PROPERTY(bool readOnly READ readOnly WRITE setReadOnly)
62 Q_PROPERTY(bool filterBarVisible READ filterBarVisible WRITE setFilterBarVisible)
63 Q_PROPERTY(QString textFilter READ textFilter WRITE setTextFilter)
64 Q_PROPERTY(bool jumpToSelectedSegmentEnabled READ jumpToSelectedSegmentEnabled WRITE setJumpToSelectedSegmentEnabled)
65 Q_PROPERTY(int segmentCount READ segmentCount)
66 Q_PROPERTY(QString useTerminologySelectorSettingsKey READ useTerminologySelectorSettingsKey WRITE setUseTerminologySelectorSettingsKey)
67 Q_PROPERTY(bool useTerminologySelector READ useTerminologySelector WRITE setUseTerminologySelector)
68 Q_PROPERTY(bool terminologySelectorOptionVisible READ terminologySelectorOptionVisible WRITE setTerminologySelectorOptionVisible)
69 Q_PROPERTY(bool terminologySelectorAutoDisable READ terminologySelectorAutoDisable WRITE setTerminologySelectorAutoDisable)
70
73 explicit qMRMLSegmentsTableView(QWidget* parent = nullptr);
76
78 Q_INVOKABLE vtkMRMLNode* segmentationNode();
79
81 Q_INVOKABLE QTableView* tableWidget();
82
84 int segmentCount() const;
85
87 Q_INVOKABLE QStringList selectedSegmentIDs();
89 Q_INVOKABLE void setSelectedSegmentIDs(QStringList segmentIDs);
91 Q_INVOKABLE void clearSelection();
92
94 Q_INVOKABLE static QString terminologyTooltipForSegment(vtkSegment* segment);
95
96 int selectionMode();
97 bool headerVisible();
98 bool visibilityColumnVisible();
99 bool colorColumnVisible();
100 bool opacityColumnVisible();
101 bool statusColumnVisible();
102 bool layerColumnVisible();
103 bool readOnly();
104 bool filterBarVisible();
105
108 Q_INVOKABLE void setHideSegments(const QStringList& segmentIDs);
109 Q_INVOKABLE QStringList hideSegments()const;
110
112 Q_INVOKABLE QStringList displayedSegmentIDs()const;
113
114 Q_INVOKABLE qMRMLSortFilterSegmentsProxyModel* sortFilterProxyModel()const;
115 Q_INVOKABLE qMRMLSegmentsModel* model()const;
116
119 QString textFilter();
120
125 QString useTerminologySelectorSettingsKey()const;
126
129 bool useTerminologySelector()const;
130
132 bool terminologySelectorOptionVisible()const;
133
135 bool terminologySelectorAutoDisable()const;
136
137 // If the specified status should be shown in the table
139 Q_INVOKABLE bool statusShown(int status);
140
142 Q_INVOKABLE int rowForSegmentID(QString segmentID);
144 Q_INVOKABLE QString segmentIDForRow(int row);
145
146public slots:
148 void setSegmentationNode(vtkMRMLNode* node);
150 void setMRMLScene(vtkMRMLScene* newScene) override;
151
155 void setSelectionMode(int mode);
156
157 void setHeaderVisible(bool visible);
158 void setVisibilityColumnVisible(bool visible);
159 void setColorColumnVisible(bool visible);
160 void setOpacityColumnVisible(bool visible);
161 void setStatusColumnVisible(bool visible);
162 void setLayerColumnVisible(bool visible);
163 void setReadOnly(bool aReadOnly);
164 void setFilterBarVisible(bool visible);
165
167 void showOnlySelectedSegments();
168
171 void jumpSlices();
172
174 void setJumpToSelectedSegmentEnabled(bool enable);
175
177 void setSelectedSegmentsStatus(int status=-1);
178
180 void clearSelectedSegments();
181
183 void moveSelectedSegmentsUp();
185 void moveSelectedSegmentsDown();
186
189 void setTextFilter(QString textFilter);
192 void setUseTerminologySelectorSettingsKey(QString settingsKey);
194 void setUseTerminologySelector(bool useTerminologySelector);
196 void setTerminologySelectorOptionVisible(bool visible);
198 void setTerminologySelectorAutoDisable(bool autoDisable);
199
202 void setStatusShown(int status, bool shown);
203
205 bool jumpToSelectedSegmentEnabled()const;
206
207signals:
209 void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
210
213 void segmentAboutToBeModified(const QString &segmentID);
214
215protected slots:
217 void onSegmentSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
218
220 void onVisibility3DActionToggled(bool visible);
221 void onVisibility2DFillActionToggled(bool visible);
222 void onVisibility2DOutlineActionToggled(bool visible);
223
225 void onSegmentsFilterModified();
227 void onShowStatusButtonClicked();
228
230 void onSegmentsTableClicked(const QModelIndex& modelIndex);
232 void onSegmentsTableDoubleClicked(const QModelIndex& modelIndex);
233
235 void endProcessing();
236
237 void onSegmentAddedOrRemoved();
238
241 void updateWidgetFromMRML();
242
244 void updateMRMLFromFilterParameters();
245
247 void modelAboutToBeReset();
248 void modelReset();
249
251 void onUseTerminologyActionToggled(bool useTerminology);
252
253protected:
260 void setSegmentVisibility(QObject* senderObject, int visible, int visible3D, int visible2DFill, int visible2DOutline);
261 void setSegmentVisibility(QString segmentId, int visible, int visible3D, int visible2DFill, int visible2DOutline);
262
264 bool eventFilter(QObject* target, QEvent* event) override;
265
267 void contextMenuEvent(QContextMenuEvent* event) override;
268
269 bool userSetCustomNameOrColor();
270
271protected:
272 QScopedPointer<qMRMLSegmentsTableViewPrivate> d_ptr;
273
274private:
275 Q_DECLARE_PRIVATE(qMRMLSegmentsTableView);
276 Q_DISABLE_COPY(qMRMLSegmentsTableView);
277};
278
279#endif
Item model for segments.
Base class for any widget that requires a MRML Scene.
Definition qMRMLWidget.h:36
Abstract Superclass for all specific types of MRML nodes.
A set of MRML Nodes that supports serialization and undo/redo.
This class encapsulates a segment that is part of a segmentation.
Definition vtkSegment.h:45