<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:12pt"><div><span>Hi, <br></span></div><div><br><span></span></div><div><span>I want to find the 3 parameters of Euler 2D Transform that register my 2 spect images.</span></div><div><br><span></span></div><div><span>I thought I understood the use of optimizer scales correctly. But definitively not. <br></span></div><div><br><span></span></div><span></span><div><span>If I initialize my transform with 0 for all my 3 parameters:</span></div><div><span> typedef RegistrationType::ParametersType ParametersType;<br> ParametersType initialParameters(transformParametersTotal);<br> initialParameters.Fill(0.0);<br> registration_->SetInitialTransformParameters(initialParameters);</span></div><div><span><br></span></div><div><span>, and define scales as follow:</span></div><div><span> typedef
OptimizerType::ScalesType ScalesType;<br> ScalesType parametersScales(3);<br> parametersScales.Fill( 1.0 );<br> for (int j = 1; j < 3; j++ ){<br> parametersScales[j] = 1.0 / 1000;<br> }</span></div><div><span> optimizer_->SetScales(parametersScales);</span></div><div><br><span></span><span>How come my first iteration test for such parameters:</span></div><div><span>-------------------------------------<br>MultiResolution Level : 0<br>0 = -0.372419 : [1.7683, -0.0955618, -0.929501]<br>1 = -0.0383217 : [1.92583, -2.08874, -0.978926]<br>2 = -0.0362538 : [1.69325, -1.10031, -2.21542]<br>3 = -0.0377709 : [1.56321, -1.28384, -3.79953]<br>4 = -0.0419196 : [1.66387, -2.53705, -3.55923]<br>5 = -0.0393448 : [1.52317, -2.40928, -4.56544]<br></span></div><div><br></div><div><span>I have many questions:</span></div>
<div><span>A) My images are 256 x 1024 pixels, with pixel size </span><span>of 2.6800001 </span><span>mm/pixel</span><span>. Do I have to take the fact that images are rectangular into account? Is that why the first parameter that is the rotation seem to change more often than translation parameters?<br></span></div>
<div><br>
<span></span></div>
<div><span>B) </span><span>In one of your previous mails: http://itk-insight-users.2283740.n2.nabble.com/Confused-abour-Optimizer-Scales-td4010857.html</span></div><div><span>it says that if you don't want one of the parameters to change (for example, center of rotation in Centered</span><span><span class="bold highlight search-highlight">Rigid2DTransform</span>
</span>to have to set to very small number</div><div><span>"</span><span>The second and third values correspond to the center of rotation,
</span><br><span> but you don't want to change this center. My suggestion will be </span><br><span> to put in here, very small numbers. For example 1e-6. "</span></div><div><br><span></span></div><div><span>Is it a small number or a very large one?<br></span></div>
<div><br>
<span></span></div>
<div><span>I am really stuck with all of this. Can somebody help me?</span></div><div><br><span></span></div><div><span>R</span>egards,</div><div> </div><div>Isabelle<br><br></div> <div style="font-family: Courier New, courier, monaco, monospace, sans-serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1"> <b><span style="font-weight:bold;">De :</span></b> Renaud Isabelle <renauisa@yahoo.fr><br> <b><span style="font-weight: bold;">À :</span></b> "insight-users@itk.org" <insight-users@itk.org> <br> <b><span style="font-weight: bold;">Envoyé le :</span></b> Mercredi 18 Janvier 2012 23h34<br> <b><span style="font-weight: bold;">Objet :</span></b> [Insight-users] initialization transform parameters not taken into account<br> </font> </div> <br><div id="yiv184902203"><div><div
style="color:#000;background-color:#fff;font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:12pt;"><div id="yiv184902203"><div><div style="color:#000;background-color:#fff;font-family:times new roman, new york, times, serif;font-size:12pt;"><div style="font-family:Courier New, courier, monaco, monospace, sans-serif;" id="yiv184902203yui_3_2_0_111_132694209626448"><span id="yiv184902203yui_3_2_0_111_132694209626465">Hi all,</span><span><br></span></div><div id="yiv184902203yui_3_2_0_111_1326942096264482" style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><br><span id="yiv184902203yui_3_2_0_111_132694209626465"></span></div><div id="yiv184902203yui_3_2_0_111_1326942096264483" style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><span id="yiv184902203yui_3_2_0_111_132694209626465">I am trying to register 2D images (spect modality) witk itk Mattes mutual information.
Visually, offsets between both images are very small (translation of ~ 5 mms). I am initializing transform parameters to 0 for the 3 parameters of euler 2D transform. However, after registration I got a rotation around 90 degres. Plus, when I am observing
optimizer iterations, first iteration is already 1.6 radian for rotation parameter, even if my initial rotation parameter was 0. <br></span></div><div id="yiv184902203yui_3_2_0_111_1326942096264596" style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><br>Here is the observer:<br><br>MultiResolution Level : 0<br>0 = -0.372419 : [1.7683, -0.0955618, -0.929501]<br>1 = -0.0383217 : [1.92583, -2.08874, -0.978926]<br>2 = -0.0362538 : [1.69325, -1.10031, -2.21542]<br>3 = -0.0377709 : [1.56321, -1.28384, -3.79953]<br>4 = -0.0419196 : [1.66387, -2.53705, -3.55923]<br>141 = -0.042436 : [1.51798, -17.6144, -6.53557]<br>142 = -0.0423536 : [1.52173, -17.635, -6.52587]<br>143 = -0.042424 : [1.51635, -17.6507, -6.54188]<br><br> Iterations = 145<br> Metric value = -0.0424182<br> Stop Condition = RegularStepGradientDescentOptimizer: Step too small after 144<br> iterations. Current step (0.0184467)
is less than minimum step (0.02).<br>Result =<br> Translation X = 17.6507 mm<br> Translation Y = 6.54188 mm<br> Rotation X = -86.8805 degres<br><br>Here is part of the print out of registration:<br> CurrentLevel: 1<br> InitialTransformParameters: [0, 0, 0]<br> InitialTransformParametersOfNextLevel: [0, 0, 0]<br> LastTransformParameters: [1.51635, -17.6507, -6.54188]<br> FixedImageRegion: ImageRegion (103F17EC)<br> Dimension: 2<br> Index: [0, 0]<br> Size: [256, 1024]<br><br> FixedImageRegion at level 0: ImageRegion (04DA4C98)<br> Dimension: 2<br> Index: [0, 0]<br> Size: [128, 512]<br><br> FixedImageRegion at level 1: ImageRegion (04DA4CAC)<br> Dimension: 2<br> Index: [0, 0]<br> Size: [256, 1024]<br><br><br><span id="yiv184902203yui_3_2_0_111_132694209626465"></span></div><div id="yiv184902203yui_3_2_0_111_1326942096264611"
style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><span id="yiv184902203yui_3_2_0_111_132694209626465">It's clear that I am missing something. </span><span id="yiv184902203yui_3_2_0_111_132694209626465">Please help. Here is my code:</span></div><div id="yiv184902203yui_3_2_0_111_1326942096264466" style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><span id="yiv184902203yui_3_2_0_111_132694209626465"><br></span></div><div id="yiv184902203yui_3_2_0_111_1326942096264467" style="font-family:Courier New, courier, monaco, monospace, sans-serif;"><span id="yiv184902203yui_3_2_0_111_132694209626465"> ImageType::RegionType fixedImageRegion = fixedImage->GetBufferedRegion();<br> ImageType::RegionType movingImageRegion = movingImage->GetBufferedRegion(); <br id="yiv184902203yui_3_2_0_111_1326942096264334"></span></div><div style="font-family:Courier New, courier, monaco, monospace,
sans-serif;" id="yiv184902203yui_3_2_0_111_1326942096264104"><span id="yiv184902203yui_3_2_0_111_132694209626465"><br></span></div><div style="font-family:Courier New, courier, monaco, monospace, sans-serif;" id="yiv184902203yui_3_2_0_111_1326942096264105"><span id="yiv184902203yui_3_2_0_111_132694209626465"> typedef itk::Euler2DTransform< double > TransformType; <br> TransformType::Pointer transform = TransformType::New();<br> registration_->SetTransform(transform);<br><br> // Initialize transform parameters<br> int transformParametersTotal =
registration_->GetTransform()->GetNumberOfParameters();<br> typedef RegistrationType::ParametersType ParametersType;<br> ParametersType initialParameters(transformParametersTotal);<br> initialParameters.Fill(0.0);<br> registration_->SetInitialTransformParameters(initialParameters); <br><br> metric_->SetNumberOfHistogramBins(50);<br> metric_->UseAllPixelsOn();<br><br> registration_->SetFixedImage(fixedImage);<br> registration_->SetMovingImage(movingImage); <br> registration_->SetFixedImageRegion(fixedImageRegion);<br></span></div><div style="font-family:Courier New, courier, monaco, monospace, sans-serif;" id="yiv184902203yui_3_2_0_111_1326942096264433"><span id="yiv184902203yui_3_2_0_111_132694209626465"><br></span></div><div style="font-family:Courier New, courier, monaco, monospace, sans-serif;" id="yiv184902203yui_3_2_0_111_1326942096264444"><span
id="yiv184902203yui_3_2_0_111_132694209626465">
typedef OptimizerType::ScalesType ScalesType;<br> int transformParametersTotal = registration_->GetTransform()->GetNumberOfParameters();<br> ScalesType parametersScales(transformParametersTotal);<br> parametersScales.Fill( 1.0 );<br><br> for (int j = 1; j < transformParametersTotal; j++ ){<br> parametersScales[j] = 1.0 / 1000;<br> } <br><br> optimizer_->SetScales(parametersScales);<br> <br> // The initial step length is defined with SetMaximumStepLength()<br> optimizer_->SetMaximumStepLength(2.0); <br> optimizer_->SetMinimumStepLength(0.02);<br><br> // Define number of iterations per multi-resolution level<br> optimizer_->SetNumberOfIterations( 200);<br> <br> optimizer_->SetRelaxationFactor(0.8); <br> <br> OptimizerIterationUpdate::Pointer
observer = OptimizerIterationUpdate::New();<br> optimizer_->AddObserver( itk::IterationEvent(), observer );<br><br> typedef RegistrationInterfaceCommand<RegistrationType> CommandType;<br> CommandType::Pointer command = CommandType::New();<br> registration_->AddObserver( itk::IterationEvent(), command );<br> <br> registration_->Update(); <br> // Output parameters<br> ParametersType finalParameters = registration_->GetLastTransformParameters();<br> result[0] = ;<br> result[1] = <br> result[2] = ; <br><br> // Print out results<br> std::cout << "Result = " << std::endl;<br> std::cout
<< " Translation X = " << </span><span id="yiv184902203yui_3_2_0_111_132694209626465">- finalParameters[1]</span><span id="yiv184902203yui_3_2_0_111_132694209626465"> << std::endl;<br> std::cout << " Translation Y = " <<</span><span id="yiv184902203yui_3_2_0_111_132694209626465">- finalParameters[2];</span><span id="yiv184902203yui_3_2_0_111_132694209626465"> << std::endl;<br> std::cout << " Rotation X = " << -</span><span id="yiv184902203yui_3_2_0_111_132694209626465"> finalParameters[0] * RAD_TO_DEG</span><span id="yiv184902203yui_3_2_0_111_132694209626465"> << std::endl; </span></div><div style="font-family:Courier New, courier, monaco, monospace, sans-serif;" id="yiv184902203yui_3_2_0_111_132694209626451"> </div><div style="font-family:Courier New, courier, monaco, monospace, sans-serif;">Isabelle Renaud<br
id="yiv184902203yui_3_2_0_111_132694209626456"></div></div></div></div></div></div></div><br>_____________________________________<br>Powered by www.kitware.com<br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br><a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br><br>Please keep messages on-topic and check the ITK FAQ at:<br><a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<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> </div> </div> </div></body></html>