<pre> Lars,<br><br>It's tricky, but you should try to scale you geometry, such that all <br>distances are less than one. I found this feature using vtkImplicitModeller <br>which is said to be very similar to vtkVoxelModeller.
<br><br>See my message "Performance of vtkImplicitModeller" dated from last week.<br><br>I also tested my code using a vtkVoxelModeller instead of an implicit one<br>and the speed up due to the scaling was also 1/100. vtkImplicitModeller is a
<br>more complex class, but it is a little bit quicker.<br><br>Regards.<br>Marie-Gabrielle<br><br>> Dear VTK-Users,<br>
> I am using vtkVoxelModeller (vtk5.0) to voxelise polygonal mesh (e.g. <br>> surface model made out off some ten-thousands quads). The target <br>> voxel dimensions are about 90 x 50 x 300 = 1.35e6.<br>
> The problem is, that is very slow. On a WinXP Pentium4, 3.4 GHz <br>> machine it takes days to get one surface model voxelised.<br><br>> How can I possibly speed up vtkVoxelModeller?<br><br><br><br>> Here comes my code:
<br><br>> vtkPolyData *polyOrgan = vtkPolyData::New();<br>> polyOrgan->SetPoints(points); // points are generated before<br>> points->Delete();<br>> polyOrgan->SetPolys(polys); // polys are generated before
<br>> polys->Delete();<br>> vtkCleanPolyData *polyOrganClean = vtkCleanPolyData::New();<br>> polyOrganClean->SetInput(polyOrgan);// get rid of double definitions<br>> vtkVoxelModeller *voxelmacher = vtkVoxelModeller::New();
<br>> voxelmacher->SetSampleDimensions(90,50,300);<br>> voxelmacher->SetModelBounds( /* box just around the polydata */ );<br>> voxelmacher->SetInput(polyOrganClean->GetOutput());<br>> vtkDataSetWriter *aWriter = vtkDataSetWriter::New();
<br>> aWriter->SetFileName("afile.vtk");<br>> aWriter->SetInputConnection(voxelmacher->GetOutputPort());<br><br><br>> A performance check told me the following cpu-time fractions when my <br>> code running:
<br><br>>         36.7%        vtkQuad::EvaluatePosition(double*, double*, int&, double*, <br>double&, double*)        <br>>         19.4%        vtkDataArrayTemplate<double>::GetTuple(int, double*)        <br>>         7.1%        vtkPoints::GetPoint(int, double*)        
<br>>         4.5%        vtkTriangle::ComputeNormal(double*, double*, double*, double*)        <br>>         3.5%        vtkQuad::InterpolationFunctions(double*, double*)        <br>>         3.4%        vtkQuad::InterpolationDerivs(double*, double*)        <br><br><br>> Thanks in advance for any hints to speed up vtkVoxelModeller!
<br>> Best regards<br><br>> Lars<br><br></pre>