[ITK-users] [ITK] Bug in itkMattesMutualInformationImageToImageMetric.hxx ?

Ivan Setiawan ivans at yahoo.co.jp
Thu May 7 12:14:39 EDT 2015


Brad, Bill, hi again.

I've added test case itkImageRegistrationMethodTest_17.cxx to verify the fix of initial ImageTrueMax which is already merged.
Without the fix, this test case will fail. But with the fix, this test case will pass.

This test case is based on itkImageRegistrationMethodTest_15.cxx.
However, the image value for both fixed and moving image are subtracted by 24000.0, i.e., all negative image values.
Without the fix, the image value range's upper limit will be around zero, which will produce a histogram with all zero, except for the leftmost bin. The registration will not move in this case because both fixed and moving image histogram is already similar.
With the fix, the image value range will be correct, then the histogram will be correct, and we have a good registration result.

Thank you and best regards,
Ivan Setiawan

----- Original Message -----
>From: Ivan Setiawan <ivans at yahoo.co.jp>
>To: Ivan Setiawan <ivans at yahoo.co.jp>; Bradley Lowekamp <blowekamp at mail.nih.gov>; Bill Lorensen <bill.lorensen at gmail.com> 
>Cc: insight-users <insight-users at itk.org>
>Date: 2015/5/5, Tue 20:09
>Subject: Re: [ITK-users] [ITK] Bug in itkMattesMutualInformationImageToImageMetric.hxx ?
> 
>
>Sorry, I meant:
>
>
>"Following your suggestions, I've changed the initial ImageTrueMax to NumericTraits::NonpositiveMin().
>Also, I've change the initial ImageTrueMin to NumericeTraits::max(), to unify it with the above.
>Three files were modified."
>
>
>Best regards,
>Ivan
>
>
>----- Original Message -----
>>From: Ivan Setiawan <ivans at yahoo.co.jp>
>>To: Bradley Lowekamp <blowekamp at mail.nih.gov>; Bill Lorensen <bill.lorensen at gmail.com> 
>>Cc: insight-users <insight-users at itk.org>
>>Date: 2015/5/5, Tue 20:05
>>Subject: Re: [ITK-users] [ITK] Bug in itkMattesMutualInformationImageToImageMetric.hxx ?
>> 
>>
>>Hi Brad, Bill,
>>
>>
>>Following your suggestions, I've changed the initial ImageTrueMin to NumericTraits::NonpositiveMin().
>>Also, I've change the initial ImageTrueMax to NumericeTraits::max(), to unify it with the above.
>>Three files were modified.
>>
>>
>>
>>This is the first time for me to submit a patch, and I don't know the best-fit reviewers, so I chose both of you.
>>
>>
>>Thank you and best regards,
>>Ivan Setiawan
>>
>>
>>----- Original Message -----
>>>From: Bradley Lowekamp <blowekamp at mail.nih.gov>
>>>To: Bill Lorensen <bill.lorensen at gmail.com> 
>>>Cc: Ivan Setiawan <ivans at yahoo.co.jp>; insight-users <insight-users at itk.org>
>>>Date: 2015/5/1, Fri 21:16
>>>Subject: Re: [ITK] [ITK-users] Bug in itkMattesMutualInformationImageToImageMetric.hxx ?
>>> 
>>>Hello,
>>>
>>>The numeric_limits::lowest() seems to be a new C++11 method [1].
>>>
>>>I believe
 NumericTraits::NonpositiveMin() will work.
>>>
>>>Thanks for finding this issue! Please include a test :)
>>>
>>>Brad
>>>
>>>
>>>[1] http://en.cppreference.com/w/cpp/types/numeric_limits/lowest
>>>
>>>On May 1, 2015, at 8:04 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>>>
>>>> Looks like you found a bug. Please submit a patch through gerrit:
>>>> http://www.itk.org/Wiki/ITK/Git/Develop
>>>> 
>>>> Thanks
>>>> 
>>>> 
>>>> On Fri, May 1, 2015 at 2:54 AM, Ivan Setiawan <ivans at yahoo.co.jp> wrote:
>>>>> Hi
 all,
>>>>> My name is Ivan, and currently I am developing
 an image registration
>>>>> software based on ITK.
>>>>> Thank you for providing such a good library!
>>>>> 
>>>>> I think, I found a bug for determining the voxel's value range in
>>>>> itkMattesMutualInformationImageToImageMetric.hxx.
>>>>> 
>>>>> In the ::Initialize(void) method, the initial value of
>>>>> this->m_FixedImageTrueMax and this->m_MovingImageTrueMax should be set to
>>>>>    std::numeric_limits<typename TFixedImage::PixelType>::lowest()  /* i.e.,
>>>>> the most negative value, = -340282346638528860000000000000000000000.000000
>>>>> for float-type image */
>>>>> instead of
>>>>>    std::numeric_limits<typename TFixedImage::PixelType>::min() /* =
>>>>> 1.17549e-038 for float-type image. */
>>>>> 
>>>>> The code lines are:
>>>>>    this->m_FixedImageTrueMax =
 std::numeric_limits<typename
>>>>> TFixedImage::PixelType>::min(); // should be lowest() instead of min()?
>>>>>    this->m_MovingImageTrueMax = std::numeric_limits<typename
>>>>> TMovingImage::PixelType>::min(); // should be lowest() instead of min()?
>>>>> 
>>>>> Problem will not appear when using short-type image, but when a float-type
>>>>> image with all negative voxel's value is used as input, then the initial
>>>>> m_FixedImageTrueMax will NOT be updated to the correct negative maximum
>>>>> value.
>>>>> 
>>>>> Could you please tell me your opinion?
>>>>> 
>>>>> Thank you very much for your attention.
>>>>> 
>>>>> Best regards,
>>>>> Ivan
>>>>> 
>>>>> 
>>>>> _____________________________________
>>>>> Powered by www.kitware.com
>>>>> 
>>>>> Visit other Kitware open-source projects at
>>>>> http://www.kitware.com/opensource/opensource.html
>>>>> 
>>>>> Kitware offers ITK Training Courses, for more information visit:
>>>>> http://www.kitware.com/products/protraining.php
>>>>> 
>>>>> Please keep messages on-topic and check the ITK FAQ at:
>>>>> http://www.itk.org/Wiki/ITK_FAQ
>>>>> 
>>>>> Follow this link to subscribe/unsubscribe:
>>>>> http://public.kitware.com/mailman/listinfo/insight-users
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> -- 
>>>> Unpaid intern in BillsBasement at noware dot com
>>>>
 _____________________________________
>>>> Powered by www.kitware.com
>>>> 
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>> 
>>>> Kitware offers ITK Training Courses, for more information visit:
>>>> http://www.kitware.com/products/protraining.php
>>>> 
>>>> Please keep messages on-topic and check the ITK FAQ at:
>>>> http://www.itk.org/Wiki/ITK_FAQ
>>>> 
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://public.kitware.com/mailman/listinfo/insight-users
>>>> _______________________________________________
>>>> Community mailing list
>>>> Community at itk.org
>>>> http://public.kitware.com/mailman/listinfo/community
>>>
>>>
>>>
>>>
>>_____________________________________
>>Powered by www.kitware.com
>>
>>Visit other Kitware open-source projects at
>>http://www.kitware.com/opensource/opensource.html
>>
>>Kitware offers ITK Training Courses, for more information visit:
>>http://www.kitware.com/products/protraining.php
>>
>>Please keep messages on-topic and check the ITK FAQ at:
>>http://www.itk.org/Wiki/ITK_FAQ
>>
>>Follow this link to subscribe/unsubscribe:
>>http://public.kitware.com/mailman/listinfo/insight-users
>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20150508/6e8c96fd/attachment.html>


More information about the Insight-users mailing list