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

HxImageTem2d Class Template Reference

Template class for operations on 2D images. More...

#include <HxImageTem2d.h>

Inheritance diagram for HxImageTem2d::

HxImageTem HxImageData HxRcObject List of all members.

Public Methods

 HxImageTem2d (int width=1, int height=1)
 HxImageTem2d (size_t *sizes)
 HxImageTem2d (const HxImageTem2d &)
virtual ~HxImageTem2d ()
int width () const
int height () const
virtual DataPtrType dataPtrClone () const
virtual void geometricOp2d (HxImageData *arg, HxMatrix func, HxGeoIntType gi, HxVec3Double translate, HxValue background)
 Geometric operation on 2D images. More...

virtual HxImageDataprojectDomain (int dimension, int coordinate)
virtual void inverseProjectDomain (int dimension, int coordinate, HxImageData *arg)
virtual void getValues (HxPointListConstIter first, HxPointListConstIter last, HxValueListBackInserter)
virtual void getRgbPixels2d (int *pixels, HxString dispF, int bufWidth, int bufHeight, int VX, int VY, int VW, int VH, double SX, double SY, double scaleX, double scaleY, HxGeoIntType gi) const

Detailed Description

template<class ImageSigT>
class HxImageTem2d< ImageSigT >

Template class for operations on 2D images.


Member Function Documentation

template<class ImageSigT>
void HxImageTem2d< ImageSigT >::geometricOp2d HxImageData   arg,
HxMatrix    func,
HxGeoIntType    gi,
HxVec3Double    translate,
HxValue    background
[virtual]
 

Geometric operation on 2D images.

Reimplemented from HxImageData.

00085 {
00086     DataPtrType objPtr = dataPtrClone();
00087     HxImageTem<ImageSigT>* argTem = (HxImageTem<ImageSigT>*) arg;
00088     DataPtrType argPtr = argTem->dataPtrClone();
00089     int maxArgX = (gi == LINEAR) ? arg->dimensionSize(1) - 2 : arg->dimensionSize(1) - 1;
00090     int maxArgY = (gi == LINEAR) ? arg->dimensionSize(2) - 2 : arg->dimensionSize(2) - 1;
00091     ArithType pixVal;
00092     int x, y;
00093     for (y=0; y<height(); y++) {
00094         for (x=0; x<width(); x++) {
00095             HxVec3Double vObj(x, y, 1);
00096             HxVec3Double vArg = func * (vObj + translate);
00097             double argXf = vArg.x() / vArg.z(); // homogeneous coordinates
00098             double argYf = vArg.y() / vArg.z();
00099             int argX = int(argXf); // truncate
00100             int argY = int(argYf);
00101             if ((argX < 0) || (argX > maxArgX)
00102                     || (argY < 0) || (argY > maxArgY))
00103                 pixVal = ArithType(background); // outside image
00104             else {
00105                 DataPtrType aPtr = argPtr;
00106                 if (gi == LINEAR) {
00107                     ArithType alpha = HxScalarDouble(argXf - argX);
00108                     ArithType beta  = HxScalarDouble(argYf - argY);
00109                     aPtr.incXYZ(argX, argY);
00110                     ArithType v1 = aPtr.read();
00111                     aPtr.incX();
00112                     ArithType v2 = aPtr.read();
00113                     aPtr.incXYZ(-1, 1);
00114                     ArithType v3 = aPtr.read();
00115                     aPtr.incX();
00116                     ArithType v4 = aPtr.read();
00117                     pixVal = v1 + alpha*(v2-v1) + beta*(v3-v1)
00118                                 + alpha*beta*(v1-v2-v3+v4);
00119                 }
00120                 else { // gi == NEAREST
00121                     aPtr.incXYZ(int(argXf + 0.5), int(argYf + 0.5));
00122                     pixVal = aPtr.read();
00123                 }
00124             }
00125             objPtr.write(pixVal);
00126             objPtr.incX();
00127         }
00128     }
00129 }


The documentation for this class was generated from the following files:
Generated on Tue Feb 3 14:18:57 2004 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001