AW: AW: [Insight-users] matrix operations in ITK

Luis Ibanez luis.ibanez@kitware.com
Thu, 24 Apr 2003 21:33:49 -0400


Hi Zein,

You could equally well use the vnl_matrix.

The ITK convention was simply to avoid exposing
VNL at the API level, and facilitating certain
operations like vector-matrix product for which
we certainly don't want to have to convert the
ITK points or vectors to vnl_vectors just for
computing the product.

For the linear algebra matrix operations, ITK
relies on VNL. For example, inverting a matrix,
of computing a principal components analysis.



Regards,


   Luis


---------------------------
salah wrote:
> Hello Luis,
> 
> Would there be any advantage of using the itk::Matrix,
> while it is actually implemented using a vnl_matrix ??
> 
> I have notices that most (in not all) matrix operations
> are already implemented in vnl_matrix, are'nt they ??
> 
> Thanks,
> 
> Zein
> 
> -----Ursprüngliche Nachricht-----
> Von: Luis Ibanez [mailto:luis.ibanez@kitware.com]
> Gesendet: Dienstag, 15. April 2003 22:05
> An: salah
> Cc: Insight-users@public.kitware.com
> Betreff: Re: AW: [Insight-users] matrix operations in ITK
> 
> 
> 
> 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
>>
>>
>>
> 
> 
>