<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>Hi,<br><br>&nbsp; I'm trying to debug my rigid registration program and the first step is to reduce the number of iterations.<br>So I set it to 0, but when I execute my program it still shows me several iterations.&nbsp; Any clue as to why this might be happening ?<br><br>Here is the output of the optimizer (segment 1).&nbsp; As you can see, NumberOfIterations = 0 . The StopCondition which I thought would be 0 is 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-&gt;SetNumberOfIterations(0), then what do the following iterations represent&nbsp; and where do they come from ?<br>3. Also, it I set the NumberOfIterations to some otehr number such as 100000, it still performs 500 iterations (the default value from
 the example programs)<br>4. The Mean Square error metric that I compute on Binarized input images is the same as that computed on grayscale images. So what I am doing here is that I convert the grayscale images to binary. ie. Every tissue, except bone is black. Then I use these binary images for registration. The metric value returned by the registration process is compared against the metric value obtained by applying the same transform on original grayscale images and checking the mean squared error. Surprisingly these two values are EXACTLY the same. I expect them to be different for obvious reasons.<br>The way I compute the metric on the original grayscale images is shown 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>&nbsp; RTTI typeinfo:&nbsp;&nbsp; class itk::VersorRigid3DTransformOptimizer<br>&nbsp;
 Reference Count: 2<br>&nbsp; Modified Time: 874<br>&nbsp; Debug: Off<br>&nbsp; Observers:<br>&nbsp;&nbsp;&nbsp; none<br>&nbsp; InitialPosition: []<br>&nbsp; CurrentPosition: []<br>&nbsp; Scales: [1, 1, 1, 0.001, 0.001, 0.001]<br>&nbsp; MaximumStepLength: 0.2<br>&nbsp; MinimumStepLength: 0.001<br>&nbsp; RelaxationFactor: 0.5<br>&nbsp; GradientMagnitudeTolerance: 0.1<br>&nbsp; NumberOfIterations: 0<br>&nbsp; CurrentIteration: 0<br>&nbsp; Value: 0<br>&nbsp; Maximize: 0<br>&nbsp; CostFunction: (None)<br>&nbsp; CurrentStepLength: 0<br>&nbsp; StopCondition: 5<br>&nbsp; Gradient: []<br>0&nbsp;&nbsp; 1976.47&nbsp;&nbsp; [0.000460224, -0.0157202, -0.041473, -6.58714, -9.17326, 0.231981]<br><br>1&nbsp;&nbsp; 669.48&nbsp;&nbsp; [0.00152886, 0.00402301, -0.0345613, -6.60421, -9.36806, 0.229234]<br>2&nbsp;&nbsp; 576.079&nbsp;&nbsp; [-0.000710302, -0.0100887, -0.0583703, -6.5576, -9.55443, 0.227974<br>]<br>3&nbsp;&nbsp; 895.329&nbsp;&nbsp; [0.0024751, 0.017149,
 -0.0188799, -6.6526, -9.70157, 0.236332]<br>4&nbsp;&nbsp; 1454.49&nbsp;&nbsp; [0.000779181, 0.00262768, -0.0415692, -6.57818, -9.73974, 0.226865<br>]<br>5&nbsp;&nbsp; 208.619&nbsp;&nbsp; [-0.000462126, -0.00352645, -0.0488536, -6.56913, -9.83714, 0.2190<br>21]<br>6&nbsp;&nbsp; 320.494&nbsp;&nbsp; [0.00156166, 0.00864248, -0.0314357, -6.61138, -9.91627, 0.207684]<br><br>7&nbsp;&nbsp; 724.278&nbsp;&nbsp; [0.000322199, -0.00121238, -0.0455856, -6.58293, -9.93788, 0.20247<br>4]<br>8&nbsp;&nbsp; 143.422&nbsp;&nbsp; [0.000259716, 0.00266556, -0.0399937, -6.59857, -9.98223, 0.192322<br>]<br>9&nbsp;&nbsp; 223.3&nbsp;&nbsp; [-0.000310048, -0.004876, -0.0507685, -6.57875, -10.018, 0.180773]<br>10&nbsp;&nbsp; 419.74&nbsp;&nbsp; [0.00029441, 5.14277e-005, -0.0436893, -6.59453, -10.026, 0.177275<br>]<br>1<br>.......<br><br><br><br><br>SEGMENT 2<br><br>MetricType::Pointer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; metricOrig&nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = MetricType::New();&nbsp;&nbsp;&nbsp; <br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; metricOrig-&gt;SetInterpolator(interpolator);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; metricOrig-&gt;SetTransform(transform);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; metricOrig-&gt;SetFixedImage(fixedImageReaderOrig-&gt;GetOutput());<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; metricOrig-&gt;SetMovingImage(movingImageReaderOrig-&gt;GetOutput());<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; metricOrig-&gt;SetTransformParameters(finalParameters);&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MetricType::TransformParametersType finalParam = registration-&gt;GetLastTransformParameters();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; std::cout&lt;&lt;" MetricOnOriginalImage = "&lt;&lt;metric-&gt;GetValue(finalParam)&lt;&lt;std::endl;<br><br><br><br><br><br></div></div><br>
      <hr size=1>Fussy? Opinionated? Impossible to please? Perfect.  <a href="http://us.rd.yahoo.com/evt=48516/*http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 ">Join Yahoo!'s user panel</a> and lay it on us.
</body></html>