<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<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 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;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 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;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.apple-tab-span
        {mso-style-name:apple-tab-span;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        mso-fareast-language:DE;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        mso-fareast-language:DE;}
span.EmailStyle23
        {mso-style-type:personal-reply;
        font-family:"Arial","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Arial","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 link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>Thank you very much! This example solved my problem :-) <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>My vtkImageData is only for 2D and z-value for spacing was set to 0. I set it to 1 and now it works.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>Good bye,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>Lukas<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Gonzalo Amadio [mailto:gonzaloamadio@gmail.com] <br><b>Sent:</b> Dienstag, 21. August 2012 17:48<br><b>To:</b> Boehm, Lukas<br><b>Cc:</b> Kevin H. Hobbs; vtkusers@vtk.org<br><b>Subject:</b> Re: [vtkusers] Find point by coordiante<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Here do you have an example. Where findPoint is used either in an image and in a polydata.<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><p class=MsoNormal><o:p> </o:p></p></div><div><div><p class=MsoNormal>#include <vtkVersion.h><o:p></o:p></p></div><div><p class=MsoNormal>#include <vtkSmartPointer.h><o:p></o:p></p></div><div><p class=MsoNormal>#include <vtkPolyData.h><o:p></o:p></p></div><div><p class=MsoNormal>#include <vtkTriangleFilter.h><o:p></o:p></p></div><div><p class=MsoNormal>#include <vtkIdTypeArray.h><o:p></o:p></p></div><div><p class=MsoNormal>#include <vtkImageDataGeometryFilter.h><o:p></o:p></p></div><div><p class=MsoNormal>#include <vtkImageData.h><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>int main(int, char *[])<o:p></o:p></p></div><div><p class=MsoNormal>{<o:p></o:p></p></div><div><p class=MsoNormal><span class=apple-tab-span> </span>//Create an image data<o:p></o:p></p></div><div><p class=MsoNormal><span class=apple-tab-span> </span>vtkSmartPointer<vtkImageData> imageData = vtkSmartPointer<vtkImageData>::New();<o:p></o:p></p></div><div><p class=MsoNormal><span class=apple-tab-span> </span>imageData->SetDimensions(5,5,1);<o:p></o:p></p></div><div><p class=MsoNormal><span class=apple-tab-span> </span>imageData->SetSpacing(1.0, 1.0, 1.0);<o:p></o:p></p></div><div><p class=MsoNormal><span class=apple-tab-span> </span>imageData->SetOrigin(0.0, 0.0, 0.0);<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><span class=apple-tab-span> </span>//Convert the image to a polydata<o:p></o:p></p></div><div><p class=MsoNormal><span class=apple-tab-span> </span>vtkSmartPointer<vtkImageDataGeometryFilter> imageDataGeometryFilter = vtkSmartPointer<vtkImageDataGeometryFilter>::New();<o:p></o:p></p></div><div><p class=MsoNormal><span class=apple-tab-span> </span>imageDataGeometryFilter->SetInputConnection(imageData->GetProducerPort());<o:p></o:p></p></div><div><p class=MsoNormal><span class=apple-tab-span> </span>imageDataGeometryFilter->Update();<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><span class=apple-tab-span> </span>vtkSmartPointer<vtkTriangleFilter> triangleFilter = vtkSmartPointer<vtkTriangleFilter>::New();<o:p></o:p></p></div><div><p class=MsoNormal><span class=apple-tab-span> </span>triangleFilter->SetInputConnection(imageDataGeometryFilter->GetOutputPort());<o:p></o:p></p></div><div><p class=MsoNormal><span class=apple-tab-span> </span>triangleFilter->Update();<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><span class=apple-tab-span> </span>vtkSmartPointer<vtkPolyData> triang = triangleFilter->GetOutput();//polydata normal, cells<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><span class=apple-tab-span> </span>triang->BuildLinks();<o:p></o:p></p></div><div><p class=MsoNormal><span class=apple-tab-span> </span>triang->BuildCells();<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><span class=apple-tab-span> </span>vtkIdType id = triang->FindPoint(0,0,0);<o:p></o:p></p></div><div><p class=MsoNormal><span class=apple-tab-span> </span>std::cout << id << std::endl;<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><span class=apple-tab-span> </span>vtkIdType id2 = imageData->FindPoint(0,0,0);<o:p></o:p></p></div><div><p class=MsoNormal><span class=apple-tab-span> </span>std::cout << id2 << std::endl;<o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal><span class=apple-tab-span> </span>return EXIT_SUCCESS;<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>}<o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>2012/8/21 Boehm, Lukas <<a href="mailto:Lukas.Boehm@cellent.de" target="_blank">Lukas.Boehm@cellent.de</a>><o:p></o:p></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>Thank you both for your answers!</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>FindPoint works perfect with vtkPolyData, but now I think I can’t use vtkPolyData. Instead I probably have to use vtkImageData. </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>My VTK pipeline looks like this:</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>1.)</span><span lang=EN-US style='font-size:7.0pt;color:#1F497D'> </span><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>Create vtkImageData with all points</span><o:p></o:p></p><p><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>2.)</span><span lang=EN-US style='font-size:7.0pt;color:#1F497D'> </span><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>Use vtkMarchingSquares filter to get vtkPolyData representing some iso lines</span><o:p></o:p></p><p><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>3.)</span><span lang=EN-US style='font-size:7.0pt;color:#1F497D'> </span><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>Some unimportant clipping stuff…</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>If I use the vtkPolyData object from vtkMarchingSquares I get values which make sense. But it seems like marching squares removes all points where no iso lines are drawn. I only find ids of points which are on the iso lines. </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>So my idea was to use vtkImageData. But not even the simpliest example works with vtkImageData and FindPoint:</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white'><span lang=EN-US style='font-size:10.0pt;font-family:Consolas;color:blue'>double</span><span lang=EN-US style='font-size:10.0pt;font-family:Consolas'>[] pos = imageData.GetPoint(200);</span><o:p></o:p></p><pre style='background:white'><span lang=EN-US style='font-family:Consolas;color:green'>// pos contains 18.0, -29.0, 0.0 which seems to be correct</span><o:p></o:p></pre><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white'><span lang=EN-US style='font-size:10.0pt;font-family:Consolas;color:blue'>int</span><span lang=EN-US style='font-size:10.0pt;font-family:Consolas'> id = imageData.FindPoint(pos[0], pos[1], pos[2]);</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>I would expect ‘id’ to have the value 200. But it always has the value -1. The documentation says that a return value < 0 means that the point can’t be found (maybe it’s outside of the vtkImageData object). Could somebody please tell me why FindPoint always returns -1?</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>Thank you,</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'>Lukas</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Gonzalo Amadio [mailto:<a href="mailto:gonzaloamadio@gmail.com" target="_blank">gonzaloamadio@gmail.com</a>] <br><b>Sent:</b> Dienstag, 21. August 2012 15:48<br><b>To:</b> Kevin H. Hobbs<br><b>Cc:</b> Boehm, Lukas; <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br><b>Subject:</b> Re: [vtkusers] Find point by coordiante</span><o:p></o:p></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'>I think this will work!..<br><br><a href="http://www.vtk.org/doc/release/5.6/html/a00430.html#fb20db494bf2e8c0aff4ff2fcf7d6a22" target="_blank">http://www.vtk.org/doc/release/5.6/html/a00430.html#fb20db494bf2e8c0aff4ff2fcf7d6a22</a><br><br>The doc says "find the closes point to the coordinates provided as arguiment"<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>2012/8/21 Kevin H. Hobbs <<a href="mailto:hobbsk@ohio.edu" target="_blank">hobbsk@ohio.edu</a>><o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'>On 08/21/2012 09:18 AM, Boehm, Lukas wrote:<br>> Hello,<br>><br>><br>><br>> I’ve got a short question. I have a vtkPoints object and a coordinate<br>> (x,y,z). Is there a way to get the id of the closest point to this<br>> coordinate? I didn’t find anything.<br>><o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'>You need a point locator.<br><br><a href="http://www.vtk.org/doc/nightly/html/classvtkPointLocator.html" target="_blank">http://www.vtk.org/doc/nightly/html/classvtkPointLocator.html</a><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><o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><br><br clear=all><o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'>-- <br>--------<br>Gonzalo Amadio<o:p></o:p></p></div></div></div></div><p class=MsoNormal><o:p> </o:p></p><p>_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _<o:p></o:p></p><p>cellent Aktiengesellschaft<br>Vorsitzender des Aufsichtsrates: Dr. Martin Setzer<br>Vertretungsberechtigter Vorstand: Andreas Schwegler<br>Gerichtsstand: Amtsgericht Stuttgart, HRB 22791<br>Umsatzsteuer-ID: DE 226611517<br>Firmensitz: Stuttgart<o:p></o:p></p><p>Diese EMail sowie etwaige Anlagen sind ausschliesslich fuer den Adressaten bestimmt und koennen vertrauliche oder gesetzlich<br>geschuetzte Informationen enthalten. Wenn Sie nicht der bestimmungsgemaesse Empfaenger sind, unterrichten Sie bitte den Absender <br>und vernichten Sie diese Mail. Anderen als dem bestimmungsgemaessen Adressaten ist es untersagt, diese EMail zu speichern, <br>weiterzuleiten oder ihren Inhalt, auf welche Weise auch immer, zu verwenden. Wir verwenden aktuelle Virenschutzprogramme. <br>Fuer Schäden, die dem Empfaenger gleichwohl durch von uns zugesandte, mit Viren befallene EMails entstehen, schliessen wir jede Haftung aus.<o:p></o:p></p><p>The information contained in this e-mail or attachments is intended only for its addressee and may contain confidential and/or <br>privileged information. If you have received this e-mail in error, please notify the sender and delete the e-mail. If you are not the <br>intended recipient, you are hereby notified, that saving, distribution or use of the content of this e-mail in any way is prohibited. <br>We use updated virus protection software. We do not accept any responsibility for damages caused anyhow by viruses transmitted via e-mail.<br>_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p></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 style='margin-bottom:12.0pt'>-- <br>--------<br>Gonzalo Amadio<o:p></o:p></p></div></div></div></body></html>