image.h

Go to the documentation of this file.
00001 /* -*- mode: c++; c-basic-offset:3 -*-
00002  *
00003  * Copyright (c) 2013, GREYC.
00004  * All rights reserved
00005  *
00006  * You may use this file under the terms of the BSD license as follows:
00007  *
00008  * "Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions are
00010  * met:
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above copyright
00014  *     notice, this list of conditions and the following disclaimer in
00015  *     the documentation and/or other materials provided with the
00016  *     distribution.
00017  *   * Neither the name of the GREYC, nor the name of its
00018  *     contributors may be used to endorse or promote products
00019  *     derived from this software without specific prior written
00020  *     permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00025  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00026  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00027  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00028  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00029  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00030  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00031  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00032  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
00033  *
00034  * 
00035  * For more information, refer to:
00036  * https://clouard.users.greyc.fr/Pandore
00037  */
00038 
00064 #ifndef __PIMAGEH__
00065 #define __PIMAGEH__
00066 
00067 namespace pandore {
00068 
00069 class Border2DIterator {
00070    private:
00071       Dimension2d _size;
00072       int _top;
00073       int _left;
00074       int _right;
00075       int _bottom;
00076       Point2d *_points;
00077       int _length;
00078       int _index;
00079 
00080    public:
00081       Border2DIterator( const Dimension2d size, int c1, int c2, int c3, int c4 ): _size(size), _top(c1), _left(c2), _right(c3), _bottom(c4) {
00082          _length = size.w * _top
00083             + size.h * _bottom
00084             + size.h * _left
00085             + size.h * _right
00086             - 2 * (_top + _bottom);
00087          _points = new Point2d[_length];
00088          _index = 0;
00089 
00090          Point2d p;
00091          // top.
00092          for (p.y = 0; p.y < _top; p.y++) {
00093             for (p.x = 0; p.x < _size.w; p.x++) {
00094                _points[_index++] = p;
00095             }
00096          }
00097 
00098          // bottom.
00099          for (p.y = _size.h - _bottom; p.y < _size.h; p.y++) {
00100             for (p.x = 0; p.x < _size.w; p.x++) {
00101                _points[_index++] = p;
00102             }
00103          }
00104 
00105          // Left
00106          for (p.x = 0; p.x < _left; p.x++) {
00107             for (p.y = _top; p.y < _size.h - _bottom; p.y++) {
00108                _points[_index++] = p;
00109             }
00110          }
00111 
00112          // Right
00113          for (p.x = _size.w - _right; p.x < _size.w; p.x++) {
00114             for (p.y = _top; p.y < _size.h - _bottom; p.y++) {
00115                _points[_index++] = p;
00116             }
00117          }
00118          _index = 0;
00119       }
00120       bool hasNext() {
00121          return _index < _length;
00122       }
00123       Point2d next() {
00124          return _points[_index++];
00125       }
00126 };
00127 
00128 class Border3DIterator {
00129    private:
00130       Dimension3d _size;
00131       int _top;
00132       int _left;
00133       int _right;
00134       int _bottom;
00135       int _front;
00136       int _back;
00137       Point3d *_points;
00138       int _depth;
00139       int _length;
00140       int _index;
00141 
00142    public:
00143       Border3DIterator( const Dimension3d size, int c1, int c2, int c3, int c4, int c5, int c6 ): _size(size), _top(c1), _left(c2), _right(c3), _bottom(c4),
00144 _front(c5), _back(c6) {
00145          _length  = (_front + _back) * (_size.h * _size.w) 
00146             + (_size.d - _top - _back) * (_top * _size.h + _bottom * _size.h + _left * (_size.w - _top - _bottom) + _right * (_size.w - _top - _bottom)) ;
00147          _points = new Point3d[_length];
00148          _index = 0;
00149 
00150          Point3d p;
00151          // Front
00152          for (p.z = 0; p.z < _front; p.z++) {
00153             for (p.y = 0; p.y < _size.h; p.y++) {
00154                for (p.x = 0; p.x < _size.w; p.x++) {
00155                   _points[_index++] = p;
00156                }
00157             }
00158          }
00159 
00160          for (p.z = _front; p.z < _size.d - _back; p.z++) {
00161             // top
00162             for (p.y = 0; p.y < _top; p.y++) {
00163                for (p.x = 0; p.x < _size.w; p.x++) {
00164                   _points[_index++] = p;
00165                }
00166             }
00167             // bottom.
00168             for (p.y = _size.h- _bottom; p.y < _size.h; p.y++) {
00169                for (p.x = 0; p.x < _size.w; p.x++) {
00170                   _points[_index++] = p;
00171                }
00172             }
00173             // Left
00174             for (p.x = 0; p.x < _left; p.x++) {
00175                for (p.y = _top; p.y < _size.h - _bottom; p.y++) {
00176                   _points[_index++] = p;
00177                }
00178             }
00179             // Right
00180             for (p.x = _size.w - _right; p.x < _size.w; p.x++) {
00181                for (p.y = _top; p.y < _size.h - _bottom; p.y++) {
00182                   _points[_index++] = p;
00183                }
00184             }
00185          }
00186 
00187          // Back
00188          for (p.z = _size.d - _back; p.z < _size.d; p.z++) {
00189             for (p.y = 0; p.y < _size.h; p.y++) {
00190                for (p.x = 0; p.x < _size.w; p.x++) {
00191                   _points[_index++] = p;
00192                }
00193             }
00194          }
00195          _index = 0;
00196 
00197       }
00198       bool hasNext() {
00199          return _index < _length - 1;
00200       }
00201       Point3d next() {
00202          return _points[_index++];
00203       }
00204 };
00205 
00209 
00210 template< typename T > 
00211 class Imx2d;
00212    
00224    template< typename T > 
00225    class Imx3d: public Pobject {
00226       protected:
00231          class Band1d {
00232             public:
00233                // 1D data accessors.
00241                explicit Band1d( const Imx3d<T> * const image, T *offset ) : _image(image), _offset(offset) {}
00242                T &operator[]( Long x ) { return _offset[x]; }
00243                const T &operator[]( Long x ) const { return _offset[x]; }
00244                T &operator[]( const Point1d &p ) { return _offset[p.x]; }
00245                const T & operator[]( const Point1d &p ) const { return _offset[p.x]; }
00246             private:
00247                const Imx3d<T> *_image;
00248                T *_offset;
00249          };
00250          
00256          class Band2d {
00257             public:
00258                // 2D data accessors.
00266                explicit Band2d( const Imx3d<T> * const image, T *offset ) : _image(image), _offset(offset) {}
00267                explicit Band2d(): _image(0), _offset(0) {};
00268                void New( const Imx3d<T> * const image, T *offset ) { _image = image; _offset=offset; }
00269                
00270                Band1d operator[]( Long y ) { return Band1d(_image, &_offset[_image->ncol*y]); }
00271                const Band1d operator[]( Long y ) const { return Band1d(_image, &_offset[_image->ncol * y]); }
00272                T &operator[]( const Point2d &p ) { return _offset[_image->ncol * p.y + p.x]; }
00273                const T & operator[]( const Point2d &p ) const { return _offset[_image->ncol * p.y + p.x]; }
00274 //             T * &operator( )( ) { return &_data[_offset]; } 
00275                Band2d& operator=( const Imx2d<T> &ims ) {
00276                   if (_image->Bands() != ims.Bands( )
00277                       || _image->Depth() != ims.Depth() 
00278                       || _image->Height() != ims.Height()
00279                       || _image->Width() != ims.Width()) {
00280                     std::cerr << "Error: incomptabiles images for operator: 2D image = 3D image[i]" << std::endl;
00281                   } else {
00282                      T *ps = ims.Vector();
00283                      T *pe = ps + ims.Bands() * ims.nrow * ims.ncol;
00284                      T *pd = _offset;
00285                      for (; ps<pe; ) {
00286                         *(pd++) = (T)*(ps++);
00287                      }
00288                   }
00289                   return *this;
00290                }
00291                Band2d& operator=( const T val ) {
00292                   T *pd = _offset;
00293                   T *pe = pd + _image->nbands * _image->nrow * _image->ncol;
00294                   for (; pd < pe; ) {
00295                      *(pd++) = val;
00296                   }
00297                   return *this;
00298                }
00299             private:
00300                const Imx3d<T> *_image;
00301                T *_offset;
00302          };
00303 
00309          class Band3d {
00310             public:
00318                explicit Band3d( const Imx3d<T> * const image, T *offset ) : _image(image), _offset(offset) {}
00319                // 3D data accessors.
00320                Band2d operator[]( Long z ) { return Band2d(_image, &_offset[_image->matrixSize * z]); }
00321                explicit Band3d(): _image(0), _offset(0) {};
00322                void New( const Imx3d<T> * const image, T *offset ) { _image = image; _offset = offset; }
00323 
00324                const Band2d operator[]( Long z ) const { return Band2d(_image, &_offset[_image->matrixSize * z]); }
00325                T &operator[]( const Point3d &p ) { return _offset[_image->matrixSize * p.z + _image->ncol * p.y + p.x]; }
00326                const T & operator[]( const Point3d &p ) const { return _offset[_image->matrixSize * p.z + _image->ncol * p.y + p.x]; }
00327                T &operator()( const Point3d &p ) { return _offset[_image->matrixSize * p.z + _image->ncol * p.y + p.x]; }
00328                const T & operator()( const Point3d &p ) const { return _offset[_image->matrixSize * p.z + _image->ncol * p.y + p.x]; }
00329 //             T * &operator( )( ) { return &_data[_offset]; }
00330             private:
00331                const Imx3d<T> *_image;
00332                T *_offset;
00333          };
00334 
00335       protected:
00337          T *_data; 
00339          bool _isDataOwner;
00340 
00342          Long nbands; 
00344          Long ncol;
00346          Long nrow;
00348          Long ndep;
00350          Long matrixSize;         
00351          Long volumeSize;
00352 
00353       private:
00355          PColorSpace colorspace;
00356 
00357       public:
00359          typedef T ValueType;
00360 
00364          Typobj Type( ) const { return ( Typobj )Po_type< Imx3d< T > >::type; }
00365 
00369          std::string Name( ) const { return TypeName< Imx3d < T > >::Name( ); }
00370 
00374          Long Width( ) const { return ncol; }
00375 
00379          Long Height( ) const { return nrow; }
00380 
00384          Long Depth( ) const { return ndep; }
00385 
00389          Long Bands( ) const { return nbands; }
00390 
00394          Dimension3d Size( ) const {
00395             return Dimension3d(ndep, nrow, ncol);
00396          }
00397 
00401          Ulong VectorSize( ) const {
00402             return (Ulong)volumeSize;
00403          }
00404 
00409          PobjectProps Props( ) const {
00410             return PobjectProps(nbands, ncol, nrow, ndep, colorspace, 0, ndep * ncol * nrow);
00411          }
00412 
00416          Imx3d( ): Pobject( ), _data(0), _isDataOwner(false), nbands(0), ncol(0), nrow(0), ndep(0), matrixSize(0), volumeSize(0), colorspace(RGB) {
00417          }
00418 
00431          Imx3d( Long b, Long d, Long h, Long w, T *data = 0, bool isOwner = false ): Pobject (), _data(0), _isDataOwner(isOwner), nbands(0), ncol(0), nrow(0), ndep(0), matrixSize(0), volumeSize(0), colorspace( RGB ) {
00432             New(b, d, h, w, data);
00433          }
00434 
00445          Imx3d( Long b, const Dimension3d &d, T *data = 0, bool isOwner = false ): Pobject ( ), _data(0), _isDataOwner(isOwner), nbands(0), ncol(0), nrow(0), ndep(0), matrixSize(0), volumeSize(0), colorspace(RGB) {
00446             New(b, d. d, d.h, d.w, data);
00447          }
00448          
00459          Imx3d( const PobjectProps &p, T *data = 0, bool isOwner = false ): Pobject ( ), _data(0), _isDataOwner(isOwner), nbands(0), ncol(0), nrow(0), ndep(0), matrixSize(0), volumeSize(0) {
00460             New(p, data);
00461          }
00462 
00469           Imx3d( const Imx3d  &ims ): Pobject(), _data(0), _isDataOwner(false), nbands(0), ncol(0), nrow(0), ndep(0) {
00470              New(ims.Props());
00471              *this = ims;
00472           }
00473       
00474           ~Imx3d( ) {
00475              Delete();
00476           }
00477 
00490          void New( Long b, Long d, Long h, Long w, T *data = 0, bool isOwner = false ) {
00491             Long size = b * w * h * d;
00492             if (size <= 0) {
00493                throw std::runtime_error("Memory allocation error: block too big.");
00494             }
00495             if (data != 0 || (nbands * ncol * nrow * ndep != size)) {
00496                Delete();
00497                
00498                if (data == 0) {
00499                   _isDataOwner = true;
00500                   _data = new T[size];
00501                } else {
00502                   _isDataOwner = isOwner;
00503                   _data = data;
00504                }
00505             }
00506             ndep = d;
00507             nrow = h;
00508             ncol = w;
00509             nbands = b;
00510             matrixSize = ncol * nrow;
00511 
00512             volumeSize = matrixSize * ndep;
00513          }
00514          
00524          void New( Long b, const Dimension3d &d, T *data = 0) {
00525             New(b, d.d, d.h, d.w, data);
00526          }
00527 
00536          virtual void New( const PobjectProps &p, T *data = 0, bool isOwner = false ) {
00537             New(p.nbands, p.ndep, p.nrow, p.ncol, data, isOwner);
00538             colorspace = p.colorspace;
00539          }
00540       
00544          void Delete( ) {
00545             if (_isDataOwner) {
00546                delete[] _data;
00547             }
00548             _data = 0;
00549             nbands = ndep = nrow = ncol = matrixSize = volumeSize = 0L;
00550          }
00551    
00556          virtual Pobject* Clone( ) const {
00557             Imx3d< T > *tmp = new Imx3d< T > (nbands, ndep, nrow, ncol);
00558             *tmp = *this;
00559       
00560             return tmp;
00561          }
00562    
00568          Imx3d< T > &operator=( const T val ) {
00569             T *bp = Vector();
00570             T *ep = bp + (nbands * ndep * nrow * ncol);
00571       
00572             for (; bp < ep; *(bp++) = val) ;
00573       
00574             return *this;
00575          }
00576    
00583          template< typename U >
00584          Imx3d< T > &operator=( const Imx3d< U > &src ) {
00585             if (Bands() != src.Bands( ) || Depth() != src.Depth()  ||
00586                 Height() != src.Height() || Width() != src.Width()) {
00587                Delete();
00588                New(src.Bands(), src.Depth(), src.Height(), src.Width());
00589             }
00590             T *pd = Vector();
00591             U *ps = src.Vector();
00592             U *pe = ps + nbands * ndep * nrow * ncol;
00593             
00594             for (; ps < pe; ) {
00595                *(pd++) = (T)*(ps++);
00596             }
00597             return *this;
00598          }
00599 
00606          Imx3d< T > &operator=( const Imx3d< T > &src ) {
00607             if (Bands() != src.Bands( )
00608                 || Depth() != src.Depth() 
00609                 || Height() != src.Height()
00610                 || Width() != src.Width()) {
00611                Delete();
00612                New(src.Bands(), src.Depth(), src.Height(), src.Width());
00613             }
00614             memcpy(Vector(), src.Vector(), nbands * ndep * nrow * ncol * sizeof(T));
00615             return *this;
00616          }
00617    
00622          T* Vector( Long band = 0 ) const {
00623             return &_data[volumeSize * band];
00624          }
00625 
00630          Band3d operator[]( Long band ) {
00631             return Band3d(this, &_data[volumeSize * band]);
00632          }
00633       
00638          const Band3d operator[]( Long band ) const {
00639             return Band3d(this, &_data[volumeSize * band]);
00640          }
00641 
00650          T &operator()( Long b, Long z, Long y, Long x ) {
00651             return _data[volumeSize * b + matrixSize * z + ncol * y + x];
00652          }
00653 
00662          const T &operator()( Long b, Long z, Long y, Long x ) const {
00663             return _data[volumeSize * b + matrixSize * z + ncol * y + x];
00664          }
00665          
00666          
00673          T &operator()( Long b, Point3d &p ) {
00674             return _data[volumeSize * b + matrixSize * p.z + ncol * p.y + p.x];
00675          }
00676          
00683          const T &operator()( Long b, Point3d &p ) const {
00684             return _data[volumeSize * b + matrixSize * p.z + ncol * p.y + p.x];
00685          }
00686          
00694          virtual Errc LoadAttributes( FILE *file ) {
00695             Long attr[4];
00696       
00697             if (this->Fdecode((void*)attr, sizeof(*attr), 4, file) < 4) {
00698                return FAILURE;
00699             }
00700             New(attr[0], attr[1], attr[2], attr[3]);
00701             return SUCCESS;
00702          }
00703    
00709          virtual Errc SaveAttributes( FILE *file ) const {
00710             Long attr[4];
00711 
00712             attr[0] = nbands;
00713             attr[1] = ndep;
00714             attr[2] = nrow;
00715             attr[3] = ncol;
00716             if (this->Fencode((void*)attr, sizeof(*attr), 4, file) < 4) {
00717                return FAILURE;
00718             }
00719             return SUCCESS;
00720          }
00721 
00729          virtual Errc LoadData( FILE *file ) {
00730             size_t x = volumeSize;
00731             // Problem : Visual C++ 2005 cannot call the fread function to read from a buffer
00732             // that is larger than 64 MB in.
00733             // See http://support.microsoft.com/default.aspx?scid=kb;en-us;899149
00734 
00735 #ifdef _WIN32
00736             if (x * sizeof(T) < (size_t)67076095) {
00737 #endif
00738                size_t a;
00739                for (int b = 0; b < nbands; b++) {
00740                   if ((a = this->Fdecode((void*)Vector(b), sizeof(T), x, file)) < x) {
00741                      return FAILURE;
00742                   }
00743                }
00744 #ifdef _WIN32
00745             } else {
00746                x = matrixSize;
00747                for (int b = 0; b < nbands; b++) {
00748                   T *data = Vector(b);
00749                   for (int z = 0; z < ndep; z++) {
00750                      if (this->Fdecode((void*)data, sizeof(T), x, file) < x) {
00751                         return FAILURE;
00752                      }
00753                      data += x;
00754                   }
00755                }
00756             }
00757 #endif      
00758             return SUCCESS;
00759          }
00760 
00766          virtual Errc SaveData( FILE *file ) const {
00767             size_t x = volumeSize;
00768             // Problem : Visual C++ 2005 cannot call the fwrite function to
00769             // write to a buffer that is larger than 64 MB in. 
00770             // See: http://support.microsoft.com/default.aspx?scid=kb;en-us;899149
00771 #ifdef _WIN32
00772             if (x * sizeof(T) < (size_t)67076095) {
00773 #endif
00774                for (int b = 0; b < nbands; b++) {
00775                   if (this->Fencode((void*)Vector(b), sizeof(T), x, file) < x) {
00776                      return FAILURE;
00777                   }
00778                }
00779 #ifdef _WIN32
00780             } else {
00781                x = matrixSize;
00782                for (int b = 0; b < nbands; b++) {
00783                   T *data = Vector(b);
00784                   for (int z = 0; z < ndep; z++) {
00785                      if (this->Fencode((void*)data, sizeof(T), x, file) < x) {
00786                         return FAILURE;
00787                      }
00788                      data += x;
00789                   }
00790                }
00791             }
00792 #endif
00793             return SUCCESS;
00794          }
00795    
00803          virtual Pobject* Mask( const Pobject* mask ) {
00804             if ((!mask)||
00805                 (mask->Type() != Po_Reg3d)||
00806                 (((Imx3d<Long>*)mask)->Size() != Size())) {
00807                std::cerr << "Warning: bad mask format... ignored" << std::endl;
00808                return this;
00809             }
00810       
00811             Imx3d< T > *objd = (Imx3d< T >*)Clone();
00812             Imx3d<Long> *m = (Imx3d<Long>*)mask;
00813             for (int b = 0; b < nbands; b++) {
00814                Ulong *pm = (Ulong*)m->Vector(0);
00815                T *pp = objd->Vector(b);
00816                T *pq = Vector(b);
00817                for (int i = 0; i < volumeSize; i++, pq++, pm++, pp++) {
00818                   *pp = (*pm == 0) ? 0 : *pq;
00819                }
00820             }
00821             return objd;
00822          }
00823    
00832          virtual Pobject* UnMask( const Pobject* mask, const Pobject* reference ) {
00833             if ((!mask)||
00834                 (mask->Type() != Po_Reg3d)||
00835                 (((Imx3d<Long>*)mask)->Size() != Size())||
00836                 (reference->Type() != Type())||
00837                 (((Imx3d<T>*)reference)->Size() != Size())) {
00838                std::cerr << "Warning: bad unmask format... ignored" << std::endl;
00839                return this;
00840             }
00841       
00842             Imx3d< T > *objs = (Imx3d< T > *)reference;
00843             Imx3d< T > *objd = (Imx3d< T >*)Clone();
00844             Imx3d<Long> *m = (Imx3d<Long>*)mask;
00845             for (int b = 0; b < nbands; b++) {
00846                Ulong *pm = (Ulong*)m->Vector(0);
00847                T *pp = objd->Vector(b);
00848                T *pq = Vector(b);
00849                T *ps = objs->Vector(b);
00850          
00851                for (int i = 0; i < volumeSize; i++, pp++, pq++, pm++, ps++) {
00852                   *pp = (*pm == 0) ? *ps : *pq;
00853                }
00854             }
00855             return objd;
00856          }
00857    
00861          PColorSpace ColorSpace( ) const { return colorspace; }
00862 
00868          PColorSpace ColorSpace( PColorSpace e ) { return colorspace=e; }
00869 
00878          bool Hold( Long z, Long y, Long x ) const {
00879             return (z>=0) && (z < ndep) && (y >= 0) && (y < nrow) && (x >= 0) && (x < ncol);
00880          }
00881 
00887          bool Hold( const Point3d &pt ) const {
00888             return (pt.z >= 0) && (pt.z < ndep) && (pt.y >= 0) && (pt.y < nrow) && (pt.x >= 0) && (pt.x < ncol);
00889          }
00890 
00898          Errc Frame( ValueType val, Long d, Long h, Long l ) {
00899             if ((d < 0) || (h < 0) || (l < 0)) {
00900                return FAILURE;
00901             }
00902             for (int b = 0; b < nbands; b++) {
00903                for (int z = 0; z < ndep; z++) {
00904                   for (int y = 0; y < nrow; y++) {
00905                      for (int x = 0; x < l; x++) {
00906                         operator()(b, z, y, x) = (T)val;
00907                         operator()(b, z, y, ncol - 1 - x) = (T)val;
00908                      }
00909                   }
00910                }
00911                for (int z = 0; z < ndep; z++) {
00912                   for (int y = 0; y < h; y++) {
00913                      for (int x = l; x < ncol - l; x++) {
00914                         operator()(b, z, y, x) = (T)val;
00915                         operator()(b, z, nrow - 1 - y, x) = (T)val;
00916                      }
00917                   }
00918                }
00919                for (int z = 0; z < d; z++) {
00920                   for (int y = h; y < nrow - h; y++) {
00921                      for (int x = l; x < ncol - l; x++) {
00922                         operator()(b, z, y, x) = (T)val;
00923                         operator()(b, ndep - 1 - z , y, x) = (T)val;
00924                      }
00925                   }
00926                }
00927             }
00928             return SUCCESS;
00929          }
00930 
00936          Errc Frame( ValueType v, Long d ) {
00937             return Frame(v, d, d, d);
00938          }
00939 
00946          template < typename U>
00947          Errc Frame( const Imx3d < U> &ims, Long d ) {
00948             return Frame(ims, d, d, d);
00949          }
00950 
00959          template < typename U >
00960          Errc Frame( const Imx3d <  U > &ims, Long d, Long h, Long l ) {
00961             if (l == -1) {
00962                l = h = d;
00963             }
00964             if ((d < 0) || (h < 0) || (l < 0)) {
00965                return FAILURE;
00966             }
00967             for ( int b = 0; b < nbands; b++ ) {
00968                for (int i = 0; i < ndep; i++) {
00969                   for (int j = 0; j < nrow; j++) {
00970                      for (int k = 0; k < l; k++) {
00971                         operator()(b, i, j, k) = ( T )ims(b, i, j, k);
00972                         operator()(b, i, j, ncol - 1 - k) = ( T )ims(b, i, j, ncol - 1 - k);
00973                      }
00974                   }
00975                }
00976                for (int i = 0; i < ndep; i++) {
00977                   for (int j = 0; j < h; j++) {
00978                      for (int k = l; k < ncol - l; k++) {
00979                         operator()(b, i, j, k) = ( T )ims(b, i, j , k);
00980                         operator()(b, i, nrow - 1 - j, k) = ( T )ims(b, i, nrow - 1 - j, k);
00981                      }
00982                   }
00983                }
00984                for (int i = 0; i < d; i++) {
00985                   for (int j = h; j < nrow - h; j++) {
00986                      for (int k = l; k<ncol-l; k++) {
00987                         operator()(b, i, j, k) = ( T )ims(b, i, j, k);
00988                         operator()(b, ndep - 1 - i, j, k) = ( T )ims(b, ndep - 1 - i, j, k);
00989                      }
00990                   }
00991                }
00992             }
00993             return SUCCESS;
00994          }
00995 
00996          Border3DIterator *getBorderIterator( int c1, int c2, int c3, int c4, int c5, int c6 ) const {
00997             return new Border3DIterator(Size(), c1, c2, c3, c4, c5, c6);
00998          }
00999    };
01000    
01004 
01012    template< typename T > 
01013    class Imx2d: public Imx3d <  T > {
01014       protected:
01015          using Imx3d < T>::_data;
01016          using Imx3d < T>::ncol;
01017          using Imx3d < T>::nrow;
01018          using Imx3d < T>::nbands;
01019          using Imx3d < T>::matrixSize;
01020          using Imx3d < T>::ColorSpace;
01021 
01022       public:
01024          typedef T ValueType;
01025 
01029          Typobj Type( ) const { return ( Typobj )Po_type< Imx2d <  T > >::type; }
01030 
01034          std::string Name( ) const { return TypeName< Imx2d < T > >::Name( ); }
01035 
01039          Dimension2d Size( ) const{ return Dimension2d(nrow, ncol); }
01040 
01044          Imx2d( ): Imx3d < T>( ) { }
01045 
01057       Imx2d( Long b, Long h, Long w, T *data = 0, bool isOwner = false ): Imx3d < T>( ) { New(b, h, w , data, isOwner); }
01058 
01069          Imx2d( Long b, const Dimension2d &d, T *data = 0, bool isOwner = false ): Imx3d < T>( ) { New(b, d.h, d.w, data, isOwner); }
01070 
01079          Imx2d( const PobjectProps &p, T *data = 0, bool isOwner = false ): Imx3d < T>( ) { New(p, data, isOwner); }
01080 
01092          void New( Long b, Long h, Long w, T *data = 0, bool isOwner = false ) { Imx3d < T>::New(b, 1, h, w, data, isOwner); }
01093 
01104          void New( Long b, const Dimension2d &d, T *data = 0, bool isOwner = false ) {
01105             New(b, d.h, d.w, data, isOwner);
01106          }
01107 
01116          void New( const PobjectProps &p, T *data = 0, bool isOwner = false ) {
01117             New(p.nbands, p.nrow, p.ncol, data, isOwner);
01118             ColorSpace(p.colorspace);
01119          }
01120 
01125          Pobject* Clone( ) const {
01126             Imx2d <  T > *tmp = new Imx2d <  T >(nbands, nrow, ncol);
01127             *tmp = *this;
01128             return tmp;
01129          }
01130 
01131          /*   
01132           * Sets all pixels with the given value.
01133           * @param val  the given value.
01134           * @return the image itself.
01135           */
01136          Imx2d <  T > &operator=( const T val ) {
01137             Imx3d < T>::operator=(val);
01138             return *this;
01139          }
01140 
01147          template< typename U >
01148          Imx2d <  T > &operator=( const Imx2d <  U > &src ) {
01149             Imx3d < T>::operator=(src);
01150             return *this;
01151          }
01152  
01159          Imx2d <  T > &operator=( const Imx2d <  T > &src ) {
01160             Imx3d < T>::operator=(src);
01161             return *this;
01162          }
01163 
01168          T* Vector( Long band = 0 ) const {
01169             return &_data[matrixSize * band];
01170          }
01171 
01176          typename Imx3d < T>::Band2d operator[]( Long band ) { return typename Imx3d < T>::Band2d(this, &_data[matrixSize * band]); } 
01177 
01182          const typename Imx3d < T>::Band2d operator[]( Long band ) const { return typename Imx3d < T>::Band2d(this, &_data[matrixSize * band]); } 
01183 
01191          T &operator()( Long b, Long y, Long x ) { return _data[matrixSize * b + ncol * y + x]; }
01192 
01200          const T &operator()( Long b, Long y, Long x ) const { return _data[matrixSize * b + ncol * y + x]; }
01201 
01208          const T &operator()( Long b, Point2d &p ) const { return _data[matrixSize * b + ncol * p.y + p.x]; }
01209 
01216          T &operator()( Long b, Point2d &p ) { return _data[matrixSize * b + ncol * p.y + p.x]; }
01217 
01225          Errc LoadAttributes( FILE *file ) {
01226             Long attr[3];
01227       
01228             if (this->Fdecode((void*)attr, sizeof(*attr), 3, file) < 3) {
01229                return FAILURE;
01230             }
01231             New(attr[0], attr[1], attr[2]);
01232             return SUCCESS;
01233          }
01234    
01240          Errc SaveAttributes( FILE *file ) const {
01241             Long attr[3];
01242 
01243             attr[0] = nbands;
01244             attr[1] = nrow;
01245             attr[2] = ncol;
01246             if (this->Fencode((void*)attr, sizeof(*attr), 3, file) < 3) {
01247                return FAILURE;
01248             }
01249             return SUCCESS;
01250          }
01251    
01259          Pobject* Mask( const Pobject* mask ) {
01260             if ((!mask)
01261                 || (mask->Type() != Po_Reg2d)
01262                 || (((Imx2d < Long>*)mask)->Size() != Size())) {
01263                std::cerr << "Warning: bad mask format... ignored" << std::endl;
01264                return this;
01265             }
01266       
01267             Imx2d <  T > *objd = (Imx2d <  T> *)Clone();
01268             Imx2d < Long> *m = (Imx2d < Long>*)mask;
01269             for (int b = 0; b < nbands; b++) {
01270                Ulong *pm = (Ulong*)m->Vector(0);
01271                T *pp = objd->Vector(b);
01272                T *pq = Vector(b);
01273          
01274                for (int i = 0; i < matrixSize; i++, pp++, pq++, pm++) {
01275                   *pp = (*pm == 0)? 0 : *pq;
01276                }
01277             }
01278             return objd;
01279          }
01280    
01281    
01290          Pobject* UnMask( const Pobject* mask, const Pobject* reference ) {
01291             if ((!mask)||
01292                 (mask->Type() != Po_Reg2d)||
01293                 (((Imx2d < Long>*)mask)->Size() != Size())||
01294                 (reference->Type() != Type())||
01295                 (((Imx2d < T>*)reference)->Size() != Size())) {
01296                std::cerr << "Warning: bad unmask format... ignored" << std::endl;
01297                return this;
01298             }
01299       
01300             Imx2d <  T > *objs = (Imx2d <  T > *)reference;
01301             Imx2d <  T > *objd = (Imx2d <  T> *)Clone();
01302             Imx2d < Long> *m = (Imx2d < Long>*)mask;
01303             for (int b = 0; b < nbands; b++) {
01304                Ulong *pm = (Ulong*)m->Vector(0);
01305                T *pp = objd->Vector(b);
01306                T *pq = Vector(b);
01307                T *ps = objs->Vector(b);
01308          
01309                for (int i = 0; i<matrixSize; i++, pp++, pq++, pm++, ps++) {
01310                   *pp = (*pm == 0) ? *ps : *pq;
01311                }
01312             }
01313             return objd;
01314          }
01315    
01323          bool Hold( Long y, Long x ) const { return (y >= 0) && (y < nrow) && (x >= 0) && (x < ncol); }
01324 
01330          bool Hold( const Point2d &pt ) const { return (pt.y >= 0) && (pt.y < nrow) && (pt.x >= 0) && ( pt.x < ncol); }
01331 
01337          Errc Frame( ValueType val, Long h ) { return Imx3d < T>::Frame(val, 0, h, h ); }
01338 
01345          Errc Frame( ValueType val, Long h, Long l ) { return Imx3d < T>::Frame(val, 0, h, l); }
01346 
01353          template < typename U >
01354          Errc Frame( const Imx2d <  U > &ims, Long h ) { return Imx3d < T>::Frame(ims, 0, h, h); }
01355 
01363          template < typename U >
01364          Errc Frame( const Imx2d <  U > &ims, Long h, Long l ) { return Imx3d < T>::Frame(ims, 0, h, l); }
01365 
01366          Border2DIterator *getBorderIterator( int c1, int c2, int c3, int c4 ) const {
01367             return new Border2DIterator(Size(), c1, c2, c3, c4);
01368          }
01369 
01376          Imx2d( const Imx2d  &ims ): Imx3d < T>( ) { New(ims.Props()); *this = ims; }
01377    };
01378 
01382 
01390    template <class T>
01391    class Imx1d: public Imx3d <  T > {
01392       protected:
01393          using Imx3d < T>::_data;
01394          using Imx3d < T>::ncol;
01395          using Imx3d < T>::nbands; 
01396          using Imx3d < T>::ColorSpace;
01397          
01398       public:
01400          typedef T ValueType;
01401 
01405          Typobj Type( ) const { return ( Typobj )Po_type< Imx1d <  T > >::type; }
01406 
01410          std::string Name( ) const { return TypeName< Imx1d < T > >::Name( ); }
01411 
01415          Dimension1d Size( ) const{ return Dimension1d( ncol ); }
01416    
01420          Imx1d( ): Imx3d < T>( ) { }
01421    
01432          Imx1d( Long b, Long w, T *data = 0, bool isOwner = false ): Imx3d < T>( ) { New(b, w, data, isOwner); }
01433 
01444          Imx1d( Long b, const Dimension1d &d, T *data = 0, bool isOwner = false ): Imx3d < T>( ) {
01445             New(b, d.w, data, isOwner);
01446          }
01447 
01458          Imx1d( const PobjectProps &p, T *data = 0, bool isOwner = false ): Imx3d < T>( ) {
01459             New(p, data, isOwner);
01460          }
01461 
01472          void New( Long b, Long w, T *data = 0, bool isOwner = false ) {
01473             Imx3d < T>::New(b, 1, 1, w, data, isOwner);
01474          }
01475 
01486          void New( Long b, const Dimension1d &d, T *data = 0, bool isOwner = false ) {
01487             New(b, d.w, data, isOwner);
01488          }
01489 
01498          void New( const PobjectProps &p, T *data = 0, bool isOwner = false ) {
01499             New(p.nbands, p.ncol, data, isOwner); ColorSpace(p.colorspace);
01500          }
01501 
01506          Pobject* Clone( ) const {
01507             Imx1d <  T > *tmp = new Imx1d <  T >(nbands, ncol);
01508             *tmp = *this;
01509       
01510             return tmp;
01511          }
01512    
01513          /*   
01514           * Sets all pixels with the given value.
01515           * @param val  the given value.
01516           * @return the image itself.
01517           */
01518          Imx1d <  T > &operator=( const T val ) { Imx3d < T>::operator=( val ); return *this; }
01519 
01526          template< typename U >
01527          Imx1d <  T > &operator=( const Imx1d <  U > &src ) { Imx3d < T>::operator=( src ); return *this; }
01528 
01535          Imx1d <  T > &operator=( const Imx1d <  T > &src ) { Imx3d < T>::operator=( src ); return *this; }
01536 
01541          T* Vector( Long band = 0 ) const { return &_data[ncol * band]; }
01542 
01547          typename Imx3d < T>::Band1d operator[]( Long band ) {
01548             return typename Imx3d < T>::Band1d(this, &_data[ncol * band]);
01549          }
01550 
01555          const typename Imx3d < T>::Band1d operator[]( Long band ) const { return typename Imx3d < T>::Band1d(this, &_data[ncol * band]); } 
01556 
01563          T &operator()( Long b, Long x ) { return _data[ncol * b + x]; }
01564 
01571          const T &operator()( Long b, Long x ) const { return _data[ncol * b + x]; }
01572 
01579          T &operator()( Long b, Point1d &p ) { return _data[ncol * b + p.x]; }
01580 
01587          const T &operator()( Long b, Point1d &p ) const { return _data[ncol * b + p.x]; }
01588 
01596          Errc LoadAttributes( FILE* file ) {
01597             Long attr[2];
01598       
01599             if (this->Fdecode((void*)attr, sizeof(*attr), 2, file) < 2) {
01600                return FAILURE;
01601             }
01602             New(attr[0], attr[1]);
01603             return SUCCESS;
01604          }
01605    
01611          Errc SaveAttributes( FILE* file ) const {
01612             Long attr[2];
01613       
01614             attr[0] = nbands; attr[1] = ncol; 
01615             if (this->Fencode((void*)attr, sizeof(*attr), 2, file) < 2) {
01616                return FAILURE;
01617             }
01618             return SUCCESS;
01619          }
01620    
01628          Pobject* Mask( const Pobject* mask ) {
01629             if ((!mask)||
01630                 (mask->Type() != Po_Reg1d)||
01631                 (((Imx1d < Long>*)mask)->Size() != Size())) {
01632                std::cerr << "Warning: bad mask format... ignored" << std::endl;
01633                return this;
01634             }
01635       
01636             Imx1d <  T > *objd = (Imx1d <  T >*)Clone();
01637             Imx1d < Long> *m=(Imx1d < Long>*)mask;
01638             for (int b = 0; b < nbands; b++) {
01639                Ulong *pm = (Ulong*)m->Vector(0);
01640                T *pp = objd->Vector(b);
01641                T *pq = Vector(b);
01642          
01643                for (int i = 0; i < ncol; i++, pp++, pq++, pm++) {
01644                   *pp = (*pm == 0) ? 0 : *pq;
01645                }         
01646             }  
01647             return objd;
01648          }
01649 
01658          Pobject* UnMask( const Pobject* mask, const Pobject* reference ) {
01659             if ((!mask)||
01660                 (mask->Type()!=Po_Reg1d)||
01661                 (((Imx1d < Long>*)mask)->Size() != Size())||
01662                 (reference->Type() != Type())||
01663                 (((Imx1d < T>*)reference)->Size() != Size())) {
01664                std::cerr << "Warning: bad unmask format... ignored" << std::endl;
01665                return this;
01666             }
01667             if ((mask == NULL) || (mask->Type() != Po_Reg1d) || (reference->Type() != Type())) {
01668                return this;
01669             }
01670             Imx1d <  T > *objs = (Imx1d <  T > *)reference;
01671             Imx1d <  T > *objd = (Imx1d <  T >*)Clone();
01672             Imx1d < Long> *m=(Imx1d < Long>*)mask;
01673             for (int b = 0; b < nbands; b++) {
01674                Ulong *pm = (Ulong*)m->Vector(0);
01675                T *pp = objd->Vector(b);
01676                T *pq = Vector(b);
01677                T *ps = objs->Vector(b);
01678          
01679                for (int i = 0; i < ncol; i++, pp++, pq++, pm++, ps++) {
01680                   *pp = (*pm == 0) ? *ps : *pq;
01681                }
01682             }
01683             return objd;
01684          }
01685    
01692          bool Hold( Long x ) const { return (x >= 0) && (x < ncol); }
01693 
01699          bool Hold( const Point1d &pt ) const { return (pt.x >= 0) && (pt.x < ncol); }
01700 
01706          Errc Frame( ValueType val, Long l ) { return Imx3d < T>::Frame(val, 1, 1, l); }
01707 
01714          template < typename U >
01715          Errc Frame( const Imx1d <  U > &ims, Long l ) { return Imx3d < T>::Frame(ims, 1, 1, l); }
01716 
01723          Imx1d( const Imx1d  &ims ): Imx3d < T>()  {
01724             New(ims.Props());
01725             *this = ims;
01726          }
01727    };
01728 
01732 
01740    template <class T>
01741    class Img1d: public Imx1d < T> {
01742       protected:
01743          using Imx1d < T>::ncol;
01744          using Imx1d < T>::nbands;
01745          using Imx1d < T>::ColorSpace;
01746 
01747       public:
01749          typedef T ValueType;
01750 
01754          Typobj Type( ) const { return ( Typobj )Po_type< Img1d <  T > >::type; }
01755 
01759          std::string Name( ) const { return TypeName< Img1d < T > >::Name( ); }
01760    
01764          Img1d( ): Imx1d < T>( ) { }
01765 
01775          Img1d( Long w, T *data = 0, bool isOwner = false ): Imx1d < T>( ) { New(w, data, isOwner); }
01776 
01786          Img1d( const Dimension1d &d, T *data = 0, bool isOwner = false ): Imx1d < T>( ) { New(d.w, data, isOwner); }
01787    
01798          Img1d( const PobjectProps &p, T *data = 0, bool isOwner = false ): Imx1d < T>( ) { New(p, data, isOwner); }
01799    
01808          void New( Long w, T *data = 0, bool isOwner = false ) { Imx1d < T>::New(1, w, data, isOwner); }
01809 
01818          void New( const Dimension1d &d, T *data = 0, bool isOwner = false ) { New(d.w, data, isOwner); }
01819 
01828          void New( const PobjectProps &p, T *data = 0, bool isOwner = false ) { New(p.ncol, data, isOwner); ColorSpace(p.colorspace); }
01829 
01834          Pobject* Clone( ) const {
01835             Img1d <  T > *tmp = new Img1d <  T >(ncol);
01836             *tmp = *this;
01837             return tmp;
01838          }
01839    
01840          // No inheritance of operator= ! Overload.
01841          /*   
01842           * Sets all pixels with the given value.
01843           * @param val  the given value.
01844           * @return the image itself.
01845           */
01846          Img1d <  T > &operator=( const T val ) {
01847             Imx1d < T>::operator=(val);
01848             return *this;
01849          }
01850 
01857          template< typename U >
01858          Img1d <  T > &operator=( const Img1d <  U > &src ) {
01859             Imx1d < T>::operator=(src);
01860             return *this;
01861          }
01862 
01869          Img1d <  T > &operator=( const Img1d <  T > &src ) {
01870             Imx1d < T>::operator=(src);
01871             return *this;
01872          }
01873 
01877          ValueType* Vector( ) const { return Imx1d < T>::Vector( 0 ); }
01878 
01883          ValueType &operator[]( Long col ) { return Imx1d < T>::operator()(0, col); }
01884 
01889          const ValueType &operator[]( Long col ) const { return Imx1d < T>::operator()(0, col); }
01890 
01896          ValueType &operator()( Long x ) { return Imx1d < T>::operator()(0, x); }
01897 
01902          ValueType &operator[]( const Point1d &p ) { return Imx1d < T>::operator()(0, p.x); }
01903 
01908          const ValueType &operator[]( const Point1d &p ) const { return Imx1d < T>::operator()(0, p.x); }
01909 
01914          ValueType &operator()( const Point1d &p ) { return Imx1d < T>::operator()(0, p.x); }
01915 
01920          const ValueType &operator()( const Point1d &p ) const { return Imx1d < T>::operator()(0, p.x); }
01921 
01928          Img1d( const Img1d  &ims ): Imx1d < T>()  { New(ims.Props()); *this = ims; }
01929    };
01930 
01934 
01942    template< typename T > 
01943    class Img2d: public Imx2d < T> {
01944       protected:
01945          using Imx2d < T>::nbands;
01946          using Imx2d < T>::nrow;
01947          using Imx2d < T>::ncol;
01948          using Imx2d < T>::ColorSpace;
01949 
01950       public:
01952          typedef T ValueType;
01953 
01957          Typobj Type( ) const { return ( Typobj )Po_type< Img2d <  T > >::type; }
01958 
01962          std::string Name( ) const { return TypeName< Img2d < T > >::Name( ); }
01963 
01967          Img2d( ): Imx2d < T>( ) {}
01968 
01979          Img2d( Long h, Long w, T *data = 0, bool isOwner = false ): Imx2d < T>( ) { New(h, w, data, isOwner); }
01980 
01990          Img2d( const Dimension2d &d, T *data = 0, bool isOwner = false ): Imx2d < T>( ) { New(d.h, d.w, data, isOwner); }
01991    
02002          Img2d( const PobjectProps &p, T *data = 0, bool isOwner = false ): Imx2d < T>( ) { New(p, data, isOwner); }
02003 
02013          void New( Long h, Long w, T *data = 0, bool isOwner = false ) { Imx2d < T>::New(1, h, w, data, isOwner); }
02014 
02023          void New( const Dimension2d &d, T *data = 0, bool isOwner = false ) { New(d.h, d.w, data, isOwner); }
02024 
02033          void New( const PobjectProps &p, T *data = 0, bool isOwner = false ) { New(p.nrow, p.ncol, data, isOwner); ColorSpace(p.colorspace); }
02034  
02039          Pobject* Clone( ) const {
02040             Img2d <  T > *tmp = new Img2d <  T >(nrow, ncol);
02041             *tmp = *this;
02042             return tmp;
02043          }
02044          // No inheritance of operator= ! Overload.
02045 
02046          /*   
02047           * Sets all pixels with the given value.
02048           * @param val  the given value.
02049           * @return the image itself.
02050           */
02051          Img2d <  T > &operator=( const T val ) {
02052             Imx2d < T>::operator=( val );
02053             return *this;
02054          }
02055 
02062          template< typename U >
02063          Img2d <  T > &operator=( const Img2d <  U > &src ) {
02064             Imx2d < T>::operator=( src );
02065             return *this;
02066          }
02067 
02074          Img2d <  T > &operator=( const Img2d <  T > &src ) {
02075             Imx2d < T>::operator=( src );
02076             return *this;
02077          }
02078 
02082          ValueType* Vector( ) const {
02083             return Imx2d < T>::Vector( 0 );
02084          }
02085 
02086 
02091          typename Imx3d < T>::Band1d operator[]( Long row ) { return Imx2d < T>::operator[](0)[row]; }
02092 
02097          const typename Imx3d < T>::Band1d operator[]( Long row ) const { return Imx2d < T>::operator[](0)[row]; }
02098 
02105          ValueType &operator()( Long y, Long x ) { return Imx2d < T>::operator()(0, y, x); }
02106 
02113          const ValueType &operator()( Long y, Long x ) const { return Imx2d < T>::operator()(0, y, x); }
02114 
02119          ValueType &operator[]( const Point2d &p ) { return Imx2d < T>::operator()(0, p.y, p.x); }
02120 
02125          const ValueType &operator[]( const Point2d &p ) const { return Imx2d < T>::operator()(0, p.y, p.x); }
02126 
02131          ValueType &operator()( int, const Point2d &p ) { return Imx2d < T>::operator()(0, p.y, p.x); }
02132 
02137          const ValueType &operator()( int, const Point2d &p ) const { return Imx2d < T>::operator()(0, p.y, p.x); }
02138 
02143          ValueType &operator()( const Point2d &p ) { return Imx2d < T>::operator()(0, p.y, p.x); }
02144 
02149          const ValueType &operator()( const Point2d &p ) const { return Imx2d < T>::operator()(0, p.y, p.x); }
02150 
02157          Img2d( const Img2d  &ims ): Imx2d < T>() { New(ims.Props()); *this = ims; }
02158    };
02159 
02163 
02171    template <typename T>
02172    class Img3d: public Imx3d < T> {
02173       protected:
02174          using Imx3d < T>::nbands;
02175          using Imx3d < T>::ncol;
02176          using Imx3d < T>::nrow;
02177          using Imx3d < T>::ndep;
02178          using Imx3d < T>::ColorSpace;
02179 
02180       public:
02182          typedef T ValueType;
02183 
02184 
02188          Typobj Type( ) const { return ( Typobj )Po_type< Img3d <  T > >::type; }
02189 
02193          std::string Name( ) const { return TypeName< Img3d < T > >::Name( ); }
02194 
02198          Img3d( ): Imx3d < T>( ) { }
02199    
02211          Img3d( Long d, Long h, Long w, T *data = 0, bool isOwner = false ): Imx3d < T>( ) { New(d, h, w, data, isOwner); }
02212    
02222          Img3d( const Dimension3d &d, T *data = 0, bool isOwner = false ): Imx3d < T>( ) { New(d.d, d.h, d.w, data, isOwner); }
02223    
02234          Img3d( const PobjectProps &p, T *data = 0, bool isOwner = false ): Imx3d < T>( ) { New(p, data, isOwner); }
02235    
02246          void New( Long d, Long h, Long w, T *data = 0, bool isOwner = false ) {
02247             Imx3d < T>::New(1, d, h, w, data, isOwner);
02248          }
02249 
02258          void New( const Dimension3d &d, T *data = 0, bool isOwner = false ) {
02259             New(d.d, d.h, d.w, data, isOwner);
02260          }
02261 
02270          void New( const PobjectProps &p, T *data = 0, bool isOwner = false ) {
02271             New(p.ndep, p.nrow, p.ncol, data, isOwner);
02272             ColorSpace(p.colorspace);
02273          }
02274 
02279          Pobject* Clone( ) const {
02280             Img3d <  T > *tmp = new Img3d <  T >(ndep, nrow, ncol);
02281             *tmp = *this;
02282             return tmp;
02283          }
02284 
02285          // No inheritance of operator= ! Overload.
02286 
02287          /*   
02288           * Sets all pixels with the given value.
02289           * @param val  the given value.
02290           * @return the image itself.
02291           */
02292          Img3d <  T > &operator=( const T val ) {
02293             Imx3d < T>::operator=( val );
02294             return *this;
02295          }
02296 
02303          template< typename U >
02304          Img3d <  T > &operator=( const Img3d <  U > &src ) { Imx3d < T>::operator=( src ); return *this; }
02305 
02312          Img3d <  T > &operator=( const Img3d <  T > &src ) { Imx3d < T>::operator=( src ); return *this; }
02313 
02317          ValueType* Vector( ) const { return Imx3d < T>::Vector(0); }
02318 
02323          typename Imx3d < T>::Band2d operator[]( Long dep ) { return Imx3d < T>::operator[](0)[dep]; }
02324          
02329          const typename Imx3d < T>::Band2d operator[]( Long dep ) const { return Imx3d < T>::operator[](0)[dep]; }
02330 
02338          ValueType &operator()( Long z, Long y, Long x ) { return Imx3d < T>::operator()(0, z, y, x); }
02339 
02347          const ValueType &operator()( Long z, Long y, Long x ) const { return Imx3d < T>::operator()(0, z, y, x); }
02348 
02353          ValueType &operator[]( const Point3d &p ) {return operator()(p.z, p.y, p.x); }
02354 
02359          const ValueType &operator[]( const Point3d &p ) const { return operator()(p.z, p.y, p.x); }
02360 
02365          ValueType &operator()( const Point3d &p ) {return operator()(p.z, p.y, p.x); }
02366 
02371          const ValueType &operator()( const Point3d &p ) const { return operator()(p.z, p.y, p.x); }
02372 
02377          const ValueType &operator()( int, const Point3d &p ) const { return operator()(p.z, p.y, p.x); }
02378 
02383          ValueType &operator()( int, const Point3d &p ) {return operator()(p.z, p.y, p.x); }
02384 
02391          Img3d( const Img3d  &ims ): Imx3d < T>() {
02392             New(ims.Props());
02393             *this = ims;
02394          }
02395    };
02396 
02400 
02408    template< typename T > 
02409    class Imc2d: public Imx2d < T> {
02410       protected:
02411          using Imx2d < T>::nbands;
02412          using Imx2d < T>::ncol;
02413          using Imx2d < T>::nrow;
02414          
02415       public:
02416          using Imx2d < T>::ColorSpace;
02417 
02419          typedef T ValueType;
02420 
02422          typename Imx3d < T>::Band2d X;
02423 
02425          typename Imx3d < T>::Band2d Y;
02426 
02428          typename Imx3d < T>::Band2d Z;
02429 
02433          Typobj Type( ) const { return ( Typobj )Po_type< Imc2d <  T > >::type; }
02434 
02438          std::string Name( ) const { return TypeName< Imc2d < T > >::Name( ); }
02439 
02443          Imc2d( ): Imx2d < T>( ) { }
02444 
02455          Imc2d( Long h, Long w, T *data = 0, bool isOwner = false ): Imx2d < T> ( ) {
02456             New(h, w, data, isOwner);
02457          }
02458 
02468          Imc2d( const Dimension2d &d, T *data = 0, bool isOwner = false ): Imx2d < T>( ) {
02469             New(d, data, isOwner);
02470          }
02471 
02485          Imc2d( Long b, const Dimension2d &d, T *data = 0, bool isOwner = false ): Imx2d < T>( ) {
02486             New(b, d.h, d.w, data, isOwner);
02487          }
02488 
02500          Imc2d( Long b, Long h, Long w, T *data = 0, bool isOwner = false ): Imx2d < T>( ) {
02501             New(b, h, w, data, isOwner);
02502          }
02503          
02514          Imc2d( const PobjectProps &p, T *data = 0, bool isOwner = false ): Imx2d < T>( ) {
02515             New(p, data, isOwner);
02516          }
02517 
02528          void New( Long h, Long w, T *data = 0, bool isOwner = false ) {
02529             Imx2d < T>::New(3, h, w, data, isOwner);
02530             // Kept for sake of compatibility.
02531             X.New(this, Imx2d < T>::Vector(0));
02532             Y.New(this, Imx2d < T>::Vector(1));
02533             Z.New(this, Imx2d < T>::Vector(2));
02534          }
02535 
02547          void New( Long /*b*/, Long h, Long w, T *data = 0, bool isOwner = false ) { New(h, w, data, isOwner); }
02548 
02558          void New( const Dimension2d &d, T *data = 0, bool isOwner = false ) { New(d.h, d.w, data, isOwner); }
02559 
02570          void New( Long /*b*/, const Dimension2d &d, T *data = 0, bool isOwner = false ) { New(d.h, d.w, data, isOwner); }
02571 
02578          void New( const PobjectProps &p, T *data = 0, bool isOwner = false ) {
02579             ColorSpace(p.colorspace);
02580             New(p.nrow, p.ncol, data, isOwner);
02581          }
02582 
02589          Pobject* Clone( ) const {
02590             Imc2d <  T > *tmp = new Imc2d <  T >(nrow, ncol);
02591             *tmp = *this;
02592             return tmp;
02593          }
02594    
02595          // No inheritance of operator=( ) ! Overload.
02596 
02597          /*   
02598           * Sets all pixels with the given value.
02599           * @param val  the given value.
02600           * @return the image itself.
02601           */
02602          Imc2d <  T > &operator=( const T val ) {
02603             Imx2d < T>::operator=( val );
02604             return *this;
02605          }
02606 
02613          template< typename U >
02614          Imc2d <  T > &operator=( const Imc2d <  U > &src ) { Imx2d < T>::operator=( src ); return *this; }
02615 
02622          Imc2d <  T > &operator=( const Imc2d <  T > &src ) { Imx2d < T>::operator=( src ); return *this; }
02623 
02628          ValueType* VectorX( ) const { return Imx2d < T>::Vector( 0 ); }
02629 
02634          ValueType* VectorY( ) const { return Imx2d < T>::Vector( 1 ); }
02635 
02640          ValueType* VectorZ( ) const { return Imx2d < T>::Vector( 2 ); }
02641 
02642          // Transfer
02650          Errc LoadAttributes( FILE *file ) {
02651             Long attr[3];
02652 
02653             if (this->Fdecode((void*)attr, sizeof(*attr), 3, file) < 3) {
02654                return FAILURE;
02655             }
02656             New(attr[1], attr[2]);
02657       
02658             PColorSpace c;
02659             if (this->Fdecode((void*)&c, sizeof(c), 1, file) < 1) {
02660                return FAILURE;
02661             }
02662             ColorSpace(c);
02663             return SUCCESS;
02664          }
02665    
02671          Errc SaveAttributes( FILE *file ) const {
02672             if (Imx2d < T>::SaveAttributes(file) == FAILURE) {
02673                return FAILURE;
02674             }
02675       
02676             PColorSpace c = ColorSpace();
02677             if (this->Fencode((void*)&c, sizeof(c), 1, file) < 1) {
02678                return FAILURE;
02679             }
02680             return SUCCESS;
02681          }
02682    
02689          Imc2d( const Imc2d  &ims ): Imx2d < T>() {
02690             New(ims.Props());
02691             *this = ims;
02692          }
02693    };
02694    
02698 
02706    template< typename T > 
02707    class Imc3d: public Imx3d < T> {
02708       protected:
02709          using Imx3d < T>::nbands;
02710          using Imx3d < T>::ncol;
02711          using Imx3d < T>::nrow;
02712          using Imx3d < T>::ndep;
02713 
02714       public:
02715          using Imx3d < T>::ColorSpace;
02716 
02718          typedef T ValueType;
02719 
02721          typename Imx3d < T>::Band3d X;
02722 
02724          typename Imx3d < T>::Band3d Y;
02725 
02727          typename Imx3d < T>::Band3d Z;
02728 
02732          Typobj Type( ) const { return ( Typobj )Po_type< Imc3d <  T > >::type; }
02733 
02737          std::string Name( ) const { return TypeName< Imc3d <T> >::Name( ); }
02738 
02742          Imc3d( ): Imx3d < T>( ) { }
02743 
02756          Imc3d( Long b, Long d, Long h, Long w, T *data = 0, bool isOwner = false ): Imx3d < T>( ) { New(b, d, h, w, data, isOwner); }
02757 
02768          Imc3d( Long b, const Dimension3d &d, T *data = 0, bool isOwner = false ): Imx3d < T>( ) { New(b, d, data, isOwner); }
02769 
02781          Imc3d( Long d, Long h, Long w, T *data = 0, bool isOwner = false ): Imx3d < T>( ) { New(d, h, w, data, isOwner); }
02782 
02792          Imc3d( const Dimension3d &d, T *data = 0, bool isOwner = false ): Imx3d < T>( ) { New(d, data, isOwner); }
02793  
02804          Imc3d( const PobjectProps &p, T *data = 0, bool isOwner = false ): Imx3d < T>( ) { New(p, data, isOwner); }
02805    
02818          void New( Long /*b*/, Long d, Long h, Long w, T *data = 0, bool isOwner = false ) { New(d, h, w, data, isOwner); } 
02819 
02830          void New( Long /*b*/, const Dimension3d &d, T *data = 0, bool isOwner = false ) { New(d.d, d.h, d.w, data, isOwner); }
02831 
02843          void New( Long d, Long h, Long w, T *data = 0, bool isOwner = false ) {
02844             Imx3d < T>::New(3, d, h, w, data, isOwner);
02845             // Kept for sake of compatibility.
02846             X.New(this, Imx3d < T>::Vector(0));
02847             Y.New(this, Imx3d < T>::Vector(1));
02848             Z.New(this, Imx3d < T>::Vector(2));
02849          }
02859          void New( const Dimension3d &d, T *data = 0, bool isOwner = false ) {
02860             New(d.d, d.h, d.w, data, isOwner);
02861          }
02862 
02869          void New( const PobjectProps &p, T* data = 0, bool isOwner = false ) {
02870             ColorSpace(p.colorspace);
02871             New(p.ndep, p.nrow, p.ncol, data, isOwner);
02872          }
02873 
02878          Pobject* Clone( ) const {
02879             Imc3d <  T > *tmp = new Imc3d <  T >(ndep, nrow, ncol);
02880             *tmp = *this;
02881             return tmp;
02882          }
02883    
02884          // No inheritance of operator= ! Overload.
02885 
02886          /*
02887           * Sets all pixels with the given value.
02888           * @param val  the given value.
02889           * @return the image itself.
02890           */
02891          Imc3d <  T > &operator=( const T val ) {
02892             Imx3d < T>::operator=(val);
02893             return *this;
02894          }
02895 
02902          template< typename U >
02903          Imc3d <  T > &operator=( const Imc3d <  U > &src ) {
02904             Imx3d < T>::operator=(src);
02905             return *this;
02906          }
02907 
02914          Imc3d <  T > &operator=( const Imc3d <  T > &src ) {
02915             Imx3d < T>::operator=(src);
02916             return *this;
02917          }
02918 
02923          ValueType* VectorX( ) const {
02924             return Imx3d < T>::Vector(0);
02925          }
02926 
02931          ValueType* VectorY( ) const {
02932             return Imx3d < T>::Vector(1);
02933          }
02934    
02939          ValueType* VectorZ( ) const {
02940             return Imx3d < T>::Vector(2);
02941          }
02942 
02950          Errc LoadAttributes( FILE *file ) {
02951             Long attr[4];
02952             // Remarque ; attr[0] = nbands. Always =3.
02953             if (this->Fdecode((void*)attr, sizeof(*attr), 4, file) < 4) {
02954                return FAILURE;
02955             }
02956             New(attr[1], attr[2], attr[3]);
02957       
02958             PColorSpace c;
02959             if (this->Fdecode((void*)&c, sizeof(c), 1, file) < 1) {
02960                return FAILURE;
02961             }
02962             ColorSpace(c);
02963             return SUCCESS;
02964          }
02965 
02971          Errc SaveAttributes( FILE *file ) const {
02972             if (Imx3d < T>::SaveAttributes(file) == FAILURE) {
02973                return FAILURE;
02974             }
02975             PColorSpace c=ColorSpace();
02976             if (this->Fencode((void*)&c, sizeof(c), 1, file) < 1) {
02977                return FAILURE;
02978             }
02979             return SUCCESS;
02980          }
02981    
02988          Imc3d( const Imc3d  &ims ): Imx3d < T>() { New(ims.Props()); *this = ims; }
02989    };
02990 
02991    typedef Imx1d < Uchar>  Imx1duc;
02992    typedef Imx1d < Long>   Imx1dsl;
02993    typedef Imx1d < Float>  Imx1dsf;
02994 
02995    typedef Imx2d < Uchar>  Imx2duc;
02996    typedef Imx2d < Long>   Imx2dsl;
02997    typedef Imx2d < Float>  Imx2dsf;
02998 
02999    typedef Imx3d < Uchar>  Imx3duc;
03000    typedef Imx3d < Long>   Imx3dsl;
03001    typedef Imx3d < Float>  Imx3dsf;
03002 
03003    typedef Img1d < Uchar>  Img1duc;
03004    typedef Img1d < Long>   Img1dsl;
03005    typedef Img1d < Float>  Img1dsf;
03006 
03007    typedef Img2d < Uchar>  Img2duc;
03008    typedef Img2d < Long>   Img2dsl;
03009    typedef Img2d < Float>  Img2dsf;
03010 
03011    typedef Img3d < Uchar>  Img3duc;
03012    typedef Img3d < Long>   Img3dsl;
03013    typedef Img3d < Float>  Img3dsf;
03014 
03015    typedef Imc2d < Uchar>  Imc2duc;
03016    typedef Imc2d < Long>   Imc2dsl;
03017    typedef Imc2d < Float>  Imc2dsf;
03018 
03019    typedef Imc3d < Uchar>  Imc3duc;
03020    typedef Imc3d < Long>   Imc3dsl;
03021    typedef Imc3d < Float>  Imc3dsf;
03022 
03023 /* @brief The magic number for the type Img1duc.
03024  *
03025  * Po_Type is an helper class that defines the
03026  * magic number for the type Img1duc.
03027  */
03028    template<> struct Po_type<Img1duc> {
03029          enum {type = Po_Img1duc };
03030    };
03031 
03032 /* @brief Trait that returns the name of the Pandore type Img1duc.
03033  *
03034  * TypeName is a trait that returns the name
03035  * of the Pandore type T.
03036  */
03037    template<> struct TypeName< Img1duc > {
03038          static std::string Name( ) { return "Img1duc"; }
03039    };
03040 /* @brief The magic number for the type Img1dsl.
03041  *
03042  * Po_Type is an helper class that defines the
03043  * magic number for the type Img1dsl.
03044  */
03045    template<> struct Po_type<Img1dsl> {
03046          enum {type = Po_Img1dsl };
03047    };
03048 
03049 /* @brief Trait that returns the name of the Pandore type Img1dsl.
03050  *
03051  * TypeName is a trait that returns the name
03052  * of the Pandore type T.
03053  */
03054    template<> struct TypeName< Img1dsl > {
03055          static std::string Name( ) { return "Img1dsl"; }
03056    };
03057 /* @brief The magic number for the type Img1dsf.
03058  *
03059  * Po_Type is an helper class that defines the
03060  * magic number for the type Img1dsf.
03061  */
03062    template<> struct Po_type<Img1dsf> {
03063          enum {type = Po_Img1dsf };
03064    };
03065 
03066 /* @brief Trait that returns the name of the Pandore type Img1dsf.
03067  *
03068  * TypeName is a trait that returns the name
03069  * of the Pandore type T.
03070  */
03071    template<> struct TypeName< Img1dsf > {
03072          static std::string Name( ) { return "Img1dsf"; }
03073    };
03074 /* @brief The magic number for the type Img2duc.
03075  *
03076  * Po_Type is an helper class that defines the
03077  * magic number for the type Img2duc.
03078  */
03079    template<> struct Po_type<Img2duc> {
03080          enum {type = Po_Img2duc };
03081    };
03082 
03083 /* @brief Trait that returns the name of the Pandore type Img2duc.
03084  *
03085  * TypeName is a trait that returns the name
03086  * of the Pandore type T.
03087  */
03088    template<> struct TypeName< Img2duc > {
03089          static std::string Name( ) { return "Img2duc"; }
03090    };
03091 /* @brief The magic number for the type Img2dsl.
03092  *
03093  * Po_Type is an helper class that defines the
03094  * magic number for the type Img2dsl.
03095  */
03096    template<> struct Po_type<Img2dsl> {
03097          enum {type = Po_Img2dsl };
03098    };
03099 
03100 /* @brief Trait that returns the name of the Pandore type Img2dsl.
03101  *
03102  * TypeName is a trait that returns the name
03103  * of the Pandore type T.
03104  */
03105    template<> struct TypeName< Img2dsl > {
03106          static std::string Name( ) { return "Img2dsl"; }
03107    };
03108 /* @brief The magic number for the type Img2dsf.
03109  *
03110  * Po_Type is an helper class that defines the
03111  * magic number for the type Img2dsf.
03112  */
03113    template<> struct Po_type<Img2dsf> {
03114          enum {type = Po_Img2dsf };
03115    };
03116 
03117 /* @brief Trait that returns the name of the Pandore type Img2dsf.
03118  *
03119  * TypeName is a trait that returns the name
03120  * of the Pandore type T.
03121  */
03122    template<> struct TypeName< Img2dsf > {
03123          static std::string Name( ) { return "Img2dsf"; }
03124    };
03125 /* @brief The magic number for the type Img3duc.
03126  *
03127  * Po_Type is an helper class that defines the
03128  * magic number for the type Img3duc.
03129  */
03130    template<> struct Po_type<Img3duc> {
03131          enum {type = Po_Img3duc };
03132    };
03133 
03134 /* @brief Trait that returns the name of the Pandore type Img3duc.
03135  *
03136  * TypeName is a trait that returns the name
03137  * of the Pandore type T.
03138  */
03139    template<> struct TypeName< Img3duc > {
03140          static std::string Name( ) { return "Img3duc"; }
03141    };
03142 /* @brief The magic number for the type Img3dsl.
03143  *
03144  * Po_Type is an helper class that defines the
03145  * magic number for the type Img3dsl.
03146  */
03147    template<> struct Po_type<Img3dsl> {
03148          enum {type = Po_Img3dsl };
03149    };
03150 
03151 /* @brief Trait that returns the name of the Pandore type Img3dsl.
03152  *
03153  * TypeName is a trait that returns the name
03154  * of the Pandore type T.
03155  */
03156    template<> struct TypeName< Img3dsl > {
03157          static std::string Name( ) { return "Img3dsl"; }
03158    };
03159 /* @brief The magic number for the type Img3dsf.
03160  *
03161  * Po_Type is an helper class that defines the
03162  * magic number for the type Img3dsf.
03163  */
03164    template<> struct Po_type<Img3dsf> {
03165          enum {type = Po_Img3dsf };
03166    };
03167 
03168 /* @brief Trait that returns the name of the Pandore type Img3dsf.
03169  *
03170  * TypeName is a trait that returns the name
03171  * of the Pandore type T.
03172  */
03173    template<> struct TypeName< Img3dsf > {
03174          static std::string Name( ) { return "Img3dsf"; }
03175    };
03176 /* @brief The magic number for the type Imc2duc.
03177  *
03178  * Po_Type is an helper class that defines the
03179  * magic number for the type Imc2duc.
03180  */
03181    template<> struct Po_type<Imc2duc> {
03182          enum {type = Po_Imc2duc };
03183    };
03184 
03185 /* @brief Trait that returns the name of the Pandore type Imc2duc.
03186  *
03187  * TypeName is a trait that returns the name
03188  * of the Pandore type T.
03189  */
03190    template<> struct TypeName< Imc2duc > {
03191          static std::string Name( ) { return "Imc2duc"; }
03192    };
03193 /* @brief The magic number for the type Imc2dsl.
03194  *
03195  * Po_Type is an helper class that defines the
03196  * magic number for the type Imc2dsl.
03197  */
03198    template<> struct Po_type<Imc2dsl> {
03199          enum {type = Po_Imc2dsl };
03200    };
03201 
03202 /* @brief Trait that returns the name of the Pandore type Imc2dsl.
03203  *
03204  * TypeName is a trait that returns the name
03205  * of the Pandore type T.
03206  */
03207    template<> struct TypeName< Imc2dsl > {
03208          static std::string Name( ) { return "Imc2dsl"; }
03209    };
03210 /* @brief The magic number for the type Imc2dsf.
03211  *
03212  * Po_Type is an helper class that defines the
03213  * magic number for the type Imc2dsf.
03214  */
03215    template<> struct Po_type<Imc2dsf> {
03216          enum {type = Po_Imc2dsf };
03217    };
03218 
03219 /* @brief Trait that returns the name of the Pandore type Imc2dsf.
03220  *
03221  * TypeName is a trait that returns the name
03222  * of the Pandore type T.
03223  */
03224    template<> struct TypeName< Imc2dsf > {
03225          static std::string Name( ) { return "Imc2dsf"; }
03226    };
03227 /* @brief The magic number for the type Imc3duc.
03228  *
03229  * Po_Type is an helper class that defines the
03230  * magic number for the type Imc3duc.
03231  */
03232    template<> struct Po_type<Imc3duc> {
03233          enum {type = Po_Imc3duc };
03234    };
03235 
03236 /* @brief Trait that returns the name of the Pandore type Imc3duc.
03237  *
03238  * TypeName is a trait that returns the name
03239  * of the Pandore type T.
03240  */
03241    template<> struct TypeName< Imc3duc > {
03242          static std::string Name( ) { return "Imc3duc"; }
03243    };
03244 /* @brief The magic number for the type Imc3dsl.
03245  *
03246  * Po_Type is an helper class that defines the
03247  * magic number for the type Imc3dsl.
03248  */
03249    template<> struct Po_type<Imc3dsl> {
03250          enum {type = Po_Imc3dsl };
03251    };
03252 
03253 /* @brief Trait that returns the name of the Pandore type Imc3dsl.
03254  *
03255  * TypeName is a trait that returns the name
03256  * of the Pandore type T.
03257  */
03258    template<> struct TypeName< Imc3dsl > {
03259          static std::string Name( ) { return "Imc3dsl"; }
03260    };
03261 /* @brief The magic number for the type Imc3dsf.
03262  *
03263  * Po_Type is an helper class that defines the
03264  * magic number for the type Imc3dsf.
03265  */
03266    template<> struct Po_type<Imc3dsf> {
03267          enum {type = Po_Imc3dsf };
03268    };
03269 
03270 /* @brief Trait that returns the name of the Pandore type Imc3dsf.
03271  *
03272  * TypeName is a trait that returns the name
03273  * of the Pandore type T.
03274  */
03275    template<> struct TypeName< Imc3dsf > {
03276          static std::string Name( ) { return "Imc3dsf"; }
03277    };
03278 /* @brief The magic number for the type Imx1duc.
03279  *
03280  * Po_Type is an helper class that defines the
03281  * magic number for the type Imx1duc.
03282  */
03283    template<> struct Po_type<Imx1duc> {
03284          enum {type = Po_Imx1duc };
03285    };
03286 
03287 /* @brief Trait that returns the name of the Pandore type Imx1duc.
03288  *
03289  * TypeName is a trait that returns the name
03290  * of the Pandore type T.
03291  */
03292    template<> struct TypeName< Imx1duc > {
03293          static std::string Name( ) { return "Imx1duc"; }
03294    };
03295 /* @brief The magic number for the type Imx1dsl.
03296  *
03297  * Po_Type is an helper class that defines the
03298  * magic number for the type Imx1dsl.
03299  */
03300    template<> struct Po_type<Imx1dsl> {
03301          enum {type = Po_Imx1dsl };
03302    };
03303 
03304 /* @brief Trait that returns the name of the Pandore type Imx1dsl.
03305  *
03306  * TypeName is a trait that returns the name
03307  * of the Pandore type T.
03308  */
03309    template<> struct TypeName< Imx1dsl > {
03310          static std::string Name( ) { return "Imx1dsl"; }
03311    };
03312 /* @brief The magic number for the type Imx1dsf.
03313  *
03314  * Po_Type is an helper class that defines the
03315  * magic number for the type Imx1dsf.
03316  */
03317    template<> struct Po_type<Imx1dsf> {
03318          enum {type = Po_Imx1dsf };
03319    };
03320 
03321 /* @brief Trait that returns the name of the Pandore type Imx1dsf.
03322  *
03323  * TypeName is a trait that returns the name
03324  * of the Pandore type T.
03325  */
03326    template<> struct TypeName< Imx1dsf > {
03327          static std::string Name( ) { return "Imx1dsf"; }
03328    };
03329 /* @brief The magic number for the type Imx2duc.
03330  *
03331  * Po_Type is an helper class that defines the
03332  * magic number for the type Imx2duc.
03333  */
03334    template<> struct Po_type<Imx2duc> {
03335          enum {type = Po_Imx2duc };
03336    };
03337 
03338 /* @brief Trait that returns the name of the Pandore type Imx2duc.
03339  *
03340  * TypeName is a trait that returns the name
03341  * of the Pandore type T.
03342  */
03343    template<> struct TypeName< Imx2duc > {
03344          static std::string Name( ) { return "Imx2duc"; }
03345    };
03346 /* @brief The magic number for the type Imx2dsl.
03347  *
03348  * Po_Type is an helper class that defines the
03349  * magic number for the type Imx2dsl.
03350  */
03351    template<> struct Po_type<Imx2dsl> {
03352          enum {type = Po_Imx2dsl };
03353    };
03354 
03355 /* @brief Trait that returns the name of the Pandore type Imx2dsl.
03356  *
03357  * TypeName is a trait that returns the name
03358  * of the Pandore type T.
03359  */
03360    template<> struct TypeName< Imx2dsl > {
03361          static std::string Name( ) { return "Imx2dsl"; }
03362    };
03363 /* @brief The magic number for the type Imx2dsf.
03364  *
03365  * Po_Type is an helper class that defines the
03366  * magic number for the type Imx2dsf.
03367  */
03368    template<> struct Po_type<Imx2dsf> {
03369          enum {type = Po_Imx2dsf };
03370    };
03371 
03372 /* @brief Trait that returns the name of the Pandore type Imx2dsf.
03373  *
03374  * TypeName is a trait that returns the name
03375  * of the Pandore type T.
03376  */
03377    template<> struct TypeName< Imx2dsf > {
03378          static std::string Name( ) { return "Imx2dsf"; }
03379    };
03380 /* @brief The magic number for the type Imx3duc.
03381  *
03382  * Po_Type is an helper class that defines the
03383  * magic number for the type Imx3duc.
03384  */
03385    template<> struct Po_type<Imx3duc> {
03386          enum {type = Po_Imx3duc };
03387    };
03388 
03389 /* @brief Trait that returns the name of the Pandore type Imx3duc.
03390  *
03391  * TypeName is a trait that returns the name
03392  * of the Pandore type T.
03393  */
03394    template<> struct TypeName< Imx3duc > {
03395          static std::string Name( ) { return "Imx3duc"; }
03396    };
03397 /* @brief The magic number for the type Imx3dsl.
03398  *
03399  * Po_Type is an helper class that defines the
03400  * magic number for the type Imx3dsl.
03401  */
03402    template<> struct Po_type<Imx3dsl> {
03403          enum {type = Po_Imx3dsl };
03404    };
03405 
03406 /* @brief Trait that returns the name of the Pandore type Imx3dsl.
03407  *
03408  * TypeName is a trait that returns the name
03409  * of the Pandore type T.
03410  */
03411    template<> struct TypeName< Imx3dsl > {
03412          static std::string Name( ) { return "Imx3dsl"; }
03413    };
03414 /* @brief The magic number for the type Imx3dsf.
03415  *
03416  * Po_Type is an helper class that defines the
03417  * magic number for the type Imx3dsf.
03418  */
03419    template<> struct Po_type<Imx3dsf> {
03420          enum {type = Po_Imx3dsf };
03421    };
03422 
03423 /* @brief Trait that returns the name of the Pandore type Imx3dsf.
03424  *
03425  * TypeName is a trait that returns the name
03426  * of the Pandore type T.
03427  */
03428    template<> struct TypeName< Imx3dsf > {
03429          static std::string Name( ) { return "Imx3dsf"; }
03430    };
03431 
03432 } //End of pandore:: namespace
03433 
03434 #endif // __PIMAGEH__

The Pantheon project
Image Team GREYC Laboratory
UMR CNRS 6072 - ENSICAEN - University of Caen, France
This page was last modified on