Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
33struct _object;
34typedef _object PyObject;
35#endif
36class qSlicerSegmentEditorScriptedEffectPrivate;
37
45class Q_SLICER_SEGMENTATIONS_EFFECTS_EXPORT qSlicerSegmentEditorScriptedEffect
47{
48 Q_OBJECT
49
50public:
52 qSlicerSegmentEditorScriptedEffect(QObject* parent = nullptr);
54
55 Q_INVOKABLE QString pythonSource()const;
56
59 Q_INVOKABLE bool setPythonSource(const QString newPythonSource);
60
62 Q_INVOKABLE PyObject* self() const;
63
66 void setName(QString name) override;
67
69 void setPerSegment(bool perSegment) override;
70
73
74// API: Methods that are to be reimplemented in the effect subclasses
75public:
77 QIcon icon() override;
78
80 const QString helpText()const override;
81
84
86 void activate() override;
87
89 void deactivate() override;
90
92 void setupOptionsFrame() override;
93
95 QCursor createCursor(qMRMLWidget* viewWidget) override;
96
101 bool processInteractionEvents(vtkRenderWindowInteractor* callerInteractor, unsigned long eid, qMRMLWidget* viewWidget) override;
102
107 void processViewNodeEvents(vtkMRMLAbstractViewNode* callerViewNode, unsigned long eid, qMRMLWidget* viewWidget) override;
108
110 void setMRMLDefaults() override;
111
115 void sourceVolumeNodeChanged() override;
117 void masterVolumeNodeChanged() override;
119 void layoutChanged() override;
121 void interactionNodeModified(vtkMRMLInteractionNode* interactionNode) override;
122
124 void cleanup() override;
125
126public slots:
128 void updateGUIFromMRML() override;
129
131 void updateMRMLFromGUI() override;
132
133protected:
134 QScopedPointer<qSlicerSegmentEditorScriptedEffectPrivate> d_ptr;
135
136private:
137 Q_DECLARE_PRIVATE(qSlicerSegmentEditorScriptedEffect);
139};
140
141#endif
Base class for any widget that requires a MRML Scene.
Definition qMRMLWidget.h:36
qSlicerSegmentEditorAbstractEffect(QObject *parent=nullptr)
QIcon icon() override
Get icon for effect to be displayed in segment editor.
qSlicerSegmentEditorAbstractEffect * clone() override
Clone editor effect. Override to return a new instance of the effect sub-class.
Q_INVOKABLE bool setPythonSource(const QString newPythonSource)
QScopedPointer< qSlicerSegmentEditorScriptedEffectPrivate > d_ptr
void activate() override
Perform actions to activate the effect (show options frame, etc.)
const QString helpText() const override
Get help text for effect to be displayed in the help box.
void layoutChanged() override
Simple mechanism to let the effects know that the layout has changed.
void setName(QString name) override
qSlicerSegmentEditorScriptedEffect(QObject *parent=nullptr)
QCursor createCursor(qMRMLWidget *viewWidget) override
Create a cursor customized for the given effect, potentially for each view.
void updateMRMLFromGUI() override
Update parameter set node from user interface.
void deactivate() override
Perform actions to deactivate the effect (hide options frame, destroy actors, etc....
void masterVolumeNodeChanged() override
Deprecated. Use sourceVolumeNodeChanged() method instead.
void setPerSegment(bool perSegment) override
Set flag indicating whether effect operates on segments (true) or the whole segmentation (false).
void sourceVolumeNodeChanged() override
Simple mechanism to let the effects know that reference volume has changed.
void updateGUIFromMRML() override
Update user interface from parameter set node.
void setMRMLDefaults() override
Set default parameters in the parameter MRML node.
void setRequireSegments(bool requireSegments) override
If this property is set to true then this effect is enabled only when the segmentation has segment(s)...
Q_INVOKABLE QString pythonSource() const
void cleanup() override
Clean up resources, event observers, and Qt signal/slot connections before deletion.
void processViewNodeEvents(vtkMRMLAbstractViewNode *callerViewNode, unsigned long eid, qMRMLWidget *viewWidget) override
Q_INVOKABLE PyObject * self() const
Convenience method allowing to retrieve the associated scripted instance.
void setupOptionsFrame() override
Create options frame widgets, make connections, and add them to the main options frame using.
void interactionNodeModified(vtkMRMLInteractionNode *interactionNode) override
Let the effect know that the interaction node is modified.
void referenceGeometryChanged() override
Simple mechanism to let the effects know that reference geometry change has changed.
bool processInteractionEvents(vtkRenderWindowInteractor *callerInteractor, unsigned long eid, qMRMLWidget *viewWidget) override
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D,...
_object PyObject