map0 = vtk.vtkImageSliceMapper() map0.BorderOn() map0.SliceAtFocalPointOn() map0.SliceFacesCameraOn() map0.SetInputConnection(dens0.GetOutputPort()) slice0 = vtk.vtkImageSlice() slice0.SetMapper(map0) slice0.GetProperty().SetColorWindow(vrange[1] - vrange[0]) slice0.GetProperty().SetColorLevel(0.5 * (vrange[0] + vrange[1])) # Now densify the point cloud and reprocess # Use relative radius print("Number of input points: {0}".format( clipper.GetOutput().GetNumberOfPoints())) denser = vtk.vtkDensifyPointCloudFilter() denser.SetInputConnection(clipper.GetOutputPort()) denser.SetTargetDistance(0.025) denser.SetMaximumNumberOfIterations(5) denser.Update() print("Number of output points: {0}".format( denser.GetOutput().GetNumberOfPoints())) dens1 = vtk.vtkPointDensityFilter() dens1.SetInputConnection(denser.GetOutputPort()) dens1.SetSampleDimensions(res, res, res) dens1.SetDensityEstimateToFixedRadius() dens1.SetRadius(0.05) dens1.SetDensityFormToVolumeNormalized() dens1.Update() vrange = dens1.GetOutput().GetScalarRange()
map0 = vtk.vtkImageSliceMapper() map0.BorderOn() map0.SliceAtFocalPointOn() map0.SliceFacesCameraOn() map0.SetInputConnection(dens0.GetOutputPort()) slice0 = vtk.vtkImageSlice() slice0.SetMapper(map0) slice0.GetProperty().SetColorWindow(vrange[1]-vrange[0]) slice0.GetProperty().SetColorLevel(0.5*(vrange[0]+vrange[1])) # Now densify the point cloud and reprocess # Use relative radius print("Number of input points: {0}".format(clipper.GetOutput().GetNumberOfPoints())) denser = vtk.vtkDensifyPointCloudFilter() denser.SetInputConnection(clipper.GetOutputPort()) denser.SetTargetDistance(0.025) denser.SetMaximumNumberOfIterations(5) denser.Update() print("Number of output points: {0}".format(denser.GetOutput().GetNumberOfPoints())) dens1 = vtk.vtkPointDensityFilter() dens1.SetInputConnection(denser.GetOutputPort()) dens1.SetSampleDimensions(res,res,res) dens1.SetDensityEstimateToFixedRadius() dens1.SetRadius(0.05) dens1.SetDensityFormToVolumeNormalized() dens1.Update() vrange = dens1.GetOutput().GetScalarRange()
glyphs = vtk.vtkGlyph3D() glyphs.SetInputConnection(cube.GetOutputPort()) glyphs.SetSourceConnection(sphere.GetOutputPort()) glyphs.ScalingOff() glyphs.OrientOff() mapper = vtk.vtkPolyDataMapper() mapper.SetInputConnection(glyphs.GetOutputPort()) actor = vtk.vtkActor() actor.SetMapper(mapper) # Now densify the point cloud and reprocess. Use a # neighborhood type of N closest points denser1 = vtk.vtkDensifyPointCloudFilter() denser1.SetInputConnection(cube.GetOutputPort()) denser1.SetNeighborhoodTypeToNClosest() denser1.SetNumberOfClosestPoints(3) denser1.SetTargetDistance(1.0) denser1.SetMaximumNumberOfIterations(3) glyphs1 = vtk.vtkGlyph3D() glyphs1.SetInputConnection(denser1.GetOutputPort()) glyphs1.SetSourceConnection(sphere.GetOutputPort()) glyphs1.ScalingOff() glyphs1.OrientOff() mapper1 = vtk.vtkPolyDataMapper() mapper1.SetInputConnection(glyphs1.GetOutputPort())