[Insight-users] ImageMomentsCalculator Bug?

Luis Ibanez luis . ibanez at kitware . com
Tue, 02 Sep 2003 23:03:49 -0400


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
>>