[Insight-users] how to calculate point using eigen vector
Luis Ibanez
luis.ibanez at kitware.com
Tue Mar 16 17:31:10 EDT 2010
Hi Kana,
Please see my comments below
interlaced with your text.
Thanks
Luis
----------------------------------------------------------
On Thu, Mar 11, 2010 at 7:13 AM, Arunachalam Kana <Kana.Arunachalam at fh->
> It is clear that the eigen values and vectors are correctly arranged as per
> the increasing order of magnitude, when the parameter is “true”. My
> observation was that the last value is still returned in negative. Due to
> curiosity i dug inside the code J and found what is the possible reason.
> This is in the itkSymmetricEigenAnalysis line 692, code below:
>
>
>
> else if( m_OrderEigenValues == OrderByMagnitude )
>
> {
>
> // Order by magnitude
>
> for (i = 0; i < m_Order-1; ++i)
>
> {
>
> k = i;
>
> p = d[i];
>
>
>
> I think instead of “m_Order” , “m_Order – 1” is used.
>
>
>
> As this is the first time i am working with eigen values, i am not sure
> whether the magnitude of the eigen will be used for any other calculation. I
> would like to know whether this is acceptable or there has to be a change in
> code.
>
>
------------------------------------------------------------
Hi Kana,
It is great that you are looking at the internals of the code.
That's the best way of harvesting the power of Open Source.
The Relevant section of code is:
692 for (i = 0; i < m_Order-1; ++i)
693 {
694 k = i;
695 p = d[i];
696
697 for (j = i+1; j < m_Order; ++j)
698 {
699 if (vnl_math_abs(d[j]) >= vnl_math_abs(p))
700 {
701 continue;
702 }
703 k = j;
704 p = d[j];
705 }
706
707 if (k == i)
708 {
709 continue;
710 }
711 d[k] = vnl_math_abs(d[i]);
712 d[i] = vnl_math_abs(p);
713
714 for (j = 0; j < m_Order; ++j)
715 {
716 p = z[j + i * m_Dimension];
717 z[j + i * m_Dimension] = z[j + k * m_Dimension];
718 z[j + k * m_Dimension] = p;
719 }
720 }
721 }
The combination of the two for-loops
692 for (i = 0; i < m_Order-1; ++i)
697 for (j = i+1; j < m_Order; ++j)
is a common method for sorting a small array.
---
Have you found that the current ordering is incorrect ?
In such case, we should file a bug report at
http://public.kitware.com/Bug/
Please let us know,
Thanks
Luis
More information about the Insight-users
mailing list