18 #ifndef __itkArray2D_h
19 #define __itkArray2D_h
22 #include "vnl/vnl_matrix.h"
43 template<
typename TValueType >
44 class Array2D:
public vnl_matrix< TValueType >
54 Array2D(
unsigned int rows,
unsigned int cols);
62 void Fill(TValueType
const & v) { this->fill(v); }
65 void SetSize(
unsigned int m,
unsigned int n);
72 template<
typename TValueType >
73 std::ostream & operator<<(std::ostream & os, const Array2D< TValueType > & arr)
75 const unsigned int numberOfRows = arr.rows();
76 const unsigned int numberOfColumns = arr.cols();
78 for (
unsigned int r = 0; r < numberOfRows; ++r )
81 if ( numberOfColumns >= 1 )
83 const unsigned int lastColumn = numberOfColumns - 1;
84 for (
unsigned int c = 0; c < lastColumn; ++c )
86 os << arr(r, c) <<
", ";
88 os << arr(r, lastColumn);
90 os <<
"]" << std::endl;
97 template<> ITKCommon_EXPORT std::ostream & operator<<(std::ostream & os, const Array2D< float > & arr);
98 template<> ITKCommon_EXPORT std::ostream & operator<<(std::ostream & os, const Array2D< double > & arr);
102 #ifndef ITK_MANUAL_INSTANTIATION
103 #include "itkArray2D.hxx"