def vtkCleanPolyData(self, inputModelNode, tolerance, runtimeLabel):
   runtime = vtk.vtkTimerLog()
   runtime.StartTimer()
   # vtkVertexGlyphFilter
   glyphFilter = vtk.vtkVertexGlyphFilter()
   glyphFilter.SetInputConnection(inputModelNode.GetPolyDataConnection())
   # vtkCleanPolyData
   cleanPolyData = vtk.vtkCleanPolyData()
   cleanPolyData.SetInputConnection(glyphFilter.GetOutputPort())
   cleanPolyData.SetTolerance(tolerance)
   cleanPolyData.Update()
   runtime.StopTimer()
   runtimeLabel.setText('vtkCleanPolyData computed in  %.2f' % runtime.GetElapsedTime() + ' s.')    
   inputModelNode.SetAndObservePolyData(cleanPolyData.GetOutput())
Example #2
0
 def vtkCleanPolyData(self, inputModelNode, tolerance, runtimeLabel):
     runtime = vtk.vtkTimerLog()
     runtime.StartTimer()
     # vtkVertexGlyphFilter
     glyphFilter = vtk.vtkVertexGlyphFilter()
     glyphFilter.SetInputConnection(inputModelNode.GetPolyDataConnection())
     # vtkCleanPolyData
     cleanPolyData = vtk.vtkCleanPolyData()
     cleanPolyData.SetInputConnection(glyphFilter.GetOutputPort())
     cleanPolyData.SetTolerance(tolerance)
     cleanPolyData.Update()
     runtime.StopTimer()
     runtimeLabel.setText('vtkCleanPolyData computed in  %.2f' %
                          runtime.GetElapsedTime() + ' s.')
     inputModelNode.SetAndObservePolyData(cleanPolyData.GetOutput())
Example #3
0
  def FiducialsToPolyData(self, fiducials, polyData):

    points = vtk.vtkPoints()
    n = fiducials.GetNumberOfFiducials()
    for fiducialIndex in range(0, n):
      p = [0, 0, 0]
      fiducials.GetNthFiducialPosition(fiducialIndex, p)
      points.InsertNextPoint(p)

    tempPolyData = vtk.vtkPolyData()
    tempPolyData.SetPoints(points)

    vertex = vtk.vtkVertexGlyphFilter()
    vertex.SetInputData(tempPolyData)
    vertex.Update()

    polyData.ShallowCopy(vertex.GetOutput())
  def FiducialsToPolyData(self, fiducials, polyData):

    points = vtk.vtkPoints()
    n = fiducials.GetNumberOfFiducials()
    for fiducialIndex in range( 0, n ):
      p = [0, 0, 0]
      fiducials.GetNthFiducialPosition( fiducialIndex, p )
      points.InsertNextPoint( p )

    tempPolyData = vtk.vtkPolyData()
    tempPolyData.SetPoints( points )

    vertex = vtk.vtkVertexGlyphFilter()
    vertex.SetInputData( tempPolyData )
    vertex.Update()

    polyData.ShallowCopy( vertex.GetOutput() )