Slicer  5.1
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerSegmentationsModuleWidget.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 Csaba Pinter, PerkLab, Queen's University
16  and was supported through the Applied Cancer Research Unit program of Cancer Care
17  Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care
18 
19 ==============================================================================*/
20 
21 #ifndef __qSlicerSegmentationsModuleWidget_h
22 #define __qSlicerSegmentationsModuleWidget_h
23 
24 // Slicer includes
26 
27 #include "qSlicerSegmentationsModuleExport.h"
28 
29 // SlicerRtCommon includes
31 
32 // CTK includes
33 #include <ctkVTKObject.h>
34 
35 class qSlicerSegmentationsModuleWidgetPrivate;
39 class vtkMRMLNodeReference;
40 class vtkMRMLNode;
41 class QItemSelection;
42 class Ui_qSlicerSegmentationsModule;
43 
45 class Q_SLICER_QTMODULES_SEGMENTATIONS_EXPORT qSlicerSegmentationsModuleWidget :
47 {
48  Q_OBJECT
49  QVTK_OBJECT
50 
51 public:
53  qSlicerSegmentationsModuleWidget(QWidget *parent=nullptr);
55 
56  void enter() override;
57  void exit() override;
58 
60  bool setEditedNode(vtkMRMLNode* node, QString role=QString(), QString context=QString()) override;
61 
62 public slots:
64  void updateWidgetFromMRML();
65 
67  void selectSegmentationNode(vtkMRMLSegmentationNode* segmentationNode);
68 
69 protected:
70  void setup() override;
71  void onEnter();
72 
74  void init();
75 
78  vtkMRMLSegmentationDisplayNode* segmentationDisplayNode(bool create=false);
79 
86  bool copySegmentBetweenSegmentations(vtkSegmentation* fromSegmentation,
87  vtkSegmentation* toSegmentation, QString segmentId, bool removeFromSource=false);
88 
93  bool copySegmentsBetweenSegmentations(bool copyFromCurrentSegmentation, bool removeFromSource = false);
94 
95  bool exportFromCurrentSegmentation();
96  bool importToCurrentSegmentation();
97 
98 protected slots:
100  void onSegmentationNodeChanged(vtkMRMLNode* node);
101 
103  void setOtherSegmentationOrRepresentationNode(vtkMRMLNode* node);
104 
106  void updateCopyMoveButtonStates();
107 
109  void onSegmentSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
110 
112  void onSegmentationNodeReferenceChanged();
113 
114  void onAddSegment();
115  void onEditSegmentation();
116  void onRemoveSelectedSegments();
117 
118  void updateLayerWidgets();
119  void collapseLabelmapLayers();
120 
121  void updateImportExportWidgets();
122  void onImportExportApply();
123  void onImportExportClearSelection();
124  void updateExportColorWidgets();
125  void onExportColorTableChanged();
126 
127  void onMoveFromCurrentSegmentation();
128  void onCopyFromCurrentSegmentation();
129  void onCopyToCurrentSegmentation();
130  void onMoveToCurrentSegmentation();
131 
132  void onMRMLSceneEndImportEvent();
133  void onMRMLSceneEndRestoreEvent();
134  void onMRMLSceneEndBatchProcessEvent();
135  void onMRMLSceneEndCloseEvent();
136 
137 protected:
138  QScopedPointer<qSlicerSegmentationsModuleWidgetPrivate> d_ptr;
139 
140 private:
141  Q_DECLARE_PRIVATE(qSlicerSegmentationsModuleWidget);
142  Q_DISABLE_COPY(qSlicerSegmentationsModuleWidget);
143 };
144 #endif
Q_INVOKABLE bool setEditedNode(vtkMRMLNode *node, QString role=QString(), QString context=QString()) override
Node editing.
MRML node to represent a complete subject hierarchy tree.
This class encapsulates a segmentation that can contain multiple segments and multiple representation...
MRML node for representing segmentation display attributes.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
virtual Q_INVOKABLE void enter()
virtual Q_INVOKABLE void exit()
QScopedPointer< qSlicerSegmentationsModuleWidgetPrivate > d_ptr
MRML node containing segmentationsSegmentation node stores a set of segments (also known as contours ...