[Insight-users] Adapted Image Similarity measure

Reinhard Hameeteman K.Hameeteman at student.tnw.tudelft.nl
Tue May 10 06:31:27 EDT 2005


Hi,

I am trying to implement an new image similarity measure in an existing registration
application. Therefore I want to make an adapted version of the
itkMattesMutualInformationImageToImageMetric so I won't need to change the rest of the
program. The only changes I want to make are the GetValue and GetValueAndDerivative
functions: I want to add a term to the MI value. Because I am new to template programming
I wonder if the following code is correct. I haven't made any changes yet. This is just to
see if I'm on the right track or making it to difficult for myself. I took the code from
the registration example ModelToImageRegistration1.cxx

Best regards,
Reinhard

#include "itkMattesMutualInformationImageToImageMetric.h"

/*************************************************
 Cost function used to optimize image registration
 *************************************************/

template <typename TFixedImage,typename TMovingImage> class AdaptedMIMetric :
 public itk::MattesMutualInformationImageToImageMetric< TFixedImage, TMovingImage > {

public:
  /** Standard class typedefs. */

 typedef AdaptedMIMetric         Self;
 typedef itk::MattesMutualInformationImageToImageMetric
   <typename TFixedImage,typename TMovingImage> Superclass;
 typedef typename Superclass::ParametersType    ParametersType;
 typedef typename Superclass::DerivativeType    DerivativeType;
 typedef typename Superclass::MeasureType    MeasureType;


  /** Get the Derivatives of the Match Measure */
  void GetDerivative( const ParametersType & parameters, DerivativeType & Derivative)
const
    {
   Superclass::GetDerivative( parameters,Derivative );
      return;
    }

  /** Get the value for SingleValue optimizers. */
  MeasureType    GetValue( const ParametersType & parameters ) const
    {
   MeasureType MetricValue = Superclass::GetValue( parameters );
      return MetricValue;
    }

  /** Get Value and Derivatives for MultipleValuedOptimizers */
  void GetValueAndDerivative( const ParametersType & parameters,
       MeasureType & Value, DerivativeType  & Derivative ) const
    {
      Value = this->GetValue(parameters);
      this->GetDerivative(parameters,Derivative);
    }
};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: AdaptedMI.cpp
Type: application/octet-stream
Size: 1518 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/insight-users/attachments/20050510/56823ef4/AdaptedMI.obj


More information about the Insight-users mailing list