Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLSegmentSelectorWidget.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 __qMRMLSegmentSelectorWidget_h
24 #define __qMRMLSegmentSelectorWidget_h
25 
26 // qMRMLWidgets includes
27 #include "qMRMLWidget.h"
28 #include "qMRMLWidgetsExport.h"
29 
30 // CTK includes
31 #include <ctkPimpl.h>
32 #include <ctkVTKObject.h>
33 
34 class vtkMRMLNode;
35 class qMRMLSegmentSelectorWidgetPrivate;
36 class QTableWidgetItem;
37 class QItemSelection;
38 class QStringList;
39 
43 class QMRML_WIDGETS_EXPORT qMRMLSegmentSelectorWidget : public qMRMLWidget
44 {
45  Q_OBJECT
46  QVTK_OBJECT
47 
48 public:
49  Q_PROPERTY(bool noneEnabled READ noneEnabled WRITE setNoneEnabled)
50  Q_PROPERTY(bool editEnabled READ editEnabled WRITE setEditEnabled)
51  Q_PROPERTY(bool segmentationNodeSelectorVisible READ segmentationNodeSelectorVisible WRITE setSegmentationNodeSelectorVisible)
52  Q_PROPERTY(bool multiSelection READ multiSelection WRITE setMultiSelection)
53  Q_PROPERTY(bool horizontalLayout READ horizontalLayout WRITE setHorizontalLayout)
54  Q_PROPERTY(bool selectNodeUponCreation READ selectNodeUponCreation WRITE setSelectNodeUponCreation)
55 
56 public:
59 
61  explicit qMRMLSegmentSelectorWidget(QWidget* parent = nullptr);
63  ~qMRMLSegmentSelectorWidget() override;
64 
66  Q_INVOKABLE vtkMRMLNode* currentNode();
68  Q_INVOKABLE QString currentNodeID();
69 
72  Q_INVOKABLE QString currentSegmentID();
75  Q_INVOKABLE QStringList selectedSegmentIDs();
76 
81  Q_INVOKABLE QStringList segmentIDs();
82 
85  bool noneEnabled()const;
88  void setNoneEnabled(bool enable);
89 
92  bool editEnabled()const;
95  void setEditEnabled(bool enable);
96 
99  bool segmentationNodeSelectorVisible()const;
102  void setSegmentationNodeSelectorVisible(bool visible);
103 
106  bool multiSelection()const;
109  void setMultiSelection(bool multi);
110 
113  bool horizontalLayout()const;
116  void setHorizontalLayout(bool horizontal);
117 
121  bool selectNodeUponCreation()const;
122  void setSelectNodeUponCreation(bool value);
123 
124 public slots:
126  Q_INVOKABLE void setCurrentNode(vtkMRMLNode* node);
128  Q_INVOKABLE void setCurrentNodeID(const QString& nodeID);
129 
132  Q_INVOKABLE void setCurrentSegmentID(QString segmentID);
135  Q_INVOKABLE void setSelectedSegmentIDs(QStringList segmentIDList);
136 
137 protected slots:
139  Q_INVOKABLE void onCurrentNodeChanged(vtkMRMLNode* node);
141  void onCurrentSegmentChanged(int index);
143  void onSegmentMultiSelectionChanged();
144 
146  void populateSegmentCombobox();
147 
148 signals:
149  void currentNodeChanged(vtkMRMLNode*);
150  void currentSegmentChanged(QString);
151  void segmentSelectionChanged(QStringList);
152 
154  void nodeAboutToBeEdited(vtkMRMLNode* node);
155 
159  void currentNodeChanged(bool validNode);
160 
161 protected:
162  QScopedPointer<qMRMLSegmentSelectorWidgetPrivate> d_ptr;
163 
164 private:
165  Q_DECLARE_PRIVATE(qMRMLSegmentSelectorWidget);
166  Q_DISABLE_COPY(qMRMLSegmentSelectorWidget);
167 };
168 
169 #endif
Base class for any widget that requires a MRML Scene.
Definition: qMRMLWidget.h:35
Qt widget for selecting a single segment from a segmentation. If multiple segments are needed...
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167