[Insight-users] ImageMomentsCalculator Bug?

Luis Ibanez luis . ibanez at kitware . com
Fri, 29 Aug 2003 20:00:37 -0400


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
>