[Insight-users] Re: ImageMomentsCalculator GNAT's bug
Luis Ibanez
luis . ibanez at kitware . com
Thu, 04 Sep 2003 06:26:15 -0400
Hi Benjamin,
Thanks for tracking this down, and providing the
testing code.
The bug has been entered in GNATs, and got Id = 298.
You can consult the Bug database at
http://www . itk . org/cgi-bin/gnatsweb . pl?database=default
and this particular bug entry at
http://www . itk . org/cgi-bin/gnatsweb . pl?debug=&database=default&cmd=view+audit-trail&cmd=view&pr=298
The current solution is :
"Don't use this combination of flags"
Any suggestions are welcome,...
Thanks
Luis
---------------------
Benjamin King wrote:
> Hi all,
>
> the thread below reveals a bug that seems to be introduced by a gcc
> optimisation flag. Please find attached some code that demonstrates the
> problem. The program works for CMAKE_CXX_FLAGS = "-O3 -pipe" and doesn't
> for "-O3 -march=pentium4 -pipe".
>
> Information about my system:
> $ uname -a
> Linux luna 2.4.20-gentoo-r6 #3 Wed Aug 20 20:32:37 CEST 2003 i686
> Intel(R) Pentium(R) 4 CPU 2.80 GHz GenuineIntel GNU/Linux
>
> $ gcc --version
> gcc (GCC) 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r1, propolice)
> [Copyright notice]
>
> As Luis pointed out, this should be entered as a GNAT's bug
>
>
> Thank you,
> Benjamin
>
>
> On Tue, 02 Sep 2003 23:03:49 -0400, Luis Ibanez
> <luis . ibanez at kitware . com> wrote:
>
>> Benjamin King wrote:
>>
>>>
>>> It runs flawless with the slower optimizations. When I found out
>>> which flag in particular caused my troubles, to whom should I report it?
>>>
>>
>>
>>
>> Please report it to the users-list, and mention that this should be
>> entered as a GNAT's bug.
>>
>>
>> Thanks
>>
>>
>> Luis
>>
>>
>>
>>
>>
>>
>> ----------------------------------
>>
>>> Hi Luis,
>>>
>>> I usually develop with Linux and even after a clean build of ITK, the
>>> code shows the funny behaviour. But as you didn't have any problems
>>> with it, I double checked with windows and it worked!
>>> I suspected my gcc (3.2.3) optimization settings so I changed them
>>> from "-O3 -mcpu=pentium4 -march=pentium4 -msse2" to "-O2" and the
>>> errors disappeared.
>>>
>>> I also changed the program to loop over some values for binaryFilter-
>>> SetInsideValue(...), you find the new code + example data in the
>>> attachment.
>>>
>>> A session with the program and the fast settings looks like this:
>>>
>>> -----
>>> king at luna> ./DebugMomentsCalculator 1
>>> InsideValue: 1
>>> *** vnl_real_eigensystem: Failed on 1th eigenvalue
>>> -0.61578 -0.562883 0.551568
>>> -0.787125 -0.473522 0.395235
>>> -0.0387084 0.677451 0.734549
>>>
>>> InsideValue: 2
>>> *** vnl_real_eigensystem: Failed on 1th eigenvalue
>>> -0.61578 -0.562883 0.551568
>>> -0.787125 -0.473522 0.395235
>>> -0.0387084 0.677451 0.734549
>>>
>>> InsideValue: 3
>>> InsideValue: 4
>>> *** vnl_real_eigensystem: Failed on 1th eigenvalue
>>> -0.61578 -0.562883 0.551568
>>> -0.787125 -0.473522 0.395235
>>> -0.0387084 0.677451 0.734549
>>>
>>> DebugMomentsCalculator:
>>> /home/king/software/ITKCVS/Insight/Utilities/vxl/vnl/vnl_matrix.h:199:
>>> T& vnl_matrix<T>::operator()(unsigned int, unsigned int) [with T =
>>> double]: Assertion 'r<rows()' failed.
>>> Program aborted.
>>> king at luna>
>>> -----
>>>
>>> It runs flawless with the slower optimizations. When I found out
>>> which flag in particular caused my troubles, to whom should I report it?
>>>
>>> Best regards,
>>> Benjamin
>>
>>
>>
>> -------------------------
>>
>>> Best regards,
>>> Benjamin
>>>
>>>
>>>
>>> On Fri, 29 Aug 2003 20:00:37 -0400, Luis Ibanez
>>> <luis . ibanez at kitware . com> wrote:
>>>
>>>> Hi Benjamin,
>>>>
>>>> It works for me for 1 to 20 :-)
>>>>
>>>> There is no reason for your code to fail for some
>>>> values of the thresholding filter.
>>>>
>>>> My guess is that you have an inconsistent build.
>>>> A very likely cause is that you are mixing Debug
>>>> and Release between you ITK build and your own
>>>> code.
>>>>
>>>> Did you get any warning at link time ?
>>>>
>>>>
>>>> You may want to do a clean build.
>>>>
>>>>
>>>> Regards,
>>>>
>>>>
>>>> Luis
>>>>
>>>>
>>>> ----------------------
>>>> Benjamin King wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I experienced a strange behaviour of itk::ImageMomentsCalculator,
>>>>> but I'm not sure if it is a bug or a misconception on my behalf.
>>>>> The attached code and image demonstrate what's happening:
>>>>>
>>>>> The program reads the test image, extracts a small region around
>>>>> the voxels with value 63 and binarises this region by setting all
>>>>> voxels with value 63 to a new value x (supplied on the command
>>>>> line) and the other ones to 0.
>>>>> When it calculates the image moments, I get errors for _some_
>>>>> values of x (e.g. for 1,2,4,8,15,16) but everything runs fine for
>>>>> other values (3,5-7,9-14,17-20).
>>>>>
>>>>> I don't know much about moments, but I think that at least the
>>>>> pricipal axes and the center of gravity should be invariant to the
>>>>> pixel values.
>>>>>
>>>>> If this is no bug, under which circumstances does the moment
>>>>> calculation fail then? I assume it has something to do with the
>>>>> eigensystem of the covariance matrix, but what can I do about that?
>>>>>
>>>>> Thank you for any suggestion,
>>>>> Benjamin
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Insight-users mailing list
>>>> Insight-users at itk . org
>>>> http://www . itk . org/mailman/listinfo/insight-users
>>>>
>>
>>
>>
>>
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk . org
>> http://www . itk . org/mailman/listinfo/insight-users
>>
>
>
>