Dominik,<br><br>I know cells are not removed because i tried something like:<br><i>my_polyData->GetNumberOfCells(</i><i>); // returns 100 cells<br>for(int i = 1; i < 10; i++)<br> my_polyData->GetPointData()-></i><i>GetArray(0)->SetTuple1(i,10); // part of my volume color changes<br>
for(int i = 1; i < 50; i++)<br> my_polyData->DeleteCell(i);<br>my_polyData-></i><i>RemovedDeletedCells(); <br>my_polyData>GetNumberOfCells()</i><i>; // returns 50 cells</i><br><br>It seems ok, but on surface/wireframe mode, my volume is the same (except for the color).<br>
<br>Moreover, I coded a method that color my surface by following connected points. Some cells are not connected, even if I use ConnectivityFilter.<br><br>Stephane,<br>I tried your suggestion of ShallowCopy and I get a black screen. I think I understand what you mean.<br>
<br>Maybe I should implement my own filter.<br>Thanks a lot for your help<br>Corinne<br><br><br>
<br><br><div class="gmail_quote">2009/7/28 Dominik Szczerba <span dir="ltr"><<a href="mailto:dominik@itis.ethz.ch">dominik@itis.ethz.ch</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Well ConnectivityFilter should do this job for you - no need for extra cell removal by foot.<br>
<br>
-- Dominik<br>
<br>
Stephane PLOIX wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
<br>
my_polyData is at the end of a pipeline. Each time you Update it (which is done at each frame if you render it), it is reset to the output of the previous filter.<br>
If you want to break the dependency chain, you have to insert a ShallowCopy :<br>
output = my_vtkPolyDataConnectivityFilter->GetOutput();<br>
my_polyData = vtkPolyData::New();<br>
my_polyData ->ShallowCopy(output);<br>
...<br>
and remeber to call my_polyData ->Delete() later.<br>
<br>
But the best way would be to implement a filter that does the job to remove some cells, so that your pipeline is still connected.<br>
<br>
Stephane<br>
<br>
<br>
<br>
<br>
*<a href="mailto:cocoricore@gmail.com" target="_blank">cocoricore@gmail.com</a>*<br>
Envoyé par : <a href="mailto:vtkusers-bounces@vtk.org" target="_blank">vtkusers-bounces@vtk.org</a><br>
<br>
28/07/2009 15:47<br>
<br>
<br>
A<br>
<a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a><br>
cc<br>
<a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>
Objet<br>
Re: [vtkusers] How to really delete cells?<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
No change.<br>
<br></div><div class="im">
2009/7/28 Dominik Szczerba < <a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a> <mailto:<a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a>> ><br>
And what does calling ->Update() ?<br>
<br>
Corinne Tith wrote:<br>
Thanks for your help. I tried to put your code after my_polyData->RemoveDeletedCells();<br>
Unfortunately It doesn't work.<br>
I tried to delete lot of cells, they are never really removed.<br>
<br>
My VTK version is 5.2, does it matter?<br>
<br>
<br></div>
2009/7/28 Dominik Szczerba < <a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a> <mailto:<a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a>> <mailto: <a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a> <mailto:<a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a>> >><div>
<div></div><div class="h5"><br>
<br>
<br>
my_polyData->Modified()<br>
<br>
Corinne Tith wrote:<br>
<br>
Hi all,<br>
<br>
I get a polydata volume with a vtkContourFilter and a<br>
vtkWindowSincPolyDataFilter.<br>
Some cells are not connected to the largest volume. They seem to<br>
be 'on' the mesh but have no vertice in common.<br>
<br>
I tried the filters vtkCleanPolyData and<br>
vtkPolyDataConnectivityFilter, but most of my unconnected cells<br>
are not removed.<br>
Finally, I tried to delete them 'manually', but nothing happens.<br>
<br>
How can I really remove my unconnected cells?<br>
<br>
Any help is appreciated, thanks!<br>
<br>
<br>
// generate my volume<br>
my_vtkWindowSincPolyDataFilter->SetInputConnection(my_vtkContourFilter->GetOutputPort());<br>
<br>
// no effect on my cells<br>
my_vtkCleanPolyData->SetInputConnection(my_vtkWindowSincPolyDataFilter->GetOutputPort());<br>
<br>
my_vtkCleanPolyData->PointMergingOn();<br>
my_vtkPolyDataConnectivityFilter->SetInputConnection(my_vtkContourFilter->GetOutputPort());<br>
my_vtkPolyDataConnectivityFilter->SetExtractionModeToLargestRegion();<br>
// manual remove<br>
my_vtkPolyDataConnectivityFilter->Update();<br>
my_polyData = my_vtkPolyDataConnectivityFilter->GetOutput();<br>
for(int i = 0; i < n; i++){<br>
my_polyData->DeleteCell(cellsToRemove[i]);<br>
}<br>
my_polyData->RemoveDeletedCells();<br>
<br>
<br>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br></div></div>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a> <<a href="http://www.kitware.com/" target="_blank">http://www.kitware.com/</a>> < <a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a> <<a href="http://www.kitware.com/" target="_blank">http://www.kitware.com/</a>> ><div class="im">
<br>
<br>
<br>
Visit other Kitware open-source projects at<br></div>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a> <<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a>><div class="im">
<br>
<br>
Please keep messages on-topic and check the VTK FAQ at:<br></div>
<a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a> <<a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a>><div class="im"><br>
<br>
Follow this link to subscribe/unsubscribe:<br></div>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a> <<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a>><div class="im">
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" 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" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br>
<br></div>
------------------------------------------------------------------------<div class="im"><br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" 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" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div></blockquote>
<br>
</blockquote></div><br>