<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Hi all,<DIV><BR class="khtml-block-placeholder"></DIV><DIV>I am currently optimizing a multi-modal affinely preregistered image with BSplines. I use the example DeformableRegistratrion8.cxx, where I have modified some parameters. For example I have changed the MaximumNumberOfEvaluations and Iterations to 1000. I have also reduced the number of pixels sampled for mutual information to 5% instead of 10%, because I have about 50,000,000 pixels and the program crashes with a bad_alloc if I use 10% of the pixels (no one answered on that bug).</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I ran into something strange though, which I hope someone can explain to me:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I thought the convergence criteria for the LBFGSB optimizer were</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>(1) projected gradient is lower than the value set via the SetProjectedGradientTolerance() Method</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>(2) cost function is higher than machine precision * factor, where factor is set with SetCostFunctionConvergenceFactor ()</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I got this information from a thread from 2004 from the insight list.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I don't exaclty know what "machine precision" means in this context, but I guess it is something like the highest/lowest floating point number supported by hardware in IEEE floating point precision. This would mean, that "machine precision" would relate to one number in the order of 2^128 for positive values and one in the order of 1-2^24 for negative values. </DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Now consider two experiments, in one I got the following:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I set <FONT class="Apple-style-span" face="Monaco"> <SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN></FONT><FONT class="Apple-style-span" face="Monaco">optimizer->SetCostFunctionConvergenceFactor( </FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco">1e+4</FONT><FONT class="Apple-style-span" face="Monaco"> );</FONT></DIV><DIV>and <SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" face="Monaco">optimizer->SetProjectedGradientTolerance( </FONT><FONT class="Apple-style-span" color="#0000FF" face="Monaco">1e-9</FONT><FONT class="Apple-style-span" face="Monaco"> );</FONT></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>in one experiment I used a diffusion filtered image to help mutual information with the noise and my registration stopped after the first iteration.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>The first column is the iteration number, the second the 'optimizer->GetValue ()' and the third the 'optimizer->GetInfinityNormOfProjectedGradient ()' call</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Start Registration</DIV><DIV>0<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>-0.0206794<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>4.72925e-05</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>in the other experiment I used the same images without filtering, expecting this would be harder and got a whole lot of iterations part of the output was:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Start Registratrion</DIV><DIV>0<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>-0.14528<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>4.5552 e-06</DIV><DIV>1<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>-0.173187<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>5.61854 e-06</DIV><DIV>2<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>-0.204225<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>8.75644 e-06</DIV><DIV>3<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>-0.249614<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>8.81237 e-06</DIV><DIV>4<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>-0.282877<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>5.53998 e-06</DIV><DIV>5<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>-0.304294<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>8.15414<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>e-06</DIV><DIV>6<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>-0.325165<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>6.08865<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>e-06</DIV><DIV>7<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>-0.344385<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>7.07919<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>e-06</DIV><DIV>........</DIV><DIV>.........</DIV><DIV>........</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Actually I ran even a couple more experiments, where I changed the density of the nodes of the BSplines from a 5x5 grid to a 36x36 grid and a 120x120 grid. The events are exactly the same, the diffusion filtered image won't start to be registered (probably for some hidden convergence stuff?) and the second example (no filtering) runs.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>My question is: Why does the program stop in the first case and not in the second? I thought the convergence criteria were only the two mentioned above? Can someone tell me what the convergence criteria for DeformableRegistration8.cxx are really?</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I would be grateful for comments as always.</DIV><DIV>Ruben</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV></BODY></HTML>