<div dir="ltr">I see,<div>Well, in this case, you may have points that are not part of any cells. Can you share your data file?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 23, 2016 at 12:16 PM, David Edmunds <span dir="ltr"><<a href="mailto:David.Edmunds@icr.ac.uk" target="_blank">David.Edmunds@icr.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi Dan,<div><br></div><div>Thanks, but I actually get a much smaller number when I count all the points from cells. Also, in my input dataset the cells are disjoint, i.e. no points are shared between multiple cells.</div><div><br></div><div>Kind regards,</div><div><br></div><div>Dave</div><div><div class="h5"><div><br></div><div><div><div>On 23 May 2016, at 16:51, Dan Lipsa <<a href="mailto:dan.lipsa@kitware.com" target="_blank">dan.lipsa@kitware.com</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr">Hi David,<div>You have shared points between cells so it is normal you'll get a bigger number when you count all the points from cells.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 23, 2016 at 10:01 AM, David Edmunds <span dir="ltr"><<a href="mailto:David.Edmunds@icr.ac.uk" target="_blank">David.Edmunds@icr.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear all,<br>
<br>
I am traversing a vtkPolyData object which is read in from a file using vtkXMLPolyDataReader. I access the number of points in the vtkPolyData in two different ways, here is my source code:<br>
<br>
vtkSmartPointer<vtkXMLPolyDataReader> reader = vtkSmartPointer<vtkXMLPolyDataReader>::New();<br>
reader->SetFileName("/Users/dedmunds/Desktop/organ_Body.vtp");<br>
reader->Update();<br>
vtkSmartPointer<vtkPolyData> poly_data = reader->GetOutput();<br>
<br>
cout << "Number of points: " << poly_data->GetNumberOfPoints() << endl;<br>
<br>
int traversal_points = 0;<br>
for (int i=0; i<poly_data->GetNumberOfCells(); i++) {<br>
traversal_points += poly_data->GetCell(i)->GetNumberOfPoints();<br>
}<br>
cout << "Traversal number of points: " << traversal_points << endl;<br>
<br>
Here is the output:<br>
<br>
Number of points: 286402<br>
Traversal number of points: 143204<br>
<br>
Why do I get two different answers? The second number is approximately half the first. What am I doing wrong?<br>
<br>
Thanks for your help,<br>
<br>
Kind regards,<br>
<br>
Dave<br>
<br>
The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP.<br>
<br>
This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer and network.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com/" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div>
</blockquote></div><br></div><br clear="both">
The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP.<br>
<br>
This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer and network.<br>
</div></div></div></blockquote></div><br></div>