[Insight-developers] itkMatrix: Algorithms Call: 02/16/01

Stephen R. Aylward aylward@unc.edu
Mon, 19 Feb 2001 13:08:24 -0500


I think we need something more consistent that what we have concerning
vectors, covariantvectors, points, indexs, .........

Another option instead of itkMatrix, is to use vnl_vectors.
If everyone will do vnl math with their vectors, should we just accept
the additional memory costs of vnl_vectors instead of having to do the
conversions?

Otherwise, from an API point of view, if we have itkVector, it seems
inappropriate not to have itkMatrix. 

   Consider

	std::list<itkVector*> X
	std::list<itkVector*> Y

	vnl_matrix M = affineRegister(X,Y)

	X.get_vnl_vector() = Y.get_vnl_vector() * M;

    VERSUS

	std::list<itkVector*> X
	std::list<itkVector*> Y

	itkMatrix M = affineRegister(x,y)

	X = Y * M;

   OR

	std::list<vnl_Vector *> X
	std::list<vnl_Vector *> Y

	vnl_Matrix M = affineRegister(X,Y);

	X = Y * M;

"William A. Hoffman" wrote:
> 
> There should not be that much cost in the conversion to the vnl vectors.
> This is what I feared in creating our own itkVector and itkMatrix, we
> would re-implement much of the code.
> 
> The conversion should be no more expensive than a function call.
> The vnl_fixed matrix and vector can re-use the memory of the itkVector and
> itkMatrix.   The only difference is that there would be a pointer to the data,
> and a size variable.   Think of it as a function call:
> 
> for example:
> 
> multiply_vectors(const float* data1, int size1, const float* data2, int size2);
> 
> same as:
> 
> itkVector v1, v2;
> convert_tovnl_vector(v) * convert_tovnl_vector(v);
> 
> There should be some convenient way of converting from itkVector to
> vnl_vector_fixed.
> 
> No dynamic memory is allocated in the conversion, just the initialization of
> the pointer and the size variable.  With a smart compiler, this could all be
> done with registers.
> 
> -Bill
> 
> At 09:40 PM 2/16/01 -0500, Stephen R. Aylward wrote:
> 
> >The idea is to provide itk users with a consistent-looking interface and
> >to increase the speed of common vector-matrix ops in itk.
> >
> >So, since we have itkVector, we should have itkMatrix for a more
> >consistent API.
> >
> >Also, because of the cost associated with converting an itkVector to a
> >vnlVector (a constructor is called and memory is allocated), we should
> >provide a few FUNCTIONS for the most common vector and matrix math that
> >uses the itkVector and itkMatrix classes directly.
> >
> >--
> >===============================================
> >Stephen R. Aylward
> >Assistant Professor of Radiology
> >Adjunct Assistant Professor of Computer Science
> >http://www.cs.unc.edu/~aylward
> >aylward@unc.edu
> >(919) 966-9695
> >
> >
> >
> >_______________________________________________
> >Insight-developers mailing list
> >Insight-developers@public.kitware.com
> >http://public.kitware.com/mailman/listinfo/insight-developers
> 
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers

-- 
===============================================
Stephen R. Aylward
Assistant Professor of Radiology
Adjunct Assistant Professor of Computer Science
http://www.cs.unc.edu/~aylward
aylward@unc.edu
(919) 966-9695