[vtkusers] Performance of vtkImplicitModeller
Marie-Gabrielle Vallet
mgv.research at gmail.com
Thu Nov 15 15:03:32 EST 2007
The two algorithms included in the vtkImplicitModeller -- the PerCell and
the PerVoxel methods -- perform differently when the input geometry is
scaled.
For my test cases -- more than a thousand of cells -- the PerVoxel algorithm
is faster, as mentioned in the class documentation.
But what is strange is that the speed is greatly influenced by the scale of
the model : using the same data, the CPU time can be reduced by 2 (PerVoxel
: 0.16 sec. instead of 0.38 sec.) or even by 100 (PerCell : 0.32 sec.
instead of 37.11 sec! ) if the geometry and all parameters relative to a
length are scaled to the geometry diameter.
Does someone know how to use the PerVoxel method at its fastest, when
changing the geometry size is not an option ?
(some code lines and output follows)
---
Marie-Gabrielle Vallet
-------------------------------------------------------------------
vtkPolyData *surf1 = vtkPolyData::New();
surf1 = surfAlg->GetOutput();
double* gridBounds = new double[6];
surf1->ComputeBounds();
surf1->GetBounds(gridBounds);
double threshold = .1*(gridBounds[1]-gridBounds[0]);
vtkImplicitModeller *imp = vtkImplicitModeller::New();
imp->SetInputConnection( surfAlg->GetOutputPort(0) );
imp->SetModelBounds( gridBounds );
imp->SetSampleDimensions( dim );
imp->SetMaximumDistance( threshold );
imp->SetCapValue( 2*threshold );
// imp->SetProcessModeToPerVoxel ();
vtkContourFilter *contour = vtkContourFilter::New();
contour->SetInputConnection( imp->GetOutputPort() );
contour->SetValue(0, threshold );
timer->StartTimer();
contour->Update();
timer->StopTimer();
cout << "ElapsedTime "<<timer->GetElapsedTime()<<" ";
cout << surf1->GetNumberOfCells() << " "
<< (dim[0]-1)*(dim[1]-1)*(dim[2]-1) << " "
<< threshold << " "
<< imp->GetMaximumDistance() << " "
<< imp->GetProcessModeAsString() << " "
<< imp->GetCapValue() << " "
<< imp->GetLocatorMaxLevel() << " "
<< endl;
--------------------------------------------------------------------
// Using the original geometry, diameter = 28.43
ElapsedTime 0.383428 4676 32760 1.548 1 PerVoxel 3.096 5
ElapsedTime 37.1108 4676 32760 1.548 1 PerCell 3.096 5
// Using the scaled geometry, diameter = 1
ElapsedTime 0.163597 4676 32760 0.0544493 0.0544493 PerVoxel 0.108899 5
ElapsedTime 0.322232 4676 32760 0.0544493 0.0544493 PerCell 0.108899 5
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20071115/a23b7b14/attachment.htm>
More information about the vtkusers
mailing list