Slicer  5.3
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerSegmentEditorScriptedEffect.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 __qSlicerSegmentEditorScriptedEffect_h
24 #define __qSlicerSegmentEditorScriptedEffect_h
25 
26 // Segmentations Editor Effects includes
28 
29 #include "qSlicerSegmentationsEditorEffectsExport.h"
30 
31 // Forward Declare PyObject*
32 #ifndef PyObject_HEAD
33 struct _object;
34 typedef _object PyObject;
35 #endif
36 class qSlicerSegmentEditorScriptedEffectPrivate;
37 
46 class Q_SLICER_SEGMENTATIONS_EFFECTS_EXPORT qSlicerSegmentEditorScriptedEffect
48 {
49  Q_OBJECT
50 
51 public:
53  qSlicerSegmentEditorScriptedEffect(QObject* parent = nullptr);
55 
56  Q_INVOKABLE QString pythonSource()const;
57 
60  Q_INVOKABLE bool setPythonSource(const QString newPythonSource);
61 
63  Q_INVOKABLE PyObject* self() const;
64 
67  void setName(QString name) override;
68 
70  void setPerSegment(bool perSegment) override;
71 
73  void setRequireSegments(bool requireSegments) override;
74 
75 // API: Methods that are to be reimplemented in the effect subclasses
76 public:
78  QIcon icon() override;
79 
81  const QString helpText()const override;
82 
85 
87  void activate() override;
88 
90  void deactivate() override;
91 
93  void setupOptionsFrame() override;
94 
96  QCursor createCursor(qMRMLWidget* viewWidget) override;
97 
102  bool processInteractionEvents(vtkRenderWindowInteractor* callerInteractor, unsigned long eid, qMRMLWidget* viewWidget) override;
103 
108  void processViewNodeEvents(vtkMRMLAbstractViewNode* callerViewNode, unsigned long eid, qMRMLWidget* viewWidget) override;
109 
111  void setMRMLDefaults() override;
112 
114  void referenceGeometryChanged() override;
116  void sourceVolumeNodeChanged() override;
118  void masterVolumeNodeChanged() override;
120  void layoutChanged() override;
122  void interactionNodeModified(vtkMRMLInteractionNode* interactionNode) override;
123 
124 public slots:
126  void updateGUIFromMRML() override;
127 
129  void updateMRMLFromGUI() override;
130 
131 protected:
132  QScopedPointer<qSlicerSegmentEditorScriptedEffectPrivate> d_ptr;
133 
134 private:
135  Q_DECLARE_PRIVATE(qSlicerSegmentEditorScriptedEffect);
136  Q_DISABLE_COPY(qSlicerSegmentEditorScriptedEffect);
137 };
138 
139 #endif
virtual void interactionNodeModified(vtkMRMLInteractionNode *interactionNode)
virtual bool processInteractionEvents(vtkRenderWindowInteractor *callerInteractor, unsigned long eid, qMRMLWidget *viewWidget)
virtual void setRequireSegments(bool requireSegments)
If this property is set to true then this effect is enabled only when the segmentation has segment(s)...
virtual Q_INVOKABLE const QString helpText() const
Get help text for effect to be displayed in the help box.
Abstract class for segment editor effects.
virtual void masterVolumeNodeChanged()
Deprecated. Override sourceVolumeNodeChanged() method instead.
qSlicerSegmentEditorAbstractEffect Superclass
virtual Q_INVOKABLE void deactivate()
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D...
virtual QCursor createCursor(qMRMLWidget *viewWidget)
Create a cursor customized for the given effect, potentially for each view.
Base class for any widget that requires a MRML Scene.
Definition: qMRMLWidget.h:35
Scripted abstract effect for implementing segment editor effects in python.
virtual void setPerSegment(bool perSegment)
virtual qSlicerSegmentEditorAbstractEffect * clone()=0
Clone editor effect. Override to return a new instance of the effect sub-class.
virtual void processViewNodeEvents(vtkMRMLAbstractViewNode *callerViewNode, unsigned long eid, qMRMLWidget *viewWidget)
virtual QIcon icon()
Get icon for effect to be displayed in segment editor.
virtual void setName(QString name)
virtual void layoutChanged()
Simple mechanism to let the effects know that the layout has changed.
_object PyObject
virtual Q_INVOKABLE void activate()
QScopedPointer< qSlicerSegmentEditorScriptedEffectPrivate > d_ptr