<br><span class="gmail_quote"></span>The two algorithms included in the vtkImplicitModeller -- the PerCell and the PerVoxel methods -- perform differently when the input geometry is scaled.<br><br>For my test cases -- more than a thousand of cells -- the PerVoxel algorithm is faster, as mentioned in the class documentation.
<br><br>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.
<br><br>Does someone know how to use the PerVoxel method at its fastest, when changing the geometry size is not an option ?
<br><br>(some code lines and output follows)<br>---<br>Marie-Gabrielle Vallet<br><br>-------------------------------------------------------------------<br> vtkPolyData *surf1 = vtkPolyData::New();<br> surf1 = surfAlg->GetOutput();
<br> double* gridBounds = new double[6];<br> surf1->ComputeBounds();<br> surf1->GetBounds(gridBounds);<br> double threshold = .1*(gridBounds[1]-gridBounds[0]);
<br><br> vtkImplicitModeller *imp = vtkImplicitModeller::New();<br> imp->SetInputConnection( surfAlg->GetOutputPort(0) );<br> imp->SetModelBounds( gridBounds );<br> imp->SetSampleDimensions( dim );
<br> imp->SetMaximumDistance( threshold );<br> imp->SetCapValue( 2*threshold );<br> // imp->SetProcessModeToPerVoxel ();<br><br> vtkContourFilter *contour = vtkContourFilter::New();<br> contour->SetInputConnection( imp->GetOutputPort() );
<br> contour->SetValue(0, threshold );<br><br> timer->StartTimer();<br> contour->Update();<br> timer->StopTimer();<br> cout << "ElapsedTime "<<timer->GetElapsedTime()<<" ";
<br> cout << surf1->GetNumberOfCells() << " " <br> << (dim[0]-1)*(dim[1]-1)*(dim[2]-1) << " " <br> << threshold << " "<br> << imp->GetMaximumDistance() << " "
<br> << imp->GetProcessModeAsString() << " "<br> << imp->GetCapValue() << " "<br> << imp->GetLocatorMaxLevel() << " "
<br>
<< endl;<br>--------------------------------------------------------------------<br>// Using the original geometry, diameter = 28.43<br>ElapsedTime 0.383428 4676 32760 1.548 1 PerVoxel 3.096 5<br>
ElapsedTime 37.1108 4676 32760 1.548 1 PerCell 3.096 5<br><br>// Using the scaled geometry, diameter = 1<br>
ElapsedTime 0.163597 4676 32760 0.0544493 0.0544493 PerVoxel 0.108899 5<br>ElapsedTime 0.322232 4676 32760 0.0544493 0.0544493 PerCell 0.108899 5<br><br><br>