<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">I have already tried it. I wrote the transform result to a txt file . Here is the transform results .But on the otherhand I also wrote the <FONT size=2>
<P>optimizer->GetValue() to a txt file. it says it is zero. Why is it zero?what might the reason?</P></FONT></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><EM><STRONG>QuaternionRigidTransform (03975550)<BR> RTTI typeinfo: class itk::QuaternionRigidTransform<float><BR> Reference Count: 2<BR> Modified Time: 27001127<BR> Debug: Off<BR> Observers: <BR> none<BR> Matrix: <BR> 0.969827 0.238191 0.0519706 <BR> -0.224559 0.955767 -0.189954 <BR> -0.0949171 0.172552 0.980416 <BR> Offset: [-0.0650461, -44.047, -19.0696]<BR> Center: [0, 0, 0]<BR> Translation: [-0.0650461, -44.047, -19.0696]<BR> Inverse: <BR> 0.969827 -0.224559 -0.0949171 <BR> 0.238191 0.955767 0.172552 <BR> 0.0519706 -0.189954 0.980416 <BR> Singular: 0<BR> Rotation: 0.0917104 0.0371611 -0.117071 0.988181</STRONG></EM><BR><BR></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">----- Original Message ----<BR>From: David Cole <david.cole@kitware.com><BR>To: tony hakki <tony2007vtk@yahoo.com><BR>Cc: Luis Ibanez <luis.ibanez@kitware.com>; insight-users@itk.org<BR>Sent: Saturday, March 31, 2007 1:10:45 PM<BR>Subject: Re: [Insight-users] How long does it take do you think ?<BR><BR>
<DIV>Why not try changing the hard-coded 10,000,000 in your code down to<BR>500 in light of Luis' email...?<BR><BR>HTH,<BR>David<BR><BR><BR>On 3/31/07, tony hakki <tony2007vtk@yahoo.com> wrote:<BR>><BR>><BR>> Dear Luis<BR>> Here is my code,what might the wrong ?According to me everything is OK.<BR>> Could you please have a look at his for me. This is really important for me.<BR>><BR>><BR>> //-----------------------------------------------------------<BR>><BR>> // Set up a Transform<BR>><BR>> //-----------------------------------------------------------<BR>><BR>> typedef itk::QuaternionRigidTransform< double > TransformType;<BR>><BR>> TransformType::Pointer transform = TransformType::New();<BR>><BR>> typedef MovingImageType::SpacingType SpacingType;<BR>><BR>> typedef MovingImageType::PointType OriginType;<BR>><BR>> typedef MovingImageType::RegionType RegionType;<BR>><BR>> typedef
MovingImageType::SizeType SizeType;<BR>><BR>> const OriginType movingOrigin = input->GetOrigin();<BR>><BR>> const RegionType movingRegion =<BR>> input->GetLargestPossibleRegion();<BR>><BR>> const SizeType movingSize = movingRegion.GetSize();<BR>><BR>> const SpacingType movingSpacing = input->GetSpacing();<BR>><BR>> TransformType::InputPointType centerMoving;<BR>><BR>> centerMoving[0] = movingOrigin[0] + movingSpacing[0] * movingSize[0] / 2.0;<BR>><BR>> centerMoving[1] = movingOrigin[1] + movingSpacing[1] * movingSize[1] / 2.0;<BR>><BR>> centerMoving[2] = movingOrigin[2] + movingSpacing[2] * movingSize[1] / 2.0;<BR>><BR>> TransformType::InputPointType centerFixed;<BR>><BR>> centerFixed[0] = 14.7947 ;<BR>><BR>> centerFixed[1] =-1.48122;<BR>><BR>> centerFixed[2] =2.43377;<BR>><BR>><BR>><BR>> transform->SetCenter(centerFixed);<BR>><BR>> transform->SetTranslation(
centerMoving - centerFixed );<BR>><BR>><BR>><BR>> //------------------------------------------------------------<BR>><BR>> // Optimizer Type<BR>><BR>> //-----------------------------------------------------------<BR>><BR>> typedef<BR>> itk::QuaternionRigidTransformGradientDescentOptimizer<BR>> OptimizerType;<BR>><BR>> OptimizerType::Pointer optimizer = OptimizerType::New();<BR>><BR>><BR>><BR>> //------------------------------------------------------------<BR>><BR>> // Set up an Interpolator<BR>><BR>> //------------------------------------------------------------<BR>><BR>> typedef itk::LinearInterpolateImageFunction<<BR>><BR>> MovingImageType,<BR>><BR>> double > InterpolatorType;<BR>><BR>> InterpolatorType::Pointer interpolator = InterpolatorType::New();<BR>><BR>> //-----------------------------------------------------------<BR>><BR>> // Set up Metric<BR>><BR>>
//-----------------------------------------------------------<BR>><BR>> typedef itk::NormalizedCorrelationPointSetToImageMetric<<BR>><BR>> FixedPointSetType,<BR>><BR>> MovingImageType > MetricType;<BR>><BR>> typedef MetricType::TransformType TransformBaseType;<BR>><BR>> typedef TransformBaseType::ParametersType ParametersType;<BR>><BR>> MetricType::Pointer metric = MetricType::New();<BR>><BR>> //-----------------------------------------------------------<BR>><BR>> //RegistrationMethod<BR>><BR>> //-----------------------------------------------------------<BR>><BR>> typedef itk::PointSetToImageRegistrationMethod<<BR>><BR>> FixedPointSetType,<BR>><BR>> MovingImageType > RegistrationType;<BR>><BR>> RegistrationType::Pointer registrationMethod = RegistrationType::New();<BR>><BR>> typedef itk::CommandIterationUpdate<<BR>><BR>> OptimizerType >
CommandIterationType;<BR>><BR>><BR>><BR>> // Instantiate an Observer to report the progress of the Optimization<BR>><BR>> CommandIterationType::Pointer iterationCommand =<BR>> CommandIterationType::New();<BR>><BR>> iterationCommand->SetOptimizer( optimizer.GetPointer() );<BR>><BR>><BR>><BR>> // Scale the translation components of the Transform in the Optimizer<BR>><BR>> OptimizerType::ScalesType scales(<BR>> transform->GetNumberOfParameters() );<BR>><BR>> scales.Fill( 1.0 );<BR>><BR>> int j;<BR>><BR>> for ( j = 4; j < 7; j++ )<BR>><BR>> {<BR>><BR>> scales[j] = 0.0001;<BR>><BR>> }<BR>><BR>><BR>><BR>> unsigned long numberOfIterations = 1000000;<BR>><BR>> optimizer->SetScales( scales );<BR>><BR>> optimizer->SetNumberOfIterations( numberOfIterations );<BR>><BR>> optimizer->MinimizeOn();<BR>><BR>><BR>><BR>> // can probably provide a
better guess than the identity...<BR>><BR>> transform->SetIdentity();<BR>><BR>> registrationMethod->SetInitialTransformParameters(<BR>> transform->GetParameters() );<BR>><BR>> RegistrationType::ParametersType initialParameters(<BR>><BR>> transform->GetNumberOfParameters() );<BR>><BR>> initialParameters.Fill( 0.0 );<BR>><BR>> initialParameters[3] = 1.0;<BR>><BR>><BR>><BR>> // Connect all the components required for Registration<BR>><BR>> //------------------------------------------------------<BR>><BR>> registrationMethod->SetMetric( metric );<BR>><BR>> registrationMethod->SetOptimizer( optimizer );<BR>><BR>> registrationMethod->SetFixedPointSet(pointSet);<BR>><BR>> registrationMethod->SetMovingImage(input);<BR>><BR>> registrationMethod->SetInterpolator(interpolator);<BR>><BR>> registrationMethod->SetTransform( transform );<BR>><BR>>
//------------------------------------------------------------<BR>><BR>> // Set up transform parameters<BR>><BR>> //------------------------------------------------------------<BR>><BR>> ParametersType parameters(<BR>> transform->GetNumberOfParameters() );<BR>><BR>> // initialize the offset/vector part<BR>><BR>> for( unsigned int k = 0; k <Dimension; k++ )<BR>><BR>> {<BR>><BR>> parameters[k]= 0.0f;<BR>><BR>> }<BR>><BR>> try<BR>><BR>> {<BR>><BR>> registrationMethod->SetInitialTransformParameters(<BR>> initialParameters );<BR>><BR>> registrationMethod->StartRegistration();<BR>><BR>> }<BR>><BR>> catch( itk::ExceptionObject & e )<BR>><BR>> {<BR>><BR>> std::cout << e << std::endl;<BR>><BR>> }<BR>><BR>><BR>><BR>><BR>><BR>> OptimizerType::ParametersType finalParameters<BR>>
=registrationMethod->GetLastTransformParameters();<BR>><BR>> const unsigned int nmbrOfIterations =<BR>> optimizer->GetCurrentIteration();<BR>><BR>> const double bestValue = optimizer->GetValue();<BR>><BR>><BR>><BR>> transform->SetParameters( finalParameters );<BR>><BR>> ----- 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>><BR>> 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>> ------------------------------------------------------------------------<BR>> >> Sucker-punch spam<BR>> >><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>> >><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>> ------------------------------------------------------------------------<BR>> > We won't tell. Get more on shows you hate to love<BR>> ><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>> > (and love to hate): Yahoo! TV's Guilty Pleasures list.<BR>> ><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>> ><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 on your site using Yahoo! Search Marketing.<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>></DIV></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><BR></DIV></div><br>
<hr size=1>
<a href="http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL"> Get your own web address.</a><br> Have a HUGE year through <a href="
http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL">Yahoo! Small Business.</a></body></html>