[Insight-users] Gradient Difference Metric
Aviv Hurvitz
aviv.hurvitz at gmail.com
Thu Jun 26 10:59:01 EDT 2008
Hi Wes,
I agree with everything you've said. I also appreciate the tests more now,
so I learned something new.
It doesn't contradict my opinion that ITK can be improved in the ways I
suggested earlier.
I hope it will be considered in the future.
Thanks,
- Aviv
On Thu, Jun 26, 2008 at 5:13 PM, Wes Turner <wes.turner at kitware.com> wrote:
> Aviv,
>
> I recognize that you spent unnecessary time fighting with an unexpected
> implementation of a metric, and are looking for someone to fix the issue.
> One of the great benefits of the ITK software process is that every filter
> should have a test and the test should show how to use the filter. In the
> case of the GradientDifferenceImageToImageMetric, the test does not
> perfectly address your issue in that it does not actually set up and use the
> metric in the context of an optimizer, however it does evaluate the metric
> at various translations of the moving and fixed image ... the same type of
> evaulations that would be generated by an optimizer exploring the space
> around a solution. The output from the test clearly shows that the metric
> is at a maximum when the two images are fully aligned (offset [0,0] - see
> below for the test output.) Again, I realize that this is not optimal from
> the standpoint of plugging filters together in an *ad hoc* fashion, but
> when you run into a problem, it is important to look for and understand the
> tests of the code. These tests can provide important clues as to how your
> particular usage differs from the expected usage of the code, as well as
> giving you insight into parameter settings, etc. For this metric, the
> source for the test can be found at
> "Insight\Testing\Code\Algorithm\itkGradientDifferenceImageToImageMetricTest.cxx"
> and the test can be executed by running "itkAlgorithmsTests2" and selecting
> option 4 (after building with Testing/Examples On).
>
> I realize that this won't help your current frustration, but as you
> continue to use ITK, you will find that this is a good habit to cultivate.
> Good luck!
>
> - Wes
>
> Output form the itkGradientDifferenceImageToImageMetricTest:
>
> To run a test, enter the test number: 4
> Parameters: [-10, -10], Value: 16315.6, Derivatives: [7875.2, 7875.2]
> Parameters: [-5, -10], Value: 16818.4, Derivatives: [17033.4, 8163.25]
> Parameters: [0, -10], Value: 17279, Derivatives: [83531.2, 19402.1]
> Parameters: [5, -10], Value: 16869.3, Derivatives: [-114.142, 16730.5]
> Parameters: [10, -10], Value: 16334.2, Derivatives: [-93.3736, 11243.7]
> Parameters: [-10, -5], Value: 16818.4, Derivatives: [8163.25, 17033.4]
> Parameters: [-5, -5], Value: 17732.6, Derivatives: [18762.5, 18762.5]
> Parameters: [0, -5], Value: 18478, Derivatives: [-9044.31, 54419.4]
> Parameters: [5, -5], Value: 17777.6, Derivatives: [-190.489, 40302.4]
> Parameters: [10, -5], Value: 16905.5, Derivatives: [-148.262, 21012.2]
> Parameters: [-10, 0], Value: 17279, Derivatives: [19402.1, 83531.2]
> Parameters: [-5, 0], Value: 18478, Derivatives: [54419.4, -9044.32]
> Parameters: [0, 0], Value: 20000, Derivatives: [458406, 458406]
> Parameters: [5, 0], Value: 18839.7, Derivatives: [-317.508, 271044]
> Parameters: [10, 0], Value: 17453.9, Derivatives: [-223.557, 105338]
> Parameters: [-10, 5], Value: 16869.3, Derivatives: [16730.5, -114.142]
> Parameters: [-5, 5], Value: 17777.6, Derivatives: [40302.4, -190.489]
> Parameters: [0, 5], Value: 18839.7, Derivatives: [271044, -317.508]
> Parameters: [5, 5], Value: 18024.8, Derivatives: [-225.825, -225.825]
> Parameters: [10, 5], Value: 17003.7, Derivatives: [-171.369, -127.79]
> Parameters: [-10, 10], Value: 16334.2, Derivatives: [11243.7, -93.3736]
> Parameters: [-5, 10], Value: 16905.5, Derivatives: [21012.2, -148.262]
> Parameters: [0, 10], Value: 17453.9, Derivatives: [105338, -223.557]
> Parameters: [5, 10], Value: 17003.7, Derivatives: [-127.79, -171.369]
> Parameters: [10, 10], Value: 16401.4, Derivatives: [-105.449, -105.449]
> GradientDifferenceImageToImageMetric (01685300)
>
> On Thu, Jun 26, 2008 at 8:40 AM, Aviv Hurvitz <aviv.hurvitz at gmail.com>
> wrote:
>
>> I saw that in the docs.
>>
>> In my opinion that bit, and the cited paper, are not enough for users to
>> understand what needs to be done. The fact is that it confused me, and
>> apparently others as well, and the cost of this confusion was big.
>>
>> I suggested a few solutions:
>> 1. Change the metric to go down.
>> 2. Add a flag to all image metrics that says which way they go.
>> 3. Clarify the metric direction in the docs.
>>
>> You say #1 is impossible since it might break old code, and I agree.
>> (reluctantly... :)
>> #2 is best, I think, since it would allow both kinds of metrics to be
>> plugged into the same framework.
>> #3 is probably worst, because it would only solve the problem in this
>> particular metric, and it would still leave room for user errors.
>>
>> Having read the code, I got the feeling that no one has used this metric
>> successfully. Sadly, I can't actually PROVE it now with a smoking gun. I'm
>> curious to know if there is any reader out there who uses this metric. I'm
>> not saying that we have a license to break it, I'm just giving you some
>> background about how I feel about this metric. In my opinion, it's not on
>> par with the rest of ITK, with regards to documentation, test cases, and
>> code quality.
>>
>> I wish this thread wouldn't end with the conclusion that everything is
>> perfect just the way it is. Would someone please acknowledge that there is a
>> problem?
>>
>> Regards,
>>
>> - Aviv
>>
>>
>>
>> On Thu, Jun 26, 2008 at 1:17 PM, Hauke Heibel <heibel at cs.tum.edu> wrote:
>>
>>> Aviv Hurvitz wrote:
>>>
>>>> All the metrics I know in ITK go "down". There was no special
>>>> documentation, ...
>>>>
>>> As a matter of fact there is. Take a look at
>>> http://www.itk.org/Doxygen34/html/classitk_1_1GradientDifferenceImageToImageMetric.html
>>> It states "after passing the squared difference through a function of
>>> type 1/(1+x)".
>>>
>>> And I would not expect the functionality to change since there are many
>>> people who got the usage right and whose code would break if the class's
>>> functionality would change.
>>>
>>> - Hauke
>>>
>>> --
>>> Tim Hauke Heibel
>>> Computer Aided Medical Procedures (CAMP)
>>> fon: +49 89 289 19427
>>> fax: +49 89 289 17059
>>>
>>>
>>
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>>
>>
>
>
> --
> Wesley D. Turner, Ph.D.
> Kitware, Inc.
> R&D Engineer
> 28 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-371-3971 x120
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20080626/8c6bffd0/attachment-0003.htm>
More information about the Insight-users
mailing list