Slicer  4.11
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 
79  bool noneEnabled()const;
82  void setNoneEnabled(bool enable);
83 
86  bool editEnabled()const;
89  void setEditEnabled(bool enable);
90 
93  bool segmentationNodeSelectorVisible()const;
96  void setSegmentationNodeSelectorVisible(bool visible);
97 
100  bool multiSelection()const;
103  void setMultiSelection(bool multi);
104 
107  bool horizontalLayout()const;
110  void setHorizontalLayout(bool horizontal);
111 
115  bool selectNodeUponCreation()const;
116  void setSelectNodeUponCreation(bool value);
117 
118 public slots:
120  Q_INVOKABLE void setCurrentNode(vtkMRMLNode* node);
122  Q_INVOKABLE void setCurrentNodeID(const QString& nodeID);
123 
126  Q_INVOKABLE void setCurrentSegmentID(QString segmentID);
129  Q_INVOKABLE void setSelectedSegmentIDs(QStringList segmentIDList);
130 
131 protected slots:
133  Q_INVOKABLE void onCurrentNodeChanged(vtkMRMLNode* node);
135  void onCurrentSegmentChanged(int index);
137  void onSegmentMultiSelectionChanged();
138 
140  void populateSegmentCombobox();
141 
142 signals:
143  void currentNodeChanged(vtkMRMLNode*);
144  void currentSegmentChanged(QString);
145  void segmentSelectionChanged(QStringList);
146 
148  void nodeAboutToBeEdited(vtkMRMLNode* node);
149 
153  void currentNodeChanged(bool validNode);
154 
155 protected:
156  QScopedPointer<qMRMLSegmentSelectorWidgetPrivate> d_ptr;
157 
158 private:
159  Q_DECLARE_PRIVATE(qMRMLSegmentSelectorWidget);
160  Q_DISABLE_COPY(qMRMLSegmentSelectorWidget);
161 };
162 
163 #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