Main Page   Class Overview   Pixels   Images   Geometry   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 template<class PixelT, class ArithT>
00018 class HxDataPtr3dScalarTem {
00019 public:
00020                             HxDataPtr3dScalarTem(
00021                                 PixelT* data, int width, int height);
00022                             HxDataPtr3dScalarTem(
00023                                 PixelT* data, size_t* size);
00024                             HxDataPtr3dScalarTem(
00025                                 const HxDataPtr3dScalarTem& rhs);
00026 
00027     HxDataPtr3dScalarTem&   operator=(const HxDataPtr3dScalarTem& rhs);
00028 
00029     void                    incX(); // will increase y when x > width, and z
00030     void                    decX(); // will decrease y when x < 0, and z
00031     void                    incY();
00032     void                    decY();
00033     void                    incZ();
00034     void                    decZ();
00035     void                    incX(int off);
00036     void                    decX(int off);
00037     void                    incY(int off);
00038     void                    decY(int off);
00039     void                    incZ(int off);
00040     void                    decZ(int off);
00041 
00042     void                    incXYZ(int xOff, int yOff, int zOff);
00043     void                    decXYZ(int xOff, int yOff, int zOff);
00044 
00045     ArithT                  read();
00046     void                    write(const ArithT& val);
00047     ArithT                  readIncX() { return ArithT(*_ptr++); }
00048     void                    writeIncX(const ArithT& val)
00049                                 { *_ptr++ = PixelT(val.x()); }
00050 
00051     void                    vprint();
00052 
00053     PixelT*                 data() { return _ptr; }
00054 
00055 private:
00056     int                     _width;
00057     int                     _height;
00058     int                     _wxh;
00059     PixelT*                 _ptr;
00060 };
00061 
00062 template<class PixelT, class ArithT>
00063 inline
00064 HxDataPtr3dScalarTem<PixelT,ArithT>::HxDataPtr3dScalarTem(
00065     PixelT* data, int width, int height)
00066 {
00067     _width = width;
00068     _height = height;
00069     _wxh = _width * _height;
00070     _ptr = data;
00071 }
00072 
00073 template<class PixelT, class ArithT>
00074 inline
00075 HxDataPtr3dScalarTem<PixelT,ArithT>::HxDataPtr3dScalarTem(
00076     PixelT* data, size_t* size)
00077 {
00078     _width = size[0];
00079     _height = size[1];
00080     _wxh = _width * _height;
00081     _ptr = data;
00082 }
00083 
00084 template<class PixelT, class ArithT>
00085 inline
00086 HxDataPtr3dScalarTem<PixelT,ArithT>::HxDataPtr3dScalarTem(
00087     const HxDataPtr3dScalarTem& rhs)
00088 {
00089     _width = rhs._width;
00090     _height = rhs._height;
00091     _wxh = rhs._wxh;
00092     _ptr = rhs._ptr;
00093 }
00094 
00095 template<class PixelT, class ArithT>
00096 inline HxDataPtr3dScalarTem<PixelT,ArithT>&
00097 HxDataPtr3dScalarTem<PixelT,ArithT>::operator=(
00098     const HxDataPtr3dScalarTem& rhs)
00099 {
00100     _width = rhs._width;
00101     _height = rhs._height;
00102     _wxh = rhs._wxh;
00103     _ptr = rhs._ptr;
00104     return *this;
00105 }
00106 
00107 template<class PixelT, class ArithT>
00108 inline void
00109 HxDataPtr3dScalarTem<PixelT,ArithT>::incX()
00110 {
00111     _ptr++;
00112 }
00113 
00114 template<class PixelT, class ArithT>
00115 inline void
00116 HxDataPtr3dScalarTem<PixelT,ArithT>::decX()
00117 {
00118     _ptr--;
00119 }
00120 
00121 template<class PixelT, class ArithT>
00122 inline void
00123 HxDataPtr3dScalarTem<PixelT,ArithT>::incY()
00124 {
00125     _ptr += _width;
00126 }
00127 
00128 template<class PixelT, class ArithT>
00129 inline void
00130 HxDataPtr3dScalarTem<PixelT,ArithT>::decY()
00131 {
00132     _ptr -= _width;
00133 }
00134 
00135 template<class PixelT, class ArithT>
00136 inline void
00137 HxDataPtr3dScalarTem<PixelT,ArithT>::incZ()
00138 {
00139     _ptr += _wxh;
00140 }
00141 
00142 template<class PixelT, class ArithT>
00143 inline void
00144 HxDataPtr3dScalarTem<PixelT,ArithT>::decZ()
00145 {
00146     _ptr -= _wxh;
00147 }
00148 
00149 template<class PixelT, class ArithT>
00150 inline void
00151 HxDataPtr3dScalarTem<PixelT,ArithT>::incX(int off)
00152 {
00153     _ptr += off;
00154 }
00155 
00156 template<class PixelT, class ArithT>
00157 inline void
00158 HxDataPtr3dScalarTem<PixelT,ArithT>::decX(int off)
00159 {
00160     _ptr -= off;
00161 }
00162 
00163 template<class PixelT, class ArithT>
00164 inline void
00165 HxDataPtr3dScalarTem<PixelT,ArithT>::incY(int off)
00166 {
00167     _ptr += off * _width;
00168 }
00169 
00170 template<class PixelT, class ArithT>
00171 inline void
00172 HxDataPtr3dScalarTem<PixelT,ArithT>::decY(int off)
00173 {
00174     _ptr -= off * _width;
00175 }
00176 
00177 template<class PixelT, class ArithT>
00178 inline void
00179 HxDataPtr3dScalarTem<PixelT,ArithT>::incZ(int off)
00180 {
00181     _ptr += off * _wxh;
00182 }
00183 
00184 template<class PixelT, class ArithT>
00185 inline void
00186 HxDataPtr3dScalarTem<PixelT,ArithT>::decZ(int off)
00187 {
00188     _ptr -= off * _wxh;
00189 }
00190 
00191 template<class PixelT, class ArithT>
00192 inline void
00193 HxDataPtr3dScalarTem<PixelT,ArithT>::incXYZ(int xOff, int yOff, int zOff)
00194 {
00195     _ptr += zOff * _wxh + yOff * _width + xOff;
00196 }
00197 
00198 template<class PixelT, class ArithT>
00199 inline void
00200 HxDataPtr3dScalarTem<PixelT,ArithT>::decXYZ(int xOff, int yOff, int zOff)
00201 {
00202     _ptr -= zOff * _wxh + yOff * _width + xOff;
00203 }
00204 
00205 template<class PixelT, class ArithT>
00206 inline ArithT
00207 HxDataPtr3dScalarTem<PixelT,ArithT>::read()
00208 {
00209     return ArithT(*_ptr);
00210 }
00211 
00212 template<class PixelT, class ArithT>
00213 inline void
00214 HxDataPtr3dScalarTem<PixelT,ArithT>::write(const ArithT& val)
00215 {
00216     *_ptr = PixelT(val.x());
00217 }
00218 
00219 #endif

Generated on Tue Jan 8 13:59:12 2002 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001