<div>Hi,</div>  <div>&nbsp;</div>  <div>In Bspline registration the use of vnl_lbfgs optimizer &nbsp;is tricky to use</div>  <div>&nbsp;</div>  <div>I would recomend to swich it to steepest descent because is much more predictible.</div>  <div>&nbsp;</div>  <div>But anyway here are the IFLAG values</div>  <div>&nbsp;</div>  <div><SPAN class=comment>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IFLAG=-1&nbsp; The line search routine MCSRCH failed. The */</SPAN><BR>&nbsp;<SPAN class=comment>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parameter INFO provides more detailed information */</SPAN><BR>&nbsp;<SPAN class=comment>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (see also the documentation of MCSRCH): */</SPAN><BR>&nbsp;<BR>1 <SPAN
 class=comment>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INFO = 0&nbsp; IMPROPER INPUT PARAMETERS. */</SPAN><BR>&nbsp;<BR> <SPAN class=comment>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INFO = 2&nbsp; RELATIVE WIDTH OF THE INTERVAL OF */</SPAN><BR>&nbsp;<SPAN class=comment>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UNCERTAINTY IS AT MOST XTOL. */</SPAN><BR>&nbsp;<BR> <SPAN class=comment>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INFO = 3&nbsp; MORE THAN 20 FUNCTION EVALUATIONS WERE */</SPAN><BR>&nbsp;<SPAN
 class=comment>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; REQUIRED AT THE PRESENT ITERATION. */</SPAN><BR>&nbsp;<BR> <SPAN class=comment>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INFO = 4&nbsp; THE STEP IS TOO SMALL. */</SPAN><BR>&nbsp;<BR> <SPAN class=comment>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INFO = 5&nbsp; THE STEP IS TOO LARGE. */</SPAN><BR>&nbsp;<BR> <SPAN class=comment>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INFO = 6&nbsp; ROUNDING ERRORS PREVENT FURTHER ROGRESS.*/</SPAN><BR>&nbsp;<SPAN
 class=comment>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; THERE MAY NOT BE A STEP WHICH SATISFIES */</SPAN><BR>&nbsp;<SPAN class=comment>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; THE SUFFICIENT DECREASE AND CURVATURE */</SPAN><BR>&nbsp;<SPAN class=comment>/*                                 CONDITIONS. TOLERANCES MAY BE TOO SMALL.  */</SPAN><BR>&nbsp;<SPAN class=comment>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IFLAG=-2&nbsp; The i-th diagonal element of the diagonal inverse */</SPAN><BR>&nbsp;<SPAN
 class=comment>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Hessian approximation, given in DIAG, is not */</SPAN><BR>&nbsp;<SPAN class=comment>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; positive. */</SPAN><BR>&nbsp;<BR> <SPAN class=comment>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IFLAG=-3&nbsp; Improper input parameters for LBFGS (N or M are */</SPAN><BR>&nbsp;<SPAN class=comment>/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; not positive). */</SPAN><BR><BR>You can observe that steplengh by watching</div>  <div>*************************************************<BR>&nbsp;&nbsp; I&nbsp;&nbsp; NFN&nbsp;&nbsp;&nbsp; FUNC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 GNORM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; STEPLENGTH</div>  <div>&nbsp;</div>  <DIV>where STEPLENGHT=is determined at each iteration by means of the&nbsp;<BR><SPAN class=comment> line search routine MCVSRCH which I dont&nbsp;think you&nbsp;can control it, only the </SPAN></DIV>  <DIV>step size stopping tolerance</DIV>  <div>&nbsp;</div>  <div>Useful links:</div>  <div>Numerical receipes</div>  <div><A href="http://www.library.cornell.edu/nr/bookcpdf/c10-7.pdf">http://www.library.cornell.edu/nr/bookcpdf/c10-7.pdf</A></div>  <div>&nbsp;</div>  <div>and Wiki</div>  <div><A href="http://en.wikipedia.org/wiki/BFGS_method">http://en.wikipedia.org/wiki/BFGS_method</A></div>  <div>&nbsp;</div>  <div>Also I recomend you can play with it first to see how actualy optimizer work here:</div>  <div>&nbsp;</div>  <div><A href="http://www.cse.uiuc.edu/eot/modules/optimization/BFGS/">http://www.cse.uiuc.edu/eot/modules/optimization/BFGS/</A></div>  <div>&nbsp;</div>  <div>&nbsp;</div> 
 <div>&nbsp;</div>  <div>Teo</div>  <div><BR><B><I>Matt Robert &lt;matt.roberto@googlemail.com&gt;</I></B> wrote:</div>  <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Another error I am getting is <BR><BR>IFLAG= -1. LINE SEARCH FAILED. SEE DOCUMENTATION OF ROUTINE MCSRCH ERROR RETURN<BR>&nbsp;OF LINE SEARCH: INFO=4 POSSIBLE CAUSES: FUNCTION OR GRADIENT ARE&nbsp; INCORRECT OR<BR>INCORRECT TOLERANCESvnl_lbfgs: ** EEEK **<BR>ExceptionObject caught !<BR><BR>  <DIV><SPAN class=gmail_quote>On 8/25/06, <B class=gmail_sendername>Matt Robert</B> &lt;<A href="mailto:matt.roberto@googlemail.com">matt.roberto@googlemail.com</A>&gt; wrote:</SPAN>  <BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">  <DIV>Hi,<BR><BR>I used example DeformableRegistration4 to register two images. It works perfectly well and gives good results while reading images from disk.
 <BR><BR>I tried extracting two slices from two volumes and used the code given in DeformableRegistration4 to register them but it gives the following error. All the parameter and initialization values are same as in example. <BR><BR>If I save these two slices on disk and use the example, then it works. <BR><BR>Initial Parameters =<BR>[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0<BR>, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,<BR>0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,<BR>&nbsp;0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0<BR>, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]<BR><BR>Starting Registration<BR>&nbsp;F = 0.00143433, GNORM = 0<BR>*************************************************<BR>&nbsp;&nbsp; I&nbsp;&nbsp; NFN&nbsp;&nbsp;&nbsp; FUNC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 GNORM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; STEPLENGTH<BR>THE SEARCH DIRECTION IS NOT A DESCENT DIRECTIONIFLAG= -1. LINE SEARCH FAILED. SE<BR>E DOCUMENTATION OF ROUTINE MCSRCH ERROR RETURN&nbsp; OF LINE SEARCH: INFO=0 POSSIBLE<BR>CAUSES: FUNCTION OR GRADIENT ARE&nbsp; INCORRECT OR INCORRECT TOLERANCESvnl_lbfgs: **<BR>&nbsp;EEEK **<BR>ExceptionObject caught !<BR><BR>itk::ExceptionObject (0137F814)<BR>Location: "unknown"<BR>File: \itksrc\Code\Numerics\itkLBFGSOpt<BR>imizer.cxx<BR>Line: 265<BR>Description: itk::ERROR: LBFGSOptimizer(01905DD0): Error occured in optimization<BR><BR>In VS 6.0, I used quick watch and it showed that in fixed and moving images, the m_Direction field was different for both images, one was [(1 , 0),(1,0)] the other was [(1,0),(0,1)]. To resolve this problem I created two empty images and copied data from previous ones using iterators, but still same error. <BR></DIV>  <DIV><SPAN
 class=sg><BR>Matt<BR><BR></SPAN></DIV></BLOCKQUOTE></DIV><BR>_______________________________________________<BR>Insight-users mailing list<BR>Insight-users@itk.org<BR>http://www.itk.org/mailman/listinfo/insight-users<BR></BLOCKQUOTE><BR><p>&#32;
                <hr size=1>Stay in the know. Pulse on the new Yahoo.com. <a href="http://us.rd.yahoo.com/evt=42974/*http://www.yahoo.com/preview"> Check it out.</a>