<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< </FONT><FONT color=#0000ff size=2>double</FONT><FONT size=2> > 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->GetOrigin();</P>
<P></FONT><FONT color=#0000ff size=2>const</FONT><FONT size=2> RegionType movingRegion = input->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->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->SetCenter(centerFixed); </P>
<P>transform->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> </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< </P>
<P>MovingImageType,</P>
<P></FONT><FONT color=#0000ff size=2>double</FONT><FONT size=2> > 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< </P>
<P>FixedPointSetType, </P>
<P>MovingImageType > 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< </P>
<P>FixedPointSetType,</P>
<P>MovingImageType > RegistrationType;</P>
<P>RegistrationType::Pointer registrationMethod = RegistrationType::New();</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::CommandIterationUpdate< </P>
<P>OptimizerType > CommandIterationType;</P>
<P> </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->SetOptimizer( optimizer.GetPointer() );</P>
<P> </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->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 < 7; j++ )</P>
<P>{</P>
<P>scales[j] = 0.0001;</P>
<P>}</P>
<P> </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->SetScales( scales );</P>
<P>optimizer->SetNumberOfIterations( numberOfIterations );</P>
<P></FONT><FONT size=2>optimizer->MinimizeOn();</P>
<P> </P>
<P></FONT><FONT color=#008000 size=2>// can probably provide a better guess than the identity...</P></FONT><FONT size=2>
<P>transform->SetIdentity();</P>
<P>registrationMethod->SetInitialTransformParameters( transform->GetParameters() );</P>
<P>RegistrationType::ParametersType initialParameters( </P>
<P>transform->GetNumberOfParameters() );</P>
<P>initialParameters.Fill( 0.0 );</P>
<P>initialParameters[3] = 1.0;</P>
<P> </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->SetMetric( metric );</P>
<P>registrationMethod->SetOptimizer( optimizer );</P>
<P>registrationMethod->SetFixedPointSet(pointSet);</P>
<P>registrationMethod->SetMovingImage(input);</P>
<P>registrationMethod->SetInterpolator(interpolator);</P>
<P>registrationMethod->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->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 <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->SetInitialTransformParameters( initialParameters );</P>
<P>registrationMethod->StartRegistration();</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2>catch</FONT><FONT size=2>( itk::ExceptionObject & e )</P>
<P>{</P>
<P>std::cout << e << std::endl;</P>
<P>}</P>
<P> </P>
<P> </P>
<P>OptimizerType::ParametersType finalParameters =registrationMethod->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->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->GetValue();</P>
<P> </P>
<P>transform->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 <luis.ibanez@kitware.com><BR>To: tony hakki <tony2007vtk@yahoo.com><BR>Cc: Robert Tamburo <rjtst21@pitt.edu>; 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> a) Your have a poor initialization, or<BR> 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> Regards,<BR><BR><BR> Luis<BR><BR><BR>-------------------<BR>tony hakki wrote:<BR>> you are generally right, but in this algorithm when optimizer finds the <BR>> best results it will be stoped by program not to wait 900 million <BR>> iterations . I didn't think that it would need 900 million iterations. I <BR>> thought at the beginning just assign 900 million any how it would not <BR>> need 900 million iterations. It has been still runnning :((<BR>> <BR>> ----- Original Message ----<BR>> From: Robert Tamburo <rjtst21@pitt.edu><BR>> To: tony hakki <tony2007vtk@yahoo.com><BR>> Cc: insight-users@itk.org<BR>> Sent: Friday, March 30, 2007 4:39:08 PM<BR>> Subject: Re: [Insight-users] How long does it take do you think ?<BR>> <BR>> I've never used this algorithm but 900 million iterations seems like <BR>>
insanity. Assume that each iteration takes either 1 millisecond (best <BR>> case scenario?) or 1 second (worst case scenario?) then calculate how <BR>> long 900 million iterations will take. You will probably want to rethink <BR>> the number of iterations you're using. You may also want to set up a <BR>> convergence criteria to stop the registration. You may find that you <BR>> only need a handful iterations to achieve acceptable results.<BR>> <BR>> On Mar 30, 2007, at 3:34 AM, tony hakki wrote:<BR>> <BR>>> hello ;<BR>>> I have tried to implement point set to image registration. My point <BR>>> set has 151 points(x,y,z),and the image 3D .raw image size is <BR>>> size = 329 527 181 and the resolution is res= 0.200068 0.200068 <BR>>> 0.200068 .Is there anybody who is expert on registration process to <BR>>> guess how long does computer
run to finish registration process? my <BR>>> computer has 2.21 GHz processor, and 3 GB Ram . I assigned <BR>>> numberofiteration as 900.000.000 (900 million) and my computer has <BR>>> been runnning for 20 hours(yes ,20 hours:))),do you think this is normal?<BR>>> Thanks<BR>>> Tony<BR>>><BR>>> ------------------------------------------------------------------------<BR>>> Sucker-punch spam <BR>>> <<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>> <BR>>> with award-winning protection.<BR>>> Try the free Yahoo! Mail Beta. <BR>>> <<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>> <BR>>><BR>>> _______________________________________________<BR>>> Insight-users mailing list<BR>>> Insight-users@itk.org <mailto: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>> <BR>> ------------------------------------------------------------------------<BR>> We won't tell. Get more on shows you hate to love <BR>> <<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> ><BR>> (and love to hate): Yahoo! TV's Guilty Pleasures list. <BR>> <<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> ><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></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>