[Insight-users] Comparing images only with same size + tolerance?

Reinhold Füreder R.Fureder at exeter.ac.uk
Fri, 16 Jan 2004 12:42:38 +0100


Dear Luis,

Thank you very much indeed for your extensive response.

Your suggested option 2 was exactly what I needed (coincident coordinate
system). When using the DifferenceImageFilter on the extracted ROIs of
the two images I get "interesting"/confusing results, because I
regularly get a lower deviation (i.e. GetMeanDifference () method) if
the structure described by pixel values != 0 is flipped around an axis
than in the correct "alignment" case. Moreover, each of the possible
flipped images gives very similar calculation results, e.g.

  0: 0.687906
  1: 0.525622
  2: 0.585111
  3: 0.662708
Difference filter does not comply!!!
  Expected: 2
  Found:    1


How is the difference calculated by DifferenceImageFilter?


The registration is not computed by means of ITK, however, I have the
final transformation matrix available. Is the NormalizedCorrelation
image metric mentioned by you in option 3 now the preferred option as it
does not require anything else?

Thanks,
	Reinhold

> -----Original Message-----
> From: Luis Ibanez [mailto:luis.ibanez at kitware.com] 
> Sent: Thursday, January 15, 2004 7:52 PM
> To: Reinhold Füreder
> Cc: insight-users at itk.org
> Subject: Re: [Insight-users] Comparing images only with same 
> size + tolerance?
> 
> 
> 
> Hi Reinhold,
> 
> 
> The DifferenceImageFilter expects the
> two input images to have the same size. 
> http://www.itk.org/Insight/Doxygen/html/classitk_1_1Difference
> ImageFilter.html
> 
> In this filter the tolerance is controlled
> by setting the maximum allowed difference
> between pixel values and by setting the
> radius of the region to select the more
> similar pixel.
> 
> The SquareDifferenceImageFilter is only
> useful as a visual aid. It doesn't compute
> a measure of the difference. Instead it
> shows you where the images are having
> differences. 
> http://www.itk.org/Insight/Doxygen/html/classitk_1_1SquaredDif
> ferenceImageFilter.html
> 
> If you have images of two difference sizes
> you may want to consider the following options:
> 
> 
> 1) Resample one of the images onto the
>     resolution and coordinate system of
>     the other. Then use the DifferenceImageFilter
>     between the resampled image and the one
>     used as reference.
> 
> Or
> 
> 2) If the coordinate systems are already
>     coincident, you can use the
>     RegionOfInterestImageFilter 
> http://www.itk.org/Insight/Doxygen/html/classitk_1_1RegionOfIn
> terestImageFilter.html
>     in order to extract the common region between
>     the images, and then compare these two common
>     regions using the DifferenceImageFilter
> 
> Or
> 
> 3) Use any ImageMetric different from the
>     one you used for computing the registration. 
> http://www.itk.org/Insight/Doxygen/html/classitk_1_1ImageToIma
> geMetric.html
>     feed the metric with the interpolator of your
>     choice and the appropriate transform that
>     will overlap the common regions between the
>     two images. Then, simply trigger the computation
>     of the metric and take the metric value as...
>     what it is after all : an evaluation of how
>     similar the two images are.
> 
>     For example, if you performed the registration
>     using MeanSquare, you can evaluate the result
>     using NormalizedCorrelation.
> 
> 
> Note that if the final goal is to do regression
> testing of a registration algorithm, you can
> simply take the last metric value of the registration
> and use it as baseline value for the future executions
> of the test.
> 
> 
> 
> Regards,
> 
> 
>    Luis
> 
> 
> 
> -------------------------
> Reinhold Füreder wrote:
> 
> > Dear Luis et al,
> > 
> > In 
> > 
> http://public.kitware.com/pipermail/insight->
users/2003-June/004034.htm
> > l
> > Luis pointed out that there are 2 filters to compare 2 
> images, namely
> > the DifferenceImageFilter and the 
> SquaredDifferenceImageFilter. In order
> > to perform a basic regression testing I therefore use, as 
> suggested, the
> > DifferenceImageFilter, as it returns some similarity metrics.
> > 
> > And here is my problem: the 2 images to compare may have very 
> > different sizes, while the structure described by pixel 
> values != 0, 
> > should be similar. Is the assumption right, that the 
> > DifferenceImageFilter only deals with equally sized images plus the 
> > optional tolerance configured by SetToleranceRadius?
> > 
> > Thus, I can not apply this filter but have to carry out a slow 
> > pixel-index based comparison of the greatest common region 
> between the 
> > 2 images?
> > 
> > Thanks,
> > 	Reinhold
> > 
> > --------------------
> > Reinhold Füreder
> > MPhil Student
> > School of Eng., CS and Maths
> > University of Exeter, UK
> >  
> > 
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org 
> > http://www.itk.org/mailman/listinfo/insight-users
> > 
> 
> 
> 
>