#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
HxImageRep L_HXIMAGEREP | HxAddVal (HxImageRep im, HxValue val) |
Addition. More... |
|
Addition. The function performs addition (see Pixels) on all pixels in the input image via a binary pixel operation (see Images). Implementation specifics : The pixel functor : HxBpoAdd. The image functor instantiator : HxInstantiatorAddV.
00014 { 00015 HxString fname("HxAddVal"); 00016 00017 if (im.isNull()) 00018 { 00019 HxGlobalError::instance()->reportError(fname, im.name(), "null image", HxGlobalError::HX_GE_INVALID); 00020 return HxImageRep(); 00021 } 00022 00023 int valdim; 00024 if ((val.tag() == HxValue::SI) || (val.tag() == HxValue::SD)) 00025 { 00026 valdim = 1; 00027 } 00028 else if ((val.tag() == HxValue::V2I) || (val.tag() == HxValue::V2D)) 00029 { 00030 valdim = 2; 00031 } 00032 else 00033 { 00034 valdim = 3; 00035 } 00036 if (im.signature().pixelDimensionality() != valdim) 00037 { 00038 HxGlobalError::instance()->reportError(fname, "pixel dimensionality differs from value dimensionality", 00039 HxGlobalError::HX_GE_UNEQUAL_DIMS); 00040 return HxImageRep(); 00041 } 00042 00043 return im.binaryPixOp(val, "add"); 00044 } |