From 36496681901d50a8dc0886a5ed74da040f8cf0c5 Mon Sep 17 00:00:00 2001 From: tfmoraes Date: Tue, 21 Dec 2010 19:13:08 +0000 Subject: [PATCH] Testing with quadric decimation --- invesalius/data/surface_process.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+), 0 deletions(-) diff --git a/invesalius/data/surface_process.py b/invesalius/data/surface_process.py index 55f724f..1bac49f 100644 --- a/invesalius/data/surface_process.py +++ b/invesalius/data/surface_process.py @@ -76,6 +76,19 @@ class SurfaceProcess(multiprocessing.Process): mcubes.ComputeNormalsOn() polydata = mcubes.GetOutput() + + triangle = vtk.vtkTriangleFilter() + triangle.SetInput(polydata) + triangle.Update() + polydata = triangle.GetOutput() + + bounds = polydata.GetBounds() + origin = ((bounds[1] + bounds[0]) / 2.0, (bounds[3] + bounds[2])/2.0, + (bounds[5] + bounds[4]) / 2.0) + + print "Bounds is", bounds + print "origin is", origin + #print "Decimating" #if self.decimate_reduction: #decimation = vtk.vtkDecimatePro() @@ -85,6 +98,20 @@ class SurfaceProcess(multiprocessing.Process): #decimation.SplittingOff() #polydata = decimation.GetOutput() + decimation = vtk.vtkQuadricClustering() + decimation.SetInput(polydata) + decimation.AutoAdjustNumberOfDivisionsOff() + decimation.SetDivisionOrigin(0, 0, 0) + decimation.SetDivisionSpacing(self.spacing) + decimation.SetFeaturePointsAngle(80) + decimation.UseFeaturePointsOn() + decimation.UseFeatureEdgesOn() + decimation.CopyCellDataOn() + + print "Division", decimation.GetNumberOfDivisions() + + polydata = decimation.GetOutput() + #if self.smooth_iterations and self.smooth_relaxation_factor: #print "Smoothing" #smoother = vtk.vtkWindowedSincPolyDataFilter() -- libgit2 0.21.2