Python vtk.vtkGeometryFilter() Examples
The following are 5
code examples of vtk.vtkGeometryFilter().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
vtk
, or try the search function
.
Example #1
Source File: gui_viewer.py From pix2vox with GNU General Public License v3.0 | 6 votes |
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
Example #2
Source File: ExtractPolyData.py From pcloudpy with BSD 3-Clause "New" or "Revised" License | 6 votes |
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()
Example #3
Source File: gui_viewer.py From voxel-dcgan with MIT License | 6 votes |
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
Example #4
Source File: Delaunay3D.py From pcloudpy with BSD 3-Clause "New" or "Revised" License | 5 votes |
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()
Example #5
Source File: filters.py From pyvista with MIT License | 5 votes |
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)