当前位置: 首页>>代码示例>>Python>>正文


Python vtk.vtkCollection函数代码示例

本文整理汇总了Python中vtk.vtkCollection函数的典型用法代码示例。如果您正苦于以下问题:Python vtkCollection函数的具体用法?Python vtkCollection怎么用?Python vtkCollection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了vtkCollection函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

    def setUp(self):
        self.vtkObjs = [vtk.vtkObject() for _ in range(30)]
        self.collection = vtk.vtkCollection()
        for obj in self.vtkObjs:
            self.collection.AddItem(obj)

        self.emptyCollection = vtk.vtkCollection()
开发者ID:ALouis38,项目名称:VTK,代码行数:7,代码来源:TestIterateCollection.py

示例2: examineForImport

  def examineForImport(self,fileLists):
    """ Returns a list of qSlicerDICOMLoadable
    instances corresponding to ways of interpreting the 
    fileLists parameter.
    """
    # Create loadables for each file list
    loadables = []
    for fileList in fileLists: # Each file list corresponds to one series, so do loadables
      # Convert file list to VTK object to be able to pass it for examining
      # (VTK class cannot have Qt object as argument, otherwise it is not python wrapped)
      vtkFileList = vtk.vtkStringArray()
      for file in fileList:
        vtkFileList.InsertNextValue(slicer.util.toVTKString(file))

      # Examine files
      loadablesCollection = vtk.vtkCollection()
      slicer.modules.dicomrtimportexport.logic().ExamineForLoad(vtkFileList, loadablesCollection)

      for loadableIndex in xrange(0,loadablesCollection.GetNumberOfItems()):
        vtkLoadable = loadablesCollection.GetItemAsObject(loadableIndex)
        # Create Qt loadable if confidence is greater than 0
        if vtkLoadable.GetConfidence() > 0:
          # Convert to Qt loadable to pass it back
          qtLoadable = slicer.qSlicerDICOMLoadable()
          qtLoadable.copyFromVtkLoadable(vtkLoadable)
          qtLoadable.tooltip = 'Valid RT object in selection'
          qtLoadable.selected = True
          loadables.append(qtLoadable)

    return loadables
开发者ID:Sunderlandkyl,项目名称:SlicerRT,代码行数:30,代码来源:DicomRtImportExportPlugin.py

示例3: loadNode

  def loadNode(self, uri, name, fileType = 'VolumeFile', fileProperties = {}):
    self.logMessage('<b>Requesting load</b> <i>%s</i> from %s...\n' % (name, uri))

    fileProperties['fileName'] = uri
    fileProperties['name'] = name
    firstLoadedNode = None
    loadedNodes = vtk.vtkCollection()
    success = slicer.app.coreIOManager().loadNodes(fileType, fileProperties, loadedNodes)

    if not success or loadedNodes.GetNumberOfItems()<1:
      self.logMessage('<b><font color="red">\tLoad failed!</font></b>\n')
      return None

    self.logMessage('<b>Load finished</b>\n')

    # since nodes were read from a temp directory remove the storage nodes
    for i in range(loadedNodes.GetNumberOfItems()):
      loadedNode = loadedNodes.GetItemAsObject(i)
      if not loadedNode.IsA("vtkMRMLStorableNode"):
        continue
      storageNode = loadedNode.GetStorageNode()
      if not storageNode:
        continue
      slicer.mrmlScene.RemoveNode(storageNode)
      loadedNode.SetAndObserveStorageNodeID(None)

    return loadedNodes.GetItemAsObject(0)
开发者ID:millerjv,项目名称:Slicer,代码行数:27,代码来源:SampleData.py

示例4: addRuler

  def addRuler(widget, color=None):
    color = color if color else [0.25, 0.25, 0.75]

    controller = widget.sliceController()
    sliceView = widget.sliceView()

    controller.setRulerType(2)

    collection = vtk.vtkCollection()
    sliceView.getDisplayableManagers(collection)
    manager = None
    for i in range(collection.GetNumberOfItems()):
      if type(collection.GetItemAsObject(i)) is slicer.vtkMRMLRulerDisplayableManager:
        manager = collection.GetItemAsObject(i)
        break

    renderers = manager.GetRenderer().GetRenderWindow().GetRenderers()
    axisActor = None
    textActor = None
    for i in range(renderers.GetNumberOfItems()):
      actors2D = renderers.GetItemAsObject(i).GetActors2D()
      for j in range(actors2D.GetNumberOfItems()):
        if type(actors2D.GetItemAsObject(j)) is vtk.vtkTextActor:
          textActor = actors2D.GetItemAsObject(j)
        elif type(actors2D.GetItemAsObject(j)) is vtk.vtkAxisActor2D:
          axisActor = actors2D.GetItemAsObject(j)
      if axisActor and textActor:
        axisActor.GetProperty().SetColor(color)
        textActor.GetProperty().SetColor(color)
        sliceView.update()
        break
开发者ID:QIICR,项目名称:Reporting,代码行数:31,代码来源:htmlReport.py

示例5: getModel3DDisplayableManager

 def getModel3DDisplayableManager(self):
   threeDViewWidget = slicer.app.layoutManager().threeDWidget(0)
   managers = vtk.vtkCollection()
   threeDViewWidget.getDisplayableManagers(managers)
   for i in range(managers.GetNumberOfItems()):
     obj = managers.GetItemAsObject(i)
     if obj.IsA('vtkMRMLLinearTransformsDisplayableManager3D'):
       return obj
   return None
开发者ID:andrewfzheng,项目名称:Slicer,代码行数:9,代码来源:SlicerTransformInteractionTest1.py

示例6: export

  def export(self, exportables): 

    exportablesCollection = vtk.vtkCollection()
    for exportable in exportables:
      vtkExportable = slicer.vtkSlicerDICOMExportable()
      exportable.copyToVtkExportable(vtkExportable)
      exportablesCollection.AddItem(vtkExportable)

    self.exportAsDICOMSEG(exportablesCollection)
开发者ID:Sunderlandkyl,项目名称:Reporting,代码行数:9,代码来源:DICOMSegmentationPlugin.py

示例7: getFiducialSliceDisplayableManagerHelper

 def getFiducialSliceDisplayableManagerHelper(self,sliceName='Red'):
   sliceWidget = slicer.app.layoutManager().sliceWidget(sliceName)
   sliceView = sliceWidget.sliceView()
   collection = vtk.vtkCollection()
   sliceView.getDisplayableManagers(collection)
   for i in range(collection.GetNumberOfItems()):
    m = collection.GetItemAsObject(i)
    if m.GetClassName() == "vtkMRMLMarkupsFiducialDisplayableManager2D":
      return m.GetHelper()
   return None
开发者ID:kingofpanda,项目名称:Slicer,代码行数:10,代码来源:FiducialLayoutSwitchBug1914.py

示例8: export

  def export(self,exportables):
    # Convert Qt loadables to VTK ones for the RT export logic
    exportablesCollection = vtk.vtkCollection()
    for exportable in exportables:
      vtkExportable = slicer.vtkSlicerDICOMExportable()
      exportable.copyToVtkExportable(vtkExportable)
      exportablesCollection.AddItem(vtkExportable)

    # Export RT study
    message = slicer.modules.dicomrtimportexport.logic().ExportDicomRTStudy(exportablesCollection)    
    return message
开发者ID:Sunderlandkyl,项目名称:SlicerRT,代码行数:11,代码来源:DicomRtImportExportPlugin.py

示例9: UpdateProxyNodeMetrics

 def UpdateProxyNodeMetrics( taskMetrics, proxyNodes, time ):
   if ( PythonMetricsCalculatorLogic.GetMRMLScene() == None or PythonMetricsCalculatorLogic.GetPerkEvaluatorLogic() == None ):
     return
   
   # Get all transforms in the scene
   relevantTransformNodes = vtk.vtkCollection()
   PythonMetricsCalculatorLogic.GetPerkEvaluatorLogic().GetProxyRelevantTransformNodes( proxyNodes, relevantTransformNodes )
   
   # Update all metrics associated with children of the recorded transform
   for j in range( relevantTransformNodes.GetNumberOfItems() ):
     currentTransformNode = relevantTransformNodes.GetItemAsObject( j )
     PythonMetricsCalculatorLogic.UpdateMetrics( taskMetrics, currentTransformNode, time )
开发者ID:mholden8,项目名称:PerkTutor,代码行数:12,代码来源:PythonMetricsCalculator.py

示例10: loadNodeFromFile

def loadNodeFromFile(filename, filetype, properties={}, returnNode=False):
  from slicer import app
  from vtk import vtkCollection
  properties['fileName'] = filename

  if returnNode:
      loadedNodes = vtkCollection()
      success = app.coreIOManager().loadNodes(filetype, properties, loadedNodes)
      return success, loadedNodes.GetItemAsObject(0)
  else:
      success = app.coreIOManager().loadNodes(filetype, properties)
      return success
开发者ID:gregsharp,项目名称:Slicer,代码行数:12,代码来源:util.py

示例11: testSubclassGhost

 def testSubclassGhost(self):
     """Make sure ghosting of the class works"""
     o = vtkCustomObject()
     c = vtk.vtkCollection()
     c.AddItem(o)
     i = id(o)
     del o
     o = vtk.vtkObject()
     o = c.GetItemAsObject(0)
     # make sure the id has changed, but class the same
     self.assertEqual(o.__class__, vtkCustomObject)
     self.assertNotEqual(i, id(o))
开发者ID:timkrentz,项目名称:SunTracker,代码行数:12,代码来源:TestSubClass.py

示例12: widgetVisible

 def widgetVisible(self, fidNode, viewNodeID):
   lm = slicer.app.layoutManager()
   for v in range(lm.threeDViewCount):
    td = lm.threeDWidget(v)
    ms = vtk.vtkCollection()
    td.getDisplayableManagers(ms)
    for i in range(ms.GetNumberOfItems()):
     m = ms.GetItemAsObject(i)
     if m.GetClassName() == "vtkMRMLMarkupsFiducialDisplayableManager3D" and m.GetMRMLViewNode().GetID() == viewNodeID:
       h = m.GetHelper()
       seedWidget = h.GetWidget(fidNode)
       return seedWidget.GetEnabled()
   return 0
开发者ID:sankhesh,项目名称:Slicer,代码行数:13,代码来源:MarkupsInViewsSelfTest.py

示例13: removeModelHierarchyAndChildModelNodesFromScene

 def removeModelHierarchyAndChildModelNodesFromScene(modelHierarchyNode):
   if modelHierarchyNode:
     cmn = vtk.vtkCollection()
     
     modelHierarchyNode.GetChildrenModelNodes(cmn)
     
     for i in range(cmn.GetNumberOfItems()):
       model = cmn.GetItemAsObject(i)
       
       if model.IsA('vtkMRMLModelNode'):
         slicer.mrmlScene.RemoveNode(model)
         
     slicer.mrmlScene.RemoveNode(modelHierarchyNode)       
开发者ID:QIICR,项目名称:LongitudinalPETCT,代码行数:13,代码来源:SlicerLongitudinalPETCTModuleViewHelper.py

示例14: makeModels

  def makeModels(study, finding, colorTable):

    if (study is None) | (finding is None) | (colorTable is None):
      return    
     
    seg = finding.GetSegmentationMappedByStudyNodeID(study.GetID())
      
    if seg:
      labelVolume = seg.GetLabelVolumeNode()

      #create a temporary model hierarchy for generating models
      tempMH = slicer.vtkMRMLModelHierarchyNode()
      slicer.mrmlScene.AddNode(tempMH)
      
      if (labelVolume is not None) & (tempMH is not None):
        parameters = {'InputVolume': labelVolume.GetID(), 'ColorTable': colorTable.GetID(),
                      'ModelSceneFile': tempMH.GetID(), 'GenerateAll': False, 'StartLabel': finding.GetColorID(),
                      'EndLabel': finding.GetColorID(), 'Name': labelVolume.GetName() + "_" + finding.GetName() + "_M"}

        cliModelMaker = None
        cliModelMaker = slicer.cli.run(slicer.modules.modelmaker, cliModelMaker, parameters, wait_for_completion = True)  
        genModelNodes = vtk.vtkCollection()
        tempMH.GetChildrenModelNodes(genModelNodes)

        if genModelNodes.GetNumberOfItems() > 0:
          modelNode = genModelNodes.GetItemAsObject(0)
          if modelNode:
            if modelNode.IsA('vtkMRMLModelNode'):
              hnode = slicer.vtkMRMLHierarchyNode.GetAssociatedHierarchyNode(modelNode.GetScene(), modelNode.GetID())
              if hnode:
                if seg.GetModelHierarchyNode():
                  SlicerLongitudinalPETCTModuleViewHelper.removeModelHierarchyAndChildModelNodesFromScene(seg.GetModelHierarchyNode())
                  
                  hnode.SetName(seg.GetName()+"_Model")
                  seg.SetAndObserveModelHierarchyNodeID(hnode.GetID())
                  modelNode.SetName(labelVolume.GetName() + "_" + finding.GetName()+"_M")
                  if modelNode.GetDisplayNode():
                    modelNode.GetDisplayNode().SetName(labelVolume.GetName() + "_" + finding.GetName()+"_D")
                    modelNode.GetDisplayNode().AddViewNodeID(SlicerLongitudinalPETCTModuleViewHelper.getStandardViewNode().GetID())
                  hnode.SetName(labelVolume.GetName() + "_" + finding.GetName()+"_H")
                  modelNode.SetHideFromEditors(False)
                else:
                  seg.SetAndObserveModelHierarchyNodeID("")
                  slicer.mrmlScene.RemoveNode(modelNode)   
                  slicer.mrmlScene.RemoveNode(hnode)
   
          slicer.mrmlScene.RemoveNode(tempMH.GetDisplayNode())
          slicer.mrmlScene.RemoveNode(tempMH)        
    
    #return '#%02X%02X%02X' % (r,g,b)
开发者ID:QIICR,项目名称:LongitudinalPETCT,代码行数:50,代码来源:SlicerLongitudinalPETCTModuleViewHelper.py

示例15: widgetVisibleOnSlice

 def widgetVisibleOnSlice(self, fidNode, sliceNodeID):
   lm = slicer.app.layoutManager()
   sliceNames = lm.sliceViewNames()
   for sliceName in sliceNames:
     sliceWidget = lm.sliceWidget(sliceName)
     sliceView = sliceWidget.sliceView()
     ms = vtk.vtkCollection()
     sliceView.getDisplayableManagers(ms)
     for i in range(ms.GetNumberOfItems()):
       m = ms.GetItemAsObject(i)
       if m.GetClassName() == 'vtkMRMLMarkupsFiducialDisplayableManager2D' and m.GetMRMLSliceNode().GetID() == sliceNodeID:
         h = m.GetHelper()
         seedWidget = h.GetWidget(fidNode)
         return seedWidget.GetEnabled()
   return 0
开发者ID:sankhesh,项目名称:Slicer,代码行数:15,代码来源:MarkupsInViewsSelfTest.py


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