<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.E-MailFormatvorlage17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE-AT" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Cool<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">For my first test that implementation below worked and i found out that this kind of algorithm does not help me on my problem, arg<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Can I send you an image/screenshot of the “geometric” stuff I want to filter? May you as an expert has a better idea for solving my problem. Short
 text description (but is really hard to explain):<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I have a mesh of a surface, scanned with a 3d scanner (triangles, vtkPolydata as explained). On the border of that mesh I have single “noisy” (or
 fringy) structures which I want to filter. These noise structures are minimal connected to the main mesh, so I can not use connected component filter (which I also used apriory to remove noise in the air).<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">Von:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Will Schroeder [mailto:will.schroeder@kitware.com]
<br>
<b>Gesend</b></span><b><span lang="DE" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">et:</span></b><span lang="DE" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Freitag, 22. Juli 2016 14:37<br>
<b>An:</b> Lodron, Gerald<br>
<b>Cc:</b> VTK Developer (vtk-developers@vtk.org)<br>
<b>Betreff:</b> Re: [vtk-developers] Number of neighbours for each cell<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Yes this is a great start. Since I am on a performance kick, I would probably use (under the hood) vtkStaticCellLocator which builds the links between points and cells much faster (threaded using vtkSMPTools and a parallel sort).  The actual
 "counting" of the neighbors could then be sped up using vtkSMPTools as well. It's probably overkill, but I'd like VTK to knock off the socks of anyone using it, and also to support our HPC friends who have this humbling habit of dumping really big data on
 top of VTK :-)<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Best,<br>
W<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Fri, Jul 22, 2016 at 8:25 AM, Lodron, Gerald <<a href="mailto:Gerald.Lodron@joanneum.at" target="_blank">Gerald.Lodron@joanneum.at</a>> wrote:<o:p></o:p></p>
<p class="MsoNormal">In my case the definition would be an edge, but yes it would be useful to define that as parameter….<br>
<br>
I already found a maybe not beautiful algorithm for vertices, not edges, may you want to reuse it as initial code:<br>
<br>
       vtkSmartPointer<vtkUnsignedIntArray> neighbours = vtkSmartPointer<vtkUnsignedIntArray>::New();<br>
        neighbours ->SetName("NumberOfNeighbours");<br>
        neighbours ->SetNumberOfValues(numberOfCells);<br>
<br>
        vtkSmartPointer<vtkIdList> cellPointIds = vtkSmartPointer<vtkIdList>::New();<br>
<br>
        vtkSmartPointer<vtkIdList> ptids = vtkSmartPointer<vtkIdList>::New();<br>
        vtkSmartPointer<vtkIdList> cellids = vtkSmartPointer<vtkIdList>::New();<br>
<br>
        for (vtkIdType cellId = 0; cellId < numberOfCells; ++cellId)<br>
        {<br>
            input->GetCellPoints(cellId, ptids);<br>
            /*<br>
            does not work<br>
            input ->GetCellNeighbors(cellId, oPtIds, oCellIds);<br>
            neighbours ->SetValue(cellId, static_cast<unsigned int>(oCellIds->GetNumberOfIds()));*/<br>
            std::set<vtkIdType> id_set;<br>
<br>
            for (vtkIdType ptid = 0; ptid < ptids ->GetNumberOfIds();ptid++)<br>
            {<br>
                poInput1->GetPointCells(ptids ->GetId(ptid), cellids);<br>
                for (vtkIdType cid = 0; cid < cellids ->GetNumberOfIds();cid++)<br>
                {<br>
                    vtkIdType id = cellids ->GetId(cid);<br>
                    if (id != cellId)<br>
                    {<br>
                        id_set.insert(cellids->GetId(cid));<br>
                    }<br>
                }<br>
            }<br>
            neighbours ->SetValue(cellId, static_cast<unsigned int>( id_set.size()));<br>
        }<br>
        output->GetCellData()->AddArray(neighbours);<br>
<br>
Von: Will Schroeder [mailto:<a href="mailto:will.schroeder@kitware.com">will.schroeder@kitware.com</a>]<br>
Gesendet: Freitag, 22. Juli 2016 14:09<br>
An: Lodron, Gerald<br>
Cc: VTK Developer (<a href="mailto:vtk-developers@vtk.org">vtk-developers@vtk.org</a>)<br>
Betreff: Re: [vtk-developers] Number of neighbours for each cell<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><br>
I don't know of such a filter but it would be easy to put together. Certainly it would be another useful tool in the topological analysis toolbox.<br>
<br>
Question: what is your definition of a neighbor? Connected at a vertex or along an edge? I suppose if we were to write such a filter the definition of a neighbor would be an optional parameter. I also suggest that this be a general filter so the same analysis
 could be applied to unstructured grids, etc. or to polygonal meshes with other than triangle cells.<br>
<br>
Best,<br>
W<br>
<br>
On Fri, Jul 22, 2016 at 6:51 AM, Lodron, Gerald <<a href="mailto:Gerald.Lodron@joanneum.at">Gerald.Lodron@joanneum.at</a>> wrote:<br>
 <br>
 <br>
Hi<br>
 <br>
I have a mesh (vtkPolyData with all triangles) where i want to visualize the number of neighbouring cells/triangles for each cell/triangle. (I later may want to threshold/filter it with that number to remove “noisy” triangles on border with low number of neighbours)<br>
 <br>
Is there a filter for that available?<br>
 <br>
Best regards<br>
 <br>
------------------------------------------------------------------------------------<br>
Gerald Lodron<br>
 <br>
Researcher of Machine Vision Applications Group<br>
DIGITAL - Institute for Information and Communication Technologies<br>
 <br>
JOANNEUM RESEARCH Forschungsgesellschaft mbH<br>
Steyrergasse 17, 8010 Graz, AUSTRIA<br>
 <br>
phone:   <a href="tel:%2B43-316-876-1751">+43-316-876-1751</a>   <br>
general fax: <a href="tel:%2B43-316-876-1751">+43-316-876-1751</a><br>
web: <a href="http://www.joanneum.at/digital" target="_blank">http://www.joanneum.at/digital</a><br>
e-mail: <a href="mailto:gerald.lodron@joanneum.at">gerald.lodron@joanneum.at</a><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>
Search the list archives at: <a href="http://markmail.org/search/?q=vtk-developers" target="_blank">
http://markmail.org/search/?q=vtk-developers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtk-developers" target="_blank">http://public.kitware.com/mailman/listinfo/vtk-developers</a><br>
<br>
<br>
<br>
<br>
<br>
--<br>
William J. Schroeder, PhD<br>
Kitware, Inc. - Building the World's Technical Computing Software<br>
28 Corporate Drive<br>
Clifton Park, NY 12065<br>
<a href="mailto:will.schroeder@kitware.com">will.schroeder@kitware.com</a><br>
<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a><br>
<a href="tel:%28518%29%20881-4902">(518) 881-4902</a><o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">-- <o:p></o:p></p>
<div>
<div>
<div>
<p class="MsoNormal">William J. Schroeder, PhD<br>
Kitware, Inc. - Building the World's Technical Computing Software<br>
28 Corporate Drive<br>
Clifton Park, NY 12065<br>
<a href="mailto:will.schroeder@kitware.com" target="_blank">will.schroeder@kitware.com</a><br>
<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a><br>
(518) 881-4902<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>