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