Slicer  4.11
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 import os
2 import vtk, qt, ctk, slicer, logging
3 from .AbstractScriptedSegmentEditorEffect import *
4 
5 __all__ = ['AbstractScriptedSegmentEditorPaintEffect']
6 
7 #
8 # Abstract class of python scripted segment editor paint effects
9 #
10 # Paint effects are a subtype of general effects that operate on a subregion of the segment
11 # defined by brush strokes.
12 #
13 
15  """ Abstract scripted segment editor Paint effects for effects implemented in python
16 
17  USAGE:
18  1. Instantiation and registration
19  Instantiate segment editor paint effect adaptor class from
20  module (e.g. from setup function), and set python source:
21  > import qSlicerSegmentationsEditorEffectsPythonQt as effects
22  > scriptedEffect = effects.qSlicerSegmentEditorScriptedPaintEffect(None)
23  > scriptedEffect.setPythonSource(MyPaintEffect.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 qSlicerSegmentEditorScriptedPaintEffect) 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)