本文整理汇总了Python中slicer.util.VTKObservationMixin类的典型用法代码示例。如果您正苦于以下问题:Python VTKObservationMixin类的具体用法?Python VTKObservationMixin怎么用?Python VTKObservationMixin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VTKObservationMixin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent=None):
VTKObservationMixin.__init__(self)
self.editUtil = EditUtil() # Kept for backward compatibility
# mrml volume node instances
self.master = None
self.masterWhenMergeWasSet = None
# Editor color LUT
self.colorNodeID = None
# string
self.createMergeOptions = ""
self.mergeVolumePostfix = "-label"
# slicer helper class
self.volumesLogic = slicer.modules.volumes.logic()
# widgets that are dynamically created on demand
# pseudo signals
# - python callable that gets True or False
self.selectCommand = None
if not parent:
self.parent = slicer.qMRMLWidget()
self.parent.setLayout(qt.QVBoxLayout())
self.parent.setMRMLScene(slicer.mrmlScene)
self.create()
self.parent.show()
else:
self.parent = parent
self.create()
示例2: __init__
def __init__(self, parent):
ScriptedLoadableModuleWidget.__init__(self, parent)
VTKObservationMixin.__init__(self)
# Members
self.parameterSetNode = None
self.editor = None
示例3: __init__
def __init__(self, parent=None):
VTKObservationMixin.__init__(self)
self.parent = parent
self.updatingGUI = False
self.widgets = []
self.parameterNode = None
self.parameterNodeTag = None
self.editUtil = EditUtil() # Kept for backward compatibility
self.tools = []
# connections is a list of widget/signal/slot tripples
# for the options gui that can be connected/disconnected
# as needed to prevent triggering mrml updates while
# updating the state of the gui
# - each level of the inheritance tree can add entries
# to this list for use by the connectWidgets
# and disconnectWidgets methods
self.connections = []
self.connectionsConnected = False
# 1) find the parameter node in the scene and observe it
# 2) set the defaults (will only set them if they are not
# already set)
self.updateParameterNode(self.parameterNode, vtk.vtkCommand.ModifiedEvent)
# TODO: change this to look for specfic events (added, removed...)
# but this requires being able to access events by number from wrapped code
self.addObserver(slicer.mrmlScene, vtk.vtkCommand.ModifiedEvent, self.updateParameterNode)
示例4: __init__
def __init__(self):
VTKObservationMixin.__init__(self)
cli = slicer.vtkMRMLCommandLineModuleNode()
self.StatusModifiedEvent = cli.StatusModifiedEvent
self.StatusEvents = []
self.ExecutionFinished = False
self.StatusEventCallback = None
示例5: __init__
def __init__(self,dicomBrowser=None):
VTKObservationMixin.__init__(self)
self.dicomBrowser = dicomBrowser
# initialize the dicomDatabase
# - pick a default and let the user know
if not slicer.dicomDatabase:
self.promptForDatabaseDirectory()
if self.dicomBrowser is None:
# This creates a DICOM database in the current working directory if nothing else
# is specified in the settings, therefore promptForDatabaseDirectory must be called before this.
self.dicomBrowser = ctk.ctkDICOMBrowser()
self.browserPersistent = settingsValue('DICOM/BrowserPersistent', False, converter=toBool)
self.tableDensity = settingsValue('DICOM/tableDensity', 'Compact')
self.popupGeometry = settingsValue('DICOM/detailsPopup.geometry', qt.QRect())
self.advancedView = settingsValue('DICOM/advancedView', 0, converter=int)
self.horizontalTables = settingsValue('DICOM/horizontalTables', 0, converter=int)
self.volumeNameTemplate = settingsValue('DICOM/volumeNameTemplate', "")
self.create()
self.popupPositioned = False
self.pluginInstances = {}
self.fileLists = []
setDatabasePrecacheTags(self.dicomBrowser)
self.dicomBrowser.connect('databaseDirectoryChanged(QString)', self.onDatabaseDirectoryChanged)
# Update visibility
for name in [
'ActionImport', 'ActionExport', 'ActionQuery', 'ActionSend', 'ActionRemove', 'ActionRepair',
'ActionViewMetadata',
'AdvancedViewCheckBox', 'HorizontalViewCheckBox', 'BrowserPersistentCheckBox'
]:
visible = settingsValue('DICOM/%s.visible' % name, True, converter=toBool)
control = self._findChildren(name)
control.visible = visible
# Define set of widgets that should be hidden/shown together
self.settingsWidgetNames = {
'DatabaseButton' : ('DatabaseNameLabel', 'DirectoryButton'),
'TableDensityComboBox' : ('tablesDensityLabel', 'tableDensityComboBox')
}
# Hide the settings button if all associated widgets should be hidden
settingsButtonHidden = True
for groupName in self.settingsWidgetNames.keys():
settingsButtonHidden = settingsButtonHidden and not settingsValue('DICOM/%s.visible' % groupName, True, converter=toBool)
self.settingsButton.visible = not settingsButtonHidden
示例6: __init__
def __init__(self, parent=0, parameter='label',colorNode=None):
VTKObservationMixin.__init__(self)
self.parameterNode = None
self.parameterNodeTag = None
self.parameter = parameter
self.colorBox = None
self.colorNode = colorNode
if parent == 0:
self.parent = slicer.qMRMLWidget()
self.parent.setLayout(qt.QVBoxLayout())
self.parent.setMRMLScene(slicer.mrmlScene)
self.create()
self.parent.show()
else:
self.parent = parent
self.create()
示例7: __init__
def __init__(self, ModuleNodeName):
VTKObservationMixin.__init__(self)
self.InputCases = list()
self.allCaseStartTime = 0
# Dictionaries
self.pipeline = {}
self.completed = {}
# Status
self.Node = slicer.vtkMRMLCommandLineModuleNode()
self.Node.SetStatus(self.Node.Idle)
self.Node.SetName(ModuleNodeName)
self.ProgressBar = slicer.qSlicerCLIProgressBar()
self.ProgressBar.setCommandLineModuleNode(self.Node)
self.ProgressBar.setNameVisibility(slicer.qSlicerCLIProgressBar.AlwaysVisible)
self.ErrorMessage = 'Unexpected error'
示例8: __init__
def __init__(self, parent=None, showVolumesFrame=True):
VTKObservationMixin.__init__(self)
self.shortcuts = []
self.toolsBox = None
# set attributes from ctor parameters
self.showVolumesFrame = showVolumesFrame
self.editUtil = EditUtil() # Kept for backward compatibility
if not parent:
self.parent = slicer.qMRMLWidget()
self.parent.setLayout(qt.QVBoxLayout())
self.parent.setMRMLScene(slicer.mrmlScene)
self.layout = self.parent.layout()
else:
self.parent = parent
self.layout = parent.layout()
ScriptedLoadableModuleWidget.__init__(self, parent)
示例9: __init__
def __init__(self, scene=None):
"""Add observers to the mrmlScene and also to all the nodes of the scene"""
VTKObservationMixin.__init__(self)
if scene:
self._scene = scene
else:
self._scene = slicer.mrmlScene
self.addObserver(scene, scene.NodeAddedEvent, self.onNodeAdded)
self.addObserver(scene, scene.NodeRemovedEvent, self.onNodeRemoved)
scene.InitTraversal()
node = scene.GetNextNode()
while node:
self._observeNode(node)
node = scene.GetNextNode()
# a dictionary of (nodeKey,eventKey) -> callback
# where nodeKey is classname "vtkMRML{nodeKey}Node"
# and eventKey is tested for equality to "{eventKey}Event"
self._triggers = {}
示例10: __init__
def __init__(self, pipelineID, CaseInput, interface):
VTKObservationMixin.__init__(self)
self.pipelineID = pipelineID
self.strPipelineID = "_" + str(self.pipelineID)
self.CaseInput = CaseInput
# Pipeline computation time
self.pipelineStartTime = 0
self.pipelineEndTime = 0
# Status
self.StatusModifiedEvent = slicer.vtkMRMLCommandLineModuleNode().StatusModifiedEvent
self.Node = slicer.vtkMRMLCommandLineModuleNode()
self.Node.SetStatus(self.Node.Idle)
self.Node.SetName('Case ' + str(self.pipelineID))
self.currentCLINode = None
self.ProgressBar = slicer.qSlicerCLIProgressBar()
self.ProgressBar.setCommandLineModuleNode(self.Node)
self.ProgressBar.setNameVisibility(slicer.qSlicerCLIProgressBar.AlwaysVisible)
self.ErrorMessage = 'Unexpected error'
示例11: __init__
def __init__(self, layoutManager=None):
VTKObservationMixin.__init__(self)
self.hasVTKPVScalarBarActor = hasattr(slicer, 'vtkPVScalarBarActor')
if not self.hasVTKPVScalarBarActor:
slicer.logging.warning("SliceAnnotations: Disable features relying on vtkPVScalarBarActor")
self.layoutManager = layoutManager
if self.layoutManager is None:
self.layoutManager = slicer.app.layoutManager()
self.layoutManager.connect("destroyed()", self.onLayoutManagerDestroyed)
self.dataProbeUtil = DataProbeUtil.DataProbeUtil()
self.dicomVolumeNode = 0
self.sliceViewNames = []
self.popupGeometry = qt.QRect()
self.cornerTexts =[]
# Bottom Left Corner Text
self.cornerTexts.append({
'1-Label':{'text':'','category':'A'},
'2-Foreground':{'text':'','category':'A'},
'3-Background':{'text':'','category':'A'}
})
# Bottom Right Corner Text
# Not used - orientation figure may be drawn there
self.cornerTexts.append({
'1-TR':{'text':'','category':'A'},
'2-TE':{'text':'','category':'A'}
})
# Top Left Corner Text
self.cornerTexts.append({
'1-PatientName':{'text':'','category':'B'},
'2-PatientID':{'text':'','category':'A'},
'3-PatientInfo':{'text':'','category':'B'},
'4-Bg-SeriesDate':{'text':'','category':'B'},
'5-Fg-SeriesDate':{'text':'','category':'B'},
'6-Bg-SeriesTime':{'text':'','category':'C'},
'7-Bg-SeriesTime':{'text':'','category':'C'},
'8-Bg-SeriesDescription':{'text':'','category':'C'},
'9-Fg-SeriesDescription':{'text':'','category':'C'}
})
# Top Right Corner Text
self.cornerTexts.append({
'1-Institution-Name':{'text':'','category':'B'},
'2-Referring-Phisycian':{'text':'','category':'B'},
'3-Manufacturer':{'text':'','category':'C'},
'4-Model':{'text':'','category':'C'},
'5-Patient-Position':{'text':'','category':'A'},
'6-TR':{'text':'','category':'A'},
'7-TE':{'text':'','category':'A'}
})
self.annotationsDisplayAmount = 0
#
self.scene = slicer.mrmlScene
self.sliceViews = {}
# If there are no user settings load defaults
self.sliceViewAnnotationsEnabled = settingsValue('DataProbe/sliceViewAnnotations.enabled', 1, converter=int)
self.bottomLeft = settingsValue('DataProbe/sliceViewAnnotations.bottomLeft', 1, converter=int)
self.topLeft = settingsValue('DataProbe/sliceViewAnnotations.topLeft', 0, converter=int)
self.topRight = settingsValue('DataProbe/sliceViewAnnotations.topRight', 0, converter=int)
self.fontFamily = settingsValue('DataProbe/sliceViewAnnotations.fontFamily', 'Times')
self.fontSize = settingsValue('DataProbe/sliceViewAnnotations.fontSize', 14, converter=int)
self.backgroundDICOMAnnotationsPersistence = settingsValue(
'DataProbe/sliceViewAnnotations.bgDICOMAnnotationsPersistence', 0, converter=int)
self.scalarBarEnabled = settingsValue('DataProbe/sliceViewAnnotations.scalarBarEnabled', 0, converter=int)
self.scalarBarEnabledLastStatus = self.scalarBarEnabled
self.scalarBarSelectedLayer = 'background'
self.rangeLabelFormat = settingsValue('DataProbe/sliceViewAnnotations.rangeLabelFormat', '%G')
self.parameter = 'sliceViewAnnotationsEnabled'
self.parameterNode = self.dataProbeUtil.getParameterNode()
self.addObserver(self.parameterNode, vtk.vtkCommand.ModifiedEvent, self.updateGUIFromMRML)
self.maximumTextLength= 35
self.create()
if self.sliceViewAnnotationsEnabled:
self.updateSliceViewFromGUI()
示例12: __init__
def __init__(self, parent=None):
ScriptedLoadableModuleWidget.__init__(self, parent)
VTKObservationMixin.__init__(self)
self.logic = None
self._parameterNode = None
示例13: __init__
def __init__(self):
VTKObservationMixin.__init__(self)
self.ModifiedEventCount = {}
示例14: __init__
def __init__(self, parent=None, optionsFrame=None):
VTKObservationMixin.__init__(self)
self.effects = []
self.effectButtons = {}
self.effectCursors = {}
self.effectActionGroup = qt.QActionGroup(parent)
self.effectActionGroup.connect('triggered(QAction*)', self._onEffectActionTriggered)
self.effectActionGroup.exclusive = True
self.currentEffect = None
self.undoRedo = UndoRedo()
self.undoRedo.stateChangedCallback = self.updateUndoRedoButtons
self.toggleShortcut = None
# check for extensions - if none have been registered, just create the empty dictionary
try:
slicer.modules.editorExtensions
except AttributeError:
slicer.modules.editorExtensions = {}
# register the builtin extensions
self.editorBuiltins = {}
self.editorBuiltins["PaintEffect"] = EditorLib.PaintEffect
self.editorBuiltins["DrawEffect"] = EditorLib.DrawEffect
self.editorBuiltins["ThresholdEffect"] = EditorLib.ThresholdEffect
self.editorBuiltins["RectangleEffect"] = EditorLib.RectangleEffect
self.editorBuiltins["LevelTracingEffect"] = EditorLib.LevelTracingEffect
self.editorBuiltins["MakeModelEffect"] = EditorLib.MakeModelEffect
self.editorBuiltins["ErodeEffect"] = EditorLib.ErodeEffect
self.editorBuiltins["DilateEffect"] = EditorLib.DilateEffect
self.editorBuiltins["ChangeLabelEffect"] = EditorLib.ChangeLabelEffect
self.editorBuiltins["RemoveIslandsEffect"] = EditorLib.RemoveIslandsEffect
self.editorBuiltins["IdentifyIslandsEffect"] = EditorLib.IdentifyIslandsEffect
self.editorBuiltins["SaveIslandEffect"] = EditorLib.SaveIslandEffect
self.editorBuiltins["ChangeIslandEffect"] = EditorLib.ChangeIslandEffect
self.editorBuiltins["GrowCutEffect"] = EditorLib.GrowCutEffect
self.editorBuiltins["WatershedFromMarkerEffect"] = EditorLib.WatershedFromMarkerEffect
self.editorBuiltins["FastMarchingEffect"] = EditorLib.FastMarchingEffect
self.editorBuiltins["WandEffect"] = EditorLib.WandEffect
# frame that holds widgets specific for each effect
if not optionsFrame:
self.optionsFrame = qt.QFrame(self.parent)
self.optionsFrame.objectName = 'OptionsFrame'
else:
self.optionsFrame = optionsFrame
# state variables for selected effect in the box
# - currentOption is an instance of an option GUI
# - currentTools is a list of EffectTool instances
self.currentOption = None
self.currentTools = []
# listen for changes in the Interaction Mode
interactionNode = slicer.app.applicationLogic().GetInteractionNode()
self.addObserver(interactionNode, interactionNode.InteractionModeChangedEvent, self.onInteractionModeChanged)
# Listen for changed on the Parameter node
self.addObserver(EditUtil.getParameterNode(), vtk.vtkCommand.ModifiedEvent, self._onParameterNodeModified)
if not parent:
self.parent = qt.QFrame()
self.parent.setLayout( qt.QVBoxLayout() )
self.create()
self.parent.show()
else:
self.parent = parent
self.create()
示例15: __init__
def __init__(self, anglePlanes):
VTKObservationMixin.__init__(self)
self.addObserver(slicer.mrmlScene, slicer.vtkMRMLScene.NodeAddedEvent, self.nodeAddedCallback)
self.addObserver(slicer.mrmlScene, slicer.vtkMRMLScene.NodeRemovedEvent, self.nodeRemovedCallback)
self.anglePlanes = anglePlanes