#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 |
HxString | name () const |
void | name (HxString s) |
virtual int | dimensionality () const=0 |
virtual int | dimensionSize (int i) const=0 |
virtual HxSizes | sizes () const=0 |
virtual int | numberOfPixels () const=0 |
virtual int | pixelDimensionality () const=0 |
virtual HxValueType | pixelType () const=0 |
virtual int | pixelPrecision () const=0 |
virtual HxImageSignature | signature () const=0 |
Import/export operations | |
virtual void | import (HxByte *data, HxTagList &tags=HxMakeTagList(), HxString importOp="importPix") const |
virtual void | import (short *data, HxTagList &tags=HxMakeTagList(), HxString importOp="importPix") const |
virtual void | import (int *data, HxTagList &tags=HxMakeTagList(), HxString importOp="importPix") const |
virtual void | import (float *data, HxTagList &tags=HxMakeTagList(), HxString importOp="importPix") const |
virtual void | import (double *data, HxTagList &tags=HxMakeTagList(), HxString importOp="importPix") const |
virtual void | exportOp (HxByte *data, HxTagList &tags, HxString exportOp="exportPix") const |
virtual void | exportOp (short *data, HxTagList &tags, HxString exportOp="exportPix") const |
virtual void | exportOp (int *data, HxTagList &tags, HxString exportOp="exportPix") const |
virtual void | exportOp (float *data, HxTagList &tags, HxString exportOp="exportPix") const |
virtual void | exportOp (double *data, HxTagList &tags, HxString exportOp="exportPix") const |
virtual void | inout (HxString inOutOp, HxTagList &tags) const |
virtual void | inout (void *data, HxString dataType, HxString inOutOp, HxTagList &tags) const |
Set and border operations | |
virtual void | set (const HxValue val) |
virtual void | set (const HxImageData *arg) |
virtual void | set (int *pixels) |
virtual void | set (HxByte *pixels) |
virtual void | set (double *pixels)=0 |
void | setPartImage (const HxImageData *src) |
void | setPartImage (const HxImageData *src, HxTagList &tags) |
void | setPartImage (const HxImageData *src, HxPointInt srcBegin, HxPointInt srcEnd, HxPointInt dstBegin) |
void | setBorder (HxTagList &tags) |
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 (const HxImageData *arg1, const HxImageData *arg2, HxString bpoName, HxTagList &tags) |
Binary pixel operation. More... | |
virtual void | multiPixOp (HxImageData **args, const int nArgs, HxString mpoName, HxTagList &tags) |
Multi pixel operation. More... | |
virtual void | generalizedConvolution (const HxImageData *srcImg, const HxImageData *kerImg, HxString genMul, HxString genAdd, HxString kerName, HxTagList &tags) |
Generalized convolution operation. More... | |
virtual void | generalizedConvolutionK1d (const HxImageData *srcImg, int dimension, const HxImageData *kerImg, HxString genMul, HxString genAdd, HxString kerName, HxTagList &tags) |
Generalized convolution operation in one dimension. More... | |
virtual void | neighbourhoodOp (const HxImageData *src, HxString ngbName, HxTagList &tags)=0 |
Neighbourhood operation. More... | |
virtual void | neighbourhoodOp (const HxImageData *src, const HxImageData *kernel, HxString ngbName, HxTagList &tags)=0 |
Neighbourhood operation with kernel. More... | |
virtual void | recursiveNeighOp (const HxImageData *srcImg, const HxImageData *kerData, HxString genMul, HxString genAdd, HxTagList &tags) |
Recursive neighbourhood operation. More... | |
virtual void | rgbOp (HxString rgbName, HxTagList &tags) |
A scratch image with the same signature as the source image and the proper border size will be allocated. More... | |
void | MNPixOp (HxImageData **results, const int resultCnt, HxImageData **args, const int argCnt, HxString mpoName, HxTagList &tags) |
M output N input pixel operation. More... | |
Geometric operations | |
virtual void | geometricOp2d (const HxImageData *arg, HxMatrix func, HxGeoIntType gi, HxVec3Double translate, HxValue background)=0 |
virtual void | restrict (const HxImageData *arg, HxPoint begin) |
virtual void | extend (const HxImageData *arg, HxPoint begin) |
virtual HxImageData * | projectDomain (int dimension, int coordinate)=0 |
virtual void | inverseProjectDomain (int dimension, int coordinate, const HxImageData *arg)=0 |
Sample operations | |
virtual void | getValues (HxPointListConstIter first, HxPointListConstIter last, HxValueListBackInserter)=0 |
virtual HxValue | sampleIdentMask (const HxImageData *mask, HxPoint p, HxSizes size, int label, HxString sFunc)=0 |
virtual void | sampleIdentMask (const HxImageData *mask, HxPoint p, HxSizes size, int label, HxString sFunc, HxValueListBackInserter res)=0 |
virtual HxValue | sampleWeightMask (const HxImageData *mask, HxPoint p, HxString sFunc)=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 () const |
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 void | convertColor (HxVec3Double scale1, HxVec3Double gamma1, HxUpoVec3Double step1, HxUpoVec3Double step2, HxUpoVec3Double step3, HxVec3Double gamma2, HxVec3Double scale2)=0 |
virtual HxImageData * | projectRange (int dimension) |
virtual void | inverseProjectRange (int dimension, const HxImageData *arg) |
virtual void | transpose (const HxImageData *src)=0 |
Public Methods | |
void | weight (double w) |
HxScalarDouble | weight () const |
Protected Methods | |
int | checkEqualImageSig (HxString func, const HxImageData *arg) |
int | checkEqualImageSizes (HxString func, const HxImageData *arg) |
int | checkEqualImageSigAndSizes (HxString func, const HxImageData *arg) |
int | checkLargerImageSigAndSizes (HxString func, const HxImageData *arg) |
int | checkProperKernelSigAndSizes (HxString func, const HxImageData *kernel, int reqDim, int reqScalar, int appliedDim=0) |
int | checkEqualImageSizesDim (HxString func, const 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.
00042 { 00043 _ident = _nr++; 00044 _name = HxString("image") + makeString(_ident); 00045 _weight = 1; 00046 HxImageDataRepository::instance()->insertImage(this); 00047 if (_objectObserver) 00048 _objectObserver->constructed(_name); 00049 } |
|
Copy constructor.
00051 : HxRcObject() 00052 { 00053 HxEnvironment::instance()->warningStream() << 00054 "HxImageData copy constructor called" << STD_ENDL; 00055 HxEnvironment::instance()->flush(); 00056 } |
|
Destructor.
00059 { 00060 HxImageDataRepository::instance()->removeImage(this); 00061 if (_objectObserver) 00062 _objectObserver->destructed(_name); 00063 } |
|
Unary pixel operation.
00344 { 00345 HxImgFtorUpoKey funcKey(signature().toString(), 00346 srcImg->signature().toString(), 00347 upoName); 00348 00349 typedef HxImgFtorI2 FunctorType; 00350 00351 static HxImgFtorTableTem<FunctorType> funcTable; 00352 FunctorType* func = funcTable.find(funcKey); 00353 00354 if (func) { 00355 func->callIt(this, srcImg, tags); 00356 } else { 00357 HxEnvironment::instance()->errorStream() 00358 << "Can't find " << funcKey << STD_ENDL; 00359 HxEnvironment::instance()->flush(); 00360 } 00361 } |
|
Binary pixel operation.
00366 { 00367 if (!checkEqualImageSizes("binaryPixOp", arg1) || 00368 !checkEqualImageSizes("binaryPixOp", arg2)) 00369 return; 00370 00371 HxImgFtorBpoKey funcKey(signature().toString(), 00372 arg1->signature().toString(), 00373 arg2->signature().toString(), 00374 bpoName); 00375 00376 typedef HxImgFtorI3 FunctorType; 00377 00378 static HxImgFtorTableTem<FunctorType> funcTable; 00379 FunctorType* func = funcTable.find(funcKey); 00380 00381 if (func) { 00382 func->callIt(this, arg1, arg2, tags); 00383 } else { 00384 HxEnvironment::instance()->errorStream() 00385 << "Can't find " << funcKey << STD_ENDL; 00386 HxEnvironment::instance()->flush(); 00387 } 00388 } |
|
Multi pixel operation.
00394 { 00395 HxImgFtorMpoKey funcKey(signature().toString(), 00396 srcImgs[0]->signature().toString(), 00397 mpoName); 00398 00399 typedef HxImgFtorIM FunctorType; 00400 00401 static HxImgFtorTableTem<FunctorType> funcTable; 00402 FunctorType* func = funcTable.find(funcKey); 00403 00404 if (func) { 00405 func->callIt(this, srcImgs, nImgs, tags); 00406 } else { 00407 HxEnvironment::instance()->errorStream() 00408 << "Can't find " << funcKey << STD_ENDL; 00409 HxEnvironment::instance()->flush(); 00410 } 00411 } |
|
M output N input pixel operation.
00441 { 00442 HxImgFtorMNpoKey funcKey(resImgs[0]->signature().toString(), 00443 srcImgs[0]->signature().toString(), 00444 mpoName); 00445 00446 typedef HxImgFtorIMN FunctorType; 00447 00448 static HxImgFtorTableTem<FunctorType> funcTable; 00449 FunctorType* func = funcTable.find(funcKey); 00450 00451 if (func) { 00452 func->callIt(resImgs, resCnt, srcImgs, srcCnt, tags); 00453 } else { 00454 HxEnvironment::instance()->errorStream() 00455 << "Can't find " << funcKey << STD_ENDL; 00456 HxEnvironment::instance()->flush(); 00457 } 00458 } |
|
Generalized convolution operation.
00466 { 00467 HxSizes borderSize = kerImg->sizes() / HxSizes(2, 2, 2); 00468 if (!checkBorderSize("generalizedConvolution", borderSize)) 00469 return; 00470 HxSizes scratchSize = srcImg->sizes() + borderSize * HxSizes(2, 2, 2); 00471 HxImageData* scratchImg 00472 = HxImgDataFactory::instance().makeImage( 00473 kerImg->signature(), scratchSize); 00474 scratchImg->setPartImage( 00475 srcImg, HxPointInt(0, 0, 0), 00476 srcImg->sizes() - HxPointInt(1, 1, 1), borderSize); 00477 scratchImg->setBorder(borderSize, tags); 00478 00479 HxImgFtorGenConvKey funcKey( 00480 signature().toString(), 00481 scratchImg->signature().toString(), 00482 kerImg->signature().toString(), 00483 genMul, genAdd, kerName); 00484 00485 typedef HxImgFtorI3 FunctorType; 00486 00487 static HxImgFtorTableTem<FunctorType> funcTable; 00488 FunctorType* func = funcTable.find(funcKey); 00489 00490 if (func) { 00491 func->callIt(this, scratchImg, kerImg, tags); 00492 } else { 00493 HxEnvironment::instance()->errorStream() 00494 << "Can't find " << funcKey << STD_ENDL; 00495 HxEnvironment::instance()->flush(); 00496 } 00497 00498 delete scratchImg; 00499 } |
|
Generalized convolution operation in one dimension.
00507 { 00508 HxSizes borderSize; 00509 00510 switch (dimension) { 00511 case 1 : 00512 borderSize = HxSizes(kerImg->sizes().x() / 2, 0, 0); 00513 break; 00514 case 2 : 00515 borderSize = HxSizes(0, kerImg->sizes().x() / 2, 0); 00516 break; 00517 case 3 : 00518 borderSize = HxSizes(0, 0, kerImg->sizes().x() / 2); 00519 break; 00520 } 00521 00522 if (!checkBorderSize("generalizedConvolutionK1d", borderSize)) 00523 return; 00524 00525 HxAddTag<HxSizes>(tags, "borderSize", borderSize); 00526 HxAddTag<int>(tags, "dimension", dimension); 00527 00528 HxSizes scratchSize = srcImg->sizes() + borderSize * HxSizes(2, 2, 2); 00529 HxImageSignature scratchSig(kerImg->signature()); 00530 scratchSig.setImageDimensionality(signature().imageDimensionality()); 00531 HxImageData* scratchImg 00532 = HxImgDataFactory::instance().makeImage(scratchSig, scratchSize); 00533 00534 scratchImg->setPartImage( 00535 srcImg, HxPointInt(0, 0, 0), 00536 srcImg->sizes() - HxPointInt(1, 1, 1), borderSize); 00537 scratchImg->setBorder(borderSize, tags); 00538 00539 HxImgFtorGenConvK1dKey funcKey( 00540 signature().toString(), 00541 scratchImg->signature().toString(), 00542 kerImg->signature().toString(), 00543 genMul, genAdd, kerName); 00544 00545 typedef HxImgFtorI3 FunctorType; 00546 00547 static HxImgFtorTableTem<FunctorType> funcTable; 00548 FunctorType* func = funcTable.find(funcKey); 00549 00550 if (func) { 00551 func->callIt(this, scratchImg, kerImg, tags); 00552 } else { 00553 HxEnvironment::instance()->errorStream() 00554 << "Can't find " << funcKey << STD_ENDL; 00555 HxEnvironment::instance()->flush(); 00556 } 00557 00558 delete scratchImg; 00559 } |
|
Neighbourhood operation.
Reimplemented in HxImageTem, and HxImageTem2d. |
|
Neighbourhood operation with kernel.
Reimplemented in HxImageTem, and HxImageTem2d. |
|
Recursive neighbourhood operation.
00566 { 00567 int dimension = HxGetTag(tags, "dimension", 0); 00568 HxSizes borderSize = kerImg->sizes() / HxSizes(2, 2, 2); 00569 00570 switch(dimension) 00571 { 00572 case 1 : 00573 borderSize = HxSizes(borderSize.x(), 0, 0); 00574 break; 00575 case 2 : 00576 borderSize = HxSizes(0, borderSize.x(), 0); 00577 break; 00578 case 3 : 00579 borderSize = HxSizes(0, 0, borderSize.x()); 00580 break; 00581 } 00582 00583 if (!checkBorderSize("recursiveNeighOp", borderSize)) 00584 return; 00585 00586 HxSizes scratchSize = srcImg->sizes() + borderSize * HxSizes(2, 2, 2); 00587 HxImageData* scratchImg 00588 = HxImgDataFactory::instance().makeImage( 00589 kerImg->signature(), scratchSize); 00590 00591 scratchImg->setPartImage( 00592 srcImg, HxPointInt(0, 0, 0), 00593 srcImg->sizes() - HxPointInt(1, 1, 1), borderSize); 00594 scratchImg->setBorder(borderSize, tags, HXBORDERPROPAGATE); 00595 00596 HxImgFtorRecNgbKey funcKey( 00597 scratchImg->signature().toString(), 00598 kerImg->signature().toString(), genMul, genAdd); 00599 00600 typedef HxImgFtorI2 FunctorType; 00601 00602 static HxImgFtorTableTem<FunctorType> funcTable; 00603 FunctorType* func = funcTable.find(funcKey); 00604 00605 if (func) { 00606 HxAddTag(tags, "borderSize", borderSize); 00607 func->callIt(scratchImg, kerImg, tags); 00608 } else { 00609 HxEnvironment::instance()->errorStream() 00610 << "Can't find " << funcKey << STD_ENDL; 00611 HxEnvironment::instance()->flush(); 00612 } 00613 00614 setPartImage( 00615 scratchImg, borderSize, borderSize + sizes() - HxPointInt(1, 1, 1), 00616 HxPointInt(0, 0, 0)); 00617 00618 delete scratchImg; 00619 } |
|
A scratch image with the same signature as the source image and the proper border size will be allocated. The border size will be stored in the tag list. The scratch image will be set to the source image with a mirrored border unless specified in the tag list otherwise
00623 { 00624 HxImgFtorRgbKey funcKey(signature().toString(), rgbName); 00625 00626 typedef HxImgFtorI1 FunctorType; 00627 00628 static HxImgFtorTableTem<FunctorType> funcTable; 00629 FunctorType* func = funcTable.find(funcKey); 00630 00631 if (func) { 00632 func->callIt(this, tags); 00633 } else { 00634 HxEnvironment::instance()->errorStream() 00635 << "Can't find " << funcKey << STD_ENDL; 00636 HxEnvironment::instance()->flush(); 00637 } 00638 } |