Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkArray2D.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkArray2D.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/03/04 22:48:30 $
00007   Version:   $Revision: 1.4 $
00008 
00009   Copyright (c) 2002 Insight Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkArray2D_h
00018 #define __itkArray2D_h
00019 
00020 #include "itkMacro.h"
00021 #include "vnl/vnl_matrix.h"
00022 
00023 namespace itk
00024 {
00025 
00026  
00043 template <typename TValueType >
00044 class Array2D : public vnl_matrix< TValueType >
00045 {
00046 public:
00047  
00049   typedef TValueType  ValueType;
00050   
00051 public:
00052 
00053   Array2D();
00054   Array2D(unsigned int rows,unsigned int cols);
00055 
00056   void Fill (TValueType const& v) { fill(v); }
00057 
00060   ~Array2D() {};
00061   
00062 };
00063 
00064 
00065   
00066 template <typename TValueType >
00067 std::ostream & operator<<(std::ostream &os, const Array2D<TValueType> &arr)
00068 {
00069   const unsigned int numberOfColumns = arr.cols();
00070   const unsigned int numberOfRows    = arr.rows();
00071   const signed int lastColumn = (signed int) numberOfColumns - 1;
00072 
00073   for (unsigned int r=0; r < numberOfRows; ++r)
00074     {
00075     os << "[";
00076     for ( signed int c=0; c < lastColumn; ++c)
00077       {
00078       os << arr(r,c) << ", ";
00079       }
00080     if (numberOfColumns >= 1)
00081       {
00082       os << arr(r,lastColumn);
00083       }
00084     os << "]" << std::endl;
00085     }
00086 
00087   return os;
00088 }
00089 
00090 } // namespace itk
00091 
00092 
00093 #ifndef ITK_MANUAL_INSTANTIATION
00094 #include "itkArray2D.txx"
00095 #endif
00096 
00097 
00098 #endif

Generated at Wed Mar 12 01:12:47 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000