[Insight-users] Using Array 2D vs itk::Matrix
kumar
MaKumartr@netscape.net
Thu, 26 Dec 2002 22:23:59 -0100
Hi Luis
Thanks a lot for the immediate response
I am really happy that Array2D has been modified and supports
Copy constructors and assignment operator now
Regarding your suggestion, I had initially considered using the itkMatrix
which extends the vnl_matrix and could be used for mathematical
operations
But the problem I faced was that the itkMatrix is templated over the
type and also the rows and columns
itk::Matrix< T, NRows, NColumns >
Hence it becomes difficult or may be even impossible to dynamically
create a itk::Matrix
But Array2D is templated over the type alone
itk::Array2D< TValueType >
Hence it was easier for dynamically creating Array2D objects
Any suggestions on these are welcome and thanks for all the help
Regards
Kumar
Luis Ibanez wrote:
> 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
>>
>
>
>
>
--
Your favorite stores, helpful shopping tools and great gift ideas.
Experience the convenience of buying online with Shop@Netscape!
http://shopnow.netscape.com/