[Insight-users] Using Array 2D

Luis Ibanez luis.ibanez@kitware.com
Thu, 26 Dec 2002 14:48:38 -0500


Hi Kumar,

Thanks for pointing this out.

The Array2D is not intended to be used
as a mathematical class. It is only a
container in the layout of a 2D matrix.

However, as you already said, its inheritance
from vnl_matrix should facilitate certain
operations.

Copy constructors and assignment operator
has just been added to the Array2D following
your suggestion.  They should allow to assign
vnl_matrices to Array2Ds.

If you want to perform matematical operations
maybe you should considering using the class

           itkMatrix

which also derives from the vnl_matrix and
it is actually intended for mathematical
operations.

A test for the Array2D class was also added
into

Insight/Testing/Code/Common/itkArray2DTest.cxx


Please let us know if you encounter any further
problems.


    Thanks


     Luis


------------------------------------------

kumar wrote:

> Hi
> 
> I have some problem with using Array2D in ITK
> I have defined
> Array2D<double> W(row,col);
> and
> Array2D<double> Dprime(row,col);
> 
> and then if I do
> 
> Dprime =    ((W.transpose()*W)/row*col));
> 
> Since the rhs results in a vnl_matrix , I get the following error
> 
> : no match for `itk::Array2D<double> & = vnl_matrix<double>'
> /opt/tools/itk/Insight_Nightly/Insight/Code/Common/itkArray2D.h:62: 
> candidates are: class itk::Array2D<double> & 
> itk::Array2D<double>::operator =(const itk::Array2D<double> &)
> 
> This is  strange as Array2D is extended from vnl_matrix and hence the 
> assignment should work
> Even  .operator= did not work and gave the error below
> 
> : no matching function for call to `itk::Array2D<double>::operator = 
> (vnl_matrix<double>)'
> /opt/tools/itk/Insight_Nightly/Insight/Code/Common/itkArray2D.h:62: 
> candidates are: class itk::Array2D<double> & 
> itk::Array2D<double>::operator =(const itk::Array2D<double> &)
> 
> 
> 
> But  Dprime.set_columns(0,(W.transpose()*W)/np*ns);
> works well
> 
> Thanks in advance for all the help
> 
> Regards
> Kumar
> 
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
>