[vtkusers] how to speed up vtkVoxelModeller?
Lars Hegenbart
lars.hegenbart at hs.fzk.de
Wed Oct 31 08:42:03 EDT 2007
Dear VTK-Users,
I am using vtkVoxelModeller (vtk5.0) to voxelise polygonal mesh (e.g.
surface model made out off some ten-thousands quads). The target
voxel dimensions are about 90 x 50 x 300 = 1.35e6.
The problem is, that is very slow. On a WinXP Pentium4, 3.4 GHz
machine it takes days to get one surface model voxelised.
How can I possibly speed up vtkVoxelModeller?
Here comes my code:
vtkPolyData *polyOrgan = vtkPolyData::New();
polyOrgan->SetPoints(points); // points are generated before
points->Delete();
polyOrgan->SetPolys(polys); // polys are generated before
polys->Delete();
vtkCleanPolyData *polyOrganClean = vtkCleanPolyData::New();
polyOrganClean->SetInput(polyOrgan);// get rid of double definitions
vtkVoxelModeller *voxelmacher = vtkVoxelModeller::New();
voxelmacher->SetSampleDimensions(90,50,300);
voxelmacher->SetModelBounds( /* box just around the polydata */ );
voxelmacher->SetInput(polyOrganClean->GetOutput());
vtkDataSetWriter *aWriter = vtkDataSetWriter::New();
aWriter->SetFileName("afile.vtk");
aWriter->SetInputConnection(voxelmacher->GetOutputPort());
A performance check told me the following cpu-time fractions when my
code running:
36.7% vtkQuad::EvaluatePosition(double*, double*, int&, double*,
double&, double*)
19.4% vtkDataArrayTemplate<double>::GetTuple(int, double*)
7.1% vtkPoints::GetPoint(int, double*)
4.5% vtkTriangle::ComputeNormal(double*, double*, double*, double*)
3.5% vtkQuad::InterpolationFunctions(double*, double*)
3.4% vtkQuad::InterpolationDerivs(double*, double*)
Thanks in advance for any hints to speed up vtkVoxelModeller!
Best regards
Lars
More information about the vtkusers
mailing list