[Insight-users] Mattes Information Metric

Karthik Krishnan karthik.krishnan at kitware.com
Sat Oct 30 09:19:32 EDT 2010


As Cory says, use the identity transform. Also set the interpolator,
and the fixed image region and finally call Initialize or the metric
will throw an error.

something like:

   MetricType::Pointer metric = MetricType::New();
   metric->SetFixedImage( image1 );
   metric->SetMovingImage( image2 );

   typedef itk::IdentityTransform< double, Dimension >  TransformType;
   TransformType::Pointer transform = TransformType::New();
   metric->SetTransform( transform );

  typedef itk::LinearInterpolateImageFunction<
           ImageType, double > InterpolatorType;
  InterpolatorType::Pointer interpolator  = InterpolatorType::New();
  metric->SetInterpolator( interpolator );

 metric->SetFixedImageRegion( image1->GetBufferedRegion() );
 metric->Initialize();
 const double metricValue = metric->GetValue( transform->GetParameters()
);


 --
 karthik

On 10/29/10, Cory Quammen <cquammen at cs.unc.edu> wrote:
> Ken,
>
> When you call GetValue(), the argument you give it is passed to the
> transform, and the metric is computed over the transformed moving
> image. If you don't want a transformation on your un-moving image,
> simply set the transform for the metric to an IdentityTransform. Then
> simply pass GetValue() a variable of type
> IdentityTransform::ParametersType. You shouldn't need to initialize
> the ParametersType variable (it should be a zero-length vector).
>
> The code should look something like
>
> typedef MattesMutualInformationImageToImageMetric< TFixedImageType,
> TMovingImageType > MetricType;
>
> MetricType::Pointer metric = MetricType::New();
>
> typedef IdentityTransform<..., ...> IdentityTransformType;
> IdentityTransformType::Pointer transform = IdentityTransformType::New();
> metric->SetTransform(transform);
>
> MetricType::ParametersType params;
> double value = metric->GetValue(params);
>
> For what it's worth, there is (I think) an effort underway to separate
> the transforms from the metrics in ITK v4, which should let you call a
> parameter-less GetValue() method and avoid this complication
> altogether.
>
> Hope that helps,
> Cory
>
> On Thu, Oct 28, 2010 at 5:56 PM, Ken Urish <ken.urish at gmail.com> wrote:
>> Simple question but Im getting lost in the code
>>
>> Given two images I want to calculate the Mattes Mutual Information
>> Metric outside of the registration framework. This is easy during
>> registration as you just need "optimizer->GetValue()". However, I dont
>> want any transforms or optimizers involved and simply want to call the
>> metric value directly from:
>> itkMattesMutualInformationImageToImageMetric given two images. The
>> GetValue in MattessMutualInformationMetric macro needs a ParameterType
>> and Im stuck looking through the code what this is?
>>
>> Thanks
>> --Ken--
>> _____________________________________
>> 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.html
>>
>> 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://www.itk.org/mailman/listinfo/insight-users
>>
>
>
>
> --
> Cory Quammen
> Computer Integrated Systems for Microscopy and Manipulation (CISMM)
> Department of Computer Science
> University of North Carolina at Chapel Hill
> http://www.cs.unc.edu/~cquammen
> _____________________________________
> 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.html
>
> 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://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list