本文整理汇总了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)