#include <HxImageData.h>
Inheritance diagram for HxImageData::
Constructors and destructor | |
HxImageData () | |
Constructor. More... | |
HxImageData (const HxImageData &) | |
Copy constructor. More... | |
virtual | ~HxImageData () |
Destructor. More... | |
Inquiry | |
int | ident () const |
Get identity. More... | |
HxString | name () const |
Get name. More... | |
void | name (HxString s) |
Set name. More... | |
virtual int | dimensionality () const=0 |
Get dimensionality. More... | |
virtual int | dimensionSize (int i) const=0 |
Get image size in given dimension. More... | |
virtual HxSizes | sizes () const=0 |
Get image sizes. More... | |
virtual int | numberOfPixels () const=0 |
Get total number of pixels. More... | |
virtual int | pixelDimensionality () const=0 |
Get dimensionality of pixels. More... | |
virtual HxValueType | pixelType () const=0 |
Get type of pixel. More... | |
virtual int | pixelPrecision () const=0 |
Get pixel precision. More... | |
virtual HxImageSignature | signature () const=0 |
Get image signature. More... | |
Import/export operations | |
virtual void | import (HxByte *data, HxTagList &tags=HxMakeTagList(), HxString importOp="importPix") |
Import pixels from HxByte data. More... | |
virtual void | import (short *data, HxTagList &tags=HxMakeTagList(), HxString importOp="importPix") |
Import pixels from short data. More... | |
virtual void | import (int *data, HxTagList &tags=HxMakeTagList(), HxString importOp="importPix") |
Import pixels from int data. More... | |
virtual void | import (float *data, HxTagList &tags=HxMakeTagList(), HxString importOp="importPix") |
Import pixels from float data. More... | |
virtual void | import (double *data, HxTagList &tags=HxMakeTagList(), HxString importOp="importPix") |
Import pixels from double data. More... | |
virtual void | exportOp (HxByte *data, HxTagList &tags, HxString exportOp="exportPix") |
Export pixels as HxByte data. More... | |
virtual void | exportOp (short *data, HxTagList &tags, HxString exportOp="exportPix") |
Export pixels as short data. More... | |
virtual void | exportOp (int *data, HxTagList &tags, HxString exportOp="exportPix") |
Export pixels as int data. More... | |
virtual void | exportOp (float *data, HxTagList &tags, HxString exportOp="exportPix") |
Export pixels as float data. More... | |
virtual void | exportOp (double *data, HxTagList &tags, HxString exportOp="exportPix") |
Export pixels as double data. More... | |
virtual void | inout (void *data, HxString dataType, HxString inOutOp, HxTagList &tags) |
InOut operation. More... | |
virtual void | inout (HxString inOutOp, HxTagList &tags) |
InOut operation (the real one). More... | |
virtual void | exportExtra (HxString exportOp, HxImageData *extraIm, HxTagList &tags) |
Export operation with extra image. More... | |
Set and border operations | |
virtual void | set (const HxValue val) |
virtual void | set (HxImageData *arg) |
virtual void | set (int *pixels) |
virtual void | set (HxByte *pixels) |
virtual void | set (double *pixels)=0 |
void | setPartImage (HxImageData *src) |
void | setPartImage (HxImageData *src, HxTagList &tags) |
Set operation (the real one). More... | |
void | setPartImage (HxImageData *src, HxPointInt srcBegin, HxPointInt srcEnd, HxPointInt dstBegin) |
void | setBorder (HxTagList &tags) |
Set border operation (the real one). More... | |
void | setBorder (HxSizes borderSize, HxTagList &tags, HxBorderType borderType=HXBORDERMIRROR) |
void | setBorder (HxBorderType borderType, HxSizes borderSize, HxTagList &tags) |
void | setBorder (HxSizes borderSize, HxValue val) |
void | mirrorBorder (HxSizes borderSize) |
void | propagateBorder (HxSizes borderSize) |
Generic operations | |
virtual void | unaryPixOp (HxImageData *src, HxString upoName, HxTagList &tags) |
Unary pixel operation. More... | |
virtual void | binaryPixOp (HxImageData *arg1, HxImageData *arg2, HxString bpoName, HxTagList &tags) |
Binary pixel operation. More... | |
virtual void | multiPixOp (HxImageData **args, int nArgs, HxString mpoName, HxTagList &tags) |
Multi pixel operation. More... | |
virtual void | generalizedConvolution (HxImageData *srcImg, HxImageData *kerImg, HxString genMul, HxString genAdd, HxString kerName, HxTagList &tags) |
Generalized convolution operation. More... | |
virtual void | generalizedConvolutionK1d (HxImageData *srcImg, int dimension, HxImageData *kerImg, HxString genMul, HxString genAdd, HxString kerName, HxTagList &tags) |
Generalized convolution operation in one dimension. More... | |
virtual void | genConvSeparated (HxImageData *srcImg, int dimension, HxImageData *kerImg1, HxImageData *kerImg2, HxString genMul, HxString genAdd, HxString kerName, HxTagList &tags) |
Generalized convolution operation separated by dimension. More... | |
virtual void | genConv2dSep (HxImageData *srcImg, HxImageData *kerImg1, HxImageData *kerImg2, HxString genMul, HxString genAdd, HxString kerName, HxTagList &tags) |
Separable generalized convolution operation on 2D images. More... | |
virtual void | genConv3dSep (HxImageData *srcImg, HxImageData *kerImg1, HxImageData *kerImg2, HxImageData *kerImg3, HxString genMul, HxString genAdd, HxString kerName, HxTagList &tags) |
Separable generalized convolution operation on 3D images. More... | |
virtual void | recGenConv (HxImageData *srcImg, HxImageData *kerImg, HxString genMul, HxString genAdd, HxTagList &tags) |
Recursive generalized convolution operation. More... | |
virtual void | recGenConv2dSep (HxImageData *srcImg, HxImageData *kerImg1, HxImageData *kerImg2, HxString genMul, HxString genAdd, HxTagList &tags) |
Separable recursive generalized convolution operation on 2D images. More... | |
virtual void | neighbourhoodOp (HxImageData *src, HxString ngbName, HxTagList &tags) |
Neighbourhood operation. More... | |
virtual void | neighbourhoodOpExtra (HxImageData *src, HxImageData *extraIm, HxString ngbName, HxTagList &tags) |
Neighbourhood operation with extra image. More... | |
virtual void | neighbourhoodOpExtra2 (HxImageData *src, HxImageData *extraIm, HxImageData *extraIm2, HxString ngbName, HxTagList &tags) |
Neighbourhood operation with extra images. More... | |
virtual void | neighbourhoodOp (HxImageData *src, HxImageData *kernel, HxString ngbName, HxTagList &tags) |
Neighbourhood operation with kernel. More... | |
virtual void | queueBasedOp (HxImageData *srcImg, HxImageData *kerImg, HxString genOp, HxTagList &tags) |
Queue based operation. More... | |
virtual void | diyOp (HxImageData *src, HxString diyName, HxTagList &tags) |
Do it yourself operation. More... | |
virtual void | rgbOp (HxString rgbName, HxTagList &tags) |
Display operation. More... | |
void | MNPixOp (HxImageData **results, int resultCnt, HxImageData **args, int argCnt, HxString mpoName, HxTagList &tags) |
M output N input pixel operation. More... | |
Geometric operations | |
virtual void | geometricOp2d (HxImageData *arg, HxMatrix func, HxGeoIntType gi, HxVec3Double translate, HxValue background)=0 |
Geometric operation on 2D images. More... | |
virtual void | restrict (HxImageData *arg, HxPoint begin) |
virtual void | extend (HxImageData *arg, HxPoint begin) |
virtual HxImageData * | projectDomain (int dimension, int coordinate)=0 |
virtual void | inverseProjectDomain (int dimension, int coordinate, HxImageData *arg)=0 |
Sample operations | |
virtual void | getValues (HxPointListConstIter first, HxPointListConstIter last, HxValueListBackInserter)=0 |
Misc operations | |
virtual void | setAt (int x, int y, int z, const HxValue v)=0 |
virtual HxValue | getAt (int x, int y, int z) const=0 |
virtual HxRcObject * | clone () |
virtual void | setPpmPixels (const HxByte *pixels) |
virtual void | getPpmPixels (HxByte *pixels) |
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 |
virtual void | getDoublePixels (double *pixels)=0 |
virtual STD_OSTREAM & | printInfo (STD_OSTREAM &os, int doData=0) const=0 |
void | setObjectObserver (const HxObjectObserver &) |
bool | probeMNpo (const HxImageSignature resultsSig, const HxImageSignature argsSig, HxString mpoName, HxTagList &tags) |
To be rewritten | |
virtual HxImageData * | projectRange (int dimension) |
virtual void | inverseProjectRange (int dimension, HxImageData *arg) |
Public Methods | |
void | weight (double w) |
HxScalarDouble | weight () const |
Protected Methods | |
int | checkEqualImageSig (HxString func, HxImageData *arg) |
int | checkEqualImageSizes (HxString func, HxImageData *arg) |
int | checkEqualImageSigAndSizes (HxString func, HxImageData *arg) |
int | checkLargerImageSigAndSizes (HxString func, HxImageData *arg) |
int | checkProperKernelSigAndSizes (HxString func, HxImageData *kernel, int reqDim, int reqScalar, int appliedDim=0) |
int | checkEqualImageSizesDim (HxString func, HxImageData *arg, int dimension) |
int | checkImageDimension (HxString func, int dim, int coord) |
int | checkPixelDimension (HxString func, int dim) |
bool | checkBorderSize (HxString funcName, HxSizes borderSize) const |
HxSizes | getProjectDomainSizes (int dimension) const |
All operations on images can be accessed by this interface, yet little of them are implemented by this class. This class serves as a handle of all types of images that are derived from this base class. The HxImageData class provides methods to make inquiries about the type of the image.
|
Constructor.
00052 { 00053 _ident = _nr++; 00054 _name = HxString("image") + makeString(_ident); 00055 _weight = 1; 00056 HxImageDataRepository::instance()->insertImage(this); 00057 if (_objectObserver) 00058 _objectObserver->constructed(_name); 00059 } |
|
Copy constructor.
00061 : HxRcObject() 00062 { 00063 HxEnvironment::instance()->warningStream() << 00064 "HxImageData copy constructor called" << STD_ENDL; 00065 HxEnvironment::instance()->flush(); 00066 } |
|
Destructor.
00069 { 00070 HxImageDataRepository::instance()->removeImage(this); 00071 if (_objectObserver) 00072 _objectObserver->destructed(_name); 00073 } |
|
Get identity.
00077 { 00078 return _ident; 00079 } |
|
Get name.
00083 { 00084 return _name; 00085 } |
|
Set name.
00089 { 00090 _name = s; 00091 } |
|
Get dimensionality.
Reimplemented in HxImageTem. |
|
Get image size in given dimension.
Reimplemented in HxImageTem. |
|
Get image sizes.
Reimplemented in HxImageTem. |
|
Get total number of pixels.
Reimplemented in HxImageTem. |
|
Get dimensionality of pixels.
Reimplemented in HxImageTem. |
|
Get type of pixel.
Reimplemented in HxImageTem. |
|
Get pixel precision.
Reimplemented in HxImageTem. |
|
Get image signature.
Reimplemented in HxImageTem. |
|
Import pixels from HxByte data.
01067 { 01068 inout((void*)data, HxClassName<HxByte>(), importOp, tags); 01069 } |
|
Import pixels from short data.
01073 { 01074 inout((void*)data, HxClassName<short>(), importOp, tags); 01075 } |
|
Import pixels from int data.
01079 { 01080 inout((void*)data, HxClassName<int>(), importOp, tags); 01081 } |
|
Import pixels from float data.
01085 { 01086 inout((void*)data, HxClassName<float>(), importOp, tags); 01087 } |
|
Import pixels from double data.
01091 { 01092 inout((void*)data, HxClassName<double>(), importOp, tags); 01093 } |
|
Export pixels as HxByte data.
01097 { 01098 inout((void*)data, HxClassName<HxByte>(), exportOp, tags); 01099 } |
|
Export pixels as short data.
01103 { 01104 inout((void*)data, HxClassName<short>(), exportOp, tags); 01105 } |
|
Export pixels as int data.
01109 { 01110 inout((void*)data, HxClassName<int>(), exportOp, tags); 01111 } |
|
Export pixels as float data.
01115 { 01116 inout((void*)data, HxClassName<float>(), exportOp, tags); 01117 } |
|
Export pixels as double data.
01121 { 01122 inout((void*)data, HxClassName<double>(), exportOp, tags); 01123 } |
|
InOut operation.
|
|
InOut operation (the real one).
01136 { 01137 HxImgFtorInOutKey funcKey(signature().toString(), inOutOp); 01138 01139 static HxImgFtorTableTem<HxImgFtorI1> funcTable; 01140 HxImgFtorI1* func = funcTable.find(funcKey); 01141 01142 if (func) { 01143 func->callIt(this, tags); 01144 } else { 01145 HxEnvironment::instance()->errorStream() 01146 << "Can't find " << funcKey << STD_ENDL; 01147 HxEnvironment::instance()->flush(); 01148 } 01149 } |
|
Export operation with extra image.
01154 { 01155 HxImgFtorExportExtraKey funcKey(signature().toString(), 01156 extraIm->signature().toString(), 01157 exportOp); 01158 01159 static HxImgFtorTableTem<HxImgFtorI2> funcTable; 01160 HxImgFtorI2* func = funcTable.find(funcKey); 01161 01162 if (func) { 01163 func->callIt(this, extraIm, tags); 01164 } else { 01165 HxEnvironment::instance()->errorStream() 01166 << "Can't find " << funcKey << STD_ENDL; 01167 HxEnvironment::instance()->flush(); 01168 } 01169 } |
|
Set operation (the real one).
01218 { 01219 HxImgFtorSetKey funcKey(signature().toString(), 01220 src->signature().toString()); 01221 01222 static HxImgFtorTableTem<HxImgFtorI2> funcTable; 01223 HxImgFtorI2* func = funcTable.find(funcKey); 01224 01225 if (func) { 01226 func->callIt(this, src, tags); 01227 } else { 01228 HxEnvironment::instance()->errorStream() 01229 << "Can't find " << funcKey << STD_ENDL; 01230 HxEnvironment::instance()->flush(); 01231 } 01232 } |
|
Set border operation (the real one).
01304 { 01305 HxImgFtorSetBorderKey funcKey(signature().toString()); 01306 01307 static HxImgFtorTableTem<HxImgFtorI1> funcTable; 01308 HxImgFtorI1* func = funcTable.find(funcKey); 01309 01310 if (func) { 01311 func->callIt(this, tags); 01312 } else { 01313 HxEnvironment::instance()->errorStream() 01314 << "Can't find " << funcKey << STD_ENDL; 01315 HxEnvironment::instance()->flush(); 01316 } 01317 } |
|
Unary pixel operation.
00355 { 00356 HxImgFtorUpoKey funcKey(signature().toString(), 00357 srcImg->signature().toString(), 00358 upoName); 00359 00360 static HxImgFtorTableTem<HxImgFtorI2> funcTable; 00361 HxImgFtorI2* func = funcTable.find(funcKey); 00362 00363 if (func) { 00364 func->callIt(this, srcImg, tags); 00365 } else { 00366 HxEnvironment::instance()->errorStream() 00367 << "Can't find " << funcKey << STD_ENDL; 00368 HxEnvironment::instance()->flush(); 00369 } 00370 } |
|
Binary pixel operation.
00375 { 00376 if (!checkEqualImageSizes("binaryPixOp", arg1) || 00377 !checkEqualImageSizes("binaryPixOp", arg2)) 00378 return; 00379 00380 HxImgFtorBpoKey funcKey(signature().toString(), 00381 arg1->signature().toString(), 00382 arg2->signature().toString(), 00383 bpoName); 00384 00385 static HxImgFtorTableTem<HxImgFtorI3> funcTable; 00386 HxImgFtorI3* func = funcTable.find(funcKey); 00387 00388 if (func) { 00389 func->callIt(this, arg1, arg2, tags); 00390 } else { 00391 HxEnvironment::instance()->errorStream() 00392 << "Can't find " << funcKey << STD_ENDL; 00393 HxEnvironment::instance()->flush(); 00394 } 00395 } |
|
Multi pixel operation.
00401 { 00402 HxImgFtorMpoKey funcKey(signature().toString(), 00403 srcImgs[0]->signature().toString(), 00404 mpoName); 00405 00406 static HxImgFtorTableTem<HxImgFtorIM> funcTable; 00407 HxImgFtorIM* func = funcTable.find(funcKey); 00408 00409 if (func) { 00410 func->callIt(this, srcImgs, nImgs, tags); 00411 } else { 00412 HxEnvironment::instance()->errorStream() 00413 << "Can't find " << funcKey << STD_ENDL; 00414 HxEnvironment::instance()->flush(); 00415 } 00416 } |
|
M output N input pixel operation.
00444 { 00445 HxImgFtorMNpoKey funcKey(resImgs[0]->signature().toString(), 00446 srcImgs[0]->signature().toString(), 00447 mpoName); 00448 00449 static HxImgFtorTableTem<HxImgFtorIMN> funcTable; 00450 HxImgFtorIMN* func = funcTable.find(funcKey); 00451 00452 if (func) { 00453 func->callIt(resImgs, resCnt, srcImgs, srcCnt, tags); 00454 } else { 00455 HxEnvironment::instance()->errorStream() 00456 << "Can't find " << funcKey << STD_ENDL; 00457 HxEnvironment::instance()->flush(); 00458 } 00459 } |
|
Generalized convolution operation.
00467 { 00468 HxSizes borderSize = kerImg->sizes() / HxSizes(2, 2, 2); 00469 if (!checkBorderSize("generalizedConvolution", borderSize)) 00470 return; 00471 HxSizes scratchSize = srcImg->sizes() + borderSize * HxSizes(2, 2, 2); 00472 HxImageData* scratchImg 00473 = HxImgDataFactory::instance().makeImage( 00474 kerImg->signature(), scratchSize); 00475 scratchImg->setPartImage( 00476 srcImg, HxPointInt(0, 0, 0), 00477 srcImg->sizes() - HxPointInt(1, 1, 1), borderSize); 00478 scratchImg->setBorder(borderSize, tags); 00479 00480 HxImgFtorGenConvKey funcKey( 00481 signature().toString(), 00482 scratchImg->signature().toString(), 00483 kerImg->signature().toString(), 00484 genMul, genAdd, kerName); 00485 00486 static HxImgFtorTableTem<HxImgFtorI3> funcTable; 00487 HxImgFtorI3* func = funcTable.find(funcKey); 00488 00489 if (func) { 00490 func->callIt(this, scratchImg, kerImg, tags); 00491 } else { 00492 HxEnvironment::instance()->errorStream() 00493 << "Can't find " << funcKey << STD_ENDL; 00494 HxEnvironment::instance()->flush(); 00495 } 00496 00497 delete scratchImg; 00498 } |
|
Generalized convolution operation in one dimension.
00506 { 00507 HxSizes borderSize; 00508 00509 switch (dimension) { 00510 case 1 : 00511 borderSize = HxSizes(kerImg->sizes().x() / 2, 0, 0); 00512 break; 00513 case 2 : 00514 borderSize = HxSizes(0, kerImg->sizes().x() / 2, 0); 00515 break; 00516 case 3 : 00517 borderSize = HxSizes(0, 0, kerImg->sizes().x() / 2); 00518 break; 00519 } 00520 00521 if (!checkBorderSize("generalizedConvolutionK1d", borderSize)) 00522 return; 00523 00524 HxAddTag<HxSizes>(tags, "borderSize", borderSize); 00525 HxAddTag<int>(tags, "dimension", dimension); 00526 00527 HxSizes scratchSize = srcImg->sizes() + borderSize * HxSizes(2, 2, 2); 00528 HxImageSignature scratchSig(kerImg->signature()); 00529 scratchSig.setImageDimensionality(signature().imageDimensionality()); 00530 HxImageData* scratchImg 00531 = HxImgDataFactory::instance().makeImage(scratchSig, scratchSize); 00532 00533 scratchImg->setPartImage( 00534 srcImg, HxPointInt(0, 0, 0), 00535 srcImg->sizes() - HxPointInt(1, 1, 1), borderSize); 00536 scratchImg->setBorder(borderSize, tags); 00537 00538 HxImgFtorGenConvK1dKey funcKey( 00539 signature().toString(), 00540 scratchImg->signature().toString(), 00541 kerImg->signature().toString(), 00542 genMul, genAdd, kerName); 00543 00544 static HxImgFtorTableTem<HxImgFtorI3> funcTable; 00545 HxImgFtorI3* func = funcTable.find(funcKey); 00546 00547 if (func) { 00548 func->callIt(this, scratchImg, kerImg, tags); 00549 } else { 00550 HxEnvironment::instance()->errorStream() 00551 << "Can't find " << funcKey << STD_ENDL; 00552 HxEnvironment::instance()->flush(); 00553 } 00554 00555 delete scratchImg; 00556 } |
|
Generalized convolution operation separated by dimension.
00564 { 00565 HxImageData* srcCopy = srcImg; 00566 for (int dim=1 ; dim<=dimensionality() ; dim++) { 00567 HxImageData* kerImg = (dim == dimension) ? kerImg1 : kerImg2; 00568 HxSizes borderSize; 00569 00570 switch (dim) { 00571 case 1 : 00572 borderSize = HxSizes(kerImg->sizes().x() / 2, 0, 0); 00573 break; 00574 case 2 : 00575 borderSize = HxSizes(0, kerImg->sizes().x() / 2, 0); 00576 break; 00577 case 3 : 00578 borderSize = HxSizes(0, 0, kerImg->sizes().x() / 2); 00579 break; 00580 } 00581 00582 if (!checkBorderSize("genConvSeparated", borderSize)) 00583 return; 00584 00585 HxAddTag<HxSizes>(tags, "borderSize", borderSize); 00586 HxAddTag<int>(tags, "dimension", dim); 00587 00588 HxSizes scratchSize = srcCopy->sizes() + borderSize * HxSizes(2, 2, 2); 00589 HxImageSignature scratchSig(kerImg->signature()); 00590 scratchSig.setImageDimensionality(signature().imageDimensionality()); 00591 HxImageData* scratchImg 00592 = HxImgDataFactory::instance().makeImage(scratchSig, scratchSize); 00593 00594 scratchImg->setPartImage( 00595 srcCopy, HxPointInt(0, 0, 0), 00596 srcCopy->sizes() - HxPointInt(1, 1, 1), borderSize); 00597 scratchImg->setBorder(borderSize, tags); 00598 00599 HxImgFtorGenConvK1dKey funcKey( 00600 signature().toString(), 00601 scratchImg->signature().toString(), 00602 kerImg->signature().toString(), 00603 genMul, genAdd, kerName); 00604 00605 static HxImgFtorTableTem<HxImgFtorI3> funcTable; 00606 HxImgFtorI3* func = funcTable.find(funcKey); 00607 00608 if (func) { 00609 func->callIt(this, scratchImg, kerImg, tags); 00610 } else { 00611 HxEnvironment::instance()->errorStream() 00612 << "Can't find " << funcKey << STD_ENDL; 00613 HxEnvironment::instance()->flush(); 00614 } 00615 00616 // setup srcCopy for the next loop (if any) 00617 if (dim == 1) 00618 srcCopy = HxImgDataFactory::instance().makeImage(scratchSig, 00619 srcImg->sizes()); 00620 if (dim != dimensionality()) 00621 srcCopy->set(this); 00622 delete scratchImg; 00623 } // end of dim loop 00624 delete srcCopy; 00625 } |
|
Separable generalized convolution operation on 2D images.
00633 { 00634 HxSizes borderSize(kerImg1->sizes().x() / 2, kerImg2->sizes().x() / 2, 0); 00635 00636 if (!checkBorderSize("genConv2dSep", borderSize)) 00637 return; 00638 00639 HxAddTag<HxSizes>(tags, "borderSize", borderSize); 00640 00641 HxSizes scratchSize = srcImg->sizes() + borderSize * HxSizes(2, 2, 2); 00642 HxImageSignature scratchSig(kerImg1->signature()); 00643 scratchSig.setImageDimensionality(signature().imageDimensionality()); 00644 HxImageData* scratchImg 00645 = HxImgDataFactory::instance().makeImage(scratchSig, scratchSize); 00646 00647 scratchImg->setPartImage( 00648 srcImg, HxPointInt(0, 0, 0), 00649 srcImg->sizes() - HxPointInt(1, 1, 1), borderSize); 00650 scratchImg->setBorder(borderSize, tags); 00651 00652 HxImgFtorGenConv2dSepKey funcKey( 00653 signature().toString(), 00654 scratchImg->signature().toString(), 00655 kerImg1->signature().toString(), 00656 kerImg2->signature().toString(), 00657 genMul, genAdd, kerName); 00658 00659 static HxImgFtorTableTem<HxImgFtorI4> funcTable; 00660 HxImgFtorI4* func = funcTable.find(funcKey); 00661 00662 if (func) { 00663 func->callIt(this, scratchImg, kerImg1, kerImg2, tags); 00664 } else { 00665 HxEnvironment::instance()->errorStream() 00666 << "Can't find " << funcKey << STD_ENDL; 00667 HxEnvironment::instance()->flush(); 00668 } 00669 00670 delete scratchImg; 00671 } |
|
Separable generalized convolution operation on 3D images.
00679 { 00680 HxImageData* srcCopy = srcImg; 00681 for (int dim=1 ; dim<=dimensionality() ; dim++) { 00682 HxImageData* kerImg; 00683 HxSizes borderSize; 00684 00685 switch (dim) { 00686 case 1 : 00687 kerImg = kerImg1; 00688 borderSize = HxSizes(kerImg->sizes().x() / 2, 0, 0); 00689 break; 00690 case 2 : 00691 kerImg = kerImg2; 00692 borderSize = HxSizes(0, kerImg->sizes().x() / 2, 0); 00693 break; 00694 case 3 : 00695 kerImg = kerImg3; 00696 borderSize = HxSizes(0, 0, kerImg->sizes().x() / 2); 00697 break; 00698 } 00699 00700 if (!checkBorderSize("genConv3dSep", borderSize)) 00701 return; 00702 00703 HxAddTag<HxSizes>(tags, "borderSize", borderSize); 00704 HxAddTag<int>(tags, "dimension", dim); 00705 00706 HxSizes scratchSize = srcCopy->sizes() + borderSize * HxSizes(2, 2, 2); 00707 HxImageSignature scratchSig(kerImg->signature()); 00708 scratchSig.setImageDimensionality(signature().imageDimensionality()); 00709 HxImageData* scratchImg 00710 = HxImgDataFactory::instance().makeImage(scratchSig, scratchSize); 00711 00712 scratchImg->setPartImage( 00713 srcCopy, HxPointInt(0, 0, 0), 00714 srcCopy->sizes() - HxPointInt(1, 1, 1), borderSize); 00715 scratchImg->setBorder(borderSize, tags); 00716 00717 HxImgFtorGenConvK1dKey funcKey( 00718 signature().toString(), 00719 scratchImg->signature().toString(), 00720 kerImg->signature().toString(), 00721 genMul, genAdd, kerName); 00722 00723 static HxImgFtorTableTem<HxImgFtorI3> funcTable; 00724 HxImgFtorI3* func = funcTable.find(funcKey); 00725 00726 if (func) { 00727 func->callIt(this, scratchImg, kerImg, tags); 00728 } else { 00729 HxEnvironment::instance()->errorStream() 00730 << "Can't find " << funcKey << STD_ENDL; 00731 HxEnvironment::instance()->flush(); 00732 } 00733 00734 // setup srcCopy for the next loop (if any) 00735 if (dim == 1) 00736 srcCopy = HxImgDataFactory::instance().makeImage(scratchSig, 00737 srcImg->sizes()); 00738 if (dim != dimensionality()) 00739 srcCopy->set(this); 00740 delete scratchImg; 00741 } // end of dim loop 00742 delete srcCopy; 00743 } |
|
Recursive generalized convolution operation.
00750 { 00751 HxSizes borderSize = kerImg->sizes() / HxSizes(2, 2, 2); 00752 if (!checkBorderSize("recursiveNeighOp", borderSize)) 00753 return; 00754 00755 HxSizes scratchSize = srcImg->sizes() + borderSize * HxSizes(2, 2, 2); 00756 HxImageData* scratchImg 00757 = HxImgDataFactory::instance().makeImage( 00758 kerImg->signature(), scratchSize); 00759 00760 scratchImg->setPartImage( 00761 srcImg, HxPointInt(0, 0, 0), 00762 srcImg->sizes() - HxPointInt(1, 1, 1), borderSize); 00763 scratchImg->setBorder(borderSize, tags, HXBORDERPROPAGATE); 00764 00765 HxImgFtorRecGenConvKey funcKey( 00766 scratchImg->signature().toString(), 00767 kerImg->signature().toString(), genMul, genAdd); 00768 00769 static HxImgFtorTableTem<HxImgFtorI2> funcTable; 00770 HxImgFtorI2* func = funcTable.find(funcKey); 00771 00772 if (func) { 00773 func->callIt(scratchImg, kerImg, tags); 00774 } else { 00775 HxEnvironment::instance()->errorStream() 00776 << "Can't find " << funcKey << STD_ENDL; 00777 HxEnvironment::instance()->flush(); 00778 } 00779 00780 setPartImage( 00781 scratchImg, borderSize, borderSize + sizes() - HxPointInt(1, 1, 1), 00782 HxPointInt(0, 0, 0)); 00783 00784 delete scratchImg; 00785 } |
|
Separable recursive generalized convolution operation on 2D images.
00793 { 00794 //HxSizes borderSize(kerImg1->sizes().x() / 2, kerImg2->sizes().x() / 2, 0); 00795 HxSizes borderSize(kerImg1->sizes().x() / 2 * 2, kerImg2->sizes().x() / 2 * 2, 0); 00796 00797 /* DK : if border is propagated this makes no sense 00798 if (!checkBorderSize("recGenConv2dSep", borderSize)) 00799 return; 00800 */ 00801 00802 HxSizes scratchSize = srcImg->sizes() + borderSize * HxSizes(2, 2, 2); 00803 HxImageData* scratchImg 00804 = HxImgDataFactory::instance().makeImage( 00805 kerImg1->signature(), scratchSize); 00806 00807 scratchImg->setPartImage( 00808 srcImg, HxPointInt(0, 0, 0), 00809 srcImg->sizes() - HxPointInt(1, 1, 1), borderSize); 00810 scratchImg->setBorder(borderSize, tags, HXBORDERPROPAGATE); 00811 00812 HxImgFtorRecGenConvK1dKey funcKey( 00813 scratchImg->signature().toString(), 00814 kerImg1->signature().toString(), genMul, genAdd); 00815 00816 static HxImgFtorTableTem<HxImgFtorI2> funcTable; 00817 HxImgFtorI2* func = funcTable.find(funcKey); 00818 00819 int dimension = 1; 00820 if (func) { 00821 HxAddTag(tags, "borderSize", borderSize); 00822 HxAddTag(tags, "dimension", dimension); 00823 func->callIt(scratchImg, kerImg1, tags); 00824 00825 dimension = 2; 00826 scratchImg->setBorder(borderSize, tags, HXBORDERPROPAGATE); 00827 HxAddTag(tags, "dimension", dimension); 00828 func->callIt(scratchImg, kerImg2, tags); 00829 } else { 00830 HxEnvironment::instance()->errorStream() 00831 << "Can't find " << funcKey << STD_ENDL; 00832 HxEnvironment::instance()->flush(); 00833 } 00834 00835 setPartImage( 00836 scratchImg, borderSize, borderSize + sizes() - HxPointInt(1, 1, 1), 00837 HxPointInt(0, 0, 0)); 00838 00839 delete scratchImg; 00840 } |
|
Neighbourhood operation.
00845 { 00846 HxImgFtorNgbKey funcKey(signature().toString(), 00847 src->signature().toString(), ngbName); 00848 00849 static HxImgFtorTableTem<HxImgFtorI2> funcTable; 00850 HxImgFtorI2* func = funcTable.find(funcKey); 00851 00852 if (func) { 00853 func->probeOp(tags); // should put borderSize in the list 00854 HxSizes borderSize = HxGetTag(tags, "borderSize", HxSizes(0,0,0)); 00855 HxSizes scratchSize = src->sizes() + borderSize * HxSizes(2, 2, 2); 00856 HxImageData* scratch = HxImgDataFactory::instance().makeImage( 00857 src->signature(), scratchSize); 00858 scratch->setPartImage( 00859 src, HxPointInt(0, 0, 0), 00860 src->sizes() - HxPointInt(1, 1, 1), borderSize); 00861 scratch->setBorder(borderSize, tags); 00862 00863 func->callIt(this, scratch, tags); 00864 00865 delete scratch; 00866 } else { 00867 HxEnvironment::instance()->errorStream() 00868 << "Can't find " << funcKey << STD_ENDL; 00869 HxEnvironment::instance()->flush(); 00870 } 00871 } |
|
Neighbourhood operation with extra image.
00876 { 00877 HxImgFtorNgbExtraKey funcKey(signature().toString(), 00878 src->signature().toString(), 00879 extraIm->signature().toString(), ngbName); 00880 00881 static HxImgFtorTableTem<HxImgFtorI3> funcTable; 00882 HxImgFtorI3* func = funcTable.find(funcKey); 00883 00884 if (func) { 00885 func->probeOp(tags); // should put borderSize in the list 00886 HxSizes borderSize = HxGetTag(tags, "borderSize", HxSizes(0,0,0)); 00887 HxSizes scratchSize = src->sizes() + borderSize * HxSizes(2, 2, 2); 00888 HxImageData* scratch = HxImgDataFactory::instance().makeImage( 00889 src->signature(), scratchSize); 00890 scratch->setPartImage( 00891 src, HxPointInt(0, 0, 0), 00892 src->sizes() - HxPointInt(1, 1, 1), borderSize); 00893 scratch->setBorder(borderSize, tags); 00894 00895 HxImageData* scratchEx = HxImgDataFactory::instance().makeImage( 00896 extraIm->signature(), scratchSize); 00897 scratchEx->setPartImage( 00898 extraIm, HxPointInt(0, 0, 0), 00899 extraIm->sizes() - HxPointInt(1, 1, 1), borderSize); 00900 scratchEx->setBorder(borderSize, tags); 00901 00902 func->callIt(this, scratch, scratchEx, tags); 00903 00904 delete scratch; 00905 delete scratchEx; 00906 } else { 00907 HxEnvironment::instance()->errorStream() 00908 << "Can't find " << funcKey << STD_ENDL; 00909 HxEnvironment::instance()->flush(); 00910 } 00911 } |
|
Neighbourhood operation with extra images.
00917 { 00918 HxImgFtorNgbExtra2Key funcKey(signature().toString(), 00919 src->signature().toString(), 00920 extraIm->signature().toString(), 00921 extraIm2->signature().toString(), ngbName); 00922 00923 static HxImgFtorTableTem<HxImgFtorI4> funcTable; 00924 HxImgFtorI4* func = funcTable.find(funcKey); 00925 00926 if (func) { 00927 func->probeOp(tags); // should put borderSize in the list 00928 HxSizes borderSize = HxGetTag(tags, "borderSize", HxSizes(0,0,0)); 00929 HxSizes scratchSize = src->sizes() + borderSize * HxSizes(2, 2, 2); 00930 HxImageData* scratch = HxImgDataFactory::instance().makeImage( 00931 src->signature(), scratchSize); 00932 scratch->setPartImage( 00933 src, HxPointInt(0, 0, 0), 00934 src->sizes() - HxPointInt(1, 1, 1), borderSize); 00935 scratch->setBorder(borderSize, tags); 00936 00937 HxImageData* scratchEx = HxImgDataFactory::instance().makeImage( 00938 extraIm->signature(), scratchSize); 00939 scratchEx->setPartImage( 00940 extraIm, HxPointInt(0, 0, 0), 00941 extraIm->sizes() - HxPointInt(1, 1, 1), borderSize); 00942 scratchEx->setBorder(borderSize, tags); 00943 00944 HxImageData* scratchEx2 = HxImgDataFactory::instance().makeImage( 00945 extraIm2->signature(), scratchSize); 00946 scratchEx2->setPartImage( 00947 extraIm2, HxPointInt(0, 0, 0), 00948 extraIm2->sizes() - HxPointInt(1, 1, 1), borderSize); 00949 scratchEx2->setBorder(borderSize, tags); 00950 00951 func->callIt(this, scratch, scratchEx, scratchEx2, tags); 00952 00953 delete scratch; 00954 delete scratchEx; 00955 delete scratchEx2; 00956 } else { 00957 HxEnvironment::instance()->errorStream() 00958 << "Can't find " << funcKey << STD_ENDL; 00959 HxEnvironment::instance()->flush(); 00960 } 00961 } |
|
Neighbourhood operation with kernel.
00967 { 00968 HxImgFtorKernelNgbKey funcKey(signature().toString(), 00969 src->signature().toString(), 00970 kernel->signature().toString(), 00971 ngbName); 00972 00973 static HxImgFtorTableTem<HxImgFtorI3> funcTable; 00974 HxImgFtorI3* func = funcTable.find(funcKey); 00975 00976 if (func) { 00977 HxAddTag(tags, "kernelSize", kernel->sizes()); 00978 func->probeOp(tags); // should put borderSize in the list 00979 HxSizes borderSize = HxGetTag(tags, "borderSize", HxSizes(0,0,0)); 00980 HxSizes scratchSize = src->sizes() + borderSize * HxSizes(2, 2, 2); 00981 HxImageData* scratch = HxImgDataFactory::instance().makeImage( 00982 src->signature(), scratchSize); 00983 scratch->setPartImage( 00984 src, HxPointInt(0, 0, 0), 00985 src->sizes() - HxPointInt(1, 1, 1), borderSize); 00986 scratch->setBorder(borderSize, tags); 00987 00988 func->callIt(this, scratch, kernel, tags); 00989 00990 delete scratch; 00991 } else { 00992 HxEnvironment::instance()->errorStream() 00993 << "Can't find " << funcKey << STD_ENDL; 00994 HxEnvironment::instance()->flush(); 00995 } 00996 } |
|
Queue based operation.
01003 { 01004 01005 // NOT YET GET/SET PART (SCRATCH) IMAGE 01006 HxImageData * thisScratchImg=const_cast<HxImageData *>(this); 01007 HxImageData * srcScratchImg=const_cast<HxImageData *>(srcImg); 01008 01009 HxImgFtorQueueBasedKey funcKey( 01010 thisScratchImg->signature().toString(), 01011 srcScratchImg->signature().toString(), 01012 kerImg->signature().toString(), 01013 genOp); 01014 01015 typedef HxImgFtorI3 FunctorType; 01016 static HxImgFtorTableTem<FunctorType> funcTable; 01017 FunctorType* func = funcTable.find(funcKey); 01018 01019 if (func) { 01020 //HxAddTag(tags, "borderSize", borderSize); 01021 func->callIt(thisScratchImg, srcScratchImg, kerImg, tags); 01022 } else { 01023 HxEnvironment::instance()->errorStream() 01024 << "Can't find " << funcKey << STD_ENDL; 01025 HxEnvironment::instance()->flush(); 01026 } 01027 } |
|
Do it yourself operation.
01032 { 01033 HxImgFtorDiyKey funcKey(signature().toString(), 01034 src->signature().toString(), diyName); 01035 01036 static HxImgFtorTableTem<HxImgFtorI2> funcTable; 01037 HxImgFtorI2* func = funcTable.find(funcKey); 01038 01039 if (func) { 01040 func->callIt(this, src, tags); 01041 } else { 01042 HxEnvironment::instance()->errorStream() 01043 << "Can't find " << funcKey << STD_ENDL; 01044 HxEnvironment::instance()->flush(); 01045 } 01046 } |
|
Display operation.
01050 { 01051 HxImgFtorRgbKey funcKey(signature().toString(), rgbName); 01052 01053 static HxImgFtorTableTem<HxImgFtorI1> funcTable; 01054 HxImgFtorI1* func = funcTable.find(funcKey); 01055 01056 if (func) { 01057 func->callIt(this, tags); 01058 } else { 01059 HxEnvironment::instance()->errorStream() 01060 << "Can't find " << funcKey << STD_ENDL; 01061 HxEnvironment::instance()->flush(); 01062 } 01063 } |
|
Geometric operation on 2D images.
Reimplemented in HxImageTem2d, and HxImageTem3d. |