Slicer  4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
AbstractScriptedSubjectHierarchyPlugin.py
Go to the documentation of this file.
1 import os
2 import vtk, qt, ctk, slicer, logging
3 
4 #
5 # Abstract class of python scripted subject hierarchy plugins
6 #
7 
9  """ Abstract scripted subject hierarchy plugin for python scripted plugins
10 
11  USAGE: Instantiate scripted subject hierarchy plugin adaptor class from
12  module (e.g. from setup function), and set python source:
13 
14  from SubjectHierarchyPlugins import *
15  ...
16  class [Module]Widget(ScriptedLoadableModuleWidget):
17  ...
18  def setup(self):
19  ...
20  scriptedPlugin = slicer.qSlicerSubjectHierarchyScriptedPlugin(None)
21  scriptedPlugin.setPythonSource(VolumeClipSubjectHierarchyPlugin.filePath)
22  ...
23 
24  Example can be found here: https://subversion.assembla.com/svn/slicerrt/trunk/VolumeClip/src
25  """
26 
27  def __init__(self, scriptedPlugin):
28  self.scriptedPlugin = scriptedPlugin
29 
30  # Register plugin on initialization
31  self.register()
32 
33  def register(self):
34  pluginHandlerSingleton = slicer.qSlicerSubjectHierarchyPluginHandler.instance()
35  pluginHandlerSingleton.registerPlugin(self.scriptedPlugin)
36  logging.debug('Scripted subject hierarchy plugin registered: ' + self.scriptedPlugin.name)