#include <HxImgFtorRgb3d.h>
Inheritance diagram for HxImgFtorRgb3d::
Public Types | |
typedef HxImgFtorRgbKey | KeyType |
The key type of this class. More... | |
Public Methods | |
HxImgFtorRgb3d () | |
Constructor. More... | |
virtual | ~HxImgFtorRgb3d () |
Destructor. More... | |
Protected Methods | |
virtual void | doIt (ImgDataPtrType ptr, HxSizes size, HxTagList &tags, HxImgFtorDescription *=0) |
The actual operation. More... |
|
The key type of this class.
Reimplemented from HxImgFtorI1Cast. |
|
Constructor.
00019 : HxImgFtorI1Cast<ImgSigT>(HxImgFtorRgbKey(HxClassName<ImgSigT>(), 00020 HxClassName<RgbT>())) 00021 { 00022 #ifdef CD_TRACE 00023 HxEnvironment::instance()->outputStream() 00024 << "HxImgFtorRgb3d::HxImgFtorRgb3d()" << STD_ENDL; 00025 #endif 00026 static HxRegKey* surKey 00027 = HxRegistry::instance().insertKey("/imagefunctortable/rgb"); 00028 00029 HxRegKey* k = surKey->insertKey(HxClassName<RgbT>()); 00030 k = k->insertKey("imagetype"); 00031 k->insertValue( 00032 HxClassName<ImgSigT>(), HxRegData(HxClassName<ImgSigT>())); 00033 } |
|
Destructor.
00037 { 00038 #ifdef CD_TRACE 00039 HxEnvironment::instance()->outputStream() 00040 << "HxImgFtorRgb3d::~HxImgFtorRgb3d()" << STD_ENDL; 00041 #endif 00042 } |
|
The actual operation.
Reimplemented from HxImgFtorI1Cast.
00048 { 00049 int* pixels = HxGetTag<int*>(tags, "pixels"); 00050 int dimension = HxGetTag<int>(tags, "dimension"); 00051 int coordinate = HxGetTag<int>(tags, "coordinate"); 00052 int resWidth = HxGetTag<int>(tags, "resWidth"); 00053 int resHeight = HxGetTag<int>(tags, "resHeight"); 00054 HxGeoIntType gi = HxGetTag<HxGeoIntType>(tags, "gi"); 00055 00056 RgbT rgbOp(tags); 00057 00058 int x, y, z; 00059 HxSizes planeSize; 00060 switch (dimension) { 00061 case 1: 00062 planeSize = HxSizes(size.y(), size.z(), 1); 00063 break; 00064 case 2: 00065 planeSize = HxSizes(size.x(), size.z(), 1); 00066 break; 00067 case 3: 00068 planeSize = HxSizes(size.x(), size.y(), 1); 00069 break; 00070 } 00071 00072 if (((resWidth == -1) && (resHeight == -1)) || 00073 ((resWidth == planeSize.x()) && (resHeight == planeSize.y()))) { 00074 ImgDataPtrType p = ptr; 00075 switch (dimension) { 00076 case 1: 00077 for (z=0 ; z<size.z() ; z++) { 00078 p = ptr; 00079 p.incXYZ(coordinate, 0, z); 00080 for (y=0 ; y<size.y() ; y++) { 00081 *pixels++ = rgbOp.doIt(p.read()); 00082 p.incY(); 00083 } 00084 } 00085 break; 00086 case 2: 00087 for (z=0 ; z<size.z() ; z++) { 00088 p = ptr; 00089 p.incXYZ(0, coordinate, z); 00090 for (x=0 ; x<size.x() ; x++) { 00091 *pixels++ = rgbOp.doIt(p.read()); 00092 p.incX(); 00093 } 00094 } 00095 break; 00096 case 3: 00097 ptr.incZ(coordinate); 00098 int nPix = size.x() * size.y(); 00099 while (--nPix >= 0) { 00100 *pixels++ = rgbOp.doIt(ptr.read()); 00101 ptr.incX(); 00102 } 00103 break; 00104 } 00105 return; 00106 } 00107 00108 double sx = (double) planeSize.x() / resWidth; 00109 double sy = (double) planeSize.y() / resHeight; 00110 TYPENAME ImgSigT::ArithTypeDouble result; 00111 switch (dimension) { 00112 case 1: 00113 for (y=0 ; y<resHeight ; y++) { 00114 for (x=0 ; x<resWidth ; x++) { 00115 result = HxFunc3dSample(ptr, result, coordinate, sx * x, sy * y, gi); 00116 *pixels++ = rgbOp.doItDouble(result); 00117 } 00118 } 00119 break; 00120 case 2: 00121 for (y=0 ; y<resHeight ; y++) { 00122 for (x=0 ; x<resWidth ; x++) { 00123 result = HxFunc3dSample(ptr, result, sx * x, coordinate, sy * y, gi); 00124 *pixels++ = rgbOp.doItDouble(result); 00125 } 00126 } 00127 break; 00128 case 3: 00129 for (y=0 ; y<resHeight ; y++) { 00130 for (x=0 ; x<resWidth ; x++) { 00131 result = HxFunc3dSample(ptr, result, sx * x, sy * y, coordinate, gi); 00132 *pixels++ = rgbOp.doItDouble(result); 00133 } 00134 } 00135 break; 00136 } 00137 } |