Woolz Image Processing  Version 1.8.3
WlzThreshold

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  WlzConComThreshold.c
 Functions to perform connected component thresholding.
 
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.
 

Macros

#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: More...
 
#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: More...
 
#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: More...
 
#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: More...
 
#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: More...
 
#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: More...
 

Enumerations

enum  _WlzCompThreshType {
  WLZ_COMPTHRESH_FOOT,
  WLZ_COMPTHRESH_DEPTH,
  WLZ_COMPTHRESH_GRADIENT,
  WLZ_COMPTHRESH_FRACMIN,
  WLZ_COMPTHRESH_SMOOTHSPLIT,
  WLZ_COMPTHRESH_OTSU
}
 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. More...
 
WlzErrorNum WlzCompThreshold (double *dstThrVal, WlzObject *histObj, WlzCompThreshType method, double extraFrac)
 Computes a threshold value from the given histogram object using the given method. More...
 
WlzObjectWlzConComThreshold2D (WlzObject *gObj, int nSeeds, WlzIVertex2 *seeds, WlzThresholdType tHiLo, int xtr, double rad, WlzThresholdType rHiLo, WlzErrorNum *dstErr)
 Performs connected component thresholding of the given object using the given 2D seed points. See also WlzConComThreshold3D(), WlzConComThreshold() and WlzThreshold(). More...
 
WlzObjectWlzConComThreshold3D (WlzObject *gObj, int nSeeds, WlzIVertex3 *seeds, WlzThresholdType tHiLo, int xtr, double rad, WlzThresholdType rHiLo, WlzErrorNum *dstErr)
 Performs connected component thresholding of the given object using the given 3D seed points. See also WlzConComThreshold2D(), WlzConComThreshold() and WlzThreshold(). More...
 
WlzObjectWlzConComThreshold (WlzObject *gObj, int nSeeds, WlzVertexType seedType, WlzVertexP seeds, WlzThresholdType tHiLo, int xtr, double rad, WlzThresholdType rHiLo, WlzErrorNum *dstErr)
 Performs connected component thresholding of the given object using the given coordinates of seed points within the given object. See also WlzConComThreshold2D(), WlzConComThreshold3D() and WlzThreshold(). More...
 
WlzObjectWlzHyThreshold (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. More...
 
WlzObjectWlzRGBAMultiThreshold (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);. More...
 
WlzObjectWlzThreshold (WlzObject *obj, WlzPixelV threshV, WlzThresholdType highlow, WlzErrorNum *dstErr)
 Thresholds a woolz grey-level object, 2D or 3D. More...
 

Detailed Description

Macro Definition Documentation

◆ WLZ_THRESH_ADD_ITV_1

#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:

  • N Number of intervals to be computed: nints.
  • NL1 Minimum line coordinate: nl1.
  • NLL Maximum line coordinate: nll.
  • NK1 Minimum column coordinate nk1.
  • NKL Maximum column coordinate nkl.
  • G The grey pointer: g.
  • IWS The interval workspace: iwsp.
  • TV The threshold value: thresh_i.
  • P The grey pointer union member: eg ubp.
  • OP The comparison operator: < for WLZ_THRESH_LOW, >= for WLZ_THRESH_HIGH and == for WLZ_THRESH_EQUAL.
  • K Column index: colno.
  • OV Over interval: over.

◆ WLZ_THRESH_ADD_ITV_FE_1

#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:

  • N Number of intervals to be computed: nints.
  • NL1 Minimum line coordinate: nl1.
  • NLL Maximum line coordinate: nll.
  • NK1 Minimum column coordinate nk1.
  • NKL Maximum column coordinate nkl.
  • G The grey pointer: g.
  • IWS The interval workspace: iwsp.
  • TV The threshold value: thresh_i.
  • P The grey pointer union member: eg ubp.
  • E The epsilon value for floating point comparison, should be > 0.0.
  • K Column index: colno.
  • OV Over interval: over.

◆ WLZ_THRESH_ADD_ITV_RGB_1

#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:

  • N Number of intervals to be computed: nints.
  • NL1 Minimum line coordinate: nl1.
  • NLL Maximum line coordinate: nll.
  • NK1 Minimum column coordinate nk1.
  • NKL Maximum column coordinate nkl.
  • G The grey pointer: g.
  • IWS The interval workspace: iwsp.
  • TV The threshold value: thresh_i.
  • OP The comparison operator: < for WLZ_THRESH_LOW, >= for WLZ_THRESH_HIGH and == for WLZ_THRESH_EQUAL.
  • K Column index: colno.
  • OV Over interval: over.

◆ WLZ_THRESH_ADD_ITV_2

#define WLZ_THRESH_ADD_ITV_2 (   N,
  NK1,
  G,
  ITV,
  IWS,
  TV,
  P,
  OP,
  K,
  OV 
)
Value:
{ \
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:

  • N Number of intervals to be computed: nints.
  • NK1 Minimum column coordinate nk1.
  • G The grey pointer: g.
  • ITV The interval pointer.
  • IWS The interval workspace: iwsp.
  • TV The threshold value: thresh_i.
  • P The grey pointer union member: eg ubp.
  • OP The comparison operator: < for WLZ_THRESH_LOW, >= for WLZ_THRESH_HIGH and == for WLZ_THRESH_EQUAL.
  • K Column index: colno.
  • OV Over interval: over.

◆ WLZ_THRESH_ADD_ITV_FE_2

#define WLZ_THRESH_ADD_ITV_FE_2 (   N,
  NK1,
  G,
  ITV,
  IWS,
  TV,
  P,
  E,
  K,
  OV 
)
Value:
{ \
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:

  • N Number of intervals to be computed: nints.
  • NK1 Minimum column coordinate nk1.
  • G The grey pointer: g.
  • ITV The interval pointer.
  • IWS The interval workspace: iwsp.
  • TV The threshold value: thresh_i.
  • P The grey pointer union member: eg ubp.
  • E The epsilon value for floating point comparison, should be > 0.0.
  • K Column index: colno.
  • OV Over interval: over.

◆ WLZ_THRESH_ADD_ITV_RGB_2

#define WLZ_THRESH_ADD_ITV_RGB_2 (   N,
  NK1,
  G,
  ITV,
  IWS,
  TV,
  P,
  OP,
  K,
  OV 
)
Value:
{ \
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); \
} \
}
#define WLZ_RGBA_MODULUS_2(V)
Definition: WlzMacro.h:169

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:

  • N Number of intervals to be computed: nints.
  • NK1 Minimum column coordinate nk1.
  • G The grey pointer: g.
  • ITV The interval pointer.
  • IWS The interval workspace: iwsp.
  • TV The threshold value: thresh_i.
  • P The grey pointer union member: eg ubp.
  • OP The comparison operator: < for WLZ_THRESH_LOW, >= for WLZ_THRESH_HIGH and == for WLZ_THRESH_EQUAL.
  • K Column index: colno.
  • OV Over interval: over.

Enumeration Type Documentation

◆ _WlzCompThreshType

Automatic threshold computation methods.
The histogram may need to be smoothed for these algorithms to work. Typedef: WlzCompThreshType.

Enumerator
WLZ_COMPTHRESH_FOOT 

Can not determine threshold type. The threshold value is intercept of a line fitted to the upper slope of the histogram main peak with the abscissa.

WLZ_COMPTHRESH_DEPTH 

Can not determine threshold type. The threshold value is that point to the right of the histogram peak that is maximally distant from the chord joining the peak and the histogram right hand end point. The histogram may need to be smoothed for this algorithm to work.

WLZ_COMPTHRESH_GRADIENT 

Can not determine threshold type. The threshold value is the first point to the right of the histogram main peak at which the gradient falls to zero (cf finding a minimum). To find the slope of the histogram at some point a straight line is fitted through the point \(\pm\) a fixed number of points to either side.

WLZ_COMPTHRESH_FRACMIN 

The threshold type is determined from the position of the histogram's maximum and the threshold value is the minimum following the specified fraction of the values.

WLZ_COMPTHRESH_SMOOTHSPLIT 

The threshold value is found by heavily smoothing the histogram and looking for the minimum. Successively lesser smoothing values are then applied and at each iteration the minimum closest to the previous is found.

WLZ_COMPTHRESH_OTSU 

The threshold value is found by using Otsu's method. This is a clustering-based algorithm which computes an optimum threshold value that separates the two classes of an (assumed) bi-modal histogram.

◆ _WlzThresholdType

Threshold value selection. Typedef: WlzThresholdType.

Enumerator
WLZ_THRESH_LOW 

Threshold < given value

WLZ_THRESH_HIGH 

Threshold >= given value

WLZ_THRESH_EQUAL 

Threshold == given value

◆ _WlzRGBAThresholdType

Colour threshold type selection. Typedef: WlzRGBAThresholdType.

Enumerator
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 

Function Documentation

◆ WlzCompThresholdVT()

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.

Returns
Woolz error code.
Parameters
hObj
methodThreshold value method.
param0First passed parameter:
  • WLZ_COMPTHRESH_FRACMIN = minimum fraction of values which are background.
  • WLZ_COMPTHRESH_SMOOTHSPLIT = minimum smoothing value for WlzHistogramSmooth().
Otherwise not used.
param1First passed parameter:
extraFracExtra fraction to be added or subtracted from the threshold value.
dstTVDestination pointer for threshold value, may be NULL.
dstTTypeDestination pointer for threshold type, may be NULL.

References _WlzHistogramDomain::binSize, _WlzGreyV::dbv, _WlzObject::domain, _WlzDomain::hist, _WlzHistogramDomain::maxBins, _WlzHistogramDomain::nBins, _WlzHistogramDomain::origin, _WlzPixelV::type, _WlzObject::type, _WlzHistogramDomain::type, _WlzPixelV::v, WLZ_COMPTHRESH_DEPTH, WLZ_COMPTHRESH_FOOT, WLZ_COMPTHRESH_GRADIENT, 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_UNIMPLEMENTED, WLZ_GREY_DOUBLE, WLZ_HISTOGRAM, WLZ_HISTOGRAMDOMAIN_FLOAT, WLZ_HISTOGRAMDOMAIN_INT, WLZ_THRESH_HIGH, and WlzHistogramBinMax().

Referenced by WlzSplitObj().

◆ WlzCompThreshold()

WlzErrorNum WlzCompThreshold ( double *  dstThrVal,
WlzObject histObj,
WlzCompThreshType  method,
double  extraFrac 
)

Computes a threshold value from the given histogram object using the given method.

Returns
Woolz error code.
Parameters
dstThrValDestination pointer for the threshold value.
histObjGiven histogram object.
methodGiven method.
extraFracExtra fraction added onto the threshold value, ie: thrVal += thrVal * extraFrac.

References _WlzHistogramDomain::binSize, _WlzObject::domain, _WlzDomain::hist, _WlzHistogramDomain::maxBins, _WlzHistogramDomain::nBins, _WlzObject::type, _WlzHistogramDomain::type, WLZ_COMPTHRESH_FOOT, WLZ_DBG, WLZ_DBG_LVL_1, 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.

◆ WlzConComThreshold2D()

WlzObject* WlzConComThreshold2D ( WlzObject gObj,
int  nSeeds,
WlzIVertex2 seeds,
WlzThresholdType  tHiLo,
int  xtr,
double  rad,
WlzThresholdType  rHiLo,
WlzErrorNum dstErr 
)

Performs connected component thresholding of the given object using the given 2D seed points. See also WlzConComThreshold3D(), WlzConComThreshold() and WlzThreshold().

Returns
New (thresholded) Woolz object or NULL on error.
Parameters
gObjGiven object to threshold, this must be either an empty object or a 2D domain object with values.
nSeedsNumber of seed positions supplied.
seedsThe given seed positions.
tHiLoThreshold mode parameter.
xtrPercent extra to add to threshold value.
radRadius of region around seed in which to establish threshold value.
rHiLoHow to choose threshold from the region around each seed.
dstErrDestination error pointer, may be NULL.

References _WlzVertexP::i2, _WlzObject::type, WLZ_2D_DOMAINOBJ, WLZ_EMPTY_OBJ, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_OBJECT_TYPE, WLZ_VERTEX_I2, and WlzConComThreshold().

◆ WlzConComThreshold3D()

WlzObject* WlzConComThreshold3D ( WlzObject gObj,
int  nSeeds,
WlzIVertex3 seeds,
WlzThresholdType  tHiLo,
int  xtr,
double  rad,
WlzThresholdType  rHiLo,
WlzErrorNum dstErr 
)

Performs connected component thresholding of the given object using the given 3D seed points. See also WlzConComThreshold2D(), WlzConComThreshold() and WlzThreshold().

Returns
New (thresholded) Woolz object or NULL on error.
Parameters
gObjGiven object to threshold, this must be an empty object or either a 2 or 3D domain object with values.
nSeedsNumber of seed positions supplied.
seedsThe given seed positions.
tHiLoThreshold mode parameter.
xtrPercent extra to add to threshold value.
radRadius of region around seed in which to establish threshold value.
rHiLoHow to choose threshold from the region around each seed.
dstErrDestination error pointer, may be NULL.

References _WlzVertexP::i3, _WlzObject::type, WLZ_2D_DOMAINOBJ, WLZ_3D_DOMAINOBJ, WLZ_EMPTY_OBJ, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_OBJECT_TYPE, WLZ_VERTEX_I3, and WlzConComThreshold().

◆ WlzConComThreshold()

WlzObject* WlzConComThreshold ( WlzObject gObj,
int  nSeeds,
WlzVertexType  seedType,
WlzVertexP  seeds,
WlzThresholdType  tHiLo,
int  xtr,
double  rad,
WlzThresholdType  rHiLo,
WlzErrorNum dstErr 
)

Performs connected component thresholding of the given object using the given coordinates of seed points within the given object. See also WlzConComThreshold2D(), WlzConComThreshold3D() and WlzThreshold().

Returns
New (thresholded) Woolz object or NULL on error.
Parameters
gObjGiven object to threshold, this may be an empty object or either a 2 or 3D domain object with values.
nSeedsNumber of seed positions supplied.
seedType
seedsThe given seed positions. If the given object is a 3D domain object the the seeds must be of type WlzIVertex3 otherwise they may be WlzIVertex2 or WlzIVertex3.
tHiLoThreshold mode parameter with WLZ_THRESH_HIGH >= threshold value, WLZ_THRESH_EQUAL == threshold value and WLZ_THRESH_LOW <= threshold value. Watch out this is slightly different from WlzThreshold().
xtrPercent extra to add to threshold value where

\[ v_{thresh} = v_{seed} \frac{100 \pm xtr}{100} \]

with the sign being: \(-\) for WLZ_THRESH_HIGH and \(+\) for WLZ_THRESH_LOW. If the value of tHiLo is WLZ_THRESH_EQUAL then this parameter is ignored.
radRadius of region around seed in which to establish threshold value, 0.0 implies a single voxel.
rHiLoHow to choose threshold from the region around each seed: WLZ_THRESH_HIGH - highest, WLZ_THRESH_EQUAL - mean and WLZ_THRESH_LOW - lowest. Unused if region radius is 0.0.
dstErrDestination error pointer, may be NULL.

References _WlzValues::core, _WlzDomain::core, _WlzObject::domain, _WlzVertexP::i2, _WlzVertexP::i3, _WlzPixelV::type, _WlzObject::type, _WlzObject::values, _WlzIVertex2::vtX, _WlzIVertex3::vtX, _WlzIVertex2::vtY, _WlzIVertex3::vtY, _WlzIVertex3::vtZ, WLZ_0_CONNECTED, WLZ_26_CONNECTED, WLZ_2D_DOMAINOBJ, WLZ_3D_DOMAINOBJ, WLZ_8_CONNECTED, WLZ_EMPTY_OBJ, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_OBJECT_TYPE, WLZ_ERR_PARAM_DATA, WLZ_ERR_PARAM_TYPE, WLZ_ERR_VALUES_NULL, WLZ_GREY_FLOAT, WLZ_VERTEX_I2, WLZ_VERTEX_I3, WlzAssignObject(), WlzGreyValueMakeWSp(), WlzMakeEmpty(), and WlzMakeSphereObject().

Referenced by WlzConComThreshold2D(), and WlzConComThreshold3D().

◆ WlzHyThreshold()

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.

Returns
Thresholded object or NULL on error.
Parameters
srcObjObject to be thresholded.
pThrVPrimary hysteresis threshold value.
sThrVThreshold for above or below values.
hiloThreshold for above or below values.
conConnectivity to examine for hysteresis.
dstErrDestination 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().

◆ WlzRGBAMultiThreshold()

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.

Returns
Thresholded object
Parameters
objObject to be thresholded
lowValRGB low values
highValRGB high values
combineModeCombination rules as an RGBA encoded unsigned integer
dstErrError return
Source:
WlzRGBAThreshold.c

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().

◆ WlzThreshold()

WlzObject* WlzThreshold ( WlzObject obj,
WlzPixelV  threshV,
WlzThresholdType  highlow,
WlzErrorNum dstErr 
)

Thresholds a woolz grey-level object, 2D or 3D.

Returns
New Woolz object or NULL on error.
Parameters
objObject to be thresholded.
threshVThreshold pixel value.
highlowMode parameter with possible values:
  • WLZ_THRESH_LOW - thresholded object is of values < given value.
  • WLZ_THRESH_HIGH - thresholded object is of values >= given value.
  • WLZ_THRESH_EQUAL - thresholded object is of values == given value.
dstErrDestination pointer for error number, may be NULL.

References _WlzObject::type, WLZ_2D_DOMAINOBJ, WLZ_ERR_NONE, and WLZ_ERR_OBJECT_NULL.

Referenced by WlzBSplineToDomain(), WlzDomainFill3D(), WlzDomainNearby(), WlzGetProjectionFromObject(), WlzGreyExtremumObj(), WlzHyThreshold(), WlzIndexObjToCompound(), WlzOffsetDist(), WlzPointsFromDomObj(), WlzRGBAMultiThreshold(), WlzScalarFeatures2D(), WlzSplitMontageObj(), and WlzSplitObj().