本文整理匯總了Python中vtk.vtkGeometryFilter方法的典型用法代碼示例。如果您正苦於以下問題:Python vtk.vtkGeometryFilter方法的具體用法?Python vtk.vtkGeometryFilter怎麽用?Python vtk.vtkGeometryFilter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vtk
的用法示例。
在下文中一共展示了vtk.vtkGeometryFilter方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_voxel
# 需要導入模塊: import vtk [as 別名]
# 或者: from vtk import vtkGeometryFilter [as 別名]
def create_voxel(self):
numberOfVertices = 8
points = vtk.vtkPoints()
points.InsertNextPoint(0, 0, 0)
points.InsertNextPoint(1, 0, 0)
points.InsertNextPoint(0, 1, 0)
points.InsertNextPoint(1, 1, 0)
points.InsertNextPoint(0, 0, 1)
points.InsertNextPoint(1, 0, 1)
points.InsertNextPoint(0, 1, 1)
points.InsertNextPoint(1, 1, 1)
voxel = vtk.vtkVoxel()
for i in range(0, numberOfVertices):
voxel.GetPointIds().SetId(i, i)
ugrid = vtk.vtkUnstructuredGrid()
ugrid.SetPoints(points)
ugrid.InsertNextCell(voxel.GetCellType(), voxel.GetPointIds())
gfilter = vtk.vtkGeometryFilter()
gfilter.SetInput(ugrid)
gfilter.Update()
return gfilter
示例2: update
# 需要導入模塊: import vtk [as 別名]
# 或者: from vtk import vtkGeometryFilter [as 別名]
def update(self):
"""
"""
appendFilter = vtkAppendFilter()
appendFilter.AddInput(self.input_)
appendFilter.Update()
extractGrid = vtkExtractUnstructuredGrid()
extractGrid.SetInput(appendFilter.GetOutput())
extractGrid.SetExtent(self.extent[0], self.extent[1], self.extent[2], self.extent[3], self.extent[4], self.extent[5])
geom = vtkGeometryFilter()
geom.SetInputConnection(extractGrid.GetOutputPort() )
geom.Update()
clean = vtkCleanPolyData()
clean.PointMergingOn()
clean.SetTolerance(0.01)
clean.SetInput(geom.GetOutput())
clean.Update()
self.output_ = clean.GetOutput()
示例3: update
# 需要導入模塊: import vtk [as 別名]
# 或者: from vtk import vtkGeometryFilter [as 別名]
def update(self):
delaunay = vtkDelaunay3D()
delaunay.SetInput(self.input_)
delaunay.SetTolerance(self.tolerance)
delaunay.SetAlpha(self.alpha)
delaunay.Update()
geom = vtkGeometryFilter()
geom.SetInputConnection(delaunay.GetOutputPort() )
triangle = vtkTriangleFilter()
triangle.SetInputConnection(geom.GetOutputPort())
triangle.Update()
self.output_ = triangle.GetOutput()
示例4: extract_geometry
# 需要導入模塊: import vtk [as 別名]
# 或者: from vtk import vtkGeometryFilter [as 別名]
def extract_geometry(dataset):
"""Extract the outer surface of a volume or structured grid dataset as PolyData.
This will extract all 0D, 1D, and 2D cells producing the
boundary faces of the dataset.
"""
alg = vtk.vtkGeometryFilter()
alg.SetInputDataObject(dataset)
alg.Update()
return _get_output(alg)