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