[Insight-users] Convert vnl_matrix<T> to itk::Matrix<T, NRows, NColumns>

Yonas Tesfazghi Weldeselassie yonas at cs.sfu.ca
Fri Mar 23 15:04:21 EST 2007


Hello,

Can someone assist please on how to convert const vnl_matrix<T> to
itk::Matrix<T, NRows, NColumns>?

I suppose itk::Matrix is a wrapper around vnl_matrix and thus there should
not be any problem but I am finding an error message "can not convert from
const vnl_matrix<T> to itk::Matrix<T, NRows, NColumns>"

Detail:

//I have a
DiffusionTensor3D<float> T;

//Compute its eigenvectors
itk::DiffusionTensor3D<float>::EigenVectorsMatrixType V;
itk::DiffusionTensor3D<float>::EigenValuesArrayType e;
V.ComputeEigenAnalysis(e, V);

//Compute the transpose of the eigenvector and assign it to
itk::DiffusionTensor3D<float>::EigenVectorsMatrixType
itk::DiffusionTensor3D<float>::EigenVectorsMatrixType Vt = V.GetTranspose();

ERROR: "can not convert from vnl_matrix_fixed<T, num_rows, num_cols> to
itk::Matrix<T, NRows, NColumns>"

I tried,
itk::DiffusionTensor3D<float>::EigenVectorsMatrixType Vt = V.GetTranspose
().as_matrix();

Still ERROR: "can not convert from vnl_matrix<T> to itk::Matrix<T, NRows,
NColumns>"

Any suggestion will be appreciated.

P.S.:- I hope one will not say why not declaring Vt as vnl_matrix or
vnl_matrix_fixed. Of course that is the simplest solution but I need to
declare it as itk::Matrix as subsequent steps will need operations of Vt and
V like multiplication will bring the same error.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070323/f86e550a/attachment.htm


More information about the Insight-users mailing list