#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
HxImageRep L_HXIMAGEREP | HxThreshold (HxImageRep im, HxValue level) |
Thresholding. More... |
|
Thresholding.
00013 { 00014 HxString fname("HxThreshold"); 00015 00016 if (im.isNull()) 00017 { 00018 HxGlobalError::instance()->reportError(fname, im.name(), "null image", HxGlobalError::HX_GE_INVALID); 00019 return HxImageRep(); 00020 } 00021 00022 if (im.pixelDimensionality() == 1) 00023 { 00024 if ((level.tag() != HxValue::SI) && (level.tag() != HxValue::SD)) 00025 { 00026 HxGlobalError::instance()->reportError(fname, im.name(), "level is of wrong value type", HxGlobalError::HX_GE_INVALID); 00027 } 00028 } 00029 if (im.pixelDimensionality() == 2) 00030 { 00031 if ((level.tag() != HxValue::V2I) && (level.tag() != HxValue::V2D) 00032 && (level.tag() != HxValue::CPL)) 00033 { 00034 HxGlobalError::instance()->reportError(fname, im.name(), "level is of wrong value type", HxGlobalError::HX_GE_INVALID); 00035 } 00036 } 00037 if (im.pixelDimensionality() == 3) 00038 { 00039 if ((level.tag() != HxValue::V3I) && (level.tag() != HxValue::V3D)) 00040 { 00041 HxGlobalError::instance()->reportError(fname, im.name(), "level is of wrong value type", HxGlobalError::HX_GE_INVALID); 00042 } 00043 } 00044 00045 HxTagList tags; 00046 HxAddTag(tags, "level", level); 00047 return im.unaryPixOp("threshold", tags); 00048 } |