<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"><BR>Dear Luis </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">Here is my code,what might the wrong ?According to me everything is OK. Could you please have a look at his for me. This is really important for me.</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><FONT color=#008000 size=2>
<P>//-----------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>// Set up a Transform</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>//-----------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::QuaternionRigidTransform&lt; </FONT><FONT color=#0000ff size=2>double</FONT><FONT size=2> &gt; TransformType;</P>
<P>TransformType::Pointer transform = TransformType::New();</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> MovingImageType::SpacingType SpacingType;</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> MovingImageType::PointType OriginType;</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> MovingImageType::RegionType RegionType;</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> MovingImageType::SizeType SizeType;</P>
<P></FONT><FONT color=#0000ff size=2>const</FONT><FONT size=2> OriginType movingOrigin = input-&gt;GetOrigin();</P>
<P></FONT><FONT color=#0000ff size=2>const</FONT><FONT size=2> RegionType movingRegion = input-&gt;GetLargestPossibleRegion();</P>
<P></FONT><FONT color=#0000ff size=2>const</FONT><FONT size=2> SizeType movingSize = movingRegion.GetSize();</P>
<P></FONT><FONT color=#0000ff size=2>const</FONT><FONT size=2> SpacingType movingSpacing = input-&gt;GetSpacing();</P>
<P>TransformType::InputPointType centerMoving;</P>
<P>centerMoving[0] = movingOrigin[0] + movingSpacing[0] * movingSize[0] / 2.0;</P>
<P>centerMoving[1] = movingOrigin[1] + movingSpacing[1] * movingSize[1] / 2.0;</P>
<P>centerMoving[2] = movingOrigin[2] + movingSpacing[2] * movingSize[1] / 2.0;</P>
<P>TransformType::InputPointType centerFixed;</P>
<P>centerFixed[0] = 14.7947 ;</P>
<P>centerFixed[1] =-1.48122;</P>
<P>centerFixed[2] =2.43377;</P>
<P></P>
<P>transform-&gt;SetCenter(centerFixed); </P>
<P>transform-&gt;SetTranslation( centerMoving - centerFixed );</P>
<P></P>
<P></FONT><FONT color=#008000 size=2>//------------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>// Optimizer Type</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>//-----------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::QuaternionRigidTransformGradientDescentOptimizer OptimizerType;</P>
<P>OptimizerType::Pointer optimizer = OptimizerType::New();</P>
<P>&nbsp;</P>
<P></FONT><FONT color=#008000 size=2>//------------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>// Set up an Interpolator</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>//------------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::LinearInterpolateImageFunction&lt; </P>
<P>MovingImageType,</P>
<P></FONT><FONT color=#0000ff size=2>double</FONT><FONT size=2> &gt; InterpolatorType;</P>
<P>InterpolatorType::Pointer interpolator = InterpolatorType::New();</P>
<P></FONT><FONT color=#008000 size=2>//-----------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>// Set up Metric</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>//-----------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::NormalizedCorrelationPointSetToImageMetric&lt; </P>
<P>FixedPointSetType, </P>
<P>MovingImageType &gt; MetricType;</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> MetricType::TransformType TransformBaseType;</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> TransformBaseType::ParametersType ParametersType;</P>
<P>MetricType::Pointer metric = MetricType::New();</P>
<P></FONT><FONT color=#008000 size=2>//-----------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>//RegistrationMethod</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>//-----------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::PointSetToImageRegistrationMethod&lt; </P>
<P>FixedPointSetType,</P>
<P>MovingImageType &gt; RegistrationType;</P>
<P>RegistrationType::Pointer registrationMethod = RegistrationType::New();</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::CommandIterationUpdate&lt; </P>
<P>OptimizerType &gt; CommandIterationType;</P>
<P>&nbsp;</P>
<P></FONT><FONT color=#008000 size=2>// Instantiate an Observer to report the progress of the Optimization</P></FONT><FONT size=2>
<P>CommandIterationType::Pointer iterationCommand = CommandIterationType::New();</P>
<P>iterationCommand-&gt;SetOptimizer( optimizer.GetPointer() );</P>
<P>&nbsp;</P>
<P></FONT><FONT color=#008000 size=2>// Scale the translation components of the Transform in the Optimizer</P></FONT><FONT size=2>
<P>OptimizerType::ScalesType scales( transform-&gt;GetNumberOfParameters() );</P>
<P>scales.Fill( 1.0 );</P>
<P></FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> j;</P>
<P></FONT><FONT color=#0000ff size=2>for</FONT><FONT size=2> ( j = 4; j &lt; 7; j++ )</P>
<P>{</P>
<P>scales[j] = 0.0001;</P>
<P>}</P>
<P>&nbsp;</P>
<P></FONT><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>long</FONT><FONT size=2> numberOfIterations = 1000000;</P></FONT><FONT size=2>
<P>optimizer-&gt;SetScales( scales );</P>
<P>optimizer-&gt;SetNumberOfIterations( numberOfIterations );</P>
<P></FONT><FONT size=2>optimizer-&gt;MinimizeOn();</P>
<P>&nbsp;</P>
<P></FONT><FONT color=#008000 size=2>// can probably provide a better guess than the identity...</P></FONT><FONT size=2>
<P>transform-&gt;SetIdentity();</P>
<P>registrationMethod-&gt;SetInitialTransformParameters( transform-&gt;GetParameters() );</P>
<P>RegistrationType::ParametersType initialParameters( </P>
<P>transform-&gt;GetNumberOfParameters() );</P>
<P>initialParameters.Fill( 0.0 );</P>
<P>initialParameters[3] = 1.0;</P>
<P>&nbsp;</P>
<P></FONT><FONT color=#008000 size=2>// Connect all the components required for Registration</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>//------------------------------------------------------</P></FONT><FONT size=2>
<P>registrationMethod-&gt;SetMetric( metric );</P>
<P>registrationMethod-&gt;SetOptimizer( optimizer );</P>
<P>registrationMethod-&gt;SetFixedPointSet(pointSet);</P>
<P>registrationMethod-&gt;SetMovingImage(input);</P>
<P>registrationMethod-&gt;SetInterpolator(interpolator);</P>
<P>registrationMethod-&gt;SetTransform( transform );</P>
<P></FONT><FONT color=#008000 size=2>//------------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>// Set up transform parameters</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>//------------------------------------------------------------</P></FONT><FONT size=2>
<P>ParametersType parameters( transform-&gt;GetNumberOfParameters() );</P>
<P></FONT><FONT color=#008000 size=2>// initialize the offset/vector part</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>for</FONT><FONT size=2>( </FONT><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> k = 0; k &lt;Dimension; k++ )</P>
<P>{</P>
<P>parameters[k]= 0.0f;</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2>try</FONT><FONT size=2> </P>
<P>{</P>
<P>registrationMethod-&gt;SetInitialTransformParameters( initialParameters );</P>
<P>registrationMethod-&gt;StartRegistration();</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2>catch</FONT><FONT size=2>( itk::ExceptionObject &amp; e )</P>
<P>{</P>
<P>std::cout &lt;&lt; e &lt;&lt; std::endl;</P>
<P>}</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>OptimizerType::ParametersType finalParameters =registrationMethod-&gt;GetLastTransformParameters();</P>
<P></FONT><FONT color=#0000ff size=2>const</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> nmbrOfIterations = optimizer-&gt;GetCurrentIteration();</P>
<P></FONT><FONT color=#0000ff size=2>const</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>double</FONT><FONT size=2> bestValue = optimizer-&gt;GetValue();</P>
<P>&nbsp;</P>
<P>transform-&gt;SetParameters( finalParameters );</P></FONT><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: Robert Tamburo &lt;rjtst21@pitt.edu&gt;; insight-users@itk.org<BR>Sent: Friday, March 30, 2007 6:56:17 PM<BR>Subject: Re: [Insight-users] How long does it take do you think ?<BR><BR>
<DIV>Hi Tony,<BR><BR>A well tunned registration process should take less than<BR>500 iterations in a Gradient-Descent type of optimizer.<BR><BR><BR>If it takes longer than 500 iterations,<BR>then it means that:<BR><BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;a) Your have a poor initialization, or<BR>&nbsp;&nbsp;&nbsp;&nbsp;b) The step length (or learning rate) are too small.<BR><BR><BR>If you were registering images of sizes 512 x 512 x 200, that should<BR>probably should take between 2 minutes and 20 minutes in a modern<BR>computer.<BR><BR>If you are doing PointSet registration, and your point sets have around<BR>25,000 points, then it should take about 20 minutes to register them<BR>using ICP (in a modern computer).<BR><BR>You will find easier to monitor the registration process is you add<BR>a visualization of the point sets using VTK, to the command observer<BR>of the
 registration.<BR><BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;Regards,<BR><BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Luis<BR><BR><BR>-------------------<BR>tony hakki wrote:<BR>&gt; you are generally right, but in this algorithm when optimizer finds the <BR>&gt; best results it will be stoped by program not to wait&nbsp;&nbsp;900 million <BR>&gt; iterations . I didn't think that it would need 900 million iterations. I <BR>&gt; thought at the beginning just assign 900 million any how it would not <BR>&gt; need 900 million&nbsp;&nbsp;iterations. It has been still runnning :((<BR>&gt; <BR>&gt; ----- Original Message ----<BR>&gt; From: Robert Tamburo &lt;rjtst21@pitt.edu&gt;<BR>&gt; To: tony hakki &lt;tony2007vtk@yahoo.com&gt;<BR>&gt; Cc: insight-users@itk.org<BR>&gt; Sent: Friday, March 30, 2007 4:39:08 PM<BR>&gt; Subject: Re: [Insight-users] How long does it take do you think ?<BR>&gt; <BR>&gt; I've never used this algorithm but 900 million iterations seems like <BR>&gt;
 insanity. Assume that each iteration takes either 1 millisecond (best <BR>&gt; case scenario?) or 1 second (worst case scenario?) then calculate how <BR>&gt; long 900 million iterations will take. You will probably want to rethink <BR>&gt; the number of iterations you're using. You may also want to set up&nbsp;&nbsp;a <BR>&gt; convergence criteria to stop the registration. You may find that you <BR>&gt; only need a handful iterations to achieve acceptable results.<BR>&gt; <BR>&gt; On Mar 30, 2007, at 3:34 AM, tony hakki wrote:<BR>&gt; <BR>&gt;&gt; hello ;<BR>&gt;&gt; I have tried to implement point set to image registration. My point <BR>&gt;&gt; set has 151 points(x,y,z),and the image 3D .raw image size is <BR>&gt;&gt; size = 329 527 181&nbsp;&nbsp;and the resolution is res=&nbsp;&nbsp;0.200068 0.200068 <BR>&gt;&gt; 0.200068&nbsp;&nbsp;.Is there anybody who is expert on registration&nbsp;&nbsp;process to <BR>&gt;&gt; guess how long does&nbsp;&nbsp;computer
 run&nbsp;&nbsp;to finish registration process? my <BR>&gt;&gt; computer has 2.21 GHz processor, and 3 GB Ram . I assigned <BR>&gt;&gt; numberofiteration as 900.000.000 (900 million) and my computer has <BR>&gt;&gt; been runnning for 20 hours(yes ,20 hours:))),do you think this is normal?<BR>&gt;&gt; Thanks<BR>&gt;&gt; Tony<BR>&gt;&gt;<BR>&gt;&gt; ------------------------------------------------------------------------<BR>&gt;&gt; Sucker-punch spam <BR>&gt;&gt; &lt;<A href="http://us.rd.yahoo.com/evt=49981/*http://advision.webevents.yahoo.com/mailbeta/features_spam.html" target=_blank>http://us.rd.yahoo.com/evt=49981/*http://advision.webevents.yahoo.com/mailbeta/features_spam.html</A>&gt; <BR>&gt;&gt; with award-winning protection.<BR>&gt;&gt; Try the free Yahoo! Mail Beta. <BR>&gt;&gt; &lt;<A href="http://us.rd.yahoo.com/evt=49981/*http://advision.webevents.yahoo.com/mailbeta/features_spam.html"
 target=_blank>http://us.rd.yahoo.com/evt=49981/*http://advision.webevents.yahoo.com/mailbeta/features_spam.html</A>&gt; <BR>&gt;&gt;<BR>&gt;&gt; _______________________________________________<BR>&gt;&gt; Insight-users mailing list<BR>&gt;&gt; Insight-users@itk.org &lt;mailto:Insight-users@itk.org&gt;<BR>&gt;&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; <BR>&gt; ------------------------------------------------------------------------<BR>&gt; We won't tell. Get more on shows you hate to love <BR>&gt; &lt;<A href="http://us.rd.yahoo.com/evt=49980/*http://tv.yahoo.com/collections/265" target=_blank>http://us.rd.yahoo.com/evt=49980/*http://tv.yahoo.com/collections/265</A> &gt;<BR>&gt; (and love to hate): Yahoo! TV's Guilty Pleasures list. <BR>&gt; &lt;<A href="http://us.rd.yahoo.com/evt=49980/*http://tv.yahoo.com/collections/265"
 target=_blank>http://us.rd.yahoo.com/evt=49980/*http://tv.yahoo.com/collections/265</A> &gt;<BR>&gt; <BR>&gt; <BR>&gt; ------------------------------------------------------------------------<BR>&gt; <BR>&gt; _______________________________________________<BR>&gt; Insight-users mailing list<BR>&gt; Insight-users@itk.org<BR>&gt; <A href="http://www.itk.org/mailman/listinfo/insight-users" target=_blank>http://www.itk.org/mailman/listinfo/insight-users</A></DIV></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><BR></DIV></div><br>

<hr size=1>The fish are biting.<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"> Get more visitors</a> on your site using <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">Yahoo! Search Marketing.</a></body></html>