[vtkusers] how to speed up vtkVoxelModeller?
Marie-Gabrielle Vallet
mgv.research at gmail.com
Mon Nov 19 16:34:29 EST 2007
Lars,
It's tricky, but you should try to scale you geometry, such that all
distances are less than one. I found this feature using vtkImplicitModeller
which is said to be very similar to vtkVoxelModeller.
See my message "Performance of vtkImplicitModeller" dated from last week.
I also tested my code using a vtkVoxelModeller instead of an implicit one
and the speed up due to the scaling was also 1/100. vtkImplicitModeller is a
more complex class, but it is a little bit quicker.
Regards.
Marie-Gabrielle
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20071119/30864002/attachment.htm>
More information about the vtkusers
mailing list