#include "HxFuncRgbOp3d.h"
#include "HxCategories.h"
#include "HxFuncs3d.h"
Functions | |
| template<class DataPtrT, class RgbT> void | HxFuncRgbOp3d (DataPtrT imPtr, HxSizes imSize, int *pixels, int dimension, int coordinate, int resWidth, int resHeight, HxGeoIntType gi, RgbT &rgb) |
| Function for RgbOp3d. More... | |
|
||||||||||||||||||||||||||||||||||||||||||||
|
Function for RgbOp3d.
00026 {
00027 int x, y, z;
00028 HxSizes planeSize;
00029 switch (dimension) {
00030 case 1:
00031 planeSize = HxSizes(imSize.y(), imSize.z(), 1);
00032 break;
00033 case 2:
00034 planeSize = HxSizes(imSize.x(), imSize.z(), 1);
00035 break;
00036 case 3:
00037 planeSize = HxSizes(imSize.x(), imSize.y(), 1);
00038 break;
00039 }
00040
00041 if (((resWidth == -1) && (resHeight == -1)) ||
00042 ((resWidth == planeSize.x()) && (resHeight == planeSize.y()))) {
00043 DataPtrT p = imPtr;
00044 switch (dimension) {
00045 case 1:
00046 for (z=0 ; z<imSize.z() ; z++) {
00047 p = imPtr;
00048 p.incXYZ(coordinate, 0, z);
00049 for (y=0 ; y<imSize.y() ; y++) {
00050 *pixels++ = rgb.doIt(p.read());
00051 p.incY();
00052 }
00053 }
00054 break;
00055 case 2:
00056 for (z=0 ; z<imSize.z() ; z++) {
00057 p = imPtr;
00058 p.incXYZ(0, coordinate, z);
00059 for (x=0 ; x<imSize.x() ; x++) {
00060 *pixels++ = rgb.doIt(p.read());
00061 p.incX();
00062 }
00063 }
00064 break;
00065 case 3:
00066 imPtr.incZ(coordinate);
00067 int nPix = imSize.x() * imSize.y();
00068 while (--nPix >= 0) {
00069 *pixels++ = rgb.doIt(imPtr.read());
00070 imPtr.incX();
00071 }
00072 break;
00073 }
00074 return;
00075 }
00076
00077 double sx = (double) planeSize.x() / resWidth;
00078 double sy = (double) planeSize.y() / resHeight;
00079 typedef typename RgbT::ArithTypeDouble ArithTypeDouble;
00080 ArithTypeDouble result;
00081 switch (dimension) {
00082 case 1:
00083 for (y=0 ; y<resHeight ; y++) {
00084 for (x=0 ; x<resWidth ; x++) {
00085 result = HxFunc3dSample(imPtr, result, coordinate, sx * x, sy * y, gi);
00086 *pixels++ = rgb.doItDouble(result);
00087 }
00088 }
00089 break;
00090 case 2:
00091 for (y=0 ; y<resHeight ; y++) {
00092 for (x=0 ; x<resWidth ; x++) {
00093 result = HxFunc3dSample(imPtr, result, sx * x, coordinate, sy * y, gi);
00094 *pixels++ = rgb.doItDouble(result);
00095 }
00096 }
00097 break;
00098 case 3:
00099 for (y=0 ; y<resHeight ; y++) {
00100 for (x=0 ; x<resWidth ; x++) {
00101 result = HxFunc3dSample(imPtr, result, sx * x, sy * y, coordinate, gi);
00102 *pixels++ = rgb.doItDouble(result);
00103 }
00104 }
00105 break;
00106 }
00107 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001