[Insight-users] Image similarity]

George Iordanescu giordanescu at cmr.nunet.net
Tue Jul 13 16:14:26 EDT 2004


Hi Luis,

Thank you for your quick reply. Below is the function I wrote and it
seems to work somehow... I started with 2 3D images whose similarity was
-0.51411. Also:
Similarity between fixed image and itself = -1.32591
Similarity between moving image  and itself = -1.37055

After rigid registration : 
Similarity between  moving image and registered image = -0.782605;
Similarity between fixed image  and registered image = -0.651837 ;

I am a bit surprised by the self-similarity values for the fixed and
moving image. Aren't they supposed to be between -1 and 1? 

Also, the rigid registration app (that uses the same type of metric and
interpolator as my function) reports  a metric value -0.435078 for the
first iteration (transform parameters are [0, 0, 0, 0, 0, 0]). This
value is close to the -0.51411 computed by my function but still a bit
different. I guess there is some variation in the results provided by
the metric.

I do not know as much as I would like about template programming but I
will try to write a class templated over the Metric type and the
Interpolator type.

Thank you.

George

-------------defined in DataManager class-----------
  typedef signed long                   ImagePixelType;
  typedef itk::Image<ImagePixelType,3>  ImageType;
  typedef ImageType::Pointer            ImagePointer ;
----------------------------------------------------

double Compute_3DImages_Similarity(DataManager::ImagePointer image1,
DataManager::ImagePointer image2)
{

  /**  Type of the metric. */
  //typedef itk::ImageToImageMetric< ImageType, ImageType >      
MetricType;
  typedef itk::MattesMutualInformationImageToImageMetric< ImageType,
ImageType >       MetricType;
  typedef itk::LinearInterpolateImageFunction< ImageType, double >
InterpolatorType ;
  typedef  itk::IdentityTransform< double, 3 >      TransformType;
  typedef MetricType::Pointer             MetricPointer;

  /**  Type of the Transform . */
  typedef  TransformType::Pointer         TransformPointer;
  typedef  MetricType::ParametersType     ParametersType;
  typedef  InterpolatorType::Pointer      InterpolatorPointer;

  TransformPointer  m_Transform = TransformType::New();
  MetricType::Pointer m_Metric =  MetricType::New();
  InterpolatorPointer m_Interpolator = InterpolatorType::New();
  m_Metric->SetMovingImage( image1 );
  m_Metric->SetFixedImage( image2 );
  m_Metric->SetTransform( m_Transform );
  m_Metric->SetInterpolator( m_Interpolator );
  m_Metric->SetFixedImageRegion( image1->GetLargestPossibleRegion() );

  const unsigned int dummyspaceDimension =
    m_Metric->GetNumberOfParameters();
  ParametersType dummyPosition(dummyspaceDimension) ;
  for( unsigned int i=0; i<dummyspaceDimension; i++){
      dummyPosition[i] = 0;
  }

  m_Metric->Initialize();

  double simi = m_Metric->GetValue(dummyPosition);
  return simi;
}

On Mon, 2004-07-12 at 19:17, Luis Ibanez wrote:
> > Hi George,
> > 
> > You can use any of the current ImageToImage metrics,
> > 
> > http://www.itk.org/Insight/Doxygen/html/group__RegistrationMetrics.html
> > 
> > and simply set
> > 
> >    Interpolator = NearestNeighborhoodInterpolator
> >    Transform    = IdentityTransform
> > 
> > If you find annoying to have to do this every time,
> > you could write a class templated over the Metric
> > type, that will do this initializations for you.
> > 
> > This new class will have a GetValue() method without
> > parameters that will simply invoke the GetValue() method
> > of the real metric with a dummy array of parameters.
> > You can use a dummy array because the IdentityTransform
> > do not require parameters.
> > 
> > In this way you can easily switch among any of the
> > twelve or so image metrics in ITK and dont have to
> > worry about the extra componets required for integration
> > with the registration framework.
> > 
> > 
> > You may want to contribute such a class to the toolkit
> > since it may prove to be useful to other ITK users.
> > 
> > 
> > Please let us now if you need any assistance for
> > writing this new class.
> > 
> > 
> >     Thanks
> > 
> > 
> >        Luis
> > 
> > 
> > 
> > --------------------------
> > George Iordanescu wrote:
> > 
> > > Hello everybody,
> > > 
> > > I would like to compute a number that describes the similarity degree
> > > between two images. I am thinking about a simple class that should have
> > > two methods SetImage1/2 and then ComputeSimilarity().
> > > 
> > > I was hoping a child of ImageToImageMetric would do, but it seems to
> > > need more inputs than just two images. Apparently, after setting the
> > > images (and the Interpolator and the (identity) transform),  I cannot
> > > call GetValue without passing some parameters that make little sense in
> > > the context of just two images. Is there any other class (filter) that
> > > will compute the similarity between two images? Is there any example
> > > about how to use a ImageToImageMetric for such a purpose?
> > > 
> > > Such a class could be very useful when trying to find the best set of
> > > registration parameters. One could register an image using multiple sets
> > > of parameters and then we could select the best set by looking at the
> > > similarity between the registered image and the fixed image.
> > > 
> > > Any suggestion will be highly appreciated.
> > > 
> > > Thank you.
> > > 
> > > George
> > > 
> > > _______________________________________________
> > > Insight-users mailing list
> > > Insight-users at itk.org
> > > http://www.itk.org/mailman/listinfo/insight-users
> > > 
> > 
> > 
> > 
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org
> > http://www.itk.org/mailman/listinfo/insight-users
> > 



More information about the Insight-users mailing list