[Insight-users] itkGradientDifferenceImageToImageMetric

Vicente Grau vicente at robots.ox.ac.uk
Fri Dec 2 12:16:57 EST 2005


Thanks very much for the fix. It seems to work for me too.
When I apply the metric to my images, it now produces values that vary 
when I apply different translations. The variation, though, is so small 
that I can't use to guide an optimizer. I have been looking at the code, 
and I don't understant well how the calculation is done. It calculates 
the metric as:

A/(A + diff^2)

where

diff = grad1 - s*grad2

Actually, this is done for each of the dimensions, and added up to 
obtain the final result. Up to this point, it looks fine to me, and it 
corresponds to the gradient difference as used, e.g., in [Penney et al, 
A comparison of similarity measures for use in 2D-3D medical imaging 
registration, IEEE TMI 17(4), 586-595.]
Now the program tries several values of s, starting from zero, and stops 
whenever it finds a maximum, i.e., when increasing the value of s 
produces a decrease in the final result. For the images I have tried, 
this usually occurs just at the first value of s (s=0), so the final 
result is the same in most cases. I am probably missing something about 
how the algorithm works. Are there any conditions for the input images 
(e.g., intensity ranges)? Why is this search for the maximum performed?

Again, thanks very much for your help.

Vicente


Lorensen, William E (Research) wrote:

>Thanks for the bug report. I think I fixed it. It never worked apparently.
>
>You will need to update:
>
>Code/Commono/itkTranslateTransform.txx
>Code/Algorithms/itkGradientDifferenceImageToImageMetric.txx and .h
>Testing/Code/Algorithm/itkGradientDifferenceImageToImageMetricTest.cxx
>
>Now, the values change. I'm not sure if thet are correct. If you find that it works as expected (or not), let us know.
>
>Bill
>
>-----Original Message-----
>From: Vicente Grau [mailto:vicente at robots.ox.ac.uk]
>Sent: Thursday, December 01, 2005 11:42 AM
>To: Lorensen, William E (Research); insight-users at itk.org
>Subject: Re: [Insight-users] itkGradientDifferenceImageToImageMetric
>
>
>Thanks very much, I have already placed a bug report (number 2543). How 
>can I know when this has been fixed?
>
>Vicente
>
>
>Lorensen, William E (Research) wrote:
>
>  
>
>>As you discovered, this filter is badly broken. I've looked at the code this morning and found a few problems already.
>>
>>As Karthik suggested, you should log a bug for itk at:
>>http://www.itk.org/Bug/index.php
>>
>>Believe it or not, we do look at these.
>>
>>Bill
>>
>>
>>
>>-----Original Message-----
>>From: insight-users-bounces+lorensen=crd.ge.com at itk.org
>>[mailto:insight-users-bounces+lorensen=crd.ge.com at itk.org]On Behalf Of
>>Vicente Grau
>>Sent: Wednesday, November 30, 2005 1:07 PM
>>To: insight-users at itk.org
>>Subject: [Insight-users] itkGradientDifferenceImageToImageMetric
>>
>>
>>I have been comparing several image-to-image metrics using a 
>>modification of the program MeanSquaresImageMetric1.cxx. With 
>>GradientDifferenceImageToImageMetric, I get a constant value, 
>>independent of the translation between the images (e.g., in case of two 
>>3D images, 40x60x60 voxels, intensity range 0-255, the value is always 
>>339204.)
>>I have only found an example that uses this metric, it is one of the 
>>tests of itkAlgorithmsTests2.exe. When I run it, I get the result below. 
>>It seems to me that this result has exactly the same problem: the same 
>>value 20000 regardless of the translation values (and derivatives equal 
>>to 0). Is this the expected result for this test? Is the metric working 
>>well?
>>
>>------------------------
>>Available tests:
>>...
>>3. itkGradientDifferenceImageToImageMetricTest
>>...
>>To run a test, enter the test number: 3
>>
>>Parameters: [-50, -50], Value: 20000, Derivatives: [0, 0]
>>Parameters: [-25, -50], Value: 20000, Derivatives: [0, 0]
>>Parameters: [0, -50], Value: 20000, Derivatives: [0, 0]
>>Parameters: [25, -50], Value: 20000, Derivatives: [0, 0]
>>Parameters: [50, -50], Value: 20000, Derivatives: [0, 0]
>>Parameters: [-50, -25], Value: 20000, Derivatives: [0, 0]
>>Parameters: [-25, -25], Value: 20000, Derivatives: [0, 0]
>>Parameters: [0, -25], Value: 20000, Derivatives: [0, 0]
>>Parameters: [25, -25], Value: 20000, Derivatives: [0, 0]
>>Parameters: [50, -25], Value: 20000, Derivatives: [0, 0]
>>Parameters: [-50, 0], Value: 20000, Derivatives: [0, 0]
>>Parameters: [-25, 0], Value: 20000, Derivatives: [0, 0]
>>Parameters: [0, 0], Value: 20000, Derivatives: [0, 0]
>>Parameters: [25, 0], Value: 20000, Derivatives: [0, 0]
>>Parameters: [50, 0], Value: 20000, Derivatives: [0, 0]
>>Parameters: [-50, 25], Value: 20000, Derivatives: [0, 0]
>>Parameters: [-25, 25], Value: 20000, Derivatives: [0, 0]
>>Parameters: [0, 25], Value: 20000, Derivatives: [0, 0]
>>Parameters: [25, 25], Value: 20000, Derivatives: [0, 0]
>>Parameters: [50, 25], Value: 20000, Derivatives: [0, 0]
>>Parameters: [-50, 50], Value: 20000, Derivatives: [0, 0]
>>Parameters: [-25, 50], Value: 20000, Derivatives: [0, 0]
>>Parameters: [0, 50], Value: 20000, Derivatives: [0, 0]
>>Parameters: [25, 50], Value: 20000, Derivatives: [0, 0]
>>Parameters: [50, 50], Value: 20000, Derivatives: [0, 0]
>>GradientDifferenceImageToImageMetric (0198CE00)
>> RTTI typeinfo:   class itk::GradientDifferenceImageToImageMetric<class 
>>itk::Image<double,2>,class itk::Image<double,2> >
>> Reference Count: 1
>> Modified Time: 50
>> Debug: Off
>> Observers:
>>   none
>> ComputeGradient: 1
>> Moving Image: 0198A938
>> Fixed  Image: 0198CAA0
>> Gradient Image: 019C85A0
>> Transform:    01987800
>> Interpolator: 019C82B0
>> FixedImageRegion: ImageRegion (0198CE54)
>> Dimension: 2
>> Index: [0, 0]
>> Size: [100, 100]
>>
>> Moving Image Mask: 00000000
>> Fixed Image Mask: 00000000
>> Number of Pixels Counted: 0
>>Test passed.
>>
>>
>>_______________________________________________
>>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