[Insight-users] questions on itk::Matrix and itk::Array2D

Martin Urschler urschler at icg.tu-graz.ac.at
Wed Jul 19 04:06:21 EDT 2006


hi duanqi,

you could try the vnl_matrix which is a utility class that gets used by
itk internally

there is a vnl_matrix_fixed which is templated over the data type and
the two dimensions
you can work with this class quite similar to MATLAB matrices

ex. 3x3 matrices:

#include "vnl_matrix_fixed.h"
#include "vnl/algo/vnl_matrix_inverse.h"

vnl_matrix_fixed<float, 3, 3> matrix;
matrix.set_identity();
vnl_matrix_fixed<float, 3, 3> matrix_inverse = vnl_matrix_inverse<float>(A)

regards
Martin


DuanQi wrote:
> 
> Dear Sir or Madam,
>  
> In one step of my applications, I need to build a 2D matrix and 
> calculate the inverse matrix of it. However, the size of the matrix, 
> i.e. Ncols & Nrows, are only defined at the run-time (but will fixed 
> after initialization). I just wonder if I can use Itk::Matrix class or I 
> should use itk::Array2D. I could not find any "inverse" function for 
> itk::Array2D class.
> Thank you.







More information about the Insight-users mailing list