AW: [Insight-users] matrix operations in ITK

Luis Ibanez luis.ibanez@kitware.com
Tue, 15 Apr 2003 16:05:21 -0400


Hi Zein,

The itk::Matrix is a wrapper class around the
VXL vnl_matrix class.

You can get the reference to the internal vnl_matrix,
using the method :

         GetVnlMatrix()

and then use all the methods defined in vnl_matrix.
Among them, the access to elements.  There is limit
in which is not worth to replicate the API of  the
internal class at the level of the wrapper class.

This limit unfortunately is pretty gray...

----

As far as how to access the elements,

 From the VXL documentation:

> The vnl_matrix<T>
> // class is row-based with addresses of rows being cached,  and
> // elements accessed as m[row][col].


so, your code will look like

     itk::Matrix<int, 4, 4>  M
     y   = M.GetVnlMatrix()[2][3];




Regards,


   Luis


---------------------------------------------
salah wrote:
> Thanks Luis,
> 
> I could not actually know how to access the elements of the
> matrix given the raw-col values, i.e. something like this 
> 
> itkMatrix<int, 4, 4>  M
> y= M[2][3];  ??????????
> 
> Is something like this not allowed? how can I then access the 
> element? i.e. in which order are they stored in the matrix?
> 
> 
> Thanks,
> 
> Zein
> 
> 
>