[ITK] [ITK-users] MutualInformationImageToImageMetric without transformation

Matt McCormick matt.mccormick at kitware.com
Thu Aug 28 22:39:54 EDT 2014


Hi Jan,

Make sure to call Initialize() [1].  See also the
MeanSquareImageMetric1.cxx file from the Examples/ directory.

Hope this helps,
Matt

[1] http://www.itk.org/Insight/Doxygen/html/classitk_1_1ImageToImageMetric.html#a2bd5955a3bedf31e701aed3ee1d4e473

On Thu, Aug 28, 2014 at 9:24 AM, jan <jan.bergmeier at imes.uni-hannover.de> wrote:
> Hi, I will use this way, because it's the most convenient that's working for
> me.
>
>     //Typedefs
>     typedef itk::IdentityTransform< double, 2 > TransformType;
>     typedef itk::GradientDescentOptimizer OptimizerType;
>     typedef itk::LinearInterpolateImageFunction< UChar2DImageType, double >
> InterpolatorType;
>     typedef itk::MutualInformationImageToImageMetric< UChar2DImageType,
> UChar2DImageType > MiMetricType;
>     typedef itk::ImageRegistrationMethod< UChar2DImageType, UChar2DImageType
>> RegistrationType;
>
>     //Create registration components
>     TransformType::Pointer transform = TransformType::New();
>     OptimizerType::Pointer optimizer = OptimizerType::New();
>     InterpolatorType::Pointer interpolator = InterpolatorType::New();
>     RegistrationType::Pointer registration = RegistrationType::New();
>
>     //Configure transform
>     transform->SetIdentity();
>
>     //Configure optimizer
>     optimizer->SetNumberOfIterations( 1 );
>
>     //Configure metric
>     MetricType::Pointer metric = MetricType::New();
>     metric->SetNumberOfSpatialSamples( 1000 );
>
>     //Set up registration
>     registration->SetOptimizer( optimizer );
>     registration->SetTransform( transform );
>     registration->SetInterpolator( interpolator );
>     registration->SetMetric( metric );
>
>     registration->SetFixedImage( fixedImageIn );
>     registration->SetMovingImage( movingImageIn );
>     registration->SetInitialTransformParameters( transform->GetParameters()
> );
>
>     //Perform registration
>     try
>     {
>         registration->Update();
>     }
>     catch( itk::ExceptionObject & err )
>     {
>         std::cout << "ExceptionObject caught !" << std::endl;
>         std::cout << err << std::endl;
>     }
>
>     //Get output
>     double bestValue = optimizer->GetValue();
>
> Thank you all for your help,
>
> Jan
>
>
>
> --
> View this message in context: http://itk-insight-users.2283740.n2.nabble.com/MutualInformationImageToImageMetric-without-transformation-tp7586081p7586134.html
> Sent from the ITK Insight Users mailing list archive at Nabble.com.
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users



More information about the Community mailing list