Main Page   Class Overview   Pixels   Images   Geometry   Quick Index  

HxMfBpo Class Reference

Class definition of method frame for binary pixel operations. More...

#include <HxMfBpo.h>

List of all members.

Public Methods

 HxMfBpo (HxImageData *src1, HxImageData *src2, HxString bpoName)
 Constructor. More...

 ~HxMfBpo ()
 Destructor. More...

HxImageDatasource1 () const
 The first argument image of the frame. More...

HxImageDatasource2 () const
 The second argument image of the frame. More...

HxImageDataresult () const
 The result image of the frame. More...

bool preOpIsOk () const
 Indicates whether initialization was OK. More...


Detailed Description

Class definition of method frame for binary pixel operations.


Constructor & Destructor Documentation

HxMfBpo::HxMfBpo HxImageData   src1,
HxImageData   src2,
HxString    bpoName
 

Constructor.

00018     : _src1(src1), _src2(src2), _tmpSrc1(0), _tmpSrc2(0), _preOpIsOk(true)
00019 {
00020     if (!src1 || !src2)
00021     {
00022         _preOpIsOk = false;
00023         return;
00024     }
00025 
00026     HxImageSignature src1Sig(src1->signature());
00027     HxImageSignature src2Sig(src2->signature());
00028     HxImageSignature broadestSig(src1Sig.broadest(src2Sig));
00029     HxImageSignature resultSig;
00030 
00031     HxImgFtorRuleBase::QueryResultType qRes;
00032 
00033     qRes = HxImgFtorRuleBase::instance().getResultType(
00034                 src1Sig, "bpo",
00035                 src1Sig.toString(), src2Sig.toString(), bpoName);
00036 
00037     if (qRes)
00038     {
00039         /*
00040          *  Only very specific combinations of argument types allowed.
00041          *  Argument types stay what they are.
00042          */
00043         resultSig = qRes;
00044     }
00045     else
00046     {
00047         // Type of result and second argument depends on type of first
00048         // argument.
00049 
00050         qRes = HxImgFtorRuleBase::instance().getArgumentType(
00051                     src1Sig, "bpo", src1Sig.toString(), bpoName);
00052 
00053         src1Sig = (qRes && src2Sig.isEqual(qRes)) ? src1Sig : broadestSig;
00054 
00055         // If type of second argument does not fit the required type
00056         // another attempt is made with the broadest signature.
00057         /*  24/01/2001 IMPORTANT DESIGN NOTE:
00058          *  One can argue that if a second argument type can be found  
00059          *  when querying with the original first argument type as key,
00060          *  and the given second argument type does not match the query result,
00061          *  the second argument should be converted to the query result, but
00062          *  only when the query result is broader than the second argument
00063          *  type.
00064          */
00065         // src1Sig = (qRes && src2Sig.broadest(qRes).isEqual(qRes))
00066         //              ? src1Sig : broadestSig;
00067 
00068         qRes = HxImgFtorRuleBase::instance().getArgumentType(
00069                     src2Sig, "bpo", src1Sig.toString(), bpoName);
00070 
00071         if (!qRes)
00072         {
00073             HxEnvironment::instance()->errorStream()
00074                 << "Cannot apply binary pixel operation " << bpoName << " to "
00075                 << "images with type " << src1Sig.toString() << " and "
00076                 << src2Sig.toString() << STD_ENDL;
00077             HxEnvironment::instance()->flush();
00078             _preOpIsOk = false;
00079         }
00080         else
00081         {
00082             src2Sig = qRes;
00083         }
00084 
00085         resultSig = HxImgFtorRuleBase::instance().getResultType(
00086                     src1Sig, "bpo", src1Sig.toString(), bpoName);
00087     }
00088 
00089     HxSizes sizes = src1->sizes().sup(src2->sizes());
00090 
00091     if (!src1Sig.isEqual(src1->signature())) {
00092         _tmpSrc1 = HxImgDataFactory::instance().makeImage(src1Sig, sizes);
00093         _tmpSrc1->set(src1);
00094         _src1 = _tmpSrc1;
00095     }
00096 
00097     if (!src2Sig.isEqual(src2->signature())) {
00098         _tmpSrc2 = HxImgDataFactory::instance().makeImage(src2Sig, sizes);
00099         _tmpSrc2->set(src2);
00100         _src2 = _tmpSrc2;
00101     }
00102 
00103     _result = HxImgDataFactory::instance().makeImage(resultSig, sizes);
00104 
00105 }

HxMfBpo::~HxMfBpo  
 

Destructor.

00108 {
00109     if (_tmpSrc1) 
00110         delete _tmpSrc1;
00111     if (_tmpSrc2) 
00112         delete _tmpSrc2;
00113 }


Member Function Documentation

HxImageData * HxMfBpo::source1   const
 

The first argument image of the frame.

00117 { 
00118     return _src1; 
00119 }

HxImageData * HxMfBpo::source2   const
 

The second argument image of the frame.

00123 { 
00124     return _src2; 
00125 }

HxImageData * HxMfBpo::result   const
 

The result image of the frame.

00129 { 
00130     return _result; 
00131 }

bool HxMfBpo::preOpIsOk   const [inline]
 

Indicates whether initialization was OK.

00054 {
00055     return _preOpIsOk;
00056 }


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