def create_new_surface(completeVoronoiDiagram): modeller = vtkvmtk.vtkvmtkPolyBallModeller() if version < 6: modeller.SetInput(completeVoronoiDiagram) else: modeller.SetInputData(completeVoronoiDiagram) modeller.SetRadiusArrayName(radiusArrayName) modeller.UsePolyBallLineOff() modeller.SetSampleDimensions(polyBallImageSize) modeller.Update() # Write the new surface marchingCube = vtk.vtkMarchingCubes() marchingCube.SetInput(modeller.GetOutput()) marchingCube.SetValue(0,0.0) marchingCube.Update() envelope = marchingCube.GetOutput() return envelope
def vmtk_polyball_modeller(voronoi_diagram, poly_ball_size): """ Wrapper for vtkvmtkPolyBallModeller. Create an image where a polyball or polyball line are evaluated as a function. Args: voronoi_diagram (vtkPolyData): Input Voronoi diagram representing surface model poly_ball_size (list): Resolution of output Returns: vtkvmtkPolyBallModeller: Image where polyballs have been evaluated over a Voronoi diagram """ modeller = vtkvmtk.vtkvmtkPolyBallModeller() modeller.SetInputData(voronoi_diagram) modeller.SetRadiusArrayName(radiusArrayName) modeller.UsePolyBallLineOff() modeller.SetSampleDimensions(poly_ball_size) modeller.Update() return modeller
def Execute(self): if self.Centerlines == None: self.PrintError('Error: No input centerlines.') if self.RadiusArrayName == None: self.PrintError('Error: No radius array name.') modeller = vtkvmtk.vtkvmtkPolyBallModeller() modeller.SetInputData(self.Centerlines) modeller.SetRadiusArrayName(self.RadiusArrayName) modeller.UsePolyBallLineOn() if self.Image: modeller.SetReferenceImage(self.Image) else: modeller.SetSampleDimensions(self.SampleDimensions) if self.ModelBounds: modeller.SetModelBounds(self.ModelBounds) modeller.SetNegateFunction(self.NegateFunction) modeller.Update() self.Image = modeller.GetOutput()
newVoronoiPoints, newVoronoiPointsMISR = VoronoiDiagramInterpolation( interpolationCellId, startId, endId, startInterpolationDataset, endHalfInterpolationDataset, interpolatedCenterlines, 1) completeVoronoiDiagram = InsertNewVoronoiPoints(completeVoronoiDiagram, newVoronoiPoints, newVoronoiPointsMISR) newVoronoiPoints, newVoronoiPointsMISR = VoronoiDiagramInterpolation( interpolationCellId, endId, startId, endInterpolationDataset, startHalfInterpolationDataset, interpolatedCenterlines, 0) completeVoronoiDiagram = InsertNewVoronoiPoints(completeVoronoiDiagram, newVoronoiPoints, newVoronoiPointsMISR) WritePolyData(completeVoronoiDiagram, completeVoronoiFilename) print('Reconstructing Surface from Voronoi Diagram') modeller = vtkvmtk.vtkvmtkPolyBallModeller() modeller.SetInputData(completeVoronoiDiagram) modeller.SetRadiusArrayName(radiusArrayName) modeller.UsePolyBallLineOff() modeller.SetSampleDimensions(polyBallImageSize) modeller.Update() marchingCube = vtk.vtkMarchingCubes() marchingCube.SetInputData(modeller.GetOutput()) marchingCube.SetValue(0, 0.0) marchingCube.Update() envelope = marchingCube.GetOutput() WritePolyData(envelope, surfaceFilename)
endCellPointRadius = patchCenterlines.GetPointData().GetArray(radiusArrayName).GetTuple1(endCellPointId) endCellPointHalfRadius = endCellPointRadius/7.0 endInterpolationDataset = ExtractCylindricInterpolationVoronoiDiagram(endId,endCellPointId,endCellPointRadius,clippedVoronoi,patchCenterlines) endHalfInterpolationDataset = ExtractCylindricInterpolationVoronoiDiagram(endId,endCellPointId,endCellPointHalfRadius,clippedVoronoi,patchCenterlines) newVoronoiPoints, newVoronoiPointsMISR = VoronoiDiagramInterpolation(interpolationCellId,startId,endId,startInterpolationDataset,endHalfInterpolationDataset,interpolatedCenterlines,1) completeVoronoiDiagram = InsertNewVoronoiPoints(completeVoronoiDiagram,newVoronoiPoints,newVoronoiPointsMISR) newVoronoiPoints, newVoronoiPointsMISR = VoronoiDiagramInterpolation(interpolationCellId,endId,startId,endInterpolationDataset,startHalfInterpolationDataset,interpolatedCenterlines,0) completeVoronoiDiagram = InsertNewVoronoiPoints(completeVoronoiDiagram,newVoronoiPoints,newVoronoiPointsMISR) WritePolyData(completeVoronoiDiagram,completeVoronoiFilename) print 'Reconstructing Surface from Voronoi Diagram' modeller = vtkvmtk.vtkvmtkPolyBallModeller() modeller.SetInputData(completeVoronoiDiagram) modeller.SetRadiusArrayName(radiusArrayName) modeller.UsePolyBallLineOff() modeller.SetSampleDimensions(polyBallImageSize) modeller.Update() marchingCube = vtk.vtkMarchingCubes() marchingCube.SetInputData(modeller.GetOutput()) marchingCube.SetValue(0,0.0) marchingCube.Update() envelope = marchingCube.GetOutput() WritePolyData(envelope,surfaceFilename)