1 import vtk, qt, ctk, slicer
3 from AbstractScriptedSubjectHierarchyPlugin
import *
6 """ Scripted subject hierarchy plugin for the Annotations module. 8 This is also an example for scripted plugins, so includes all possible methods. 9 The methods that are not needed (i.e. the default implementation in 10 qSlicerSubjectHierarchyAbstractPlugin is satisfactory) can simply be 11 omitted in plugins created based on this one. 18 scriptedPlugin.name =
'Annotations' 19 AbstractScriptedSubjectHierarchyPlugin.__init__(self, scriptedPlugin)
23 if node.IsA(
"vtkMRMLAnnotationROINode")
or node.IsA(
"vtkMRMLAnnotationRulerNode"):
28 pluginHandlerSingleton = slicer.qSlicerSubjectHierarchyPluginHandler.instance()
29 shNode = pluginHandlerSingleton.subjectHierarchyNode()
30 associatedNode = shNode.GetItemDataNode(itemID)
32 if associatedNode
is not None:
33 if associatedNode.IsA(
"vtkMRMLAnnotationROINode")
or associatedNode.IsA(
"vtkMRMLAnnotationRulerNode"):
55 pluginHandlerSingleton = slicer.qSlicerSubjectHierarchyPluginHandler.instance()
56 shNode = pluginHandlerSingleton.subjectHierarchyNode()
57 associatedNode = shNode.GetItemDataNode(itemID);
58 if associatedNode
is not None:
60 if associatedNode.IsA(
"vtkMRMLAnnotationROINode"):
61 roiIconPath = os.path.join(os.path.dirname(__file__),
'../Resources/Icons/AnnotationROI.png')
62 if os.path.exists(roiIconPath):
63 return qt.QIcon(roiIconPath)
65 if associatedNode.IsA(
"vtkMRMLAnnotationRulerNode"):
66 rulerIconPath = os.path.join(os.path.dirname(__file__),
'../Resources/Icons/AnnotationDistance.png')
67 if os.path.exists(rulerIconPath):
68 return qt.QIcon(rulerIconPath)
73 pluginHandlerSingleton = slicer.qSlicerSubjectHierarchyPluginHandler.instance()
74 return pluginHandlerSingleton.pluginByName(
'Default').
visibilityIcon(visible)
77 pluginHandlerSingleton = slicer.qSlicerSubjectHierarchyPluginHandler.instance()
78 pluginHandlerSingleton.pluginByName(
'Default').
editProperties(itemID)
90 pluginHandlerSingleton = slicer.qSlicerSubjectHierarchyPluginHandler.instance()
91 tooltip = pluginHandlerSingleton.pluginByName(
'Default').
tooltip(itemID)
95 pluginHandlerSingleton = slicer.qSlicerSubjectHierarchyPluginHandler.instance()
99 pluginHandlerSingleton = slicer.qSlicerSubjectHierarchyPluginHandler.instance()
def sceneContextMenuActions(self)
def itemContextMenuActions(self)
def setDisplayVisibility(self, itemID, visible)
def canOwnSubjectHierarchyItem(self, itemID)
def visibilityIcon(self, visible)
def getDisplayVisibility(self, itemID)
def tooltip(self, itemID)
def canAddNodeToSubjectHierarchy(self, node, parentItemID)
def showContextMenuActionsForItem(self, itemID)
def editProperties(self, itemID)
def __init__(self, scriptedPlugin)