18 #ifndef __itkArray2D_h
19 #define __itkArray2D_h
22 #include "vnl/vnl_matrix.h"
43 template<
typename TValueType >
55 Array2D(
unsigned int rows,
unsigned int cols);
63 void Fill(TValueType
const & v) { this->fill(v); }
66 void SetSize(
unsigned int m,
unsigned int n);
73 template<
typename TValueType >
74 std::ostream & operator<<(std::ostream & os, const Array2D< TValueType > & arr)
76 const unsigned int numberOfColumns = arr.cols();
77 const unsigned int numberOfRows = arr.rows();
78 const signed int lastColumn = (
signed int)numberOfColumns - 1;
80 for (
unsigned int r = 0; r < numberOfRows; ++r )
83 for (
signed int c = 0; c < lastColumn; ++c )
85 os << arr(r, c) <<
", ";
87 if ( numberOfColumns >= 1 )
89 os << arr(r, lastColumn);
91 os <<
"]" << std::endl;
99 #define ITK_TEMPLATE_Array2D(_, EXPORT, TypeX, TypeY) \
102 _( 1 ( class EXPORT Array2D< ITK_TEMPLATE_1 TypeX > ) ) \
103 _( 1 ( EXPORT std::ostream & operator<<(std::ostream &, \
104 const Array2D< ITK_TEMPLATE_1 TypeX > &) ) ) \
105 namespace Templates \
107 typedef Array2D< ITK_TEMPLATE_1 TypeX > Array2D##TypeY; \
111 #if ITK_TEMPLATE_EXPLICIT
112 #include "Templates/itkArray2D+-.h"
116 #include "itkArray2D.hxx"