[Insight-users] How to read and access elements of vnl_matrix

Sam sd2usa at gmail.com
Fri Dec 29 12:09:12 EST 2006


Dear ITK developer and users;

 

I am trying to read and access elements of vnl_matrix data by using the
following code:

 

#include <vnl/vnl_matrix.h>

.

 

       unsigned int  nRows = (unsigned int)lHeight ;

       unsigned int  nColumns = (unsigned int)lWidth ;

       vnl_matrix<unsigned short> inputMatrix( nRows, nColumns ) ;

 

       it.GoToBegin();

       for(unsigned int i=0; i<lHeight; i++)

       for(unsigned int j=0; j<lWidth;  j++)

       {

              inputMatrix[i][j] = it.Get() ;

              ++it ;

       }

.

 

It was compiled successfully, but when I try to check the elements of the
matrix using "watch" function, some error displayed:

When I use inputMatrix[i][j], an error displays: "CXX0058: Error: overloaded
operator not found"

When I use inputMatrix(i,j), an error displays: "CXX0059: Error: left
operand is class not a function name"

 

I am confused of these errors. Could you please teach me how to fix it? Did
I miss some header files or not? 

 

Your kind help is greatly appreciated.

 

Best regards,

Sam

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20061229/8991e966/attachment.html


More information about the Insight-users mailing list