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

HxImageRep Class Reference

Class definition of Horus image representation. More...

#include <HxImageRep.h>

List of all members.

Constructors

 HxImageRep ()
 Null image. More...

 HxImageRep (const HxImageRep &)
 Copy constructor. More...


Destructor

 ~HxImageRep ()
 Destructor. More...


Operators

HxImageRep & operator= (const HxImageRep &)
 Assignment operator. More...

int operator== (const HxImageRep &arg) const
 Equality. More...

int isNull () const
 Indicates wether this is a valid image. More...

 operator int () const
 Indicates wether this is a valid image. More...


Inquiry

int ident () const
 The unique identifier of the image. More...

HxString name () const
 The (not necessarily unique) name of the image. More...

void name (HxString s)
 Sets the name of the image. More...

int dimensionality () const
 The number of dimensions of the image. More...

int dimensionSize (int i) const
 The size of the image in the i-th dimension. More...

HxSizes sizes () const
 The dimension sizes of the image. More...

int numberOfPixels () const
 The total number of pixels in the image. More...

int pixelDimensionality () const
 The number of dimensions of one pixel. More...

HxValueType pixelType () const
 The pixel range value type. More...

int pixelPrecision () const
 The pixel size in bits. More...

HxImageSignature signature () const
 The signature of the image. More...


Unary pixel operations

HxImageRep unaryPixOp (HxString upoName, HxTagList &tags=HxMakeTagList()) const
 Unary pixel operation. More...


Binary pixel operations

HxImageRep binaryPixOp (const HxValue arg, HxString bpoName, HxTagList &tags=HxMakeTagList()) const
 Binary pixel operation. More...

HxImageRep binaryPixOp (const HxImageRep arg, HxString bpoName, HxTagList &tags=HxMakeTagList()) const
 Binary pixel operation. More...


Multi pixel operations.

HxImageRep multiPixOp (const HxImageList &args, HxString mpoName, HxTagList &tags=HxMakeTagList()) const
 Multi pixel operation. More...

HxImageList MNPixOp (const HxImageList &args, HxString mpoName, HxTagList &tags=HxMakeTagList()) const
 M output N input pixel operation. More...


Export operations

void exportOp (HxString exportName, HxTagList &tags=HxMakeTagList()) const
 Export operation. More...

void exportOpExtra (HxString exportName, HxImageRep extraIm, HxTagList &tags=HxMakeTagList()) const
 Export operation with an extra image. More...

HxValue reduceOp (HxString op, HxTagList &tags=HxMakeTagList()) const
 Reduce operation. More...


Generalized convolution operations.

HxImageRep generalizedConvolution (HxImageRep kerImg, HxString gMul, HxString gAdd, ResultPrecision resPrec=DEFAULT_PREC, HxTagList &tags=HxMakeTagList()) const
 Generalized convolution operation. More...

HxImageRep generalizedConvolutionK1d (int dimension, HxImageRep kerImg, HxString gMul, HxString gAdd, ResultPrecision resPrec=DEFAULT_PREC, HxTagList &tags=HxMakeTagList()) const
 Generalized convolution operation in one dimension. More...

HxImageRep genConvSeparated (HxImageRep kernel, HxString gMul, HxString gAdd, ResultPrecision resPrec=DEFAULT_PREC, HxTagList &tags=HxMakeTagList()) const
 Generalized convolution operation separated for each dimension. More...

HxImageRep genConv2dSep (HxImageRep kernel1, HxImageRep kernel2, HxString gMul, HxString gAdd, ResultPrecision resPrec=DEFAULT_PREC, HxTagList &tags=HxMakeTagList()) const
 Generalized convolution operation on 2d images separated for each dimension. More...

HxImageRep genConv3dSep (HxImageRep kernel1, HxImageRep kernel2, HxImageRep kernel3, HxString gMul, HxString gAdd, ResultPrecision resPrec=DEFAULT_PREC, HxTagList &tags=HxMakeTagList()) const
 Generalized convolution operation on 3d images separated for each dimension. More...


Recursive generalized convolution operations.

HxImageRep recGenConv (HxImageRep kerImg, HxString gMul, HxString gAdd, ResultPrecision resPrec=DEFAULT_PREC, HxTagList &tags=HxMakeTagList()) const
 Recursive generalized convolution operation. More...

HxImageRep recGenConv2dSep (HxImageRep kernel1, HxImageRep kernel2, HxString gMul, HxString gAdd, ResultPrecision resPrec=DEFAULT_PREC, HxTagList &tags=HxMakeTagList()) const
 Recursive generalized convolution operation on 2d images separated for each dimension. More...


Neighbourhood operations.

HxImageRep neighbourhoodOp (HxString ngbName, HxTagList &tags=HxMakeTagList()) const
 Neighbourhood operation. More...

HxImageRep neighbourhoodOpExtra (HxString ngbName, HxImageRep extraIm, HxTagList &tags=HxMakeTagList()) const
 Neighbourhood operation with an extra image. More...

HxImageRep neighbourhoodOpExtra2 (HxString ngbName, HxImageRep extraIm, HxImageRep extraIm2, HxTagList &tags=HxMakeTagList()) const
 Neighbourhood operation with two extra images. More...

HxImageRep neighbourhoodOp (HxImageRep kernel, HxString ngbName, HxTagList &tags=HxMakeTagList()) const
 Neighbourhood operation with kernel. More...


Queue based operations.

HxImageRep queueBasedOp (HxImageRep kernel, HxString qName, HxTagList &tags=HxMakeTagList()) const
 Queue based operation. More...


Geometric operations.

HxImageRep geometricOp2d (HxMatrix func, HxGeoIntType gi=LINEAR, HxGeoTransType gt=FORWARD, int adjustSize=1, HxValue background=HxValue(0)) const
 Geometric operation in 2D. More...


Do it yourself (DIY) operations.

HxImageRep diyOp (HxString diyName, HxTagList &tags=HxMakeTagList()) const
 DIY operation. More...


Misc operations

void setAt (const HxValue v, int x, int y=0, int z=0)
 setAt is to be removed. More...

HxValue getAt (int x, int y=0, int z=0) const
 Return pixel value at given position. More...

STD_OSTREAM & printInfo (STD_OSTREAM &os, int doData=0)
 Print information. More...


Output/display operations

void getRgbPixels2d (int *pixels, HxString displayMode, int resWidth=-1, int resHeight=-1, HxGeoIntType gi=NEAREST) const
 The getRgbPixels functions fill an externally allocated buffer(pixels) with pixelvalues of the (2d) image. More...

void getRgbPixels2d (int *pixels, HxString displayMode, int bufWidth, int bufHeight, int VX, int VY, int VW, int VH, double SX, double SY, double scaleX, double scaleY, HxGeoIntType gi) const
 Partial display for large images. More...

void getRgbPixels3d (int *pixels, HxString displayMode, int dimension, int coordinate, int resWidth=-1, int resHeight=-1, HxGeoIntType gi=NEAREST) const
 Display for 3D images. More...


For testing purposes only :-)

HxImageDatadirty ()
HxString ref () const
void setObjectObserver (const HxObjectObserver &)
void setImageDataObserver (const HxObjectObserver &)

Public Types

enum  ResultPrecision { DEFAULT_PREC, SOURCE_PREC, ARITH_PREC, SMALL_PREC }
 For some operations a precision needs to be specified. More...


Static Public Methods

void setDefaultResultPrecision (ResultPrecision resPrec)
 Set the value for DEFAULT_PREC. More...

ResultPrecision getResultPrecision (ResultPrecision resPrec=DEFAULT_PREC)
 Get the value for the result precision. More...


Friends

class HxImageFactory
class HxImageRepInit
HxImageRep L_HXIMAGEREP HxProjectRange (HxImageRep im, int dimension)
 Projection of the pixel range. More...

HxImageRep L_HXIMAGEREP HxInverseProjectRange (HxImageRep im, int dimension, HxImageRep arg)
 Inverse projection of the pixel range. More...

HxImageRep L_HXIMAGEREP HxRestrict (HxImageRep img, HxPoint begin, HxPoint end)
 Restriction of domain. More...

HxImageRep L_HXIMAGEREP HxExtend (HxImageRep img, HxImageRep background, HxPoint begin)
 Extension of domain. More...

HxImageRep L_HXIMAGEREP HxExtendVal (HxImageRep img, HxSizes newSize, HxValue background, HxPoint begin)
 Extension of domain. More...

void L_HXIMAGEREP HxGetValues (HxImageRep img, HxPointListConstIter first, HxPointListConstIter last, HxValueListBackInserter valPtr)
void L_HXIMAGEREP HxExportMatlabPixels (HxImageRep img, double *pixels)
 Export image data to array of int. More...


Detailed Description

Class definition of Horus image representation.


Member Enumeration Documentation

enum HxImageRep::ResultPrecision
 

For some operations a precision needs to be specified.

The type of the result image will be set according to the specified precision:

SOURCE\_PREC The result type is the same as the object type. ARITH\_PREC The result type is the same as the type of the kernel after the kernel has been converted. SMALL\_PREC The result type will be the same as above but with a smaller pixel precision. If the kernel has an integral pixel type the result pixel precision is that of short. If the kernel has a real pixel type the result pixel precision is that of float.

00239                                         {
00240                             DEFAULT_PREC, SOURCE_PREC,
00241                             ARITH_PREC, SMALL_PREC};


Constructor & Destructor Documentation

HxImageRep::HxImageRep  
 

Null image.

00126                        : _pointee(0) {
00127     if (_objectObserver)
00128         _objectObserver->constructed(name());
00129 }

HxImageRep::HxImageRep const HxImageRep &    rhs
 

Copy constructor.

00132     : _pointee(rhs.pointee())
00133 {
00134     if (_objectObserver)
00135         _objectObserver->constructed(name());
00136 }

HxImageRep::~HxImageRep  
 

Destructor.

00347 {
00348     if (_objectObserver)
00349         _objectObserver->destructed(name());
00350 }


Member Function Documentation

HxImageRep & HxImageRep::operator= const HxImageRep &    rhs
 

Assignment operator.

00357 {
00358     _pointee = rhs._pointee;
00359     return *this;
00360 }

int HxImageRep::operator== const HxImageRep &    arg const
 

Equality.

00364 {
00365     return ident() == arg.ident();
00366 }

int HxImageRep::isNull   const
 

Indicates wether this is a valid image.

00370 { 
00371     return !int(_pointee); 
00372 }

HxImageRep::operator int   const
 

Indicates wether this is a valid image.

00375 { 
00376     return int(_pointee); 
00377 }

int HxImageRep::ident   const
 

The unique identifier of the image.

00384 {
00385     return pointee() ? pointee()->ident() : 0;
00386 }

HxString HxImageRep::name   const
 

The (not necessarily unique) name of the image.

00390 {
00391     return pointee() ? pointee()->name() : HxString("");
00392 }

void HxImageRep::name HxString    s
 

Sets the name of the image.

00396 {
00397     if (pointee())
00398         pointee()->name(s);
00399 }

int HxImageRep::dimensionality   const
 

The number of dimensions of the image.

00403 {
00404     return pointee() ? pointee()->dimensionality() : 0;
00405 }

int HxImageRep::dimensionSize int    i const
 

The size of the image in the i-th dimension.

The first dimension has i = 1.

00409 {
00410     return pointee() ? pointee()->dimensionSize(i) : 0;
00411 }

HxSizes HxImageRep::sizes   const
 

The dimension sizes of the image.

00445 {
00446     return pointee() ? pointee()->sizes() : HxSizes(0, 0, 0);
00447 }

int HxImageRep::numberOfPixels   const
 

The total number of pixels in the image.

00415 {
00416     return pointee() ? pointee()->numberOfPixels() : 0;
00417 }

int HxImageRep::pixelDimensionality   const
 

The number of dimensions of one pixel.

00421 {
00422     return pointee() ? pointee()->pixelDimensionality() : 0;
00423 }

HxValueType HxImageRep::pixelType   const
 

The pixel range value type.

INT_VALUE or REAL_VALUE or COMPLEX_VALUE.

00427 {
00428     return pointee() ? pointee()->pixelType() : INT_VALUE;
00429 }

int HxImageRep::pixelPrecision   const
 

The pixel size in bits.

If the pixel has more than one dimension the size of a pixel element is returned.

00433 {
00434     return pointee() ? pointee()->pixelPrecision() : 0;
00435 }

HxImageSignature HxImageRep::signature   const
 

The signature of the image.

00439 {
00440     return pointee() ? pointee()->signature() : HxImageSignature();
00441 }

HxImageRep HxImageRep::unaryPixOp HxString    upoName,
HxTagList   tags = HxMakeTagList()
const
 

Unary pixel operation.

The result is obtained by applying the pixel functor designated by string "op" to all pixels in this image.

00454 {
00455     if (!pointee())
00456         return HxImageRep();
00457     HxMfUpo methodFrame(pointee(), upoName);
00458     if (methodFrame.result())
00459         methodFrame.result()->unaryPixOp(methodFrame.source(), upoName, tags);
00460     return HxImageRep(methodFrame.result());
00461 }

HxImageRep HxImageRep::binaryPixOp const HxValue    val,
HxString    bpoName,
HxTagList   tags = HxMakeTagList()
const
 

Binary pixel operation.

The result is obtained by applying the pixel functor designated by string "bpoName" to all pairs of pixels in this image and the argument.

00486 {
00487     if (!pointee())
00488         return HxImageRep();
00489     HxMfUpo methodFrame(pointee(), bpoName);
00490     HxAddTag(tags, "value", val);
00491     methodFrame.result()->unaryPixOp(methodFrame.source(), bpoName, tags);
00492     return HxImageRep(methodFrame.result());
00493 }

HxImageRep HxImageRep::binaryPixOp const HxImageRep    arg,
HxString    bpoName,
HxTagList   tags = HxMakeTagList()
const
 

Binary pixel operation.

The result is obtained by applying the pixel functor designated by string "bpoName" to all pairs of pixels in this image and the argument.

00498 {
00499     if (!pointee())
00500         return HxImageRep();
00501     HxMfBpo methodFrame(pointee(), arg.pointee(), bpoName);
00502     if (methodFrame.preOpIsOk())
00503         methodFrame.result()->binaryPixOp(methodFrame.source1(),
00504                                 methodFrame.source2(), bpoName, tags);
00505     return methodFrame.preOpIsOk()  ? HxImageRep(methodFrame.result())
00506                                     : HxImageRep();
00507 }

HxImageRep HxImageRep::multiPixOp const HxImageList   args,
HxString    mpoName,
HxTagList   tags = HxMakeTagList()
const
 

Multi pixel operation.

The result is obtained by applying the pixel functor designated by string "mpoName" to corresponding pixels in this image and all argument images.

00515 {
00516     if (!pointee())
00517         return HxImageRep();
00518 
00519     HxImageData **imsPointee = new HxImageData * [args.size()+1];
00520     HxImageList::const_iterator i;
00521     int n = 0;
00522 
00523     imsPointee[n++] = pointee();
00524     for (i = args.begin(); i != args.end(); i++)
00525         imsPointee[n++] = (*i).pointee();
00526 
00527     HxMfMpo methodFrame(imsPointee, n, mpoName);
00528 
00529     methodFrame.result()->multiPixOp(methodFrame.sources(),
00530                             methodFrame.nSources(), mpoName, tags);
00531 
00532     delete [] imsPointee;
00533 
00534     return HxImageRep(methodFrame.result());
00535 }

HxImageList HxImageRep::MNPixOp const HxImageList   args,
HxString    mpoName,
HxTagList   tags = HxMakeTagList()
const
 

M output N input pixel operation.

The results is obtained by applying the pixel functor designated by string "mpoName" to corresponding pixels in this image and all argument images.

00543 {
00544     if (!pointee())
00545         return HxImageRep();
00546 
00547     typedef HxImageData** HxImgDataPtrArray;
00548 
00549     HxImageData **srcPtrs = new HxImageData * [args.size()+1];
00550     HxImageList::const_iterator i;
00551     int srcCnt = 0;
00552 
00553     srcPtrs[srcCnt++] = pointee();
00554     for (i = args.begin(); i != args.end(); i++)
00555         srcPtrs[srcCnt++] = (*i).pointee();
00556 
00557     HxMfMNpo methodFrame(srcPtrs, srcCnt, mpoName);
00558 
00559     delete [] srcPtrs;
00560 
00561     HxImageData::MNPixOp(
00562         methodFrame.results(), methodFrame.resultCnt(),
00563         methodFrame.sources(), methodFrame.sourceCnt(), mpoName, tags);
00564 
00565     HxImageList result;
00566 
00567     for (int n = 0; n < methodFrame.resultCnt(); n++) {
00568     HxImageRep temp(methodFrame.results(n));
00569         result += temp;
00570     }
00571 
00572     return result;
00573 }

void HxImageRep::exportOp HxString    exportName,
HxTagList   tags = HxMakeTagList()
const
 

Export operation.

00580 {
00581     if (HxImgFtorRuleBase::instance().getIsModifying("inout", exportName))
00582     {
00583         HxEnvironment::instance()->errorStream()
00584             << "Error: " << exportName << " is an image data modifying "
00585             << "operator" << STD_ENDL;
00586         return;
00587     }
00588     if (pointee())
00589         pointee()->inout(exportName, tags);
00590 }

void HxImageRep::exportOpExtra HxString    exportName,
HxImageRep    extraIm,
HxTagList   tags = HxMakeTagList()
const
 

Export operation with an extra image.

00595 {
00596     HxMfExportExtra methodFrame(pointee(), extraIm.pointee(), exportName, tags);
00597     if (methodFrame.preOpIsOk())
00598         methodFrame.source()->exportExtra(exportName, methodFrame.extra(), tags);
00599 }

HxValue HxImageRep::reduceOp HxString    op,
HxTagList   tags = HxMakeTagList()
const
 

Reduce operation.

The result is obtained by reducing all pixel values in this image to a single value by applying the pixel functor designated by string "op" repeatedly to a combination of 2 values.

00603 {
00604     exportOp(op, tags);
00605     HxValue result = HxGetTag(tags, "result", HxValue(0));
00606     return result;
00607 }

void HxImageRep::setDefaultResultPrecision ResultPrecision    resPrec [static]
 

Set the value for DEFAULT_PREC.

00043 {
00044     _defaultResPrec = resPrec;
00045 }

HxImageRep::ResultPrecision HxImageRep::getResultPrecision ResultPrecision    resPrec = DEFAULT_PREC [static]
 

Get the value for the result precision.

00049 {
00050     return resPrec == DEFAULT_PREC ? _defaultResPrec : resPrec;
00051 }

HxImageRep HxImageRep::generalizedConvolution HxImageRep    kernel,
HxString    gMul,
HxString    gAdd,
ResultPrecision    resPrec = DEFAULT_PREC,
HxTagList   tags = HxMakeTagList()
const
 

Generalized convolution operation.

The result is obtained by sliding the kernel over this image and at each position combining the values of the kernel with the underlying values of this image by means of the pixel punctor designated by "gMul", and reducing this set of values to a single value by means of the pixel functor designated by "gAdd".

00616 {
00617     resPrec = getResultPrecision(resPrec);
00618 
00619     HxMfGenConv methodFrame(pointee(), kernel.pointee(), resPrec);
00620     if (methodFrame.preOpIsOk())
00621         methodFrame.result()->generalizedConvolution(
00622                                 methodFrame.source(),
00623                                 methodFrame.kernel(),
00624                                 gMul, gAdd, "stdKernel", tags);
00625     return methodFrame.preOpIsOk()  ? HxImageRep(methodFrame.result())
00626                                     : HxImageRep();
00627 }

HxImageRep HxImageRep::generalizedConvolutionK1d int    dimension,
HxImageRep    kernel,
HxString    gMul,
HxString    gAdd,
ResultPrecision    resPrec = DEFAULT_PREC,
HxTagList   tags = HxMakeTagList()
const
 

Generalized convolution operation in one dimension.

The result is obtained by sliding the kernel over this image and at each position combining the values of the kernel with the underlying values of this image by means of the pixel punctor designated by "gMul", and reducing this set of values to a single value by means of the pixel functor designated by "gAdd".

The kernel images should be two dimensional and the size in the second dimension should be 1. The convolution is performed in the specified dimension only. The precision of the result type is as specified by resPrec.

00633 {
00634     resPrec = getResultPrecision(resPrec);
00635 
00636     HxMfGenConv methodFrame(pointee(), kernel.pointee(), resPrec, true);
00637     if (methodFrame.preOpIsOk())
00638         methodFrame.result()->generalizedConvolutionK1d(
00639                                 methodFrame.source(),
00640                                 dimension, methodFrame.kernel(),
00641                                 gMul, gAdd, "stdKernel", tags);
00642     return methodFrame.preOpIsOk()  ? HxImageRep(methodFrame.result())
00643                                     : HxImageRep();
00644 }

HxImageRep HxImageRep::genConvSeparated HxImageRep    kernel,
HxString    gMul,
HxString    gAdd,
ResultPrecision    resPrec = DEFAULT_PREC,
HxTagList   tags = HxMakeTagList()
const
 

Generalized convolution operation separated for each dimension.

The result is obtained by sliding the kernel over this image and at each position combining the values of the kernel with the underlying values of this image by means of the pixel punctor designated by "gMul", and reducing this set of values to a single value by means of the pixel functor designated by "gAdd".

The convolution is performed separately in all The kernel images should be two dimensional and the size in the second dimension should be 1. dimensions using the same kernel. The precision of the result type is as specified by resPrec.

00650 {
00651     if (dimensionality() == 2)
00652         return genConv2dSep(kernel, kernel, gMul, gAdd, resPrec, tags);
00653     return genConv3dSep(kernel, kernel, kernel, gMul, gAdd, resPrec, tags);
00654 }

HxImageRep HxImageRep::genConv2dSep HxImageRep    kernel1,
HxImageRep    kernel2,
HxString    gMul,
HxString    gAdd,
ResultPrecision    resPrec = DEFAULT_PREC,
HxTagList   tags = HxMakeTagList()
const
 

Generalized convolution operation on 2d images separated for each dimension.

The result is obtained by sliding the kernels over this image and at each position combining the values of the kernel with the underlying values of this image by means of the pixel punctor designated by "gMul", and reducing this set of values to a single value by means of the pixel functor designated by "gAdd".

The kernel images should be two dimensional and the size in the second dimension should be 1. The convolution is performed using kernel1 in the first dimension and kernel2 in the second dimension. The precision of the result type is as specified by resPrec.

00685 {
00686     resPrec = getResultPrecision(resPrec);
00687 
00688     HxMfGenConv methodFrame(pointee(), kernel1.pointee(), kernel2.pointee(), 
00689                             resPrec, true);
00690 
00691     if (!methodFrame.preOpIsOk())
00692         return HxImageRep();
00693     
00694     bool useK1d = HxGetTag(tags, "useK1d", false);
00695 
00696     if (useK1d)
00697         methodFrame.result()->genConvSeparated(
00698                             methodFrame.source(), 1,
00699                             methodFrame.kernel(), methodFrame.kernel2(),
00700                             gMul, gAdd, "stdKernel", tags);
00701     else
00702         methodFrame.result()->genConv2dSep(
00703                             methodFrame.source(),
00704                             methodFrame.kernel(), methodFrame.kernel2(),
00705                             gMul, gAdd, "stdKernel", tags);
00706 
00707     return methodFrame.preOpIsOk()  ? HxImageRep(methodFrame.result())
00708                                     : HxImageRep();
00709 }

HxImageRep HxImageRep::genConv3dSep HxImageRep    kernel1,
HxImageRep    kernel2,
HxImageRep    kernel3,
HxString    gMul,
HxString    gAdd,
ResultPrecision    resPrec = DEFAULT_PREC,
HxTagList   tags = HxMakeTagList()
const
 

Generalized convolution operation on 3d images separated for each dimension.

The result is obtained by sliding the kernels over this image and at each position combining the values of the kernel with the underlying values of this image by means of the pixel punctor designated by "gMul", and reducing this set of values to a single value by means of the pixel functor designated by "gAdd".

The kernel images should be two dimensional and the size in the second dimension should be 1. The convolution is performed using kernel1 in the first dimension, etc. The precision of the result type is as specified by resPrec.

00716 {
00717     resPrec = getResultPrecision(resPrec);
00718 
00719     HxMfGenConv methodFrame(pointee(), kernel1.pointee(), kernel2.pointee(),
00720                             kernel3.pointee(), resPrec, true);
00721 
00722     if (!methodFrame.preOpIsOk())
00723         return HxImageRep();
00724 
00725     methodFrame.result()->genConv3dSep(
00726                             methodFrame.source(), methodFrame.kernel(),
00727                             methodFrame.kernel2(), methodFrame.kernel3(),
00728                             gMul, gAdd, "stdKernel", tags);
00729 
00730     return methodFrame.preOpIsOk()  ? HxImageRep(methodFrame.result())
00731                                     : HxImageRep();
00732 }

HxImageRep HxImageRep::recGenConv HxImageRep    kernel,
HxString    gMul,
HxString    gAdd,
ResultPrecision    resPrec = DEFAULT_PREC,
HxTagList   tags = HxMakeTagList()
const
 

Recursive generalized convolution operation.

The result is obtained by sliding the kernel over this image and at each position combining the values of the kernel with the underlying values of this image by means of the pixel punctor designated by "gMul", and reducing this set of values to a single value by means of the pixel functor designated by "gAdd". The operation has two passes : a forward pass (from the upper left corner to the lower right corner) and a backward pass (lower right to upper left). The forward pass uses the "upper left" part of the kernel, the backward pass the "lower right" part. The result at each position is written "in the input image" so it has an influence at the next position.

00741 {
00742     resPrec = getResultPrecision(resPrec);
00743 
00744     HxMfGenConv methodFrame(pointee(), kernel.pointee(), resPrec);
00745     if (methodFrame.preOpIsOk())
00746         methodFrame.result()->recGenConv(
00747                                 methodFrame.source(), methodFrame.kernel(),
00748                                 gMul, gAdd, tags);
00749     return methodFrame.preOpIsOk()  ? HxImageRep(methodFrame.result())
00750                                     : HxImageRep();
00751 }

HxImageRep HxImageRep::recGenConv2dSep HxImageRep    kernel1,
HxImageRep    kernel2,
HxString    gMul,
HxString    gAdd,
ResultPrecision    resPrec = DEFAULT_PREC,
HxTagList   tags = HxMakeTagList()
const
 

Recursive generalized convolution operation on 2d images separated for each dimension.

The result is obtained by sliding the kernel over this image and at each position combining the values of the kernel with the underlying values of this image by means of the pixel punctor designated by "gMul", and reducing this set of values to a single value by means of the pixel functor designated by "gAdd". The operation has two passes : a forward pass (from the upper left corner to the lower right corner) and a backward pass (lower right to upper left). The forward pass uses the "upper left" part of the kernel, the backward pass the "lower right" part. The result at each position is written "in the input image" so it has an influence at the next position.

The kernel images should be two dimensional and the size in the second dimension should be 1. The convolution is performed using kernel1 in the first dimension and kernel2 in the second dimension. The precision of the result type is as specified by resPrec.

00757 {
00758     resPrec = getResultPrecision(resPrec);
00759 
00760     HxMfGenConv methodFrame(pointee(), kernel1.pointee(), kernel2.pointee(), 
00761                             resPrec, true);
00762     if (methodFrame.preOpIsOk())
00763         methodFrame.result()->recGenConv2dSep(
00764                                 methodFrame.source(), methodFrame.kernel(),
00765                                 methodFrame.kernel2(),
00766                                 gMul, gAdd, tags);
00767     return methodFrame.preOpIsOk()  ? HxImageRep(methodFrame.result())
00768                                     : HxImageRep();
00769 }

HxImageRep HxImageRep::neighbourhoodOp HxString    ngbName,
HxTagList   tags = HxMakeTagList()
const
 

Neighbourhood operation.

Slides a "neighbourhood" over this image and offers all pixels in the neighbourhood to the functor designated by "ngbName". The result at each position is determined by "ngbName".

00776 {
00777     HxMfNgb methodFrame(pointee(), ngbName, tags);
00778     if (methodFrame.preOpIsOk())
00779         methodFrame.result()->neighbourhoodOp(
00780                                 methodFrame.source(), ngbName, tags);
00781     return methodFrame.preOpIsOk()  ? HxImageRep(methodFrame.result())
00782                                     : HxImageRep();
00783 }

HxImageRep HxImageRep::neighbourhoodOpExtra HxString    ngbName,
HxImageRep    extraIm,
HxTagList   tags = HxMakeTagList()
const
 

Neighbourhood operation with an extra image.

Slides a "neighbourhood" over the images and offers all pixels in the neighbourhood to the functor designated by "ngbName". The result at each position is determined by "ngbName".

00788 {
00789     HxMfNgb methodFrame(pointee(), extraIm.pointee(), ngbName, tags);
00790     if (methodFrame.preOpIsOk())
00791         methodFrame.result()->neighbourhoodOpExtra(
00792                                 methodFrame.source(), methodFrame.extra(),
00793                                 ngbName, tags);
00794     return methodFrame.preOpIsOk()  ? HxImageRep(methodFrame.result())
00795                                     : HxImageRep();
00796 }

HxImageRep HxImageRep::neighbourhoodOpExtra2 HxString    ngbName,
HxImageRep    extraIm,
HxImageRep    extraIm2,
HxTagList   tags = HxMakeTagList()
const
 

Neighbourhood operation with two extra images.

Slides a "neighbourhood" over the images and offers all pixels in the neighbourhood to the functor designated by "ngbName". The result at each position is determined by "ngbName".

00801 {
00802     HxMfNgb methodFrame(pointee(), extraIm.pointee(), extraIm2.pointee(),
00803                         ngbName, tags);
00804     if (methodFrame.preOpIsOk())
00805         methodFrame.result()->neighbourhoodOpExtra2(
00806                                 methodFrame.source(), methodFrame.extra(),
00807                                 methodFrame.extra2(), ngbName, tags);
00808     return methodFrame.preOpIsOk()  ? HxImageRep(methodFrame.result())
00809                                     : HxImageRep();
00810 }

HxImageRep HxImageRep::neighbourhoodOp HxImageRep    kernel,
HxString    ngbName,
HxTagList   tags = HxMakeTagList()
const
 

Neighbourhood operation with kernel.

Slides a "neighbourhood" over this image and offers all pixels in the neighbourhood as well as the corresponding pixels in the kernel to the functor designated by "ngbName". The result at each position is determined by "ngbName".

00815 {
00816     HxMfKernelNgb methodFrame(pointee(), kernel.pointee(), ngbName, tags);
00817     if (methodFrame.preOpIsOk())
00818         methodFrame.result()->neighbourhoodOp(
00819                                 methodFrame.source(), methodFrame.kernel(),
00820                                 ngbName, tags);
00821     return methodFrame.preOpIsOk()  ? HxImageRep(methodFrame.result())
00822                                     : HxImageRep();
00823 }

HxImageRep HxImageRep::queueBasedOp HxImageRep    kernel,
HxString    qName,
HxTagList   tags = HxMakeTagList()
const
 

Queue based operation.

00831 {
00832     HxMfQueueBased methodFrame(pointee(), kernel.pointee(), qName, tags);
00833     if (methodFrame.preOpIsOk())
00834         methodFrame.result()->queueBasedOp(
00835                                 methodFrame.source(), methodFrame.kernel(),
00836                                 qName, tags);
00837     return methodFrame.preOpIsOk()  ? HxImageRep(methodFrame.result())
00838                                     : HxImageRep();
00839 }

HxImageRep HxImageRep::geometricOp2d HxMatrix    func,
HxGeoIntType    gi = LINEAR,
HxGeoTransType    gt = FORWARD,
int    adjustSize = 1,
HxValue    background = HxValue(0)
const
 

Geometric operation in 2D.

The result is obtained by applying the given transformation to the position of each pixel in this image. By default, the actual transformation is based on the inverse of the given transformation matrix M: f(x) = M.i() * x (postfix multiplication). Beware that the image coordinate system has a different orientation than the cartesian coordinate system used in specification of matrix M.

The matrix needs to be 3x3 (homogeneous coordinates)

00847 {
00848     if ((func.nCol() != 3) || (func.nRow() != 3))
00849         return errorIm("geometricOp2d: matrix needs to be 3x3");
00850 
00851     HxMatrix funcForw = (gt == FORWARD) ? func : func.i();
00852     HxMatrix funcBack = (gt == FORWARD) ? func.i() : func;
00853     if (!funcForw.valid() || !funcBack.valid())
00854         return errorIm("geometricOp2d: matrix is not valid");
00855 
00856     HxSizes newSize = sizes();
00857     HxVec3Double translate = HxVec3Double(0,0,0);
00858     if (adjustSize) {
00859         HxVec3Double ulP = funcForw * HxVec3Double(0,0,1);
00860         HxVec3Double llP = funcForw * HxVec3Double(0, dimensionSize(2), 1);
00861         HxVec3Double urP = funcForw * HxVec3Double(dimensionSize(1), 0, 1);
00862         HxVec3Double lrP = funcForw * sizes();
00863         ulP /= HxScalarDouble(ulP.z()); // homogeneous coordinates
00864         llP /= HxScalarDouble(llP.z());
00865         urP /= HxScalarDouble(urP.z());
00866         lrP /= HxScalarDouble(lrP.z());
00867 
00868         HxVec3Double maerB = ulP.inf(llP).inf(urP).inf(lrP);
00869         HxVec3Double maerE = ulP.sup(llP).sup(urP).sup(lrP);
00870         newSize = HxSizes(maerE.x() - maerB.x() + 0.5,
00871             maerE.y() - maerB.y() + 0.5, 1);
00872         translate = HxVec3Double(maerB.x(), maerB.y(), 0);
00873     }
00874 
00875     HxMfResize methodFrame(pointee(), newSize);
00876     methodFrame.result()->geometricOp2d(methodFrame.source(), funcBack, gi,
00877                                         translate, background);
00878     return HxImageRep(methodFrame.result());
00879 }

HxImageRep HxImageRep::diyOp HxString    diyName,
HxTagList   tags = HxMakeTagList()
const
 

DIY operation.

Offers data pointers to this image and the result image to the functor designated by "diyName".

00971 {
00972     if (!pointee())
00973         return HxImageRep();
00974     HxSizes resultSizes = HxGetTag(tags, "resultSizes", sizes());
00975     HxMfDiy methodFrame(pointee(), diyName, resultSizes);
00976     methodFrame.result()->diyOp(methodFrame.source(), diyName, tags);
00977     return HxImageRep(methodFrame.result());
00978 }

void HxImageRep::setAt const HxValue    v,
int    x,
int    y = 0,
int    z = 0
 

setAt is to be removed.

00996 {
00997     if (_pointee) {
00998         _pointee.getUnshared();
00999         _pointee->setAt(x, y, z, v);
01000     }
01001 }

HxValue HxImageRep::getAt int    x,
int    y = 0,
int    z = 0
const
 

Return pixel value at given position.

01005 {
01006     return _pointee ? _pointee->getAt(x, y, z) : HxValue(HxScalarInt(0));
01007 }

STD_OSTREAM & HxImageRep::printInfo STD_OSTREAM &    os,
int    doData = 0
 

Print information.

01011 {
01012     return _pointee ? pointee()->printInfo(os, doData) : os ;
01013 }

void HxImageRep::getRgbPixels2d int *    pixels,
HxString    displayMode,
int    resWidth = -1,
int    resHeight = -1,
HxGeoIntType    gi = NEAREST
const
 

The getRgbPixels functions fill an externally allocated buffer(pixels) with pixelvalues of the (2d) image.

The values are stored in the buffer according to the format used in Java. Conversion of pixel values in the image to the Java format is done via a HxRgbFunctor (a function object). By default, the size of the pixels buffer matches the image sizes. However, the user may request pixels at a different resolution by giving a resWidth and resHeight. Then, for each pixel in the buffer the value is obtained from the relative position (resWidth is mapped onto the image width, etc.). The value at the relative position is obtained through the given geometric interpolation type gi (and passed to the RgbFunctor). See also: \Ref{Color conversion/display}

01035 {
01036     if (!pointee())
01037         return;
01038 
01039     HxTagList tags;
01040     HxAddTag(tags, "pixels", pixels);
01041     HxAddTag(tags, "resWidth", resWidth);
01042     HxAddTag(tags, "resHeight", resHeight);
01043     HxAddTag(tags, "gi", gi);
01044 
01045     if (displayMode == HxString("LogMagnitude")) {
01046         HxImageRep n2 = HxNorm2(*this);
01047         double lowVal = ((HxScalarDouble)n2.reduceOp("minAssign")).x();
01048         double highVal = ((HxScalarDouble)n2.reduceOp("maxAssign")).x();
01049         HxAddTag(tags, "lowVal", lowVal);
01050         HxAddTag(tags, "highVal", highVal);
01051 
01052         n2.pointee()->rgbOp(displayMode, tags);
01053         return;
01054     }
01055 
01056     if (displayMode == HxString("Stretch")) {
01057         double lowVal = ((HxVec3Double) reduceOp("minAssign")).min().x();
01058         double highVal = ((HxVec3Double) reduceOp("maxAssign")).max().x();
01059         HxAddTag(tags, "lowVal", lowVal);
01060         HxAddTag(tags, "highVal", highVal);
01061     }
01062 
01063     pointee()->rgbOp(displayMode, tags);
01064 }

void HxImageRep::getRgbPixels2d int *    pixels,
HxString    displayMode,
int    bufWidth,
int    bufHeight,
int    VX,
int    VY,
int    VW,
int    VH,
double    SX,
double    SY,
double    scaleX,
double    scaleY,
HxGeoIntType    gi
const
 

Partial display for large images.

01070 {
01071     if (!pointee())
01072         return;
01073     pointee()->getRgbPixels2d(pixels, displayMode, bufWidth, bufHeight,
01074             VX, VY, VW, VH, SX, SY, scaleX, scaleY, gi);
01075 }

void HxImageRep::getRgbPixels3d int *    pixels,
HxString    displayMode,
int    dimension,
int    coordinate,
int    resWidth = -1,
int    resHeight = -1,
HxGeoIntType    gi = NEAREST
const
 

Display for 3D images.

01080 {
01081     if (!pointee())
01082         return;
01083     HxTagList tags;
01084     HxAddTag(tags, "pixels", pixels);
01085     HxAddTag(tags, "dimension", dimension);
01086     HxAddTag(tags, "coordinate", coordinate);
01087     HxAddTag(tags, "resWidth", resWidth);
01088     HxAddTag(tags, "resHeight", resHeight);
01089     HxAddTag(tags, "gi", gi);
01090 
01091     if (displayMode == HxString("LogMagnitude")) {
01092         HxImageRep n2 = HxNorm2(*this);
01093         double lowVal = ((HxScalarDouble)n2.reduceOp("minAssign")).x();
01094         double highVal = ((HxScalarDouble)n2.reduceOp("maxAssign")).x();
01095         HxAddTag(tags, "lowVal", lowVal);
01096         HxAddTag(tags, "highVal", highVal);
01097 
01098         n2.pointee()->rgbOp(displayMode, tags);
01099         return;
01100     }
01101 
01102     if (displayMode == HxString("Stretch")) {
01103         double lowVal = ((HxVec3Double) reduceOp("minAssign")).min().x();
01104         double highVal = ((HxVec3Double) reduceOp("maxAssign")).max().x();
01105         HxAddTag(tags, "lowVal", lowVal);
01106         HxAddTag(tags, "highVal", highVal);
01107     }
01108 
01109     pointee()->rgbOp(displayMode, tags);
01110 }


Friends And Related Function Documentation

HxImageRep L_HXIMAGEREP HxProjectRange HxImageRep    im,
int    dimension
[friend]
 

Projection of the pixel range.

The function computes the projection (see Pixels) of all pixels in the input image via a unary pixel operation (see Images). Dimension starts at 1.

00013 {
00014     HxString fname("HxProjectRange");
00015 
00016     if (im.isNull())
00017     {
00018         HxGlobalError::instance()->reportError(fname, im.name(), "null image", HxGlobalError::HX_GE_INVALID);
00019         return HxImageRep();
00020     }
00021     if ((im.pixelDimensionality() != 2) &&
00022         (im.pixelDimensionality() != 3))
00023     {
00024         HxGlobalError::instance()->reportError(fname, "Operation is only valid for Vector images", HxGlobalError::HX_GE_INVALID);
00025         return HxImageRep();
00026     }
00027     if (dimension < 1)
00028     {
00029         HxGlobalError::instance()->reportError(fname, "Dimension should be greater than zero", HxGlobalError::HX_GE_INVALID);
00030         return HxImageRep();
00031     }
00032     if (dimension > im.pixelDimensionality())
00033     {
00034         HxGlobalError::instance()->reportError(fname, "Dimension should be less than pixel dimensionality", HxGlobalError::HX_GE_INVALID);
00035         return HxImageRep();
00036     }
00037 
00038     return im.projectRange(dimension);
00039 }

HxImageRep L_HXIMAGEREP HxInverseProjectRange HxImageRep    im,
int    dimension,
HxImageRep    arg
[friend]
 

Inverse projection of the pixel range.

The function projects (see Pixels) all pixels of image im on the given dimension of image arg via a unary pixel operation (see Images). Dimension starts at 1.

00013 {
00014     HxString fname("HxInverseProjectRange");
00015 
00016     if (im.isNull())
00017     {
00018         HxGlobalError::instance()->reportError(fname, im.name(), "null image", HxGlobalError::HX_GE_INVALID);
00019         return HxImageRep();
00020     }
00021     if (arg.isNull())
00022     {
00023         HxGlobalError::instance()->reportError(fname, arg.name(), "null arg image", HxGlobalError::HX_GE_INVALID);
00024         return HxImageRep();
00025     }
00026 
00027     if (im.dimensionality() != arg.dimensionality())
00028     {
00029         HxGlobalError::instance()->reportError(fname, "unequal image dimensionalities", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00030         return HxImageRep();
00031     }
00032 
00033     if (im.pixelDimensionality() != 1)
00034     {
00035         HxGlobalError::instance()->reportError(fname, "operation only valid on scalar input images", HxGlobalError::HX_GE_INVALID);
00036         return HxImageRep();
00037     }
00038 
00039     if (im.sizes().x() != arg.sizes().x())
00040     {
00041         HxGlobalError::instance()->reportError(fname, "unequal image widths", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00042         return HxImageRep();
00043     }
00044     if (im.sizes().y() != arg.sizes().y())
00045     {
00046         HxGlobalError::instance()->reportError(fname, "unequal image heights", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00047         return HxImageRep();
00048     }
00049     if (im.dimensionality() > 2)
00050     {
00051         if (im.sizes().z() != arg.sizes().z())
00052         {
00053             HxGlobalError::instance()->reportError(fname, "unequal image depths", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00054             return HxImageRep();
00055         }
00056     }
00057     if (dimension < 1)
00058     {
00059         HxGlobalError::instance()->reportError(fname, "dimension parameter should be greater than zero", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00060         return HxImageRep();
00061     }
00062     if (dimension > arg.pixelDimensionality())
00063     {
00064         HxGlobalError::instance()->reportError(fname, "dimension parameter should be less than result pixel dimensionality", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00065         return HxImageRep();
00066     }
00067 
00068     return im.inverseProjectRange(dimension, arg);
00069 }

HxImageRep L_HXIMAGEREP HxRestrict HxImageRep    img,
HxPoint    begin,
HxPoint    end
[friend]
 

Restriction of domain.

Restrict the domain of the image to the region specified by the given points. Points are treated as pixel coordinates (integers).

00013 {
00014     HxString fname("HxRestrict");
00015 
00016     if (img.isNull())
00017     {
00018         HxGlobalError::instance()->reportError(fname, img.name(), "null image", HxGlobalError::HX_GE_INVALID);
00019         return HxImageRep();
00020     }
00021     if (begin.x() < 0)
00022     {
00023         HxGlobalError::instance()->reportError(fname, "begin.x less then 0", HxGlobalError::HX_GE_INVALID);
00024         return HxImageRep();
00025     }
00026     if (begin.y() < 0)
00027     {
00028         HxGlobalError::instance()->reportError(fname, "begin.y less then 0", HxGlobalError::HX_GE_INVALID);
00029         return HxImageRep();
00030     }
00031     if ((img.dimensionality() > 2) && (begin.z() < 0))
00032     {
00033         HxGlobalError::instance()->reportError(fname, "begin.y less then 0", HxGlobalError::HX_GE_INVALID);
00034         return HxImageRep();
00035     }
00036 
00037     if (end.x() < begin.x())
00038     {
00039         HxGlobalError::instance()->reportError(fname, "end.x less than begin.x", HxGlobalError::HX_GE_INVALID);
00040         return HxImageRep();
00041     }
00042     if (end.y() < begin.y())
00043     {
00044         HxGlobalError::instance()->reportError(fname, "end.y less than begin.y", HxGlobalError::HX_GE_INVALID);
00045         return HxImageRep();
00046     }
00047     if ((img.dimensionality() > 2) && (end.z() < begin.z()))
00048     {
00049         HxGlobalError::instance()->reportError(fname, "end.z less than begin.z", HxGlobalError::HX_GE_INVALID);
00050         return HxImageRep();
00051     }
00052     if (begin.x() > img.sizes().x())
00053     {
00054         HxGlobalError::instance()->reportError(fname, "begin.x greater then image size", HxGlobalError::HX_GE_INVALID);
00055         return HxImageRep();
00056     }
00057     if (begin.y() > img.sizes().y())
00058     {
00059         HxGlobalError::instance()->reportError(fname, "begin.y greater then image size", HxGlobalError::HX_GE_INVALID);
00060         return HxImageRep();
00061     }
00062     if ((img.dimensionality() > 2) && (begin.z() > img.sizes().z()))
00063     {
00064         HxGlobalError::instance()->reportError(fname, "begin.z greater then image size", HxGlobalError::HX_GE_INVALID);
00065         return HxImageRep();
00066     }
00067     if (end.x() > img.sizes().x())
00068     {
00069         HxGlobalError::instance()->reportError(fname, "end.x greater then image size", HxGlobalError::HX_GE_INVALID);
00070         return HxImageRep();
00071     }
00072     if (end.y() > img.sizes().y())
00073     {
00074         HxGlobalError::instance()->reportError(fname, "end.y greater then image size", HxGlobalError::HX_GE_INVALID);
00075         return HxImageRep();
00076     }
00077     if ((img.dimensionality() > 2) && (end.z() > img.sizes().z()))
00078     {
00079         HxGlobalError::instance()->reportError(fname, "end.z greater then image size", HxGlobalError::HX_GE_INVALID);
00080         return HxImageRep();
00081     }
00082 
00083     return img.restrict(begin, end);
00084 }

HxImageRep L_HXIMAGEREP HxExtend HxImageRep    img,
HxImageRep    background,
HxPoint    begin
[friend]
 

Extension of domain.

Extend the domain of the image to the size of the background image. The image is put at the position indicated by begin. Points are treated as pixel coordinates (integers).

00013 {
00014     HxString fname("HxExtend");
00015 
00016     if (img.isNull())
00017     {
00018         HxGlobalError::instance()->reportError(fname, img.name(), "null image", HxGlobalError::HX_GE_INVALID);
00019         return HxImageRep();
00020     }
00021     if (background.isNull())
00022     {
00023         HxGlobalError::instance()->reportError(fname, background.name(), "null image", HxGlobalError::HX_GE_INVALID);
00024         return HxImageRep();
00025     }
00026 
00027     if (img.dimensionality() != background.dimensionality())
00028     {
00029         HxGlobalError::instance()->reportError(fname, "unequal image dimensionalities", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00030         return HxImageRep();
00031     }
00032     if (img.pixelDimensionality() != background.pixelDimensionality())
00033     {
00034         HxGlobalError::instance()->reportError(fname, "unequal pixel dimensionalities", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00035         return HxImageRep();
00036     }
00037 
00038     if (begin.x() < 0)
00039     {
00040         HxGlobalError::instance()->reportError(fname, "begin.x less then 0", HxGlobalError::HX_GE_INVALID);
00041         return HxImageRep();
00042     }
00043     if (begin.y() < 0)
00044     {
00045         HxGlobalError::instance()->reportError(fname, "begin.y less then 0", HxGlobalError::HX_GE_INVALID);
00046         return HxImageRep();
00047     }
00048     if (begin.z() < 0)
00049     {
00050         HxGlobalError::instance()->reportError(fname, "begin.z less then 0", HxGlobalError::HX_GE_INVALID);
00051         return HxImageRep();
00052     }
00053     if ((begin.x() + img.sizes().x()) > background.sizes().x())
00054     {
00055         HxGlobalError::instance()->reportError(fname, "x size of extend too large", HxGlobalError::HX_GE_INVALID);
00056         return HxImageRep();
00057     }
00058     if ((begin.y() + img.sizes().y()) > background.sizes().y())
00059     {
00060         HxGlobalError::instance()->reportError(fname, "y size of extend too large", HxGlobalError::HX_GE_INVALID);
00061         return HxImageRep();
00062     }
00063     if ((img.dimensionality() > 2) && ((begin.z() + img.sizes().z()) > background.sizes().z()))
00064     {
00065         HxGlobalError::instance()->reportError(fname, "z size of extend too large", HxGlobalError::HX_GE_INVALID);
00066         return HxImageRep();
00067     }
00068 
00069     return img.extend(background, begin);
00070 }

HxImageRep L_HXIMAGEREP HxExtendVal HxImageRep    img,
HxSizes    newSize,
HxValue    background,
HxPoint    begin
[friend]
 

Extension of domain.

Extend the domain of the image to the given size. The image is put at the position indicated by begin. Points are treated as pixel coordinates (integers).

00014 {
00015     HxString fname("HxExtendVal");
00016 
00017     if (img.isNull())
00018     {
00019         HxGlobalError::instance()->reportError(fname, img.name(), "null image", HxGlobalError::HX_GE_INVALID);
00020         return HxImageRep();
00021     }
00022 
00023     if (img.pixelDimensionality() == 2)
00024     {
00025         if ((background.tag() != HxValue::V2I) && (background.tag() != HxValue::V2D))
00026         {
00027             HxGlobalError::instance()->reportError(fname, "value dimensionality is not equal to pixel dimensionalities", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00028             return HxImageRep();
00029         }
00030     }
00031     if (img.pixelDimensionality() == 3)
00032     {
00033         if ((background.tag() != HxValue::V3I) && (background.tag() != HxValue::V3D))
00034         {
00035             HxGlobalError::instance()->reportError(fname, "value dimensionality is not equal to pixel dimensionalities", HxGlobalError::HX_GE_UNEQUAL_IMAGES);
00036             return HxImageRep();
00037         }
00038     }
00039 
00040     if (begin.x() < 0)
00041     {
00042         HxGlobalError::instance()->reportError(fname, "begin.x less then 0", HxGlobalError::HX_GE_INVALID);
00043         return HxImageRep();
00044     }
00045     if (begin.y() < 0)
00046     {
00047         HxGlobalError::instance()->reportError(fname, "begin.y less then 0", HxGlobalError::HX_GE_INVALID);
00048         return HxImageRep();
00049     }
00050     if (begin.z() < 0)
00051     {
00052         HxGlobalError::instance()->reportError(fname, "begin.z less then 0", HxGlobalError::HX_GE_INVALID);
00053         return HxImageRep();
00054     }
00055     if ((begin.x() + img.sizes().x()) > newSize.x())
00056     {
00057         HxGlobalError::instance()->reportError(fname, "x size of extend too large", HxGlobalError::HX_GE_INVALID);
00058         return HxImageRep();
00059     }
00060     if ((begin.y() + img.sizes().y()) > newSize.y())
00061     {
00062         HxGlobalError::instance()->reportError(fname, "y size of extend too large", HxGlobalError::HX_GE_INVALID);
00063         return HxImageRep();
00064     }
00065     if ((begin.z() + img.sizes().z()) > newSize.z())
00066     {
00067         HxGlobalError::instance()->reportError(fname, "z size of extend too large", HxGlobalError::HX_GE_INVALID);
00068         return HxImageRep();
00069     }
00070 
00071 
00072     return img.extend(newSize, background, begin);
00073 }

void L_HXIMAGEREP HxExportMatlabPixels HxImageRep    img,
double *    pixels
[friend]
 

Export image data to array of int.

The size of the (pre-allocated) array must be equal to the dimensionality of the pixel values times the number of pixels in the image.

00013 {
00014     HxString fname("HxExportMatlabPixels");
00015 
00016     if (img.isNull())
00017     {
00018         HxGlobalError::instance()->reportError(fname, img.name(), "null image", HxGlobalError::HX_GE_INVALID);
00019         return;
00020     }
00021 
00022     if (pixels == NULL)
00023     {
00024         HxGlobalError::instance()->reportError(fname, "null pointer", HxGlobalError::HX_GE_INVALID);
00025         return;
00026     }
00027 
00028     img.getDoublePixels(pixels);
00029 }


The documentation for this class was generated from the following files:
Generated on Mon Jan 27 15:49:00 2003 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001