<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-family: times new roman,new york,times,serif; font-size: 12pt;">Hi Luis,<br><br> Yes, I see the value of m_StopCondition in the debugger and it does not get initialized to 0, if the MaxNumberofIterations is 0.<br>I haven't checked whether this occurs for 0 value alone.<br><br>Emma<br><br><br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: Luis Ibanez <luis.ibanez@kitware.com><br>To: Emma Ryan <eryanvtk@yahoo.com><br>Cc: insight-users@itk.org<br>Sent: Friday, August 10, 2007 9:18:58 AM<br>Subject: Re: [Insight-users] Re: SetMaxIterations(0) still computes<br><br><div><br>Hi Emma,<br><br> You are right, this is a
bug.<br><br><br> If Number of Iterations is set to zero,<br> then the optimizer will runs forever.<br><br><br>We have logged this and Bug #5476<br><a target="_blank" href="http://public.kitware.com/Bug/view.php?id=5476">http://public.kitware.com/Bug/view.php?id=5476</a><br><br><br>The changes should be easy to put in place.<br><br><br><br>A couple of questions first:<br><br> How are you looking at the value of m_StopCondition ?<br> by using a debugger ?<br> by using print outs ?<br><br>StopCondition is *initialized* with "MaximumNumberOfIterations",<br>that's probably the reason why you see that value when you<br>(I assume "manually") stop the optimizer.<br><br>We probably should add a "Unknown" to the enum, and initialize<br>the StopCondition to that value.<br><br><br><br> Please let us
konw,<br><br><br> Thanks<br><br><br> Luis<br><br><br><br>------------------<br>Emma Ryan wrote:<br>> Hi,<br>> <br>> With reference to my earlier email ( below), I think ITK does not <br>> allow the MaxNumberOfIterations to be zero. It needs to be a minimum of <br>> one because the check<br>> if (m_currentIteration = = m_NumberOfIterations) then quit; is done in a <br>> sort-of 'do-while' loop rather than 'while'. So this condition is never <br>> true for m_NumberofIterations=0.<br>> <br>> I am still confused about Stop_Condition getting a value of 5.<br>> <br>> Also, if Stop_Condition is defined by NumberofIterations, then why <br>> doesn't the optimizer continue iterating till it reaches the number, <br>> rather than terminating at a 'decent' metric value ?<br>> <br>> Obviously
there is another hidden condition for termination which I dont <br>> see. Could anyone point to me the location ?<br>> <br>> Thank you,<br>> Emma<br>> <br>> ----- Original Message ----<br>> From: Emma Ryan <eryanvtk@yahoo.com><br>> To: insight-users@itk.org<br>> Sent: Thursday, August 9, 2007 1:35:23 AM<br>> Subject: SetMaxIterations(0) still computes<br>> <br>> Hi,<br>> <br>> I'm trying to debug my rigid registration program and the first step <br>> is to reduce the number of iterations.<br>> So I set it to 0, but when I execute my program it still shows me <br>> several iterations. Any clue as to why this might be happening ?<br>> <br>> Here is the output of the optimizer (segment 1). As you can see, <br>> NumberOfIterations = 0 . The StopCondition which I thought would be 0 is <br>> 5. So based on this and other experiments, I have a few
questions.<br>> <br>> 1. Shouldn't the StopCondition be 0 ?<br>> 2. If optimizer->SetNumberOfIterations(0), then what do the following <br>> iterations represent and where do they come from ?<br>> 3. Also, it I set the NumberOfIterations to some otehr number such as <br>> 100000, it still performs 500 iterations (the default value from the <br>> example programs)<br>> 4. The Mean Square error metric that I compute on Binarized input images <br>> is the same as that computed on grayscale images. So what I am doing <br>> here is that I convert the grayscale images to binary. ie. Every tissue, <br>> except bone is black. Then I use these binary images for registration. <br>> The metric value returned by the registration process is compared <br>> against the metric value obtained by applying the same transform on <br>> original grayscale images and checking the mean squared error. <br>> Surprisingly
these two values are EXACTLY the same. I expect them to be <br>> different for obvious reasons.<br>> The way I compute the metric on the original grayscale images is shown <br>> below under segment 2<br>> <br>> <br>> What is going on ?<br>> <br>> Any clue ?<br>> <br>> Thanks in advance<br>> Emma<br>> <br>> <br>> SEGMENT 1<br>> ---------------<br>> VersorRigid3DTransformOptimizer (019220B8)<br>> RTTI typeinfo: class itk::VersorRigid3DTransformOptimizer<br>> Reference Count: 2<br>> Modified Time: 874<br>> Debug: Off<br>> Observers:<br>> none<br>> InitialPosition: []<br>> CurrentPosition: []<br>> Scales: [1, 1, 1, 0.001, 0.001, 0.001]<br>> MaximumStepLength: 0.2<br>> MinimumStepLength: 0.001<br>>
RelaxationFactor: 0.5<br>> GradientMagnitudeTolerance: 0.1<br>> NumberOfIterations: 0<br>> CurrentIteration: 0<br>> Value: 0<br>> Maximize: 0<br>> CostFunction: (None)<br>> CurrentStepLength: 0<br>> StopCondition: 5<br>> Gradient: []<br>> 0 1976.47 [0.000460224, -0.0157202, -0.041473, -6.58714, -9.17326, <br>> 0.231981]<br>> <br>> 1 669.48 [0.00152886, 0.00402301, -0.0345613, -6.60421, -9.36806, <br>> 0.229234]<br>> 2 576.079 [-0.000710302, -0.0100887, -0.0583703, -6.5576, -9.55443, <br>> 0.227974<br>> ]<br>> 3 895.329 [0.0024751, 0.017149, -0.0188799, -6.6526, -9.70157, 0.236332]<br>> 4 1454.49 [0.000779181, 0.00262768, -0.0415692, -6.57818, -9.73974, <br>>
0.226865<br>> ]<br>> 5 208.619 [-0.000462126, -0.00352645, -0.0488536, -6.56913, <br>> -9.83714, 0.2190<br>> 21]<br>> 6 320.494 [0.00156166, 0.00864248, -0.0314357, -6.61138, -9.91627, <br>> 0.207684]<br>> <br>> 7 724.278 [0.000322199, -0.00121238, -0.0455856, -6.58293, -9.93788, <br>> 0.20247<br>> 4]<br>> 8 143.422 [0.000259716, 0.00266556, -0.0399937, -6.59857, -9.98223, <br>> 0.192322<br>> ]<br>> 9 223.3 [-0.000310048, -0.004876, -0.0507685, -6.57875, -10.018, <br>> 0.180773]<br>> 10 419.74 [0.00029441, 5.14277e-005, -0.0436893, -6.59453, -10.026, <br>> 0.177275<br>> ]<br>> 1<br>> .......<br>> <br>> <br>> <br>> <br>> SEGMENT 2<br>> <br>> MetricType::Pointer
metricOrig = MetricType::New(); <br>> <br>> metricOrig->SetInterpolator(interpolator);<br>> metricOrig->SetTransform(transform);<br>> metricOrig->SetFixedImage(fixedImageReaderOrig->GetOutput());<br>> metricOrig->SetMovingImage(movingImageReaderOrig->GetOutput());<br>> metricOrig->SetTransformParameters(finalParameters); <br>> MetricType::TransformParametersType finalParam = <br>> registration->GetLastTransformParameters();<br>> <br>>
std::cout<<" MetricOnOriginalImage = <br>> "<<metric->GetValue(finalParam)<<std::endl;<br>> <br>> <br>> <br>> <br>> <br>> <br>> ------------------------------------------------------------------------<br>> Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user <br>> panel <br>> <<a target="_blank" href="http://us.rd.yahoo.com/evt=48516/*http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7%20">http://us.rd.yahoo.com/evt=48516/*http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7%20</a>> <br>> and lay it on us.<br>> <br>> <br>> ------------------------------------------------------------------------<br>> Be a better Heartthrob. Get better relationship answers <br>> <<a target="_blank"
href="http://us.rd.yahoo.com/evt=48255/*http://answers.yahoo.com/dir/_ylc=X3oDMTI5MGx2aThyBF9TAzIxMTU1MDAzNTIEX3MDMzk2NTQ1MTAzBHNlYwNCQUJwaWxsYXJfTklfMzYwBHNsawNQcm9kdWN0X3F1ZXN0aW9uX3BhZ2U-?link=list&sid=396545433%3Efrom">http://us.rd.yahoo.com/evt=48255/*http://answers.yahoo.com/dir/_ylc=X3oDMTI5MGx2aThyBF9TAzIxMTU1MDAzNTIEX3MDMzk2NTQ1MTAzBHNlYwNCQUJwaWxsYXJfTklfMzYwBHNsawNQcm9kdWN0X3F1ZXN0aW9uX3BhZ2U-?link=list&sid=396545433>from</a> <br>> someone who knows.<br>> Yahoo! Answers - Check it out.<br>> <br>> <br>> ------------------------------------------------------------------------<br>> <br>> _______________________________________________<br>> Insight-users mailing list<br>> Insight-users@itk.org<br>> <a target="_blank" href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a><br></div></div><br></div></div><br>
<hr size=1>Boardwalk for $500? In 2007? Ha! <br><a href="http://us.rd.yahoo.com/evt=48223/*http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow">Play Monopoly Here and Now</a> (it's updated for today's economy) at Yahoo! Games.</body></html>