Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

HxDataPtr3dScalarTem.h

00001 /*
00002  *  Copyright (c) 1998, University of Amsterdam, The Netherlands.
00003  *  All rights reserved.
00004  *
00005  *
00006  *  Author(s):
00007  *  Dennis Koelma (koelma@wins.uva.nl)
00008  *  Edo Poll (poll@wins.uva.nl)
00009  */
00010 
00011 #ifndef HxDataPtr3dScalarTem_h
00012 #define HxDataPtr3dScalarTem_h
00013 
00014 #include <stddef.h>
00015 #include "HxIncludedNonnative.h"
00016 
00017 
00020 template<class PixelT, class ArithT>
00021 class HxDataPtr3dScalarTem {
00022 public:
00023                             HxDataPtr3dScalarTem(
00024                                 PixelT* data, int width, int height);
00025                             HxDataPtr3dScalarTem(
00026                                 PixelT* data, size_t* size);
00027                             HxDataPtr3dScalarTem(
00028                                 const HxDataPtr3dScalarTem& rhs);
00029 
00030     HxDataPtr3dScalarTem&   operator=(const HxDataPtr3dScalarTem& rhs);
00031 
00032     void                    incX(); // will increase y when x > width, and z
00033     void                    decX(); // will decrease y when x < 0, and z
00034     void                    incY();
00035     void                    decY();
00036     void                    incZ();
00037     void                    decZ();
00038     void                    incX(int off);
00039     void                    decX(int off);
00040     void                    incY(int off);
00041     void                    decY(int off);
00042     void                    incZ(int off);
00043     void                    decZ(int off);
00044 
00045     void                    incXYZ(int xOff, int yOff, int zOff);
00046     void                    decXYZ(int xOff, int yOff, int zOff);
00047 
00048     ArithT                  read();
00049     void                    write(const ArithT& val);
00050     ArithT                  readIncX() { return ArithT(*_ptr++); }
00051     void                    writeIncX(const ArithT& val)
00052                                 { *_ptr++ = PixelT(val.x()); }
00053 
00054     void                    vprint();
00055 
00056     PixelT*                 data() { return _ptr; }
00057 
00058 private:
00059     int                     _width;
00060     int                     _height;
00061     int                     _wxh;
00062     PixelT*                 _ptr;
00063 };
00064 
00065 template<class PixelT, class ArithT>
00066 inline
00067 HxDataPtr3dScalarTem<PixelT,ArithT>::HxDataPtr3dScalarTem(
00068     PixelT* data, int width, int height)
00069 {
00070     _width = width;
00071     _height = height;
00072     _wxh = _width * _height;
00073     _ptr = data;
00074 }
00075 
00076 template<class PixelT, class ArithT>
00077 inline
00078 HxDataPtr3dScalarTem<PixelT,ArithT>::HxDataPtr3dScalarTem(
00079     PixelT* data, size_t* size)
00080 {
00081     _width = size[0];
00082     _height = size[1];
00083     _wxh = _width * _height;
00084     _ptr = data;
00085 }
00086 
00087 template<class PixelT, class ArithT>
00088 inline
00089 HxDataPtr3dScalarTem<PixelT,ArithT>::HxDataPtr3dScalarTem(
00090     const HxDataPtr3dScalarTem& rhs)
00091 {
00092     _width = rhs._width;
00093     _height = rhs._height;
00094     _wxh = rhs._wxh;
00095     _ptr = rhs._ptr;
00096 }
00097 
00098 template<class PixelT, class ArithT>
00099 inline HxDataPtr3dScalarTem<PixelT,ArithT>&
00100 HxDataPtr3dScalarTem<PixelT,ArithT>::operator=(
00101     const HxDataPtr3dScalarTem& rhs)
00102 {
00103     _width = rhs._width;
00104     _height = rhs._height;
00105     _wxh = rhs._wxh;
00106     _ptr = rhs._ptr;
00107     return *this;
00108 }
00109 
00110 template<class PixelT, class ArithT>
00111 inline void
00112 HxDataPtr3dScalarTem<PixelT,ArithT>::incX()
00113 {
00114     _ptr++;
00115 }
00116 
00117 template<class PixelT, class ArithT>
00118 inline void
00119 HxDataPtr3dScalarTem<PixelT,ArithT>::decX()
00120 {
00121     _ptr--;
00122 }
00123 
00124 template<class PixelT, class ArithT>
00125 inline void
00126 HxDataPtr3dScalarTem<PixelT,ArithT>::incY()
00127 {
00128     _ptr += _width;
00129 }
00130 
00131 template<class PixelT, class ArithT>
00132 inline void
00133 HxDataPtr3dScalarTem<PixelT,ArithT>::decY()
00134 {
00135     _ptr -= _width;
00136 }
00137 
00138 template<class PixelT, class ArithT>
00139 inline void
00140 HxDataPtr3dScalarTem<PixelT,ArithT>::incZ()
00141 {
00142     _ptr += _wxh;
00143 }
00144 
00145 template<class PixelT, class ArithT>
00146 inline void
00147 HxDataPtr3dScalarTem<PixelT,ArithT>::decZ()
00148 {
00149     _ptr -= _wxh;
00150 }
00151 
00152 template<class PixelT, class ArithT>
00153 inline void
00154 HxDataPtr3dScalarTem<PixelT,ArithT>::incX(int off)
00155 {
00156     _ptr += off;
00157 }
00158 
00159 template<class PixelT, class ArithT>
00160 inline void
00161 HxDataPtr3dScalarTem<PixelT,ArithT>::decX(int off)
00162 {
00163     _ptr -= off;
00164 }
00165 
00166 template<class PixelT, class ArithT>
00167 inline void
00168 HxDataPtr3dScalarTem<PixelT,ArithT>::incY(int off)
00169 {
00170     _ptr += off * _width;
00171 }
00172 
00173 template<class PixelT, class ArithT>
00174 inline void
00175 HxDataPtr3dScalarTem<PixelT,ArithT>::decY(int off)
00176 {
00177     _ptr -= off * _width;
00178 }
00179 
00180 template<class PixelT, class ArithT>
00181 inline void
00182 HxDataPtr3dScalarTem<PixelT,ArithT>::incZ(int off)
00183 {
00184     _ptr += off * _wxh;
00185 }
00186 
00187 template<class PixelT, class ArithT>
00188 inline void
00189 HxDataPtr3dScalarTem<PixelT,ArithT>::decZ(int off)
00190 {
00191     _ptr -= off * _wxh;
00192 }
00193 
00194 template<class PixelT, class ArithT>
00195 inline void
00196 HxDataPtr3dScalarTem<PixelT,ArithT>::incXYZ(int xOff, int yOff, int zOff)
00197 {
00198     _ptr += zOff * _wxh + yOff * _width + xOff;
00199 }
00200 
00201 template<class PixelT, class ArithT>
00202 inline void
00203 HxDataPtr3dScalarTem<PixelT,ArithT>::decXYZ(int xOff, int yOff, int zOff)
00204 {
00205     _ptr -= zOff * _wxh + yOff * _width + xOff;
00206 }
00207 
00208 template<class PixelT, class ArithT>
00209 inline ArithT
00210 HxDataPtr3dScalarTem<PixelT,ArithT>::read()
00211 {
00212     return ArithT(*_ptr);
00213 }
00214 
00215 template<class PixelT, class ArithT>
00216 inline void
00217 HxDataPtr3dScalarTem<PixelT,ArithT>::write(const ArithT& val)
00218 {
00219     *_ptr = PixelT(val.x());
00220 }
00221 
00222 #ifdef INC_TEMPLATE_SRC
00223 #include "HxDataPtr3dScalarTem.c"
00224 #endif
00225 
00226 #endif

Generated on Tue Feb 3 14:18:33 2004 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001