Main Page   Class Overview   Pixels   Images   Geometry   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...


Reduce operations

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 genConvSeparated (int dimension, HxImageRep kernel1, HxImageRep kernel2, HxString gMul, HxString gAdd, ResultPrecision resPrec=DEFAULT_PREC, HxTagList &tags=HxMakeTagList()) const
 Generalized convolution operation separated for each dimension. More...


Neighbourhood operations.

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

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

HxImageRep recursiveNeighOp (HxImageRep kerImg, HxString gMul, HxString gAdd, HxTagList &tags=HxMakeTagList(), ResultPrecision resPrec=DEFAULT_PREC) const
 Recursive neighbourhood 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...


Sample operations

HxValue sampleIdentMask (const HxImageRep mask, HxPoint p, HxSizes size, int label, HxString sFunc) const
 Sample the image with the given identification mask. More...

void sampleIdentMask (const HxImageRep mask, HxPoint p, HxSizes size, int label, HxString sFunc, HxValueListBackInserter res) const
 Sample the image with the given identification mask. More...

HxValue sampleWeightMask (const HxImageRep mask, HxPoint p, HxString sFunc) const
 Sample the image with the given weight mask. More...


Misc operations

void exportOp (HxString exportName, HxTagList &tags=HxMakeTagList()) const
 Survey operations. More...

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

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)
HxValue L_HXIMAGEREP HxIdentMaskMean (HxImageRep im, HxImageRep mask, HxPoint p, HxSizes size, int label)
HxValue L_HXIMAGEREP HxIdentMaskStDev (HxImageRep im, HxImageRep mask, HxPoint p, HxSizes size, int label)
HxValue L_HXIMAGEREP HxIdentMaskSum (HxImageRep im, HxImageRep mask, HxPoint p, HxSizes size, int label)
HxValue L_HXIMAGEREP HxMaskSum (HxImageRep im, HxImageRep mask, HxPoint p)
HxImageRep L_HXIMAGEREP HxMakeFromSi (IMAGE *im)
 Make an HxImageRep with from the given image in ScilImage format. More...

L_HXIMAGEREP IMAGE * HxExportSi (HxImageRep img)
 Export image data to a ScilImage image. More...

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.

00231                                         {
00232                             DEFAULT_PREC, SOURCE_PREC,
00233                             ARITH_PREC, SMALL_PREC};


Constructor & Destructor Documentation

HxImageRep::HxImageRep  
 

Null image.

00116                        : _pointee(0) {
00117     if (_objectObserver)
00118         _objectObserver->constructed(name());
00119 }

HxImageRep::HxImageRep const HxImageRep &    rhs
 

Copy constructor.

00122     : _pointee(rhs.pointee())
00123 {
00124     if (_objectObserver)
00125         _objectObserver->constructed(name());
00126 }

HxImageRep::~HxImageRep  
 

Destructor.

00344 {
00345     if (_objectObserver)
00346         _objectObserver->destructed(name());
00347 }


Member Function Documentation

HxImageRep & HxImageRep::operator= const HxImageRep &    rhs
 

Assignment operator.

00354 {
00355     _pointee = rhs._pointee;
00356     return *this;
00357 }

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

Equality.

00361 {
00362     return ident() == arg.ident();
00363 }

int HxImageRep::isNull   const
 

Indicates wether this is a valid image.

00367 { 
00368     return !int(_pointee); 
00369 }

HxImageRep::operator int   const
 

Indicates wether this is a valid image.

00372 { 
00373     return int(_pointee); 
00374 }

int HxImageRep::ident   const
 

The unique identifier of the image.

00381 {
00382     return pointee() ? pointee()->ident() : 0;
00383 }

HxString HxImageRep::name   const
 

The (not necessarily unique) name of the image.

00387 {
00388     return pointee() ? pointee()->name() : HxString("");
00389 }

void HxImageRep::name HxString    s
 

Sets the name of the image.

00393 {
00394     if (pointee())
00395         pointee()->name(s);
00396 }

int HxImageRep::dimensionality   const
 

The number of dimensions of the image.

00400 {
00401     return pointee() ? pointee()->dimensionality() : 0;
00402 }

int HxImageRep::dimensionSize int    i const
 

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

The first dimension has i = 1.

00406 {
00407     return pointee() ? pointee()->dimensionSize(i) : 0;
00408 }

HxSizes HxImageRep::sizes   const
 

The dimension sizes of the image.

00442 {
00443     return pointee() ? pointee()->sizes() : HxSizes(0, 0, 0);
00444 }

int HxImageRep::numberOfPixels   const
 

The total number of pixels in the image.

00412 {
00413     return pointee() ? pointee()->numberOfPixels() : 0;
00414 }

int HxImageRep::pixelDimensionality   const
 

The number of dimensions of one pixel.

00418 {
00419     return pointee() ? pointee()->pixelDimensionality() : 0;
00420 }

HxValueType HxImageRep::pixelType   const
 

The pixel range value type.

INT_VALUE or REAL_VALUE or COMPLEX_VALUE.

00424 {
00425     return pointee() ? pointee()->pixelType() : INT_VALUE;
00426 }

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.

00430 {
00431     return pointee() ? pointee()->pixelPrecision() : 0;
00432 }

HxImageSignature HxImageRep::signature   const
 

The signature of the image.

00436 {
00437     return pointee() ? pointee()->signature() : HxImageSignature();
00438 }

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.

00451 {
00452     if (!pointee())
00453         return HxImageRep();
00454     HxMfUpo methodFrame(pointee(), upoName);
00455     methodFrame.result()->unaryPixOp(methodFrame.object(), upoName, tags);
00456     return HxImageRep(methodFrame.result());
00457 }

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.

00495 {
00496     if (!pointee())
00497         return HxImageRep();
00498     HxMfUpo methodFrame(pointee(), bpoName);
00499     HxAddTag(tags, "value", val);
00500     methodFrame.result()->unaryPixOp(methodFrame.object(), bpoName, tags);
00501     return HxImageRep(methodFrame.result());
00502 }

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.

00507 {
00508     if (!pointee())
00509         return HxImageRep();
00510     HxMfBpo methodFrame(pointee(), arg.pointee(), bpoName);
00511     if (methodFrame.preOpIsOk())
00512         methodFrame.result()->binaryPixOp(methodFrame.source1(),
00513                                 methodFrame.source2(), bpoName, tags);
00514     return methodFrame.preOpIsOk()  ? HxImageRep(methodFrame.result())
00515                                     : HxImageRep();
00516 }

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.

00524 {
00525     if (!pointee())
00526         return HxImageRep();
00527 
00528     HxImageData **imsPointee = new HxImageData * [args.size()+1];
00529     HxImageList::const_iterator i;
00530     int n = 0;
00531 
00532     imsPointee[n++] = pointee();
00533     for (i = args.begin(); i != args.end(); i++)
00534         imsPointee[n++] = (*i).pointee();
00535 
00536     HxMfMpo methodFrame(imsPointee, n, mpoName);
00537 
00538     methodFrame.result()->multiPixOp(methodFrame.sources(),
00539                             methodFrame.nSources(), mpoName, tags);
00540 
00541     delete [] imsPointee;
00542 
00543     return HxImageRep(methodFrame.result());
00544 }

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.

00552 {
00553     if (!pointee())
00554         return HxImageRep();
00555 
00556     typedef HxImageData** HxImgDataPtrArray;
00557 
00558     HxImageData **srcPtrs = new HxImageData * [args.size()+1];
00559     HxImageList::const_iterator i;
00560     int srcCnt = 0;
00561 
00562     srcPtrs[srcCnt++] = pointee();
00563     for (i = args.begin(); i != args.end(); i++)
00564         srcPtrs[srcCnt++] = (*i).pointee();
00565 
00566     HxMfMNpo methodFrame(srcPtrs, srcCnt, mpoName);
00567 
00568     delete [] srcPtrs;
00569 
00570     HxImageData::MNPixOp(
00571         methodFrame.results(), methodFrame.resultCnt(),
00572         methodFrame.sources(), methodFrame.sourceCnt(), mpoName, tags);
00573 
00574     HxImageList result;
00575 
00576     for (int n = 0; n < methodFrame.resultCnt(); n++) {
00577     HxImageRep temp(methodFrame.results(n));
00578         result += temp;
00579     }
00580 
00581     return result;
00582 }

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.

00589 {
00590     exportOp(op, tags);
00591     HxValue result = HxGetTag(tags, "result", HxValue(0));
00592     return result;
00593 }

void HxImageRep::setDefaultResultPrecision ResultPrecision    resPrec [static]
 

Set the value for DEFAULT_PREC.

00047 {
00048     _defaultResPrec = resPrec;
00049 }

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

Get the value for the result precision.

00053 {
00054     return resPrec == DEFAULT_PREC ? _defaultResPrec : resPrec;
00055 }

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".

00602 {
00603     resPrec = getResultPrecision(resPrec);
00604 
00605     HxMfGenConv methodFrame(pointee(), kernel.pointee(), resPrec);
00606     if (methodFrame.preOpIsOk())
00607         methodFrame.object()->generalizedConvolution(
00608                                 methodFrame.source(),
00609                                 methodFrame.kernel(),
00610                                 gMul, gAdd, "stdKernel", tags);
00611     return methodFrame.preOpIsOk()  ? HxImageRep(methodFrame.result())
00612                                     : HxImageRep();
00613 }

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 image should have the same dimensionality as the object image. The convolution is performed in the specified dimension only. The precision of the result type is as specified by resPrec.

00619 {
00620     resPrec = getResultPrecision(resPrec);
00621 
00622     HxMfGenConv methodFrame(pointee(), kernel.pointee(), resPrec, true);
00623     if (methodFrame.preOpIsOk())
00624         methodFrame.object()->generalizedConvolutionK1d(
00625                                 methodFrame.source(),
00626                                 dimension, methodFrame.kernel(),
00627                                 gMul, gAdd, "stdKernel", tags);
00628     return methodFrame.preOpIsOk()  ? HxImageRep(methodFrame.result())
00629                                     : HxImageRep();
00630 }

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 kernel image should have the same dimensionality as the object image. The convolution is performed separately in all dimensions using the same kernel. The precision of the result type is as specified by resPrec.

00636 {
00637     resPrec = getResultPrecision(resPrec);
00638 
00639     HxMfGenConv methodFrame(
00640                     pointee(), kernel.pointee(), resPrec, true, ARITH_PREC);
00641 
00642     if (!methodFrame.preOpIsOk())
00643         return HxImageRep();
00644 
00645     for (int i=1; i<=dimensionality(); i++)
00646     {
00647         methodFrame.object()->generalizedConvolutionK1d(
00648                                 methodFrame.source(),
00649                                 i, methodFrame.kernel(),
00650                                 gMul, gAdd, "stdKernel", tags);
00651         methodFrame.setObjectAsSource();
00652     }
00653 
00654     return methodFrame.preOpIsOk()  ? HxImageRep(methodFrame.result())
00655                                     : HxImageRep();
00656 }

HxImageRep HxImageRep::genConvSeparated int    dimension,
HxImageRep    kernel1,
HxImageRep    kernel2,
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 kernel images should be two dimensional and the size in the second dimension should be 1. The convolution is performed using kernel1 in the specified dimension and kernel2 in all other dimensions. The precision of the result type is as specified by resPrec.

00663 {
00664     resPrec = getResultPrecision(resPrec);
00665 
00666     HxMfGenConv methodFrame(
00667                     pointee(), kernel1.pointee(), kernel2.pointee(), 
00668                     resPrec, true, ARITH_PREC);
00669 
00670     if (!methodFrame.preOpIsOk())
00671         return HxImageRep();
00672 
00673     int i;
00674     for (i=1; i<=dimensionality(); i++)
00675     {
00676         if (i == dimension)
00677             methodFrame.object()->generalizedConvolutionK1d(
00678                                     methodFrame.source(),
00679                                     i, methodFrame.kernel(),
00680                                     gMul, gAdd, "stdKernel", tags);
00681         else
00682             methodFrame.object()->generalizedConvolutionK1d(
00683                                     methodFrame.source(),
00684                                     i, methodFrame.kernel2(),
00685                                     gMul, gAdd, "stdKernel", tags);
00686         methodFrame.setObjectAsSource();
00687     }
00688 
00689     return methodFrame.preOpIsOk()  ? HxImageRep(methodFrame.result())
00690                                     : HxImageRep();
00691 }

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".

00698 {
00699     HxMfNgb methodFrame(pointee(), ngbName, tags);
00700     if (methodFrame.preOpIsOk())
00701         methodFrame.result()->neighbourhoodOp(
00702                                 methodFrame.source(), ngbName, tags);
00703     return methodFrame.preOpIsOk()  ? HxImageRep(methodFrame.result())
00704                                     : HxImageRep();
00705 }

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 to the functor designated by "ngbName". The result at each position is determined by "ngbName".

00710 {
00711     HxMfKernelNgb methodFrame(pointee(), kernel.pointee(), ngbName, tags);
00712     if (methodFrame.preOpIsOk())
00713         methodFrame.result()->neighbourhoodOp(
00714                                 methodFrame.source(), methodFrame.kernel(),
00715                                 ngbName, tags);
00716     return methodFrame.preOpIsOk()  ? HxImageRep(methodFrame.result())
00717                                     : HxImageRep();
00718 }

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

Recursive neighbourhood operation.

THIS SHOULD BE CALLED RECURSIVE GENERALIZED CONVOLUTION!!

00724 {
00725     if (resPrec == DEFAULT_PREC)
00726         resPrec = _defaultResPrec;
00727     HxMfGenConv methodFrame(pointee(), kernel.pointee(), resPrec);
00728     if (methodFrame.preOpIsOk())
00729         methodFrame.object()->recursiveNeighOp(
00730                                 methodFrame.source(), methodFrame.kernel(),
00731                                 gMul, gAdd, tags);
00732     return methodFrame.preOpIsOk()  ? HxImageRep(methodFrame.result())
00733                                     : HxImageRep();
00734 }

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)

00743 {
00744     if ((func.nCol() != 3) || (func.nRow() != 3))
00745         return errorIm("geometricOp2d: matrix needs to be 3x3");
00746 
00747     HxMatrix funcForw = (gt == FORWARD) ? func : func.i();
00748     HxMatrix funcBack = (gt == FORWARD) ? func.i() : func;
00749     if (!funcForw.valid() || !funcBack.valid())
00750         return errorIm("geometricOp2d: matrix is not valid");
00751 
00752     HxSizes newSize = sizes();
00753     HxVec3Double translate = HxVec3Double(0,0,0);
00754     if (adjustSize) {
00755         HxVec3Double ulP = funcForw * HxVec3Double(0,0,1);
00756         HxVec3Double llP = funcForw * HxVec3Double(0, dimensionSize(2), 1);
00757         HxVec3Double urP = funcForw * HxVec3Double(dimensionSize(1), 0, 1);
00758         HxVec3Double lrP = funcForw * sizes();
00759         ulP /= HxScalarDouble(ulP.z()); // homogeneous coordinates
00760         llP /= HxScalarDouble(llP.z());
00761         urP /= HxScalarDouble(urP.z());
00762         lrP /= HxScalarDouble(lrP.z());
00763 
00764         HxVec3Double maerB = ulP.inf(llP).inf(urP).inf(lrP);
00765         HxVec3Double maerE = ulP.sup(llP).sup(urP).sup(lrP);
00766         newSize = HxSizes(maerE.x() - maerB.x() + 0.5,
00767             maerE.y() - maerB.y() + 0.5, 1);
00768         translate = HxVec3Double(maerB.x(), maerB.y(), 0);
00769     }
00770 
00771     HxMfResize methodFrame(pointee(), newSize);
00772     methodFrame.object()->geometricOp2d(pointee(), funcBack, gi, translate,
00773         background);
00774     return HxImageRep(methodFrame.result());
00775 }

HxValue HxImageRep::sampleIdentMask const HxImageRep    mask,
HxPoint    p,
HxSizes    size,
int    label,
HxString    sFunc
const
 

Sample the image with the given identification mask.

"mask" is assumed to be an identification image with pixel type short. For points within the area starting at point "p" with given "size" the function denoted by "sFunc" is called if the pixel value is equal to "label". "sFunc" should reside in HxSampleFunTable.

00886 {
00887     if (!pointee())
00888         return HxValue(0); // ADB 14 Feb 2001, was HxImageRep();
00889     HxMfReqMaskPixType methodFrame(mask.pointee(), 1, INT_VALUE, 16);
00890     return pointee()->sampleIdentMask(methodFrame.mask(), p, size, label, sFunc);
00891 }

void HxImageRep::sampleIdentMask const HxImageRep    mask,
HxPoint    p,
HxSizes    size,
int    label,
HxString    sFunc,
HxValueListBackInserter    res
const
 

Sample the image with the given identification mask.

"mask" is assumed to be an identification image with pixel type short. For points within the area starting at point "p" with given "size" the functor denoted by "sFunc" is called if the pixel value is equal to "label". "sFunc" should reside in HxSampleFunctorTable.

00896 {
00897     if (!pointee())
00898         return;
00899     HxMfReqMaskPixType methodFrame(mask.pointee(), 1, INT_VALUE, 16);
00900     pointee()->sampleIdentMask(methodFrame.mask(), p, size, label, sFunc, res);
00901 }

HxValue HxImageRep::sampleWeightMask const HxImageRep    mask,
HxPoint    p,
HxString    sFunc
const
 

Sample the image with the given weight mask.

The type of mask is adjusted to match the type of the image. For points within the area starting at point p with the size of the "mask" the function denoted by "sFunc" is called.

00905 {
00906     if (!pointee())
00907         return HxValue(0); // ADB 14 Feb 2001, was HxImageRep();
00908     HxMfReqMaskPixType methodFrame(mask.pointee(), pointee());
00909     return pointee()->sampleWeightMask(methodFrame.mask(), p, sFunc);
00910 }

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

Survey operations.

00917 {
00918     if (HxImgFtorRuleBase::instance().getIsModifying("inout", exportName))
00919     {
00920         HxEnvironment::instance()->errorStream()
00921             << "Error: " << exportName << " is an image data modifying "
00922             << "operator" << STD_ENDL;
00923         return;
00924     }
00925     if (pointee())
00926         pointee()->inout(exportName, tags);
00927 }

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

setAt is to be removed.

00931 {
00932     if (_pointee) {
00933         _pointee.getUnshared();
00934         _pointee->setAt(x, y, z, v);
00935     }
00936 }

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

Return pixel value at given position.

00940 {
00941     return _pointee ? _pointee->getAt(x, y, z) : HxValue(HxScalarInt(0));
00942 }

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

Print information.

00946 {
00947     return _pointee ? pointee()->printInfo(os, doData) : os ;
00948 }

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}

00985 {
00986     if (!pointee())
00987         return;
00988 
00989     HxTagList tags;
00990     HxAddTag(tags, "pixels", pixels);
00991     HxAddTag(tags, "resWidth", resWidth);
00992     HxAddTag(tags, "resHeight", resHeight);
00993     HxAddTag(tags, "gi", gi);
00994 
00995     if (displayMode == HxString("LogMagnitude")) {
00996         HxImageRep n2 = HxNorm2(*this);
00997         double lowVal = ((HxScalarDouble)n2.reduceOp("minAssign")).x();
00998         double highVal = ((HxScalarDouble)n2.reduceOp("maxAssign")).x();
00999         HxAddTag(tags, "lowVal", lowVal);
01000         HxAddTag(tags, "highVal", highVal);
01001 
01002         n2.pointee()->rgbOp(displayMode, tags);
01003         return;
01004     }
01005 
01006     if (displayMode == HxString("Stretch")) {
01007         double lowVal = ((HxVec3Double) reduceOp("minAssign")).min().x();
01008         double highVal = ((HxVec3Double) reduceOp("maxAssign")).max().x();
01009         HxAddTag(tags, "lowVal", lowVal);
01010         HxAddTag(tags, "highVal", highVal);
01011     }
01012 
01013     pointee()->rgbOp(displayMode, tags);
01014 }

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.

01020 {
01021     if (!pointee())
01022         return;
01023     pointee()->getRgbPixels2d(pixels, displayMode, bufWidth, bufHeight,
01024             VX, VY, VW, VH, SX, SY, scaleX, scaleY, gi);
01025 }


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     return im.projectRange(dimension);
00015 }

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     return im.inverseProjectRange(dimension, arg);
00015 }

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     return img.restrict(begin, end);
00015 }

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     return img.extend(background, begin);
00015 }

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     return img.extend(newSize, background, begin);
00016 }

HxImageRep L_HXIMAGEREP HxMakeFromSi IMAGE *    im [friend]
 

Make an HxImageRep with from the given image in ScilImage format.

00013 {
00014     return HxImageRep(im);
00015 }

L_HXIMAGEREP IMAGE* HxExportSi HxImageRep    img [friend]
 

Export image data to a ScilImage image.

00013 {
00014     return img.toImageSi();
00015 }

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     img.getDoublePixels(pixels);
00015 }


The documentation for this class was generated from the following files:
Generated on Tue Jan 8 13:59:26 2002 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001