<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hello everyone,<br>
<br>
I am trying to get the ExhaustiveOptimizerv4 to work. Therefore I built a minimal example:<br>
<br>
<br>
    typedef itk::Image< double, 2 > ImageType;<br>
    typedef itk::ImageFileReader< ImageType > ReaderType;<br>
    typedef itk::MeanSquaresImageToImageMetricv4< ImageType, ImageType > MetricType;<br>
    typedef itk::ExhaustiveOptimizerv4< double > OptimizerType;<br>
    typedef itk::TranslationTransform< double, 2 >TransformType;<br>
    typedef itk::ImageRegistrationMethodv4< ImageType, ImageType, TransformType > RegistrationType;<br>
<br>
    ReaderType::Pointer fixedReader = ReaderType::New();<br>
    ReaderType::Pointer movingReader = ReaderType::New();<br>
    MetricType::Pointer metric = MetricType::New();<br>
    OptimizerType::Pointer optimizer = OptimizerType::New();<br>
    TransformType::Pointer identityTransform = TransformType::New();<br>
    RegistrationType::Pointer registration = RegistrationType::New();<br>
<br>
    fixedReader->SetFileName( "/home/jan/mitk/DicomTestSceneBuild/drillImg_000000.png" );<br>
    movingReader->SetFileName( "/home/jan/mitk/DicomTestSceneBuild/drillImg_source_visEar0.05_dhRad1mm.png" );<br>
<br>
    identityTransform->SetIdentity();<br>
<br>
    OptimizerType::StepsType steps( identityTransform->GetNumberOfParameters() );<br>
    steps[1] = 10;<br>
    steps[2] = 50;<br>
    optimizer->SetNumberOfSteps( steps );<br>
    optimizer->SetStepLength( 1 );<br>
<br>
    registration->SetMetric( metric );<br>
    registration->SetOptimizer( optimizer );<br>
    registration->SetFixedImage( fixedReader->GetOutput() );<br>
    registration->SetMovingImage( movingReader->GetOutput() );<br>
    registration->SetFixedInitialTransform( identityTransform );<br>
    registration->SetMovingInitialTransform( identityTransform );<br>
<br>
    registration->Update();<br>
<br>
    std::cout << "Best value: " << registration->GetOptimizer()->GetValue() << std::endl;<br>
    std::cout << "Number of iterations: " << optimizer->GetCurrentIteration() << std::endl;<br>
<br>
<br>
When I run this code, the number of iterations are 21. I would expect them to be 10*50 = 500, but the second steps entry seems to have no effect.<br>
<br>
Furthermore, the output from the registration metric is always 0, while it isn't if I use different optimizers.<br>
<br>
<br>
I hope anyone can help me.<br>
Thanks in advance!<br>
<br>
Jan<br>
</div>
</body>
</html>