Woolz Image Processing  Version 1.8.3
WlzContour

Files

file  WlzContour.c
 Functions for extracting contours from objects.
 

Data Structures

struct  _WlzContour
 A collection of 2D polylines or 3D surface elements represented by a Woolz geometric model. Typedef: WlzContour. More...
 

Enumerations

enum  _WlzContourTriIsn2D {
  WLZ_CONTOUR_TIC2D_NONE,
  WLZ_CONTOUR_TIC2D_V1V0,
  WLZ_CONTOUR_TIC2D_V0V2,
  WLZ_CONTOUR_TIC2D_V2V1,
  WLZ_CONTOUR_TIC2D_V1S02,
  WLZ_CONTOUR_TIC2D_V0S21,
  WLZ_CONTOUR_TIC2D_V2S10,
  WLZ_CONTOUR_TIC2D_S10S02,
  WLZ_CONTOUR_TIC2D_S02S21,
  WLZ_CONTOUR_TIC2D_S21S10
}
 Classification of the intersection of a line segment with a triangle. Typedef: WlzContourTriIsn2D. More...
 
enum  _WlzContourBndSamMethod {
  WLZ_CONTOUR_BNDPTS_REGULAR,
  WLZ_CONTOUR_BNDPTS_RANDOM
}
 Boudary point sampling methods. Typedef: WlzContourBndSamMethod. More...
 
enum  _WlzContourMethod {
  WLZ_CONTOUR_MTD_ISO,
  WLZ_CONTOUR_MTD_GRD,
  WLZ_CONTOUR_MTD_BND,
  WLZ_CONTOUR_MTD_RBFBND
}
 Contour generation methods. Typedef: WlzContourMethod. More...
 

Functions

WlzContourWlzContourObjGrd (WlzObject *srcObj, double ctrLo, double ctrHi, double ctrWth, int nrmFlg, WlzErrorNum *dstErr)
 Creates a contour (list of connected edges or surface patches) from a Woolz object with values using a maximal gradient algorithm and retains the gradient vectors. The gradient vectors are only valid for valid vertex indicies and do not have unit length. More...
 
WlzContourWlzContourObj (WlzObject *srcObj, WlzContourMethod ctrMtd, double ctrVal, double ctrWth, int nrmFlg, WlzErrorNum *dstErr)
 Creates a contour (list of connected edges or surface patches) from a Woolz object's values. The source object should either a 2D or 3D domain object with values. This is the top level contour generation function which calls the appropriate function for the given contour type (dimension) and generation method. The given contour value is taken to be the iso-value for iso-value contours and the minimum gradient threshold value for maximal gradient contours. The contour width parameter is only used for maximal gradient contours where it is used to generate a recursive Deriche filter, see WlzRsvFilter(). More...
 
WlzContourWlzContourFromPoints (WlzObject *dObj, WlzVertexType vtxType, int nSPts, WlzVertexP sPts, double sAlpha, int nIPts, WlzVertexP iPts, double iDist, double iAlpha, int nOPts, WlzVertexP oPts, double oDist, double oAlpha, double delta, double tau, double samFac, WlzErrorNum *dstErr)
 Given three points sets: On, inside and outside some curve this function computes a contour for the curve. This is done by approximating (or interpolating) the distance function for the curve using multi order spline radial basis functions. The contour is then computed from the zero level set of the radial basis functions within the given distance object. The distance object sampling factor is used to subsample the distance object prior to cuting the zero value isosurface. The surface computed from a sampled distance object is then transformed using the inverse of the sampling transform. More...
 
WlzContourWlzContourGrdObj2D (WlzObject *srcObj, WlzObject *gGXObj, WlzObject *gGYObj, double grdLo, double grdHi, double ftrPrm, int nrmFlg, WlzErrorNum *dstErr)
 Creates an maximal gradient contour (list of edges) from a 2D Woolz object's values. More...
 
WlzContourWlzContourRBFBndObj3D (WlzObject *gObj, int bErosion, int bDilation, int sDilation, int sFac, int oFac, double sAlpha, double oAlpha, double delta, double tau, double samFac, WlzErrorNum *dstErr)
 Computes a 3D contour from the boundary of the given objects domain by extracting the zero level set of an approximate signed distance function computed using a multi-order spline radial basis function. The distance object sampling factor is used to subsample the distance object prior to cuting the zero value isosurface. The surface computed from a sampled distance object is then transformed using the inverse of the sampling transform. More...
 

Detailed Description

Enumeration Type Documentation

◆ _WlzContourTriIsn2D

Classification of the intersection of a line segment with a triangle. Typedef: WlzContourTriIsn2D.

Enumerator
WLZ_CONTOUR_TIC2D_NONE 

No intersection

WLZ_CONTOUR_TIC2D_V1V0 

Vertex 1 - vertex 0

WLZ_CONTOUR_TIC2D_V0V2 

Vertex 0 - vertex 2

WLZ_CONTOUR_TIC2D_V2V1 

Vertex 2 - vertex 1

WLZ_CONTOUR_TIC2D_V1S02 

Vertex 1 - side 0-2

WLZ_CONTOUR_TIC2D_V0S21 

Vertex 0 - side 2-1

WLZ_CONTOUR_TIC2D_V2S10 

Vertex 2 - side 1-0

WLZ_CONTOUR_TIC2D_S10S02 

Side 1-0 - side 0-2

WLZ_CONTOUR_TIC2D_S02S21 

Side 0-2 - side 2-1

WLZ_CONTOUR_TIC2D_S21S10 

Side 2-1 - side 1-0

◆ _WlzContourBndSamMethod

Boudary point sampling methods. Typedef: WlzContourBndSamMethod.

Enumerator
WLZ_CONTOUR_BNDPTS_REGULAR 
WLZ_CONTOUR_BNDPTS_RANDOM 

◆ _WlzContourMethod

Contour generation methods. Typedef: WlzContourMethod.

Enumerator
WLZ_CONTOUR_MTD_ISO 

Iso-value.

WLZ_CONTOUR_MTD_GRD 

Maximum gradient value.

WLZ_CONTOUR_MTD_BND 

Object boundary.

WLZ_CONTOUR_MTD_RBFBND 

Object boundary established using a radial basis function.

Function Documentation

◆ WlzContourObjGrd()

WlzContour* WlzContourObjGrd ( WlzObject srcObj,
double  ctrLo,
double  ctrHi,
double  ctrWth,
int  nrmFlg,
WlzErrorNum dstErr 
)

Creates a contour (list of connected edges or surface patches) from a Woolz object with values using a maximal gradient algorithm and retains the gradient vectors. The gradient vectors are only valid for valid vertex indicies and do not have unit length.

Returns
Contour, or NULL on error.
Parameters
srcObjGiven object from which to compute the contours. required.
ctrLoLower maximal gradient threshold value.
ctrHiHigher maximal gradient threshold value.
ctrWthContour filter width.
nrmFlgAdd image gradients as normals to contour if non zero.
dstErrDestination error pointer, may be NULL.

References _WlzValues::core, _WlzDomain::core, _WlzObject::domain, _WlzObject::type, _WlzObject::values, WLZ_2D_DOMAINOBJ, WLZ_3D_DOMAINOBJ, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_VALUES_NULL, and WlzContourGrdObj2D().

Referenced by WlzRegICPObjsGrd().

◆ WlzContourObj()

WlzContour* WlzContourObj ( WlzObject srcObj,
WlzContourMethod  ctrMtd,
double  ctrVal,
double  ctrWth,
int  nrmFlg,
WlzErrorNum dstErr 
)

Creates a contour (list of connected edges or surface patches) from a Woolz object's values. The source object should either a 2D or 3D domain object with values. This is the top level contour generation function which calls the appropriate function for the given contour type (dimension) and generation method. The given contour value is taken to be the iso-value for iso-value contours and the minimum gradient threshold value for maximal gradient contours. The contour width parameter is only used for maximal gradient contours where it is used to generate a recursive Deriche filter, see WlzRsvFilter().

Returns
Contour, or NULL on error.
Parameters
srcObjGiven object from which to compute the contours.
ctrMtdContour generation method.
ctrValContour value.
ctrWthContour filter width.
nrmFlgGenerate normals from image if possible.
dstErrDestination error pointer, may be NULL.

References _WlzDomain::core, _WlzObject::domain, _WlzObject::type, WLZ_2D_DOMAINOBJ, WLZ_CONTOUR_MTD_ISO, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, and WLZ_ERR_OBJECT_NULL.

◆ WlzContourFromPoints()

WlzContour* WlzContourFromPoints ( WlzObject dObj,
WlzVertexType  vtxType,
int  nSPts,
WlzVertexP  sPts,
double  sAlpha,
int  nIPts,
WlzVertexP  iPts,
double  iDist,
double  iAlpha,
int  nOPts,
WlzVertexP  oPts,
double  oDist,
double  oAlpha,
double  delta,
double  tau,
double  samFac,
WlzErrorNum dstErr 
)

Given three points sets: On, inside and outside some curve this function computes a contour for the curve. This is done by approximating (or interpolating) the distance function for the curve using multi order spline radial basis functions. The contour is then computed from the zero level set of the radial basis functions within the given distance object. The distance object sampling factor is used to subsample the distance object prior to cuting the zero value isosurface. The surface computed from a sampled distance object is then transformed using the inverse of the sampling transform.

Returns
New contour or NULL on error.
Parameters
dObjObject with double values, within which the distance function will be evaluated.
vtxTypeType of all vertices.
nSPtsNumber of on surface points.
sPtsPositions of the on surface points.
sAlphaAlpha value for the on surface points.
nIPtsNumber of inside points.
iPtsPositions of the inside points.
iDistDistance from surface for the inside points.
iAlphaAlpha value for the inside points.
nOPtsNumber of outside points.
oPtsPositions of the outside points.
oDistDistance from surface for the outside points.
oAlphaAlpha value for the outside points.
deltaMultiorder spline \(\delta\) smoothness parameter.
tauMultiorder spline \(\tau\) smoothness parameter.
samFacDistance object sampling factor.
dstErrDestination error pointer, may be NULL.

References _WlzValues::core, _WlzDomain::core, _WlzObject::domain, _WlzVertexP::v, _WlzObject::values, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_PARAM_DATA, WLZ_ERR_VALUES_NULL, WLZ_VERTEX_D3, WLZ_VERTEX_F3, and WLZ_VERTEX_I3.

◆ WlzContourGrdObj2D()

WlzContour* WlzContourGrdObj2D ( WlzObject srcObj,
WlzObject gGXObj,
WlzObject gGYObj,
double  grdLo,
double  grdHi,
double  ftrPrm,
int  nrmFlg,
WlzErrorNum dstErr 
)

Creates an maximal gradient contour (list of edges) from a 2D Woolz object's values.

Returns
Contour , or NULL on error.
          Creates an maximal gradient contour (list of edges)
          from a 2D Woolz object's values.
          Direction of gradient is encoded as:
                  +------+------+
                  |\   2 | 1   /|
                  |  \   |   /  |
                  | 3  \ | /  0 |
                  +------+------+
                  | 4  / | \  7 |
                  |  /   |   \  |
                  |/   5 | 6   \|
                  +------+------+
Parameters
srcObjGiven object from which to compute gradients for the contours.
gGXObjIf non NULL used for gradients across columns.
gGYObjIf non NULL used for gradient through lines.
grdLoLower threshold for modulus of gradient.
grdHiUpper threshold for modulus of gradient.
ftrPrmFilter width parameter.
nrmFlgAdd image gradients as normals to contour if non zero.
dstErrDestination error pointer, may be NULL.

References ALC_ER_NONE, AlcBit2Calloc(), AlcDouble2Calloc(), AlcUnchar2Calloc(), _WlzRsvFilter::c, _WlzValues::core, _WlzDomain::core, _WlzGreyP::dbp, _WlzObject::domain, _WlzDomain::i, _WlzIntervalWSpace::intrmn, _WlzIntervalDomain::kol1, _WlzIntervalDomain::lastkl, _WlzIntervalWSpace::lftpos, _WlzIntervalDomain::line1, _WlzIntervalWSpace::linpos, _WlzContour::model, _WlzIntervalWSpace::nwlpos, _WlzGreyWSpace::pixeltype, _WlzIntervalWSpace::rgtpos, _WlzGreyWSpace::u_grintptr, _WlzGreyP::v, _WlzObject::values, _WlzIVertex2::vtX, _WlzIVertex2::vtY, WLZ_BIT_GET, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_VALUES_NULL, WLZ_GMMOD_2D, WLZ_GMMOD_2N, WLZ_GREY_DOUBLE, WLZ_RSVFILTER_ACTION_X, WLZ_RSVFILTER_ACTION_Y, WLZ_RSVFILTER_NAME_DERICHE_1, WlzAssignGMModel(), WlzBitLnSetItv(), WlzGMModelNew(), WlzInitGreyScan(), WlzMakeContour(), WlzNextGreyInterval(), WlzRsvFilterFreeFilter(), WlzRsvFilterMakeFilter(), WlzRsvFilterObj(), WlzValueCopyGreyToGrey(), WlzValueSetDouble(), and WlzValueSetUByte().

Referenced by WlzContourObjGrd().

◆ WlzContourRBFBndObj3D()

WlzContour* WlzContourRBFBndObj3D ( WlzObject gObj,
int  bErosion,
int  bDilation,
int  sDilation,
int  sFac,
int  oFac,
double  sAlpha,
double  oAlpha,
double  delta,
double  tau,
double  samFac,
WlzErrorNum dstErr 
)

Computes a 3D contour from the boundary of the given objects domain by extracting the zero level set of an approximate signed distance function computed using a multi-order spline radial basis function. The distance object sampling factor is used to subsample the distance object prior to cuting the zero value isosurface. The surface computed from a sampled distance object is then transformed using the inverse of the sampling transform.

Returns
Woolz contour or NULL on error.
Parameters
gObjThe given object.
bErosionObject boundary erosion for interior points.
bDilationObject boundary dilation for exterior points.
sDilationObject boundary dilation for distance object used in surface extraction.
sFacSampling factor for surface points.
oFacSampling factor for interior and exterior points.
sAlphaDegree of approximation for the surface boundary points. The multi-order spline \(\alpha\) parameter.
oAlphaDegree of approximation for the interior and exterior points. The multi-order spline \(\alpha\) parameter.
deltaMulti-order spline \(\delta\) parameter.
tauMulti-order spline \(tau\) parameter.
samFacDistance object sampling factor.
dstErrDestination error pointer, may be NULL.

References _WlzDomain::core, _WlzObject::domain, _WlzVertexP::i3, _WlzObject::type, _WlzVertexP::v, WLZ_3D_DOMAINOBJ, WLZ_CONTOUR_BNDPTS_RANDOM, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_OBJECT_TYPE, WLZ_ERR_PARAM_DATA, WlzFreeObj(), WlzMakeSphereObject(), WlzStructDilation(), WlzStructErosion(), and WlzWriteObj().