Hi,<br><br>Finally, I used Goodwin Lawlor&#39;s filter: <a href="http://www.bioengineering-research.com/vtk/vtkRemoveCellsFilter.htm" target="_blank">http://www.bioengineering-research.com/vtk/vtkRemoveCellsFilter.htm</a> , which works very well. I just get a list of unconnected cells and remove them using this filter.<br>
<br>I still don&#39;t understand why the connectivity filter doesn&#39;t work for me. It removes the &quot;big&quot; unconnected regions but not some regions near my largest region. <br><br>Once again, thanks!<br>Corinne<br>
<br><br><div class="gmail_quote">2009/7/29 Dominik Szczerba <span dir="ltr">&lt;<a href="mailto:dominik@itis.ethz.ch">dominik@itis.ethz.ch</a>&gt;</span><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">Corinne Tith wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Dominik,<br>
<br>
I know cells are not removed because i tried something like:<br>
/my_polyData-&gt;GetNumberOfCells(//); // returns 100 cells<br>
for(int i = 1; i &lt; 10; i++)<br>
    my_polyData-&gt;GetPointData()-&gt;//GetArray(0)-&gt;SetTuple1(i,10);  //  part of my volume color changes<br>
for(int i = 1; i &lt; 50; i++)<br>
    my_polyData-&gt;DeleteCell(i);<br>
my_polyData-&gt;//RemovedDeletedCells();<br>
my_polyData&gt;GetNumberOfCells()//; // returns 50 cells/<br>
<br>
It seems ok, but on surface/wireframe mode, my volume is the same (except for the color).<br>
</blockquote>
<br></div>
sounds like the actor/mapper is not up to date... you need to call Update() or Modify() somewhere (on the dataset and/or the )... Also make sure that the input is actually valid, if you re-created the object its address changes and you have to make sure the actor/mapper gets the right input. One way is to use SetInputConnection style, another way is to re-set the input via SetInput().<div class="im">
<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<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>
</blockquote>
<br></div>
If you are after removing the disconnected regions and keeping only the largest one the connectivity filter has been serving me very well for years now.<br>
<br>
-- Dominik<br>
<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>
<br>
<br>
<br>
2009/7/28 Dominik Szczerba &lt;<a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a> &lt;mailto:<a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a>&gt;&gt;<br>
<br></div><div class="im">
    Well ConnectivityFilter should do this job for you - no need for<br>
    extra cell removal by foot.<br>
<br>
    -- Dominik<br>
<br>
    Stephane PLOIX wrote:<br>
<br>
<br>
        my_polyData is at the end of a pipeline. Each time you Update it<br>
        (which is done at each frame if you render it), it is reset to<br>
        the output of the previous filter.<br>
        If you want to break the dependency chain, you have to insert a<br>
        ShallowCopy :<br>
        output = my_vtkPolyDataConnectivityFilter-&gt;GetOutput();<br>
        my_polyData = vtkPolyData::New();<br>
        my_polyData -&gt;ShallowCopy(output);<br>
        ...<br>
        and remeber to call my_polyData -&gt;Delete() later.<br>
<br>
        But the best way would be to implement a filter that does the<br>
        job to remove some cells, so that your pipeline is still connected.<br>
<br>
        Stephane<br>
<br>
<br>
<br>
<br></div>
        *<a href="mailto:cocoricore@gmail.com" target="_blank">cocoricore@gmail.com</a> &lt;mailto:<a href="mailto:cocoricore@gmail.com" target="_blank">cocoricore@gmail.com</a>&gt;*<div class="im"><br>
        Envoyé par : <a href="mailto:vtkusers-bounces@vtk.org" target="_blank">vtkusers-bounces@vtk.org</a><br></div>
        &lt;mailto:<a href="mailto:vtkusers-bounces@vtk.org" target="_blank">vtkusers-bounces@vtk.org</a>&gt;<div class="im"><br>
<br>
        28/07/2009 15:47<br>
<br>
                       A<br></div><div class="im">
               <a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a> &lt;mailto:<a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a>&gt;<br></div>
        cc<br>
               <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a> &lt;mailto:<a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a>&gt;<div class="im"><br>
        Objet<br>
               Re: [vtkusers] How to really delete cells?<br>
<br>
<br>
               <br>
<br>
<br>
<br>
<br>
        No change.<br>
<br>
        2009/7/28 Dominik Szczerba &lt; <a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a><br></div>
        &lt;mailto:<a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a>&gt; &lt;mailto:<a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a><div class="im"><br>
        &lt;mailto:<a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a>&gt;&gt; &gt;<br>
        And what does calling -&gt;Update() ?<br>
<br>
        Corinne Tith wrote:<br>
        Thanks for your help. I tried to put your code after<br>
        my_polyData-&gt;RemoveDeletedCells();<br>
        Unfortunately It doesn&#39;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>
        2009/7/28 Dominik Szczerba &lt; <a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a><br>
        &lt;mailto:<a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a>&gt; &lt;mailto:<a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a><br></div>
        &lt;mailto:<a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a>&gt;&gt; &lt;mailto: <a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a><div><div></div><div class="h5">
<br>
        &lt;mailto:<a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a>&gt; &lt;mailto:<a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a><br>
        &lt;mailto:<a href="mailto:dominik@itis.ethz.ch" target="_blank">dominik@itis.ethz.ch</a>&gt;&gt; &gt;&gt;<br>
<br>
<br>
<br>
          my_polyData-&gt;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<br>
        seem to<br>
              be &#39;on&#39; the mesh but have no vertice in common.<br>
<br>
              I tried the filters vtkCleanPolyData and<br>
              vtkPolyDataConnectivityFilter, but most of my unconnected<br>
        cells<br>
              are not removed.<br>
              Finally, I tried to delete them &#39;manually&#39;, but nothing<br>
        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-&gt;SetInputConnection(my_vtkContourFilter-&gt;GetOutputPort());<br>
<br>
              // no effect on my cells<br>
                     my_vtkCleanPolyData-&gt;SetInputConnection(my_vtkWindowSincPolyDataFilter-&gt;GetOutputPort());<br>
<br>
              my_vtkCleanPolyData-&gt;PointMergingOn();<br>
                     my_vtkPolyDataConnectivityFilter-&gt;SetInputConnection(my_vtkContourFilter-&gt;GetOutputPort());<br>
                     my_vtkPolyDataConnectivityFilter-&gt;SetExtractionModeToLargestRegion();<br>
              // manual remove<br>
              my_vtkPolyDataConnectivityFilter-&gt;Update();<br>
              my_polyData = my_vtkPolyDataConnectivityFilter-&gt;GetOutput();<br>
              for(int i = 0; i &lt; n; i++){<br>
                    my_polyData-&gt;DeleteCell(cellsToRemove[i]);<br>
              }<br>
              my_polyData-&gt;RemoveDeletedCells();<br>
<br>
<br>
                     ------------------------------------------------------------------------<br>
<br>
              _______________________________________________<br>
              Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a> &lt;<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>&gt;<br>
        &lt;<a href="http://www.kitware.com/" target="_blank">http://www.kitware.com/</a>&gt; &lt; <a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a><br>
        &lt;<a href="http://www.kitware.com/" target="_blank">http://www.kitware.com/</a>&gt; &gt;<br>
<br>
<br>
<br>
              Visit other Kitware open-source projects at<br>
               <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
        &lt;<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a>&gt;<br>
<br>
<br>
              Please keep messages on-topic and check the VTK FAQ at:<br>
               <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
        &lt;<a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a>&gt;<br>
<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>
        &lt;<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a>&gt;<br>
<br>
<br>
<br>
<br>
<br>
        _______________________________________________<br></div></div>
        Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a> &lt;<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>&gt;<div class="im"><br>
<br>
        Visit other Kitware open-source projects at<br>
        <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br></div><div class="im">
        Please keep messages on-topic and check the VTK FAQ at:<br>
        <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>
        ------------------------------------------------------------------------<br>
<br>
<br>
        _______________________________________________<br></div>
        Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a> &lt;<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>&gt;<div class="im"><br>
<br>
        Visit other Kitware open-source projects at<br>
        <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br></div><div class="im">
        Please keep messages on-topic and check the VTK FAQ at:<br>
        <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>
<br>
</div></blockquote><font color="#888888">
<br>
<br>
-- <br>
d o m i n i k   s z c z e r b a ,   p h d . . . . . . . . . . .<br>
c o m p u t a t i o n a l   l i f e   s c i e n c e   g r o u p<br>
. . . . . . . i t &#39; i s   r e s e a r c h   f o u n d a t i o n<br>
. . . . . . . . . . . . . . . . . . . . <a href="http://www.itis.ethz.ch" target="_blank">http://www.itis.ethz.ch</a><br>
<br>
</font></blockquote></div><br>