[vtkusers] Quadric Decimation stoping at 20%

rec88 rec88 at msstate.edu
Fri Dec 2 12:58:56 EST 2016


I have a few large mesh datasets I am working with, over 1.5 gb, per mesh and
and am trying to reduce them using the Quadric error metrics. While the
first one seems to have worked well, the others seem to  stop reducing at
20%. I was wondering if anybody has  run into a similar problem. Here is an
example of my decimation code in python. 


import os
import sys
import vtk
import subprocess
import time
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
#




time0=time.time()

reductionF = .995


filein="FILEIN"
fileout="FILEOUT"

#set up the pipeline 
reader=vtk.vtkXMLPolyDataReader()
reader.SetFileName(filein)
reader.Update()
reader_output=reader.GetOutput()

#set filters
gf=vtk.vtkGeometryFilter()
gf.SetInputData(reader_output)
tf=vtk.vtkTriangleFilter()
tf.SetInputConnection(gf.GetOutputPort())

#set mappers and actors
gMapper = vtk.vtkPolyDataMapper()
gMapper.SetInputConnection(gf.GetOutputPort())
time1=time0-time.time()
gActor = vtk.vtkActor()
gActor.SetMapper(gMapper)
mapper=vtk.vtkPolyDataMapper()
mapper.SetInputData(reader.GetOutput())

#do the decimation
mesh = vtk.vtkQuadricDecimation()
mesh.SetInputConnection(tf.GetOutputPort())
mesh.SetTargetReduction(reductionF)
#mesh.AttributeErrorMetricOn()
print "SET REDUCTION SUCCSEFUL"
mesh.Update()

time2=time0-time.time()
#set directory to write.
os.chdir("LOCATION")



#Setup the out pipes and write it out
extract = vtk.vtkExtractPolyDataPiece()
extract.SetInputConnection(mesh.GetOutputPort())
pdWriter = vtk.vtkXMLPolyDataWriter()
pdWriter.SetFileName(fileout)
pdWriter.SetInputConnection(mesh.GetOutputPort())
pdWriter.SetDataModeToAppended()
#pdWriter.SetNumberOfPieces(2)            #originally 2
pdWriter.Write()


 

mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(mesh.GetOutputPort())
os.chdir("script location")





--
View this message in context: http://vtk.1045678.n5.nabble.com/Quadric-Decimation-stoping-at-20-tp5741405.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list