Slicer 5.6
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
68 explicit qMRMLSegmentsTableView(QWidget* parent = nullptr);
71
73 Q_INVOKABLE vtkMRMLNode* segmentationNode();
74
76 Q_INVOKABLE QTableView* tableWidget();
77
79 int segmentCount() const;
80
82 Q_INVOKABLE QStringList selectedSegmentIDs();
84 Q_INVOKABLE void setSelectedSegmentIDs(QStringList segmentIDs);
86 Q_INVOKABLE void clearSelection();
87
89 Q_INVOKABLE static QString terminologyTooltipForSegment(vtkSegment* segment);
90
91 int selectionMode();
92 bool headerVisible();
93 bool visibilityColumnVisible();
94 bool colorColumnVisible();
95 bool opacityColumnVisible();
96 bool statusColumnVisible();
97 bool layerColumnVisible();
98 bool readOnly();
99 bool filterBarVisible();
100
103 Q_INVOKABLE void setHideSegments(const QStringList& segmentIDs);
104 Q_INVOKABLE QStringList hideSegments()const;
105
107 Q_INVOKABLE QStringList displayedSegmentIDs()const;
108
109 Q_INVOKABLE qMRMLSortFilterSegmentsProxyModel* sortFilterProxyModel()const;
110 Q_INVOKABLE qMRMLSegmentsModel* model()const;
111
114 QString textFilter();
115 // If the specified status should be shown in the table
117 Q_INVOKABLE bool statusShown(int status);
118
120 int rowForSegmentID(QString segmentID);
122 QString segmentIDForRow(int row);
123
124public slots:
126 void setSegmentationNode(vtkMRMLNode* node);
128 void setMRMLScene(vtkMRMLScene* newScene) override;
129
133 void setSelectionMode(int mode);
134
135 void setHeaderVisible(bool visible);
136 void setVisibilityColumnVisible(bool visible);
137 void setColorColumnVisible(bool visible);
138 void setOpacityColumnVisible(bool visible);
139 void setStatusColumnVisible(bool visible);
140 void setLayerColumnVisible(bool visible);
141 void setReadOnly(bool aReadOnly);
142 void setFilterBarVisible(bool visible);
143
145 void showOnlySelectedSegments();
146
149 void jumpSlices();
150
152 void setJumpToSelectedSegmentEnabled(bool enable);
153
155 void setSelectedSegmentsStatus(int status=-1);
156
158 void clearSelectedSegments();
159
161 void moveSelectedSegmentsUp();
163 void moveSelectedSegmentsDown();
164
167 void setTextFilter(QString textFilter);
170 void setStatusShown(int status, bool shown);
171
173 bool jumpToSelectedSegmentEnabled()const;
174
175signals:
177 void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
178
181 void segmentAboutToBeModified(const QString &segmentID);
182
183protected slots:
185 void onSegmentSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
186
188 void onVisibility3DActionToggled(bool visible);
189 void onVisibility2DFillActionToggled(bool visible);
190 void onVisibility2DOutlineActionToggled(bool visible);
191
193 void onSegmentsFilterModified();
195 void onShowStatusButtonClicked();
196
198 void onSegmentsTableClicked(const QModelIndex& modelIndex);
199
201 void endProcessing();
202
203 void onSegmentAddedOrRemoved();
204
207 void updateWidgetFromMRML();
208
210 void updateMRMLFromFilterParameters();
211
213 void modelAboutToBeReset();
214 void modelReset();
215
216protected:
223 void setSegmentVisibility(QObject* senderObject, int visible, int visible3D, int visible2DFill, int visible2DOutline);
224 void setSegmentVisibility(QString segmentId, int visible, int visible3D, int visible2DFill, int visible2DOutline);
225
227 bool eventFilter(QObject* target, QEvent* event) override;
228
230 void contextMenuEvent(QContextMenuEvent* event) override;
231
232protected:
233 QScopedPointer<qMRMLSegmentsTableViewPrivate> d_ptr;
234
235private:
236 Q_DECLARE_PRIVATE(qMRMLSegmentsTableView);
237 Q_DISABLE_COPY(qMRMLSegmentsTableView);
238};
239
240#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