I got it work, very odd behavior though. For the next guy:<br><br>vtkLinearTransform* inv = icp-&gt;GetLinearInverse();<br>seems to return something very bizarre and not the actual inverse that I wanted.<br><br>I&#39;m not sure if it&#39;s a good plan, but I directly modified the matrix of the vtkIterativeClosestPointTransform:<br>
<br>    vtkTransformPolyDataFilter* ModelToScan = vtkTransformPolyDataFilter::New();<br>    ModelToScan-&gt;SetInput(Model);<br>    icp-&gt;GetMatrix()-&gt;Invert();<br>    ModelToScan-&gt;SetTransform(icp);<br>    ModelToScan-&gt;Update();<br>
    vtkPolyData* polydataModel = ModelToScan-&gt;GetOutput();<br><br>and it worked properly.<br><br>Thanks for the guidance Wes.<br><br clear="all">Thanks,<br><br>David<br>
<br><br><div class="gmail_quote">On Mon, Mar 23, 2009 at 10:33 AM, Wes Turner <span dir="ltr">&lt;<a href="mailto:wes.turner@kitware.com">wes.turner@kitware.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><br><div class="gmail_quote"><div class="im">On Mon, Mar 23, 2009 at 9:52 AM, David Doria <span dir="ltr">&lt;<a href="mailto:daviddoria@gmail.com" target="_blank">daviddoria@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Wes - you were right on, I switched which file was the target and it worked much better. I guess I thought the implementation would have thrown away points that didn&#39;t have a &quot;good&quot; match, but maybe it is and that threshold is just larger than expected? Is that modifiable?<br>


<br>Also, I am apparently doing something wrong with the inverse transform.<br>This works correctly, and brings the Scan to the Model:<br>    vtkTransformPolyDataFilter* ScanToModel = vtkTransformPolyDataFilter::New();<br>



    ScanToModel-&gt;SetInput(Scan);<br>
    ScanToModel-&gt;SetTransform(icp);<br>
    ScanToModel-&gt;Update();<br>
    vtkPolyData* polydataScan = ScanToModel-&gt;GetOutput();<br>
</blockquote></div><div><br>I don&#39;t believe there is a threshold, and can&#39;t find it in the documentation of the class.  I believe that this variant simply uses the closest point regardless of the actual distance.  <br>

</div><div class="im"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>So I thought this would bring the Model to the Scan:<br><br>    vtkTransformPolyDataFilter* ModelToScan = vtkTransformPolyDataFilter::New();<br>

    ModelToScan-&gt;SetInput(Model);<br>    vtkLinearTransform* inv = icp-&gt;GetLinearInverse();<br>
    ModelToScan-&gt;SetTransform(inv);<br>    ModelToScan-&gt;Update();<br>    vtkPolyData* polydataModel = ModelToScan-&gt;GetOutput();<br><br>but it ends up in a really wacky position. Is there more to it than simply calling GetLinearInverse?</blockquote>

</div><div><br>First, make sure you do an icp-&gt;Update() before you grab the linear transform, just to be sure the ICP has actually run.  Other than that, I&#39;m not sure what GetLinearInverse() does in the ICP algorithm and would have to look in the code.   If it grabs the transform matrix and explicitly inverts it, then this should probably work.  If it calls the icp-&gt;Inverse() function, then you will end in the same state as what you had originally.  The way I normally do it is to call icp-&gt;Update, followed by icp-?GetLandMarkTransform()-&gt;GetMatrix() and then operate explicitly on the 4x4 matrix as I described in my last note.  There are undoubtedly other ways, but I have used this and know it works.  Check out the Doxygen pages if you need specific calls: <a href="http://www.vtk.org/doc/nightly/html/classvtkMatrix4x4.html" target="_blank">http://www.vtk.org/doc/nightly/html/classvtkMatrix4x4.html</a><br>
<font color="#888888">
<br>- Wes<br><br></font></div><div><div></div><div class="h5"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br clear="all">Thanks,<br><font color="#888888"><br>David</font><div><div></div><div><br>
<br><br><div class="gmail_quote">On Mon, Mar 23, 2009 at 9:13 AM, Wes Turner <span dir="ltr">&lt;<a href="mailto:wes.turner@kitware.com" target="_blank">wes.turner@kitware.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


My apologies ... as always haste makes waste.  I edited what I wrote to make it (slightly) more readable.<br><br><div class="gmail_quote">On Mon, Mar 23, 2009 at 9:05 AM, Wes Turner <span dir="ltr">&lt;<a href="mailto:wes.turner@kitware.com" target="_blank">wes.turner@kitware.com</a>&gt;</span> wrote:<br>




<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">David,<br><br>I just took a quick look, so you probably need to do some analysis on your own to fully resolve this issue.  Looking at the data sets, it appears that you are sampling Bunny.vtp (source) and using it to sample points from BunnyScan.vtp (target) using ICP.  Since BunnyScan only contains the front side of Bunny, any points sampled from the rear surface of Bunny will not find a true match and will end up pulling BunnyScan away from the front surface and more toward the center of Bunny.  This is consistent with the data you are showing.<br>





<br>You might be able to get what you are looking for simply by swapping the source and target in the ICP and using that as the transform to apply to BunnyScan, moving it towards Bunny.  If you need the inverse transform (moving Bunny towards BunnyScan) you will need to explicitly calculate the inverse transform by grabbing the Matrix4x4 from the ICP on completion, inverting it, and applying it as the transform to Bunny.  Directly inverting the icp will not work as it just swaps source and target which will get you right back to your current state.  <br>


<div><div></div><div>


<br>All of this is from memory, so your mileage may vary.  <br><br>- Wes<br><br><div class="gmail_quote"><div><div></div><div>On Sat, Mar 21, 2009 at 11:48 AM, David Doria <span dir="ltr">&lt;<a href="mailto:daviddoria@gmail.com" target="_blank">daviddoria@gmail.com</a>&gt;</span> wrote:<br>





</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div>Here are my input files / output file:<br><br><a href="http://www.rpi.edu/%7Edoriad/Bunny/" target="_blank">http://www.rpi.edu/~doriad/Bunny/</a><br>





<br>I am trying to register Bunny.vtp to BunnyScan.vtp and the result is in MatchedBunny.vtp<br>
<br>Here are my settings:<br>    vtkIterativeClosestPointTransform * icp = vtkIterativeClosestPointTransform::New();<br>    icp-&gt;SetMaximumNumberOfIterations(1000);<br>    icp-&gt;SetMaximumMeanDistance(1e-6);<br>    icp-&gt;GetLandmarkTransform()-&gt;SetModeToRigidBody();<br>






<br>I believe I am calling everything correctly because the resulting point cloud is much nearer than the original. However it seems to still be significantly wrong. Anyone know why this would be?<br><br clear="all">Thanks,<br>





<font color="#888888">
<br>David<br>
</font><br></div></div>_______________________________________________<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></blockquote></div><font color="#888888"><br><br clear="all"><br>-- <br>Wesley D. Turner, Ph.D.<br>Kitware, Inc.<br>R&amp;D Engineer<br>28 Corporate Drive<br>Clifton Park, NY 12065-8662<br>Phone: 518-371-3971 x120<br>





</font></div></div></blockquote></div><div><div></div><div><br><br clear="all"><br>-- <br>Wesley D. Turner, Ph.D.<br>Kitware, Inc.<br>R&amp;D Engineer<br>28 Corporate Drive<br>Clifton Park, NY 12065-8662<br>Phone: 518-371-3971 x120<br>



</div></div></blockquote></div><br>
</div></div><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></blockquote></div></div></div><div><div></div><div class="h5"><br><br clear="all"><br>-- <br>Wesley D. Turner, Ph.D.<br>Kitware, Inc.<br>R&amp;D Engineer<br>28 Corporate Drive<br>Clifton Park, NY 12065-8662<br>Phone: 518-371-3971 x120<br>

</div></div></blockquote></div><br>