00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
#ifndef __itkArray_h
00018
#define __itkArray_h
00019
00020
#include "itkMacro.h"
00021
#include "vnl/vnl_vector.h"
00022
00023
namespace itk
00024 {
00025
00026
00043
template <
typename TValueType >
00044 class Array :
public vnl_vector< TValueType >
00045 {
00046
public:
00047
00049 typedef TValueType
ValueType;
00050
00051
public:
00052
00055
Array();
00056
00058
Array(
unsigned int dimension);
00059
00061 void Fill (TValueType
const& v) { fill(v); }
00062
00064 unsigned int Size (
void )
const
00065
{
return static_cast<unsigned int>( this->size() ); }
00066 unsigned int GetNumberOfElements(
void)
const
00067
{
return static_cast<unsigned int>( this->size() ); }
00068
00070
const TValueType &
GetElement(
unsigned int i )
const
00071 {
return this->operator[]( i ); }
00072
00074
void SetElement(
unsigned int i,
const TValueType & value )
00075 { this->operator[]( i ) = value; }
00076
00077
00078
00081
~Array() {};
00082
00083 };
00084
00085
00086
00087
template <
typename TValueType >
00088 std::ostream & operator<<(std::ostream &os, const Array<TValueType> &arr)
00089 {
00090
const unsigned int length = arr.size();
00091
const signed int last = (
unsigned int) length - 1;
00092
00093 os <<
"[";
00094
for (
signed int i=0; i < last; ++i)
00095 {
00096 os << arr[i] <<
", ";
00097 }
00098
if (length >= 1)
00099 {
00100 os << arr[last];
00101 }
00102 os <<
"]";
00103
return os;
00104 }
00105
00106 }
00107
00108
00109
00110
#ifndef ITK_MANUAL_INSTANTIATION
00111
#include "itkArray.txx"
00112
#endif
00113
00114
00115
#endif