Woolz Image Processing Version 1.4.0
|
Files | |
file | WlzCbThreshold.c |
Threshold an object using a callback function to determine if the pixel value satifies the threshold criteria. | |
file | WlzCompThresh.c |
Functions for computing a threshold value from a histogram object. | |
file | WlzHyThreshold.c |
A hysteresis threshold filter. | |
file | WlzRGBAThreshold.c |
Threshold functions for RGBA objects. | |
file | WlzThreshold.c |
Thresholds 2D or 3D domain objects with values. | |
Defines | |
#define | WLZ_THRESH_ADD_ITV_1(N, NL1, NLL, NK1, NKL, G, IWS, TV, P, OP, K, OV) |
Computes the number of intervals for WlzThreshold() from integral grey values or floating point if not comparing equality. The following parameters are required: | |
#define | WLZ_THRESH_ADD_ITV_FE_1(N, NL1, NLL, NK1, NKL, G, IWS, TV, P, E, K, OV) |
Computes the number of intervals for WlzThreshold() from floating point grey values using an equality operator. The following parameters are required: | |
#define | WLZ_THRESH_ADD_ITV_RGB_1(N, NL1, NLL, NK1, NKL, G, IWS, TV, OP, K, OV) |
Computes the number of intervals for WlzThreshold() from RGBA grey values using a modulus operator to compute a scalar grey value from the RGBA value. The following parameters are required: | |
#define | WLZ_THRESH_ADD_ITV_2(N, NK1, G, ITV, IWS, TV, P, OP, K, OV) |
Constructs the intervals for WlzThreshold() from integral grey values or floating point if not comparing equality. The following parameters are required: | |
#define | WLZ_THRESH_ADD_ITV_FE_2(N, NK1, G, ITV, IWS, TV, P, E, K, OV) |
Constructs the intervals for WlzThreshold() from floating point grey values using an equality operator. The following parameters are required: | |
#define | WLZ_THRESH_ADD_ITV_RGB_2(N, NK1, G, ITV, IWS, TV, P, OP, K, OV) |
Constructs the intervals for WlzThreshold() from RGBA grey values using a modulus operator to compute a scalar grey value from the RGBA value. The following parameters are required: | |
Enumerations | |
enum | _WlzCompThreshType { WLZ_COMPTHRESH_FOOT, WLZ_COMPTHRESH_DEPTH, WLZ_COMPTHRESH_GRADIENT, WLZ_COMPTHRESH_FRACMIN, WLZ_COMPTHRESH_SMOOTHSPLIT } |
Automatic threshold computation methods. The histogram may need to be smoothed for these algorithms to work. Typedef: WlzCompThreshType. More... | |
enum | _WlzThresholdType { WLZ_THRESH_LOW = 0, WLZ_THRESH_HIGH, WLZ_THRESH_EQUAL } |
Threshold value selection. Typedef: WlzThresholdType. More... | |
enum | _WlzRGBAThresholdType { WLZ_RGBA_THRESH_NONE, WLZ_RGBA_THRESH_SINGLE, WLZ_RGBA_THRESH_MULTI, WLZ_RGBA_THRESH_PLANE, WLZ_RGBA_THRESH_SLICE, WLZ_RGBA_THRESH_BOX, WLZ_RGBA_THRESH_SPHERE } |
Colour threshold type selection. Typedef: WlzRGBAThresholdType. More... | |
Functions | |
WlzErrorNum | WlzCompThresholdVT (WlzObject *hObj, WlzCompThreshType method, double param0, double param1, double extraFrac, WlzPixelV *dstTV, WlzThresholdType *dstTType) |
Computes a threshold value and type using the given histogram and method. | |
WlzErrorNum | WlzCompThreshold (double *dstThrVal, WlzObject *histObj, WlzCompThreshType method, double extraFrac) |
Computes a threshold value from the given histogram object using the given method. | |
WlzObject * | WlzHyThreshold (WlzObject *srcObj, WlzPixelV pThrV, WlzPixelV sThrV, WlzThresholdType hilo, WlzConnectType con, WlzErrorNum *dstErr) |
Hysteresis thresholds the given Woolz object. Values are in the domain of the hysteresis threshold'd object if they are above/below the primary threshold or above/below the secondary threshold and connected to values above/below the primary threshold. | |
WlzObject * | WlzRGBAMultiThreshold (WlzObject *obj, WlzPixelV lowVal, WlzPixelV highVal, WlzUInt combineMode, WlzErrorNum *dstErr) |
Apply independent thresholds to each colour channel independently and combine according to the settings encoded in combineMode. Each channel can have one of two modes: WLZ_BO_AND and WLZ_BO_OR. These are encoded into a single mode variable using the RGBA macro, e.g.: WLZ_RGBA_RGBA_SET(combineMode, redMode, greenMode, blueMode, 255);. | |
WlzObject * | WlzThreshold (WlzObject *obj, WlzPixelV threshV, WlzThresholdType highlow, WlzErrorNum *dstErr) |
Thresholds a woolz grey-level object, 2D or 3D. |
#define WLZ_THRESH_ADD_ITV_1 | ( | N, | |
NL1, | |||
NLL, | |||
NK1, | |||
NKL, | |||
G, | |||
IWS, | |||
TV, | |||
P, | |||
OP, | |||
K, | |||
OV | |||
) |
Computes the number of intervals for WlzThreshold() from integral grey values or floating point if not comparing equality. The following parameters are required:
Referenced by WlzThreshold().
#define WLZ_THRESH_ADD_ITV_FE_1 | ( | N, | |
NL1, | |||
NLL, | |||
NK1, | |||
NKL, | |||
G, | |||
IWS, | |||
TV, | |||
P, | |||
E, | |||
K, | |||
OV | |||
) |
Computes the number of intervals for WlzThreshold() from floating point grey values using an equality operator. The following parameters are required:
Referenced by WlzThreshold().
#define WLZ_THRESH_ADD_ITV_RGB_1 | ( | N, | |
NL1, | |||
NLL, | |||
NK1, | |||
NKL, | |||
G, | |||
IWS, | |||
TV, | |||
OP, | |||
K, | |||
OV | |||
) |
Computes the number of intervals for WlzThreshold() from RGBA grey values using a modulus operator to compute a scalar grey value from the RGBA value. The following parameters are required:
Referenced by WlzThreshold().
#define WLZ_THRESH_ADD_ITV_2 | ( | N, | |
NK1, | |||
G, | |||
ITV, | |||
IWS, | |||
TV, | |||
P, | |||
OP, | |||
K, | |||
OV | |||
) |
{ \ for((K)=((IWS).lftpos);(K)<=((IWS).rgtpos);++(K)) \ { \ if((*(G).P)OP(TV)) \ { \ if(!(OV)) \ { \ (OV)=1; \ ((ITV)->ileft)=(K)-(NK1); \ } \ } \ else \ { \ if(OV) \ { \ (OV)=0; \ ((ITV)->iright)=(K)-(NK1)-1; \ ++(N); \ ++(ITV); \ } \ } \ ++((G).P); \ } \ }
Constructs the intervals for WlzThreshold() from integral grey values or floating point if not comparing equality. The following parameters are required:
Referenced by WlzThreshold().
#define WLZ_THRESH_ADD_ITV_FE_2 | ( | N, | |
NK1, | |||
G, | |||
ITV, | |||
IWS, | |||
TV, | |||
P, | |||
E, | |||
K, | |||
OV | |||
) |
{ \ for((K)=((IWS).lftpos);(K)<=((IWS).rgtpos);++(K)) \ { \ if((*((G).P)<((TV)-(E)))||(*((G).P)>((TV)+(E)))) \ { \ if(OV) \ { \ (OV)=0; \ ((ITV)->iright)=(K)-(NK1)-1; \ ++(N); \ ++(ITV); \ } \ } \ else \ { \ if(!(OV)) \ { \ (OV)=1; \ ((ITV)->ileft)=(K)-(NK1); \ } \ } \ ++((G).P); \ } \ }
Constructs the intervals for WlzThreshold() from floating point grey values using an equality operator. The following parameters are required:
Referenced by WlzThreshold().
#define WLZ_THRESH_ADD_ITV_RGB_2 | ( | N, | |
NK1, | |||
G, | |||
ITV, | |||
IWS, | |||
TV, | |||
P, | |||
OP, | |||
K, | |||
OV | |||
) |
{ \ for((K)=((IWS).lftpos);(K)<=((IWS).rgtpos);++(K)) \ { \ if((WLZ_RGBA_MODULUS_2(*(G).P))OP(TV)) \ { \ if(!(OV)) \ { \ (OV)=1; \ ((ITV)->ileft)=(K)-(NK1); \ } \ } \ else \ { \ if(OV) \ { \ (OV)=0; \ ((ITV)->iright)=(K)-(NK1)-1; \ ++(N); \ ++(ITV); \ } \ } \ ++((G).P); \ } \ }
Constructs the intervals for WlzThreshold() from RGBA grey values using a modulus operator to compute a scalar grey value from the RGBA value. The following parameters are required:
Referenced by WlzThreshold().
enum _WlzCompThreshType |
Automatic threshold computation methods. The histogram may need to be smoothed for these algorithms to work. Typedef: WlzCompThreshType.
enum _WlzThresholdType |
Threshold value selection. Typedef: WlzThresholdType.
Colour threshold type selection. Typedef: WlzRGBAThresholdType.
WlzErrorNum WlzCompThresholdVT | ( | WlzObject * | hObj, |
WlzCompThreshType | method, | ||
double | param0, | ||
double | param1, | ||
double | extraFrac, | ||
WlzPixelV * | dstTV, | ||
WlzThresholdType * | dstTType | ||
) |
Computes a threshold value and type using the given histogram and method.
hObj | |
method | Threshold value method. |
param0 | First passed parameter:
|
param1 | First passed parameter:
|
extraFrac | Extra fraction to be added or subtracted from the threshold value. |
dstTV | Destination pointer for threshold value, may be NULL. |
dstTType | Destination pointer for threshold type, may be NULL. |
References _WlzHistogramDomain::binSize, _WlzGreyV::dbv, _WlzObject::domain, _WlzDomain::hist, _WlzHistogramDomain::maxBins, _WlzHistogramDomain::nBins, _WlzHistogramDomain::origin, _WlzHistogramDomain::type, _WlzObject::type, _WlzPixelV::type, _WlzPixelV::v, WLZ_COMPTHRESH_DEPTH, WLZ_COMPTHRESH_FOOT, WLZ_COMPTHRESH_FRACMIN, WLZ_COMPTHRESH_GRADIENT, WLZ_COMPTHRESH_SMOOTHSPLIT, WLZ_ERR_COMPTHRESH_TYPE, WLZ_ERR_DOMAIN_DATA, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_OBJECT_TYPE, WLZ_ERR_PARAM_DATA, WLZ_ERR_UNIMPLEMENTED, WLZ_GREY_DOUBLE, WLZ_GREY_INT, WLZ_HISTOGRAM, WLZ_HISTOGRAMDOMAIN_FLOAT, WLZ_HISTOGRAMDOMAIN_INT, WLZ_THRESH_HIGH, WLZ_THRESH_LOW, WlzHistogramBinMax(), and WlzValueConvertPixel().
Referenced by WlzSplitObj().
WlzErrorNum WlzCompThreshold | ( | double * | dstThrVal, |
WlzObject * | histObj, | ||
WlzCompThreshType | method, | ||
double | extraFrac | ||
) |
Computes a threshold value from the given histogram object using the given method.
dstThrVal | Destination pointer for the threshold value. |
histObj | Given histogram object. |
method | Given method. |
extraFrac | Extra fraction added onto the threshold value, ie: thrVal += thrVal * extraFrac. |
References _WlzHistogramDomain::binSize, _WlzObject::domain, _WlzDomain::hist, _WlzHistogramDomain::maxBins, _WlzHistogramDomain::nBins, _WlzHistogramDomain::type, _WlzObject::type, WLZ_COMPTHRESH_DEPTH, WLZ_COMPTHRESH_FOOT, WLZ_COMPTHRESH_FRACMIN, WLZ_COMPTHRESH_GRADIENT, WLZ_COMPTHRESH_SMOOTHSPLIT, WLZ_DBG, WLZ_DBG_LVL_1, WLZ_ERR_COMPTHRESH_TYPE, WLZ_ERR_DOMAIN_DATA, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_OBJECT_TYPE, WLZ_ERR_PARAM_NULL, WLZ_HISTOGRAM, WLZ_HISTOGRAMDOMAIN_FLOAT, and WLZ_HISTOGRAMDOMAIN_INT.
WlzObject* WlzHyThreshold | ( | WlzObject * | srcObj, |
WlzPixelV | pThrV, | ||
WlzPixelV | sThrV, | ||
WlzThresholdType | hilo, | ||
WlzConnectType | con, | ||
WlzErrorNum * | dstErr | ||
) |
Hysteresis thresholds the given Woolz object. Values are in the domain of the hysteresis threshold'd object if they are above/below the primary threshold or above/below the secondary threshold and connected to values above/below the primary threshold.
srcObj | Object to be thresholded. |
pThrV | Primary hysteresis threshold value. |
sThrV | Threshold for above or below values. |
hilo | Threshold for above or below values. |
con | Connectivity to examine for hysteresis. |
dstErr | Destination error pointer, may be null. |
References _WlzValues::core, _WlzDomain::core, _WlzGreyV::dbv, _WlzObject::domain, _WlzGreyV::flv, _WlzGreyV::inv, _WlzObject::plist, _WlzGreyV::rgbv, _WlzGreyV::shv, _WlzPixelV::type, _WlzGreyV::ubv, _WlzPixelV::v, _WlzObject::values, WLZ_0_CONNECTED, WLZ_EMPTY_OBJ, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_GREY_TYPE, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_VALUES_NULL, WLZ_GREY_DOUBLE, WLZ_GREY_FLOAT, WLZ_GREY_INT, WLZ_GREY_RGBA, WLZ_GREY_SHORT, WLZ_GREY_UBYTE, WlzDilation(), WlzFreeObj(), WlzIntersect2(), WlzMakeMain(), WlzThreshold(), WlzUnion2(), and WlzValueConvertPixel().
Referenced by WlzCannyDeriche().
WlzObject* WlzRGBAMultiThreshold | ( | WlzObject * | obj, |
WlzPixelV | lowVal, | ||
WlzPixelV | highVal, | ||
WlzUInt | combineMode, | ||
WlzErrorNum * | dstErr | ||
) |
Apply independent thresholds to each colour channel independently and combine according to the settings encoded in combineMode. Each channel can have one of two modes: WLZ_BO_AND and WLZ_BO_OR. These are encoded into a single mode variable using the RGBA macro, e.g.: WLZ_RGBA_RGBA_SET(combineMode, redMode, greenMode, blueMode, 255);.
The macro WLZ_RGBA_RED_GET(combineMode) will return redMode and similarly for green and blue.
obj | Object to be thresholded |
lowVal | RGB low values |
highVal | RGB high values |
combineMode | Combination rules as an RGBA encoded unsigned integer |
dstErr | Error return |
References _WlzValues::core, _WlzObject::domain, _WlzGreyV::inv, _WlzCompoundArray::n, _WlzCompoundArray::o, _WlzValues::obj, _WlzGreyV::rgbv, _WlzPixelV::type, _WlzObject::type, _WlzPixelV::v, _WlzObject::values, WLZ_2D_DOMAINOBJ, WLZ_3D_DOMAINOBJ, WLZ_BO_AND, WLZ_COMPOUND_ARR_1, WLZ_COMPOUND_ARR_2, WLZ_EMPTY_OBJ, WLZ_ERR_NONE, WLZ_ERR_OBJECT_DATA, WLZ_ERR_OBJECT_NULL, WLZ_ERR_OBJECT_TYPE, WLZ_ERR_PARAM_TYPE, WLZ_ERR_VALUES_NULL, WLZ_GREY_INT, WLZ_GREY_RGBA, WLZ_RGBA_BLUE_GET, WLZ_RGBA_GREEN_GET, WLZ_RGBA_RED_GET, WLZ_RGBA_SPACE_RGB, WLZ_THRESH_HIGH, WLZ_THRESH_LOW, WLZ_TRANS_OBJ, WlzAssignObject(), WlzFreeObj(), WlzIntersect2(), WlzIsEmpty(), WlzMakeEmpty(), WlzMakeMain(), WlzRGBAToCompound(), WlzThreshold(), and WlzUnion2().
Referenced by WlzRGBABoxThreshold().
WlzObject* WlzThreshold | ( | WlzObject * | obj, |
WlzPixelV | threshV, | ||
WlzThresholdType | highlow, | ||
WlzErrorNum * | dstErr | ||
) |
Thresholds a woolz grey-level object, 2D or 3D.
obj | Object to be thresholded. |
threshV | Threshold pixel value. |
highlow | Mode parameter with possible values:
|
dstErr | Destination pointer for error number, may be NULL. |
References AlcFreeStackPush(), AlcMalloc(), _WlzValues::core, _WlzDomain::core, _WlzGreyV::dbv, _WlzObject::domain, _WlzGreyV::flv, _WlzIntervalDomain::freeptr, _WlzDomain::i, _WlzIntervalWSpace::intrmn, _WlzGreyV::inv, _WlzInterval::iright, _WlzIntervalDomain::kol1, _WlzIntervalDomain::lastkl, _WlzIntervalDomain::lastln, _WlzIntervalDomain::line1, _WlzIntervalWSpace::linpos, _WlzValues::obj, _WlzGreyWSpace::pixeltype, _WlzObject::plist, _WlzGreyV::rgbv, _WlzGreyV::shv, _WlzPixelV::type, _WlzObject::type, _WlzGreyWSpace::u_grintptr, _WlzGreyV::ubv, _WlzPixelV::v, _WlzObject::values, WLZ_2D_DOMAINOBJ, WLZ_3D_DOMAINOBJ, WLZ_EMPTY_OBJ, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_EOO, WLZ_ERR_GREY_TYPE, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_OBJECT_TYPE, WLZ_ERR_PARAM_DATA, WLZ_ERR_VALUES_NULL, WLZ_GREY_DOUBLE, WLZ_GREY_FLOAT, WLZ_GREY_INT, WLZ_GREY_RGBA, WLZ_GREY_SHORT, WLZ_GREY_UBYTE, WLZ_INTERVALDOMAIN_INTVL, WLZ_RGBA_MODULUS, WLZ_THRESH_ADD_ITV_1, WLZ_THRESH_ADD_ITV_2, WLZ_THRESH_ADD_ITV_FE_1, WLZ_THRESH_ADD_ITV_FE_2, WLZ_THRESH_ADD_ITV_RGB_1, WLZ_THRESH_ADD_ITV_RGB_2, WLZ_THRESH_EQUAL, WLZ_THRESH_HIGH, WLZ_THRESH_LOW, WLZ_TRANS_OBJ, WlzFreeIntervalDomain(), WlzInitGreyScan(), WlzMakeEmpty(), WlzMakeInterval(), WlzMakeIntervalDomain(), WlzMakeMain(), and WlzNextGreyInterval().
Referenced by main(), WlzCMeshIntersectDom2D5(), WlzGetProjectionFromObject(), WlzHyThreshold(), WlzIndexObjToCompound(), WlzProjectObjToPlane(), WlzRGBAMultiThreshold(), WlzScalarFeatures2D(), WlzSplitMontageObj(), and WlzSplitObj().