<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#003333">
<font size="-1"><font face="Tahoma">Hi all,<br>
<br>
I'm working on contour resulting from vtkCutter. <br>
>From contour, I would like to get all points related to each regions of
my contour.<br>
<br>
My code works but I encounter some performance problems on a mesh : it
takes 8min to compute the process and 70% of the computation is taken
by vtkPolyDataConnectivityFilter and also vtkStripper is quite low. <br>
<br>
For information, my mesh contains ~37000 triangles and a lot of holes<br>
<br>
I have already done this before without using Vtk and it took me less
time (less than 30sec) so I guess ther's should be some optimisation.<br>
<br>
- one a hand, I would like to know if I use the best way to do what I
want<br>
- on the other hand, does anybody have an idea to optimize this code ?<br>
<br>
Here is a pseudo code which illustrates my development : <br>
<br>
slice = vtkCutter->getOutput();<br>
<br>
vtkPolyDataConnectivityFilter filter;<br>
filter->SetExtractionModeToAllRegions();<br>
filter->SetInput(slice);<br>
filter->Update();<br>
<br>
nb_contours = filter->GetNumberOfExtractedRegions(); </font></font><font
size="-1"><font face="Tahoma">//- nb_contours : ~900</font></font><br>
<font size="-1"><font face="Tahoma"><br>
for i=0 to nb_contours<br>
{ <br>
<br>
//EXTRACTING EACH REGION OF THE CUTTER RESULT<br>
filter->InitializeSpecifiedRegionList(); <br>
filter->AddSpecifiedRegion(idx);<br>
filter->Update();<br>
<br>
vtkPolyData contour;<br>
contour->DeepCopy(filter->GetOutput());<br>
contour->Update();<br>
<br>
//GETTING ALL LINES FROM EACH REGION<br>
vtkStripper stripper;<br>
stripper->SetInput(contour);<br>
stripper->Update();<br>
<br>
int numberOfLines = stripper->GetOutput()->GetNumberOfLines();<br>
<br>
vtkSmartPointer<vtkPoints> points =
stripper->GetOutput()->GetPoints();<br>
vtkSmartPointer<vtkCellArray> lines =
stripper->GetOutput()->GetLines();<br>
<br>
vtkIdType *indices;<br>
vtkIdType numberOfPoints;<br>
unsigned int lineCount = 0;<br>
<br>
for (lines->InitTraversal();
lines->GetNextCell(numberOfPoints, indices); lineCount++)<br>
{<br>
//GETTING ALL POINTS FROM LINES<br>
for (vtkIdType i = 0; i < numberOfPoints; i++)<br>
{<br>
double coord[3];<br>
points->GetPoint(indices[i], coord);<br>
<br>
//...<br>
}<br>
<br>
}<br>
}<br>
<br>
Please help me with this problem<br>
<br>
Thanks by advance,<br>
<br>
Nicolas</font></font><br>
</body>
</html>