• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python util.VTKObservationMixin类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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()
开发者ID:BRAINSia,项目名称:Slicer,代码行数:29,代码来源:HelperBox.py


示例2: __init__

  def __init__(self, parent):
    ScriptedLoadableModuleWidget.__init__(self, parent)
    VTKObservationMixin.__init__(self)

    # Members
    self.parameterSetNode = None
    self.editor = None
开发者ID:Slicer,项目名称:Slicer,代码行数:7,代码来源:SegmentEditor.py


示例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)
开发者ID:LucasGandel,项目名称:Slicer,代码行数:28,代码来源:EditOptions.py


示例4: __init__

  def __init__(self):
    VTKObservationMixin.__init__(self)

    cli = slicer.vtkMRMLCommandLineModuleNode()
    self.StatusModifiedEvent = cli.StatusModifiedEvent
    self.StatusEvents = []

    self.ExecutionFinished = False
    self.StatusEventCallback = None
开发者ID:BRAINSia,项目名称:Slicer,代码行数:9,代码来源:CLIEventTest.py


示例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
开发者ID:jonieva,项目名称:Slicer,代码行数:51,代码来源:DICOMWidgets.py


示例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()
开发者ID:BRAINSia,项目名称:Slicer,代码行数:16,代码来源:EditColor.py


示例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'
开发者ID:NIRALUser,项目名称:SPHARM-PDM,代码行数:18,代码来源:LogicMixin.py


示例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)
开发者ID:andrewfzheng,项目名称:Slicer,代码行数:20,代码来源:Editor.py


示例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 = {}
开发者ID:jcfr,项目名称:CommonGL,代码行数:21,代码来源:ShaderComputation.py


示例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'
开发者ID:NIRALUser,项目名称:SPHARM-PDM,代码行数:22,代码来源:PipelineMixin.py


示例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()
开发者ID:LucasGandel,项目名称:Slicer,代码行数:84,代码来源:SliceViewAnnotations.py


示例12: __init__

 def __init__(self, parent=None):
   ScriptedLoadableModuleWidget.__init__(self, parent)
   VTKObservationMixin.__init__(self)
   self.logic = None
   self._parameterNode = None
开发者ID:andrewfzheng,项目名称:Slicer,代码行数:5,代码来源:VectorToScalarVolume.py


示例13: __init__

 def __init__(self):
   VTKObservationMixin.__init__(self)
   self.ModifiedEventCount = {}
开发者ID:BRAINSia,项目名称:Slicer,代码行数:3,代码来源:test_slicer_util_VTKObservationMixin.py


示例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()
开发者ID:BRAINSia,项目名称:Slicer,代码行数:67,代码来源:EditBox.py


示例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
开发者ID:juanprietob,项目名称:AnglePlanes-Extension,代码行数:5,代码来源:AnglePlanes.py



注:本文中的slicer.util.VTKObservationMixin类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python common_utils.jsonify函数代码示例发布时间:2022-05-27
下一篇:
Python app.moduleManager函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap