Slicer
4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Modules
Loadable
Segmentations
EditorEffects
Python
AbstractScriptedSegmentEditorLabelEffect.py
Go to the documentation of this file.
1
import
os
2
import
vtk, qt, ctk, slicer, logging
3
from
AbstractScriptedSegmentEditorEffect
import
*
4
5
__all__ = [
'AbstractScriptedSegmentEditorLabelEffect'
]
6
7
#
8
# Abstract class of python scripted segment editor label effects
9
#
10
# Label effects are a subtype of general effects that edit the currently selected
11
# segment (i.e. for things like paint or draw, but not for things like threshold)
12
#
13
14
class
AbstractScriptedSegmentEditorLabelEffect
(
AbstractScriptedSegmentEditorEffect
):
15
""" Abstract scripted segment editor label effects for effects implemented in python
16
17
USAGE:
18
1. Instantiation and registration
19
Instantiate segment editor label effect adaptor class from
20
module (e.g. from setup function), and set python source:
21
> import qSlicerSegmentationsEditorEffectsPythonQt as effects
22
> scriptedEffect = effects.qSlicerSegmentEditorScriptedLabelEffect(None)
23
> scriptedEffect.setPythonSource(MyLabelEffect.filePath)
24
Registration is automatic
25
26
2. Call host C++ implementation using
27
> self.scriptedEffect.functionName()
28
29
2.a. Most frequently used such methods are:
30
Parameter get/set: parameter, integerParameter, doubleParameter, setParameter
31
Add options widget: addOptionsWidget
32
Coordinate transforms: rasToXy, xyzToRas, xyToRas, xyzToIjk, xyToIjk
33
Convenience getters: renderWindow, renderer, viewNode
34
Geometry getters: imageToWorldMatrix (for volume node and for oriented image data with segmentation)
35
36
2.b. Always call API functions (the ones that are defined in the adaptor
37
class qSlicerSegmentEditorScriptedLabelEffect) using the adaptor accessor:
38
> self.scriptedEffect.updateGUIFromMRML()
39
40
An example for a generic effect is the DrawEffect
41
42
"""
43
44
def
__init__
(self, scriptedEffect):
45
AbstractScriptedSegmentEditorEffect.__init__(self, scriptedEffect)
AbstractScriptedSegmentEditorLabelEffect.AbstractScriptedSegmentEditorLabelEffect
Definition:
AbstractScriptedSegmentEditorLabelEffect.py:14
AbstractScriptedSegmentEditorEffect.AbstractScriptedSegmentEditorEffect
Definition:
AbstractScriptedSegmentEditorEffect.py:8
AbstractScriptedSegmentEditorLabelEffect.AbstractScriptedSegmentEditorLabelEffect.__init__
def __init__(self, scriptedEffect)
Definition:
AbstractScriptedSegmentEditorLabelEffect.py:44
Generated on Fri May 17 2019 15:20:20 for Slicer by
1.8.14