23 #include "vnl/vnl_matrix.h"
41 template <
typename TValue>
42 class ITK_TEMPLATE_EXPORT
Array2D :
public vnl_matrix<TValue>
54 Array2D(
unsigned int numberOfRows,
unsigned int numberOfCols);
58 Array2D(
unsigned int numberOfRows,
unsigned int numberOfCols,
const TValue & initialValue);
67 : vnl_matrix<TValue>(std::move(array))
73 Array2D(
const VnlMatrixType & matrix);
77 operator=(
const Self &) =
default;
86 this->VnlMatrixType::operator=(std::move(array));
93 operator=(
const VnlMatrixType & matrix);
105 return this->operator()(static_cast<unsigned int>(row), static_cast<unsigned int>(col));
112 this->operator()(static_cast<unsigned int>(row), static_cast<unsigned int>(col)) = value;
117 SetSize(
unsigned int m,
unsigned int n);
123 template <
typename TValue>
127 const unsigned int numberOfRows = arr.rows();
128 const unsigned int numberOfColumns = arr.cols();
130 for (
unsigned int r = 0; r < numberOfRows; ++r)
133 if (numberOfColumns >= 1)
135 const unsigned int lastColumn = numberOfColumns - 1;
136 for (
unsigned int c = 0; c < lastColumn; ++c)
138 os << arr(r, c) <<
", ";
140 os << arr(r, lastColumn);
142 os <<
']' << std::endl;
150 ITKCommon_EXPORT std::ostream &
151 operator<<(std::ostream & os,
const Array2D<float> & arr);
153 ITKCommon_EXPORT std::ostream &
154 operator<<(std::ostream & os,
const Array2D<double> & arr);
158 #ifndef ITK_MANUAL_INSTANTIATION
159 # include "itkArray2D.hxx"