hi,
<div><br></div><div>I run ImageRegistration7 example in ITK.</div><div>and the output like following</div><div>-------------------------------------</div><div><div> Scale         = 1.08438</div><div> Angle (radians) 0.154531</div>

<div> Angle (degrees) 8.85397</div><div> Center X      = 170.327</div><div> Center Y      = 148.556</div><div> Translation X = -26.6822</div><div> Translation Y = -93.4428</div><div> Iterations    = 500</div><div> Metric value  = 4551.86</div>

<div>---------------------------------------</div><div><br></div><div>I made a program in which i use a same metric, transformation, interpolate object type as above example, with same two input image file. I set above value to calculate metric value directly from metric object, but the result is not same as what the example made..</div>

<div><br></div><div>here is the code, did i miss something? </div><div>I&#39;m running out of time! really appreciate any help!</div><div><br></div><div>-------------------------------------------------------------------------</div>
<div>int main( int argc, char * argv[] )</div><div><div>{</div><div><span style="white-space:pre">        </span>const     unsigned int   Dimension = 2;</div>
<div><span style="white-space:pre">        </span>typedef   unsigned char  PixelType;</div><div><span style="white-space:pre">        </span>typedef itk::Image&lt; PixelType, Dimension &gt;   ImageType;</div>
<div><span style="white-space:pre">        </span>typedef itk::ImageFileReader&lt; ImageType &gt;  ReaderType;</div><div><br></div><div><span style="white-space:pre">        </span>ReaderType::Pointer fixedReader  = ReaderType::New();</div>

<div><span style="white-space:pre">        </span>ReaderType::Pointer movingReader = ReaderType::New();</div><div><br></div><div><span style="white-space:pre">        </span>fixedReader-&gt;SetFileName(  &quot;fixed.bmp&quot; );</div>

<div><span style="white-space:pre">        </span>movingReader-&gt;SetFileName( &quot;moving.bmp&quot; );</div><div><br></div><div>
<span style="white-space:pre">        </span>try </div><div><span style="white-space:pre">        </span>{</div><div><span style="white-space:pre">                </span>fixedReader-&gt;Update();</div>
<div><span style="white-space:pre">                </span>movingReader-&gt;Update();</div><div><span style="white-space:pre">        </span>}</div><div><span style="white-space:pre">        </span>catch( itk::ExceptionObject &amp; excep )</div>
<div><span style="white-space:pre">        </span>{</div><div><span style="white-space:pre">                </span>std::cerr &lt;&lt; &quot;Exception catched !&quot; &lt;&lt; std::endl;</div><div>
<span style="white-space:pre">                </span>std::cerr &lt;&lt; excep &lt;&lt; std::endl;</div><div><span style="white-space:pre">        </span>}</div><div><br></div><div><span style="white-space:pre">        </span>typedef itk::MeanSquaresImageToImageMetric&lt; ImageType, ImageType &gt;  MetricType;</div>

<div><span style="white-space:pre">        </span>MetricType::Pointer metric = MetricType::New();</div><div><br></div><div><span style="white-space:pre">        </span>typedef itk::CenteredSimilarity2DTransform &lt; double &gt;  TransformType;</div>
<div><span style="white-space:pre">        </span>TransformType::Pointer transform = TransformType::New();</div>
<div><br></div><div><span style="white-space:pre">        </span>typedef itk::LinearInterpolateImageFunction&lt; ImageType, double &gt;  InterpolatorType;</div>
<div><span style="white-space:pre">        </span>InterpolatorType::Pointer interpolator = InterpolatorType::New();</div><div><br></div><div><span style="white-space:pre">        </span>ImageType::Pointer fixedImage  = fixedReader-&gt;GetOutput();</div>
<div><span style="white-space:pre">        </span>ImageType::Pointer movingImage = movingReader-&gt;GetOutput();</div><div><br></div><div><span style="white-space:pre">        </span>typedef itk::CenteredTransformInitializer&lt; TransformType, ImageType, ImageType &gt;  TransformInitializerType;</div>

<div><span style="white-space:pre">        </span>TransformInitializerType::Pointer initializer = TransformInitializerType::New();</div><div><br></div><div><span style="white-space:pre">        </span>initializer-&gt;SetTransform(   transform );</div>

<div><span style="white-space:pre">        </span>initializer-&gt;SetFixedImage(  fixedImage );</div><div><span style="white-space:pre">        </span>initializer-&gt;SetMovingImage( movingImage );</div>
<div><span style="white-space:pre">        </span>initializer-&gt;MomentsOn();</div><div><span style="white-space:pre">        </span>initializer-&gt;InitializeTransform();</div><div><br></div><div><span style="white-space:pre">        </span>metric-&gt;SetTransform( transform );</div>
<div><span style="white-space:pre">        </span>metric-&gt;SetInterpolator( interpolator );</div>
<div><span style="white-space:pre">        </span>metric-&gt;SetFixedImage(  fixedImage  );</div><div><span style="white-space:pre">        </span>metric-&gt;SetMovingImage( movingImage );</div>
<div><span style="white-space:pre">        </span>metric-&gt;SetFixedImageRegion(  fixedImage-&gt;GetBufferedRegion()  );</div><div><br></div><div><span style="white-space:pre">        </span>try </div>
<div><span style="white-space:pre">        </span>{</div><div><span style="white-space:pre">                </span>metric-&gt;Initialize();</div><div><span style="white-space:pre">        </span>}</div>
<div><span style="white-space:pre">        </span>catch( itk::ExceptionObject &amp; excep )</div><div><span style="white-space:pre">        </span>{</div><div><span style="white-space:pre">                </span>std::cerr &lt;&lt; &quot;Exception catched !&quot; &lt;&lt; std::endl;</div>

<div><span style="white-space:pre">                </span>std::cerr &lt;&lt; excep &lt;&lt; std::endl;</div><div><span style="white-space:pre">                </span>return EXIT_FAILURE;</div><div><span style="white-space:pre">        </span>}</div>
<div><span style="white-space:pre">        </span></div><div><span style="white-space:pre">        </span></div><div><span style="white-space:pre">        </span>transform-&gt;SetScale(1.08438);</div>
<div><span style="white-space:pre">        </span>transform-&gt;SetAngle(8.85397);</div><div><span style="white-space:pre">        </span>TransformType::TranslationType translation;</div><div>
<span style="white-space:pre">        </span>translation[0] = -26.6822;</div><div><span style="white-space:pre">        </span>translation[1] = -93.6822;</div><div><br></div><div><span style="white-space:pre">        </span>MetricType::TransformParametersType transformParams = transform-&gt;GetParameters();</div>

<div><br></div><div><span style="white-space:pre">        </span>double metricval = metric-&gt;GetValue(transformParams);</div><div><span style="white-space:pre">        </span></div><div><span style="white-space:pre">        </span>return EXIT_SUCCESS;</div>

<div>}</div><div><br></div></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>