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

Luis Ibanez luis.ibanez at kitware.com
Thu, 15 Jan 2004 13:52:00 -0500


Hi Reinhold,


The DifferenceImageFilter expects the
two input images to have the same size.
http://www.itk.org/Insight/Doxygen/html/classitk_1_1DifferenceImageFilter.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_1SquaredDifferenceImageFilter.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_1RegionOfInterestImageFilter.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_1ImageToImageMetric.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.html
> 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
>