<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">Dear Luis;</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">I convert my STL data to itk pointset like that:first I read it with VTK ,then i converted vtk polydata to itk mesh and lastly i converted itk mesh to itk pointset with the following code?Is that code incorrect? Is there an easier way to convert vtkpolydata to itkpointset?</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">&nbsp;</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><FONT color=#0000ff size=2>
<P><FONT size=3>const</FONT></FONT> <FONT color=#0000ff>unsigned</FONT> <FONT color=#0000ff>int</FONT> Dimension = 3;</P>
<P><FONT color=#0000ff>typedef</FONT> <FONT color=#0000ff>unsigned</FONT> <FONT color=#0000ff>short</FONT> PixelType;</P>
<P><FONT color=#0000ff>typedef</FONT> itk::PointSet&lt; <FONT color=#0000ff>float</FONT>, Dimension &gt; FixedPointSetType;</P>
<P><FONT color=#0000ff>typedef</FONT> itk::Image&lt; PixelType, Dimension &gt; MovingImageType;</P>
<P><FONT color=#0000ff>typedef</FONT> FixedPointSetType::PointsContainer PointsContainer;</P>
<P>PointsContainer::Pointer pointsContainer = PointsContainer::New();</P>
<P>pointsContainer = input_mesh-&gt;GetPoints();</P>
<P>itk::PointSet&lt;<FONT color=#0000ff>float</FONT>, 3&gt;::Pointer pointSet = itk::PointSet&lt;<FONT color=#0000ff>float</FONT>,3&gt;::New();</P>
<P>pointSet-&gt;SetPoints(pointsContainer);</P>
<P><FONT color=#0000ff>unsigned</FONT> <FONT color=#0000ff>long</FONT> pointId = 0;</P>
<P><FONT color=#0000ff>typedef</FONT> FMeshType::PointsContainer::Iterator PointsIterator;</P>
<P><FONT color=#008000>&nbsp;</P></FONT>
<P>PointsIterator pointIterator = input_mesh-&gt;GetPoints()-&gt;Begin(); </P>
<P>PointsIterator end = input_mesh-&gt;GetPoints()-&gt;End();</P>
<P><FONT color=#0000ff>while</FONT>( pointIterator != end ) </P>
<P>{</P>
<P>FMeshType::PointType p = pointIterator.Value(); <FONT color=#008000>// access the point</P></FONT>
<P>std::cout &lt;&lt; p &lt;&lt; std::endl; <FONT color=#008000>// print the point</P></FONT>
<P>pointSet-&gt;SetPoint( pointId, p );<FONT color=#008000>// advance to next point</P></FONT>
<P>pointSet-&gt;SetPointData( pointId, pointSet-&gt;GetBufferedRegion() );</P>
<P>++pointIterator; </P>
<P>++pointId;</P>
<P>}</P><BR><BR></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">----- Original Message ----<BR>From: Luis Ibanez &lt;luis.ibanez@kitware.com&gt;<BR>To: tony hakki &lt;tony2007vtk@yahoo.com&gt;<BR>Cc: insight-users@itk.org<BR>Sent: Sunday, April 8, 2007 12:01:48 AM<BR>Subject: Re: [Insight-users] Versor problem<BR><BR>
<DIV>Hi Tony,<BR><BR><BR>1) Are you using the TransformFileWriter class ?<BR><BR><A href="http://www.itk.org/Insight/Doxygen/html/classitk_1_1TransformFileWriter.html" target=_blank>http://www.itk.org/Insight/Doxygen/html/classitk_1_1TransformFileWriter.html</A><BR><BR><BR><BR>2) The code in your email is inconsistent.<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;You are declaring a QuaternionRigidTransform in the code,<BR>&nbsp;&nbsp;&nbsp;&nbsp;but the print out indicates that what you have in the file<BR>&nbsp;&nbsp;&nbsp;&nbsp;is a VersorRigidTransform.<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;The transform in the file *MUST* match the type<BR>&nbsp;&nbsp;&nbsp;&nbsp;of the transform that you declare in the code.<BR><BR><BR><BR>3) The fact that your point set is stored in an STL file<BR>&nbsp;&nbsp;&nbsp;&nbsp;is irrelevant for the purpose of the registration.<BR>&nbsp;&nbsp;&nbsp;&nbsp;As we suggested in a previous email, you should use VTK<BR>&nbsp;&nbsp;&nbsp;&nbsp;for reading the STL file,
 and then convert the points from<BR>&nbsp;&nbsp;&nbsp;&nbsp;a vtkPolyData into an itkPointSet.<BR><BR><BR><BR>4) The fact that your image is stored in a .raw file is<BR>&nbsp;&nbsp;&nbsp;&nbsp;also irrelevant for the purpose of the registration.<BR>&nbsp;&nbsp;&nbsp;&nbsp;What matter is whether you are able to read the image file<BR>&nbsp;&nbsp;&nbsp;&nbsp;into an itk Image.<BR><BR><BR><BR>5) Yes,<BR>&nbsp;&nbsp;&nbsp;&nbsp;You can do PointSet to Image registration in ITK.<BR><BR><BR><BR>&nbsp;&nbsp; Regards,<BR><BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Luis<BR><BR><BR><BR><BR>---------------------<BR>tony hakki wrote:<BR>&gt;&nbsp;&nbsp;Dear Luis;<BR>&gt; <BR>&gt; I set the Center like the following code. I think it is correct to set <BR>&gt; center. At the end of the registration I write the transform staffs to <BR>&gt; the a txt folder. In this folder center is seen [0,0,0],as if I hadn't <BR>&gt; set it. What might the problem?I apply finalparameters to the <BR>&gt;
 TransformMeshfilter as a input like&nbsp;&nbsp;that<BR>&gt; <BR>&gt; transform-&gt;SetParameters( finalParameters );<BR>&gt; <BR>&gt; filter-&gt;SetTransform(transform ); <BR>&gt; <BR>&gt; but The pointset goes far away from the image instead of the overlapping<BR>&gt; <BR>&gt; If you like to see my whole code I can add it.<BR>&gt; <BR>&gt;&nbsp;&nbsp;<BR>&gt; <BR>&gt;&nbsp;&nbsp;<BR>&gt; <BR>&gt; typedef itk::QuaternionRigidTransform&lt; double &gt; TransformType;<BR>&gt; <BR>&gt; TransformType::Pointer transform = TransformType::New();<BR>&gt; <BR>&gt; TransformType::InputPointType centerFixed;<BR>&gt; <BR>&gt; centerFixed[0] = 15 ;<BR>&gt; <BR>&gt; centerFixed[1] =-20;<BR>&gt; <BR>&gt; centerFixed[2] =0;<BR>&gt; <BR>&gt; transform-&gt;SetCenter(centerFixed);<BR>&gt; <BR>&gt;&nbsp;&nbsp;<BR>&gt; <BR>&gt;&nbsp;&nbsp;here is the Transform staff at the end of the registration : Also here <BR>&gt; the transformation and the versor variables are too small according to
 <BR>&gt; me?Is ITK capable to&nbsp;&nbsp;registrate STL Polydata(I convert it to ITK mesh <BR>&gt; then to a&nbsp;&nbsp;pointset) and .raw extension 3D image?<BR>&gt; <BR>&gt;&nbsp;&nbsp;<BR>&gt; <BR>&gt; VersorRigid3DTransform (04D73558)<BR>&gt;&nbsp;&nbsp; RTTI typeinfo:&nbsp;&nbsp; class itk::VersorRigid3DTransform&lt;double&gt;<BR>&gt;&nbsp;&nbsp; Reference Count: 4<BR>&gt;&nbsp;&nbsp; Modified Time: 1221<BR>&gt;&nbsp;&nbsp; Debug: Off<BR>&gt;&nbsp;&nbsp; Observers:<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; none<BR>&gt;&nbsp;&nbsp; Matrix:<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; 0.999912 -0.00431884 0.0125821<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; 0.00426851 0.999983 0.00402404<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; -0.0125992 -0.00396998 0.999913<BR>&gt;&nbsp;&nbsp; Offset: [1.00003, -0.73264, -1.39039]<BR>&gt;&nbsp;&nbsp; Center: [0, 0, 0]<BR>&gt;&nbsp;&nbsp; Translation: [1.00003, -0.73264, -1.39039]<BR>&gt;&nbsp;&nbsp; Inverse:<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; 0.999912 0.00426851
 -0.0125992<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; -0.00431884 0.999983 -0.00396998<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; 0.0125821 0.00402404 0.999913<BR>&gt;&nbsp;&nbsp; Singular: 0<BR>&gt;&nbsp;&nbsp; Versor: [ -0.00199855, 0.00629548, 0.00214689, 0.999976 ]<BR>&gt; <BR>&gt; <BR>&gt; ----- Original Message ----<BR>&gt; From: Luis Ibanez &lt;luis.ibanez@kitware.com&gt;<BR>&gt; To: tony hakki &lt;tony2007vtk@yahoo.com&gt;<BR>&gt; Cc: insight-users@itk.org<BR>&gt; Sent: Friday, April 6, 2007 4:15:48 PM<BR>&gt; Subject: Re: [Insight-users] Versor problem<BR>&gt; <BR>&gt; Hi Tony,<BR>&gt; <BR>&gt; <BR>&gt; 1) The center of the Transform should be set to the Center of the<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Fixed object. In your case, that will be the Fixed Point Set.<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; 2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FORGET EULER ANGLES !!<BR>&gt; <BR>&gt; <BR>&gt;
 <BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; They are a *BAD* representation of 3D rotations<BR>&gt; <BR>&gt; <BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Versors ARE NOT EULER ANGLES<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Versors are unit Quaternions<BR>&gt; <BR>&gt; <BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The methods SetRotationAroundX,Y,Z, *ARE NOT* cumulative.<BR>&gt; <BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The rotation that you set with SetRotationAroundY is<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; overriding the rotation that you set around X previously.<BR>&gt; <BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The correct way of setting a versor is via an Axis and an Angle.<BR>&gt; <BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; You should provide the three components (x,y,z) of the
 axis<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; of rotation, as a unit vector.&nbsp;&nbsp;And you should provide the<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; angle of rotation in radians. Note that the component of the<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; axis *ARE NOT* the Euler angles either.<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; Please read the tutorial on Quaternions:<BR>&gt; <BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; <A href="http://www.itk.org/CourseWare/Training/QuaternionsI.pdf" target=_blank>http://www.itk.org/CourseWare/Training/QuaternionsI.pdf</A><BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; <A href="http://www.itk.org/CourseWare/Training/QuaternionsII.pdf" target=_blank>http://www.itk.org/CourseWare/Training/QuaternionsII.pdf</A><BR>&gt; <BR>&gt; and the description of Versors in the Wikipedia:<BR>&gt; <BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="http://en.wikipedia.org/wiki/Versor" target=_blank>http://en.wikipedia.org/wiki/Versor</A><BR>&gt; <BR>&gt; The four
 components of a Quaternion correspond to:<BR>&gt; <BR>&gt; <BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; q0 = Ax * sin( T / 2 )<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; q0 = Ay * sin( T / 2 )<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; q0 = Az * sin( T / 2 )<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; q0 =&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cos( T / 2 )<BR>&gt; <BR>&gt; <BR>&gt; where (Ax,Ay,Az) are the components of the axis<BR>&gt; of rotation and T is the angle of rotation.<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Regards,<BR>&gt; <BR>&gt; <BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Luis<BR>&gt; <BR>&gt; <BR>&gt; ------------------------<BR>&gt; tony hakki wrote:<BR>&gt;&nbsp;&nbsp;&gt; hello;<BR>&gt;&nbsp;&nbsp;&gt; I have 2 questions:<BR>&gt;&nbsp;&nbsp;&gt;&nbsp;&nbsp;1- When we implement pointSetToImageRegistration Should we Set the<BR>&gt;&nbsp;&nbsp;&gt; center of transform like SetTransform(Center) ,if yes which
 data's<BR>&gt;&nbsp;&nbsp;&gt; center should it be,PointSet center or image center?<BR>&gt;&nbsp;&nbsp;&gt;&nbsp;&nbsp;<BR>&gt;&nbsp;&nbsp;&gt; 2- I use VersorRigid3DTransform,and I want to set Versor by my self and<BR>&gt;&nbsp;&nbsp;&gt; see the effect of Versor. But I set the versor type like the following<BR>&gt;&nbsp;&nbsp;&gt; then I get the transform parameters to confirm the versor variables it<BR>&gt;&nbsp;&nbsp;&gt; says that *versor[0,&nbsp;&nbsp;&nbsp;&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;-0.26745,&nbsp;&nbsp; 0.963572]&nbsp;&nbsp;Why do the versor<BR>&gt;&nbsp;&nbsp;&gt; variables not&nbsp;&nbsp; same what I set at the beginning?and What does the<BR>&gt;&nbsp;&nbsp;&gt; fourth one(&nbsp;&nbsp;0.963572) indicate?*<BR>&gt;&nbsp;&nbsp;&gt; **<BR>&gt;&nbsp;&nbsp;&gt; **<BR>&gt;&nbsp;&nbsp;&gt;<BR>&gt;&nbsp;&nbsp;&gt; *TransformType::VersorType versor;*<BR>&gt;&nbsp;&nbsp;&gt;<BR>&gt;&nbsp;&nbsp;&gt; *versor.SetRotationAroundX( 0.276538
 );*<BR>&gt;&nbsp;&nbsp;&gt;<BR>&gt;&nbsp;&nbsp;&gt; *versor.SetRotationAroundY( 1.595315);*<BR>&gt;&nbsp;&nbsp;&gt;<BR>&gt;&nbsp;&nbsp;&gt; *versor.SetRotationAroundZ( -0.5414906);*<BR>&gt;&nbsp;&nbsp;&gt;<BR>&gt;&nbsp;&nbsp;&gt; *transform-&gt;SetRotation( versor );*<BR>&gt;&nbsp;&nbsp;&gt;<BR>&gt;&nbsp;&nbsp;&gt;<BR>&gt;&nbsp;&nbsp;&gt; ------------------------------------------------------------------------<BR>&gt;&nbsp;&nbsp;&gt; Expecting? Get great news right away with email Auto-Check.<BR>&gt;&nbsp;&nbsp;&gt; <BR>&gt; &lt;<A href="http://us.rd.yahoo.com/evt=49982/*http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html" target=_blank>http://us.rd.yahoo.com/evt=49982/*http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html</A>&gt;<BR>&gt;&nbsp;&nbsp;&gt; Try the Yahoo! Mail Beta.<BR>&gt;&nbsp;&nbsp;&gt; <BR>&gt; &lt;<A href="http://us.rd.yahoo.com/evt=49982/*http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html"
 target=_blank>http://us.rd.yahoo.com/evt=49982/*http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html</A>&gt;<BR>&gt;&nbsp;&nbsp;&gt;<BR>&gt;&nbsp;&nbsp;&gt;<BR>&gt;&nbsp;&nbsp;&gt; ------------------------------------------------------------------------<BR>&gt;&nbsp;&nbsp;&gt;<BR>&gt;&nbsp;&nbsp;&gt; _______________________________________________<BR>&gt;&nbsp;&nbsp;&gt; Insight-users mailing list<BR>&gt;&nbsp;&nbsp;&gt; Insight-users@itk.org<BR>&gt;&nbsp;&nbsp;&gt; <A href="http://www.itk.org/mailman/listinfo/insight-users" target=_blank>http://www.itk.org/mailman/listinfo/insight-users</A><BR>&gt; <BR>&gt; <BR>&gt; ------------------------------------------------------------------------<BR>&gt; The fish are biting.<BR>&gt; Get more visitors <BR>&gt; &lt;<A href="http://us.rd.yahoo.com/evt=49679/*http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php?o=US2140&amp;cmp=Yahoo&amp;ctv=Q107Tagline&amp;s=Y&amp;s2=EM&amp;b=50"
 target=_blank>http://us.rd.yahoo.com/evt=49679/*http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php?o=US2140&amp;cmp=Yahoo&amp;ctv=Q107Tagline&amp;s=Y&amp;s2=EM&amp;b=50</A>&gt; <BR>&gt; on your site using Yahoo! Search Marketing. &lt; <BR>&gt; <A href="http://us.rd.yahoo.com/evt=49679/*http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php?o=US2140&amp;cmp=Yahoo&amp;ctv=Q107Tagline&amp;s=Y&amp;s2=EM&amp;b=50" target=_blank>http://us.rd.yahoo.com/evt=49679/*http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php?o=US2140&amp;cmp=Yahoo&amp;ctv=Q107Tagline&amp;s=Y&amp;s2=EM&amp;b=50</A>&gt;</DIV></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><BR></DIV></div><br>

<hr size=1>Need Mail bonding?<br>Go to the <a href="http://answers.yahoo.com/dir/index;_ylc=X3oDMTFvbGNhMGE3BF9TAzM5NjU0NTEwOARfcwMzOTY1NDUxMDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90YWcx?link=ask&sid=396546091">Yahoo! Mail Q&A</a> for <a href="http://answers.yahoo.com/dir/index;_ylc=X3oDMTFvbGNhMGE3BF9TAzM5NjU0NTEwOARfcwMzOTY1NDUxMDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90YWcx?link=ask&sid=396546091">great tips from Yahoo! Answers</a> users.</body></html>