#include "HxImageRep.h"
Go to the source code of this file.
| Functions | |
| HxImageRep L_HXIMAGEREP | HxTriStateThreshold (HxImageRep im, HxValue level, HxValue v1, HxValue v2, HxValue v3) | 
| Tri state threshold. More... | |
| 
 | ||||||||||||||||||||||||
| Tri state threshold. The function computes the tri state threshold of all pixels in the input image via a unary pixel operation. Implementation specifics : The pixel functor : HxUpoTriStateThreshold. The image functor instantiator : HxInstantiatorTriStateThreshold. 
 00131 {
00132     HxString fname("HxTriStateThreshold");
00133 
00134     if (im.isNull())
00135     {
00136         HxGlobalError::instance()->reportError(fname, im.name(), "null image", HxGlobalError::HX_GE_INVALID);
00137         return HxImageRep();
00138     }
00139 
00140     if (im.pixelDimensionality() == 1)
00141     {
00142         if ((level.tag() != HxValue::SI) && (level.tag() != HxValue::SD))
00143         {
00144             HxGlobalError::instance()->reportError(fname, im.name(), "level is of wrong value type", HxGlobalError::HX_GE_INVALID);
00145         }
00146     }
00147     if (im.pixelDimensionality() == 2)
00148     {
00149         if ((level.tag() != HxValue::V2I) && (level.tag() != HxValue::V2D) 
00150                                             && (level.tag() != HxValue::CPL))
00151         {
00152             HxGlobalError::instance()->reportError(fname, im.name(), "level is of wrong value type", HxGlobalError::HX_GE_INVALID);
00153         }
00154     }
00155     if (im.pixelDimensionality() == 3)
00156     {
00157         if ((level.tag() != HxValue::V3I) && (level.tag() != HxValue::V3D))
00158         {
00159             HxGlobalError::instance()->reportError(fname, im.name(), "level is of wrong value type", HxGlobalError::HX_GE_INVALID);
00160         }
00161     }
00162 
00163     // Put all non-image parameters in a TagList
00164     HxTagList tags;
00165     HxAddTag(tags, "level", level);
00166     HxAddTag(tags, "v1", v1);
00167     HxAddTag(tags, "v2", v2);
00168     HxAddTag(tags, "v3", v3);
00169 
00170     // call HxImageRep member function to do the image processing
00171     return im.unaryPixOp("triStateThreshold", tags);
00172 }
 | 
 1.2.12 written by Dimitri van Heesch,
 © 1997-2001
1.2.12 written by Dimitri van Heesch,
 © 1997-2001