23 #include "vnl/vnl_matrix.h"
44 template <
typename TValue>
45 class ITK_TEMPLATE_EXPORT
Array2D :
public vnl_matrix<TValue>
54 Array2D(
unsigned int numberOfRows,
unsigned int numberOfCols);
59 operator=(
const Self & array);
74 return this->operator()(static_cast<unsigned int>(row), static_cast<unsigned int>(col));
81 this->operator()(static_cast<unsigned int>(row), static_cast<unsigned int>(col)) = value;
86 SetSize(
unsigned int m,
unsigned int n);
93 template <
typename TValue>
97 const unsigned int numberOfRows = arr.rows();
98 const unsigned int numberOfColumns = arr.cols();
100 for (
unsigned int r = 0; r < numberOfRows; ++r)
103 if (numberOfColumns >= 1)
105 const unsigned int lastColumn = numberOfColumns - 1;
106 for (
unsigned int c = 0; c < lastColumn; ++c)
108 os << arr(r, c) <<
", ";
110 os << arr(r, lastColumn);
112 os <<
"]" << std::endl;
120 ITKCommon_EXPORT std::ostream &
121 operator<<(std::ostream & os,
const Array2D<float> & arr);
123 ITKCommon_EXPORT std::ostream &
124 operator<<(std::ostream & os,
const Array2D<double> & arr);
128 #ifndef ITK_MANUAL_INSTANTIATION
129 # include "itkArray2D.hxx"