[Insight-developers] itk::Array

Brad King brad.king@kitware.com
Thu, 18 Jan 2001 16:52:03 -0500 (EST)


Hello all,

In response to the problems with itkVector and itkPoint, I have written a
generic "Array" class that could facilitate our needs.  Example sources
are available at

http://public.kitware.com/InsightExamples/

itkArray.* go in Insight/Code/Common
itkArrayTest.cxx goes in Insight/Testing/Code/Common
(add itkArrayTest to CMakeLists.txt and run "make itkArrayTest")

The test program doesn't demonstrate all of what the class can do, but it
shows how using the Array::Reference class for function parameters can
make it easy to use c-arrays and Array instances interchangably.  It also
demonstrates the comma-separated list assignment capability of the
array.

I've briefly discussed this with Luis, and we believe we can derive
itk::Vector and itk::Point from this Array class to add the math
functionality at the appropriate levels.

Other advantages of the Array class include the passing of its size in
type information, which avoids size-mismatch problems involved with
c-style arrays, and the option for copy-semantics instead of forced
reference-semantics as in a c-style array.

The class is ready to check into the insight CVS repository if you all
like it.  The interface should probably change a bit, though, to look more
like the rest of Insight (ex. "begin" -> "Begin").

Thoughts?
-Brad