[Insight-users] ImageMomentsCalculator question

Luis Ibanez luis.ibanez at kitware.com
Tue Jul 12 11:36:55 EDT 2005




Hi Benjamin,


If you want to do Principal Components Analysis,
you can use directly the Moments Calculator.


Note that the calculator is computing internally
the Eigen Analysis of the matrix of second order
moments. Which is what you need for PCA.



What you need to query from the MomentsCalculator
are:

           Principal Axes
           Principal Moments





Reading the Doxygen documentation of
this class will certainly help you  :-)

http://www.itk.org/Insight/Doxygen/html/classitk_1_1ImageMomentsCalculator.html


Please check the method:


                    GetPrincipalMoments()
   	

Return principal moments, in physical coordinates. This method
returns the principal moments of the image whose moments were
last computed by this object. The moments are returned as a
vector, with the principal moments ordered from smallest to
largest. The moments are computed in physical coordinates.




    Regards,



        Luis



-----------------------
Benjamin King wrote:

> Hello,
> 
> I'm a little lost with the itk::ImageMomentsCalculator. What I want to know is 
> the variance of a point set in the direction of greatest spread. I thought, I 
> could use GetPrincipalMoments() for this, but apparently this is not the 
> value that I'm looking for (see below).
> 
> Right now, I'm using the following method:
> 1) Use one ImageMomentsCalculator to perform PCA
> 2) Iterate over the transformed image to compute the mean index
> 3) Iterate over the transformed image to compute the index variance.
> 
> - OR -
> 
> 2) Use another ImageMomentsCalculator to find the second central moments 
> matrix m.
> 3) m[end][end] is close to the variance I'm looking for.
> 
> What's correct? Is there an easier way? Maybe I should have paid more 
> attention during statistics class... ;)
> 
> Thanks for your help,
> 	Benjamin
> 
> PS:
> 
> For an example binary data set (rounded cuboid), I'm getting these values from 
> the two ImageMomentCalculators:
> 
> Moments before principal axis transformation:
> -----
>   Zeroth Moment about origin: 2.10095e+08
>   First Moment about origin: [127.062, 127.223, 127.987]
>   Second Moment about origin:
> 		501.084 49.4927 123.275
> 		49.4927 417.388 57.1835
> 		123.275 57.1835 536.871
> 
>   Center of Gravity: [127.062, 127.223, 127.987]
>   Second central moments:
> 		501.084 49.4927 123.275
> 		49.4927 417.388 57.1835
> 		123.275 57.1835 536.871
> 
>   Principal Moments: [8.2863e+10, 8.2868e+10, 1.40029e+11]
>   Principal axes:
> 		0.776758 -0.313056 -0.546482
> 		-0.0677716 -0.904218 0.421659
> 		-0.626142 -0.290491 -0.723575
> 
> Moments after principal axis transformation:
> -----
>   Zeroth Moment about origin: 2.10081e+08
>   First Moment about origin: [127.062, 127.222, 127.987]
>   Second Moment about origin:
> 		394.452 0.0174592 -0.0375555
> 		0.0174592 394.533 0.00182282
> 		-0.0375555 0.00182282 666.542
> 
>   Center of Gravity: [127.062, 127.222, 127.987]
>   Second central moments:
> 		394.452 0.0174592 -0.0375555
> 		0.0174592 394.533 0.00182282
> 		-0.0375555 0.00182282 666.542
> 
>   Principal Moments: [8.28659e+10, 8.28844e+10, 1.40027e+11]
>   Principal axes:
> 		0.979273 -0.202545 0.000136521
> 		-0.202545 -0.979273 -2.14026e-05
> 		0.000138026 -6.69248e-06 -1
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 
> 





More information about the Insight-users mailing list