Woolz Image Processing Version 1.4.0
WlzDomainOps

Files

file  WlzClipObjToBox.c
 

Functions for clipping the domain of either 2D or 3D domain objects so that they lie within the given axis aligned biunding box.


file  WlzDiffDomain.c
 

Functions for computing the domain difference between objects.


file  WlzDiffDomain3d.c
 

Functions for computing the domain difference between 3D objects.


file  WlzDomainFill.c
 

Functions to fill holes in domain objects.


file  WlzDomainUtils.c
 

Utility functions for domains.


file  WlzDrawDomain.c
 

Functions for composing a domain from simple drawing commands.


file  WlzEmpty.c
 

Convenience functions to check empty status of objects.


file  WlzFillBlankPlanes.c
 

Fills blank planes of a 3D object. Originally this was used by MAPaint to allow painting of intermediate planes.


file  WlzIntervalCount.c
 

Counts the number of intervals (or equivalent) in an object's domain.


file  WlzIntervalDomScan.c
 

Functions for scanning through an object's interval domain.


file  WlzIterate.c
 

Functions for iteration through Woolz objects.


file  WlzLBTDomain.c
 

Functions for creating and manipulating linear binary tree domains.


file  WlzSkeleton.c
 

Performs a proper interval-domain skeletonisation Hilditch's method.


file  WlzVolume.c
 

Computes the volume of domain objects.


Functions

WlzObjectWlzClipObjToBox3D (WlzObject *srcObj, WlzIBox3 clipBox, WlzErrorNum *dstErrNum)
 Clips the given object's domain so that it does not lie outside the given 3D axis alaigned clip box.
WlzObjectWlzDiffDomain (WlzObject *obj1, WlzObject *obj2, WlzErrorNum *dstErr)
 Calculates the domain difference between two objects.
WlzObjectWlzDiffDomain3d (WlzObject *obj1, WlzObject *obj2, WlzErrorNum *dstErr)
 Calculates the domain difference between two 3D objects This function assumes that the object pointers have been checked to be non-NULL, non-empty, both 3D types and with non-NULL domains. This is the case if the function is accessed via WlzDiffDomain which is recommended.
WlzObjectWlzDomainFill (WlzObject *obj, WlzErrorNum *dstErr)
 fill holes in a woolz domain object domain. The returned object will have a NULL valuetable.
WlzObjectType WlzDomainType (WlzDomain dom)
 Gets the type of the given domain.
void WlzBitLnSetItv (WlzUByte *bitLnP, int iLft, int iRgt, int size)
 Sets bits in the given byte packed bit line which are within the given interval.
WlzErrorNum WlzDynItvLnFromBitLn (WlzIntervalDomain *iDom, WlzUByte *bitLn, int line, int width, WlzDynItvPool *iPool)
 Adds an interval line to a interval domain given an allocated interval domain a byte packed bitmask for the interval line and a pool of available intervals.
WlzErrorNum WlzDynItvAdd (WlzIntervalDomain *iDom, WlzDynItvPool *iPool, int line, int iLft, int iLen)
 Adds an interval to a interval domain given an allocated interval domain, a pool of available intervals, the line, the intervals left most column and the intertvals width.
WlzErrorNum WlzStandardIntervalDomain (WlzIntervalDomain *idom)
 Standardises an interval domain by ensuring that it has a minaimal bounding box, striping away empty lines as required. The domain is modified "in place".
WlzErrorNum WlzStandardPlaneDomain (WlzPlaneDomain *pdom, WlzVoxelValues *voxtb)
 Standardizes a plane domain and corresponding voxel-table (voxel-tables must have exactly matching valuetables) by stripping leading and trailing NULL domains and standardising each domain in turn. The bounding box is reset to be minimal. Both the domain and values may be modified by this function. Any plane which has an invalid interval domain is discarded.
WlzObjectWlzDrawDomainObj (WlzDVertex2 org, WlzThreeDViewStruct *view, int keep2D, char *cmdStr, int *dstErrIdx, WlzErrorNum *dstErr)
 Constructs a 3D spatial domain object (without values) by drawing on a section in 3D space, using commands in the given command string.
int WlzIsEmpty (WlzObject *obj, WlzErrorNum *wlzErr)
 Convenience procedure to check if an object is empty. This include objects with zero area or volume.
WlzErrorNum WlzFillBlankPlanes (WlzObject *obj, int min_domain)
 Fill in blank planes of a 3D object.
int WlzIDomMaxItvLn (WlzIntervalDomain *iDom)
 Computes the maximum number of intervals on any line.
int WlzIntervalCount (WlzIntervalDomain *idom, WlzErrorNum *dstErr)
 Count the number of intervals or equivalent if rectangular.
WlzLong WlzIntervalCountObj (WlzObject *obj, WlzErrorNum *dstErr)
 Counts the number of intervals in an object, where the object type is WLZ_EMPTY_OBJ, WLZ_2D_DOMAINOBJ or WLZ_3D_DOMAINOBJ. Any other object type (including compound objects is an error).
WlzErrorNum WlzInitRasterScan (WlzObject *obj, WlzIntervalWSpace *iwsp, WlzRasterDir raster)
 Initialise raster scanning.
WlzErrorNum WlzNextInterval (WlzIntervalWSpace *iwsp)
 Get next interval in a standard object.
WlzErrorNum WlzNextLine (WlzIntervalWSpace *iwsp, int step)
 Moving to the line which is step away from the present line (beware when both nextline() and nextinterval() are used since nextinterval() will locate the first interval in that line)
WlzErrorNum WlzInitLineScan (WlzObject *obj, WlzIntervalWSpace *iwsp, WlzRasterDir raster, int scale, int firstline)
 Initialise line scanning, must be called before the first call of WlzNextLine().
WlzRasterDir WlzRasterDir2D (WlzRasterDir dir)
 Masks a 2 or 3D raster direction so that it is valid for 2D.
WlzIterateWSpaceWlzIterateInit (WlzObject *obj, WlzRasterDir dir, int grey, WlzErrorNum *dstErr)
 Creates a new domain object iteration workspace that may be used to iterate through either a 2 or 3D domain object.
void WlzIterateWSpFree (WlzIterateWSpace *itWSp)
 Frees the given iteration workspace including it's interval and grey workspaces. The object and 2D object are freed if non NULL.
WlzErrorNum WlzIterate (WlzIterateWSpace *itWSp)
 Iterates through an object for which the given workspace was initialised. This function will return WLZ_ERR_EOO when there are no more pixels/voxels remaining.
WlzDomain WlzLBTDomainFromObj (WlzObject *obj, WlzErrorNum *dstErr)
 Creates a new 2D or 3D linear binary tree domain from the given object's domain. The given object must be either a 2D or 3D domain object. domain.
WlzLBTDomain2DWlzLBTDomain2DFromDomain (WlzDomain dom, WlzErrorNum *dstErr)
 Creates a new 2D linear binary tree domain from the given domain.
WlzLBTDomain3DWlzLBTDomain3DFromDomain (WlzDomain dom, WlzErrorNum *dstErr)
 Creates a new 2D linear binary tree domain from the given domain.
WlzIntervalDomainWlzLBTDomainToIDomain (WlzLBTDomain2D *lDom, WlzErrorNum *dstErr)
 Creates a new interval domain from the given 2D linear binary tree domain.
WlzPlaneDomainWlzLBTDomainToPDomain (WlzLBTDomain3D *lDom, WlzErrorNum *dstErr)
 Creates a new plane domain from the given 3D linear binary tree domain.
WlzIntervalDomainWlzIDomainFromPItv2D (int line1, int lastln, int kol1, int lastkl, int nPItv, WlzPartialItv2D *pItv, WlzErrorNum *dstErr)
 Allocates and computes an interval domain from the given table of partial intervals. The given partial intervals must fit within the given domain bounding box.
WlzPlaneDomainWlzPDomainFromPItv3D (int plane1, int lastpl, int line1, int lastln, int kol1, int lastkl, int nPItv, WlzPartialItv3D *pItv, WlzErrorNum *dstErr)
 Allocates and computes a plane domain from the given table of partial intervals. The given partial intervals must fit within the given domain bounding box.
WlzLBTDomain3DWlzLBTDomain3DFromPDomain (WlzPlaneDomain *pDom, WlzErrorNum *dstErr)
 Creates a new 3D linear binary tree domain from the given interval domain.
WlzLBTDomain2DWlzLBTDomain2DFromIDomain (WlzIntervalDomain *iDom, WlzErrorNum *dstErr)
 Creates a new 2D linear binary tree domain from the given interval domain.
WlzErrorNum WlzLBTBalanceDomain2D (WlzLBTDomain2D *lDom, WlzObject *iObj, int maxSz, int maxBndSz)
 Balances the given LBT domain so that the neighbouring nodes of each node are either of the same size or differ in size by a ratio of 2:1. The function also enforces maximum node size for all nodes and boundary nodes. The neighbour finding algorithm used is quick and simple but it requires an object in which the values are set to the corresponding LBT domain indices. For efficiency an associated interval domain may be given, if the associated domain pointer is NULL then a domain will be computed.
WlzErrorNum WlzLBTBalanceDomain3D (WlzLBTDomain3D *lDom, WlzObject *iObj, int maxSz, int maxBndSz)
 Balances the given LBT domain so that the neighbouring nodes of each node are either of the same size or differ in size by a ratio of 2:1. The function also enforces maximum node size for all nodes and boundary nodes. The neighbour finding algorithm used is quick and simple but it requires an object in which the values are set to the corresponding LBT domain indices. For efficiency an associated interval domain may be given, if the associated domain pointer is NULL then a domain will be computed.
WlzObjectWlzLBTMakeNodeIndexObj2D (WlzLBTDomain2D *lDom, WlzIntervalDomain *iDom, WlzErrorNum *dstErr)
 Creates a new 2D domain object with integer values which are the indices of the nodes containing the pixels of the domain.
WlzObjectWlzLBTMakeNodeIndexObj3D (WlzLBTDomain3D *lDom, WlzPlaneDomain *pDom, WlzErrorNum *dstErr)
 Creates a new 3D domain object with integer values which are the indices of the nodes containing the pixels of the domain.
WlzErrorNum WlzLBTIndexObjSetAllNodes2D (WlzLBTDomain2D *lDom, WlzObject *iObj)
 Sets all index values in an existing 2D LBT node index object.
WlzErrorNum WlzLBTIndexObjSetAllNodes3D (WlzLBTDomain3D *lDom, WlzObject *iObj)
 Sets all index values in an existing 3D LBT node index object.
void WlzLBTClassifyNode2D (WlzLBTDomain2D *lDom, WlzGreyValueWSpace *iGVWSp, int idN, WlzLBTNodeClass2D *dstCls, int *dstRot)
 Classifies the given LBT node by it's connectivity and returns it's class and the counter-clockwise rotation of the basic class pattern in multiples of 90 degrees.
void WlzLBTClassifyNodeFace3D (WlzLBTDomain3D *lDom, WlzGreyValueWSpace *iGVWSp, int idN, int idF, WlzDVertex3 *vtx, WlzLBTNodeClass2D *dstCls, int *dstRot)
 Classifies the given LBT node's face by it's connectivity and returns it's class and the counter-clockwise rotation of the basic class pattern, when viewed from outside of the node's cube looking at the face, in multiples of 90 degrees. This function uses the face index and orientation system defined in WlzCMeshFromBalLBTDom3D().
int WlzLBTCountNodNbrDir2D (WlzLBTDomain2D *lDom, WlzGreyValueWSpace *iGVWSp, int idN, WlzDirection dir)
 Counts the number of neighbours of the given node in the given direction.
int WlzLBTNodeSz2D (WlzLBTNode2D *nod)
 Computes the size of a 2D linear binary tree node.
int WlzLBTNodeLogSz2D (WlzLBTNode2D *nod)
 Computes the log (base 2) of the size of a 2D linear binary tree node.
int WlzLBTNodeSz3D (WlzLBTNode3D *nod)
 Computes the size of a 3D linear binary tree node.
int WlzLBTNodeLogSz3D (WlzLBTNode3D *nod)
 Computes the log (base 2) of the size of a 3D linear binary tree node.
void WlzLBTPosToKey3D (WlzIVertex3 pos, unsigned *keys)
 Sets the value of the LBT key for the given position, where the position is relative to the first line and column of the domain. The key is encoded by interleaving the bits of the column coordinate, line coordinate, plane coordinate and term value in that order. The keys are ordered so that bit 0 is least significant.
void WlzLBTPosToKey2D (WlzIVertex2 pos, unsigned *keys)
 Sets the value of the LBT key for the given position, where the position is relative to the first line and column of the domain. The key is encoded by interleaving the bits of the column coordinate, line coordinate and term value in that order. The keys are ordered so that bit 0 is least significant.
void WlzLBTGetKeyDigits3D (unsigned *keys, WlzUByte *digits)
 Gets an array of WLZ_LBTDOMAIN_MAXDIGITS location digits from the given 3D keys.
void WlzLBTGetKeyDigits2D (unsigned *keys, WlzUByte *digits)
 Gets an array of WLZ_LBTDOMAIN_MAXDIGITS location digits from the given 2D keys.
void WlzLBTKeyToPos3I (unsigned *key, WlzIVertex3 *pos)
 Sets position (relative to the first line and column of the domain) which corresponds to the given 3D LBT key.
void WlzLBTKeyToPos2I (unsigned *key, WlzIVertex2 *pos)
 Sets position (relative to the first line and column of the domain) which corresponds to the given 3D LBT key.
void WlzLBTKeyToBox3I (unsigned *key, WlzIBox3 *box)
 Sets bounding box which corresponds to the given 3D LBT key.
void WlzLBTKeyToBox2I (unsigned *key, WlzIBox2 *box)
 Sets bounding box which corresponds to the given 2D LBT key.
WlzErrorNum WlzLBTTestOutputNodesTxt (FILE *fP, WlzDomain dom)
 Outputs the nodes of the LBT ask text for testing.
WlzErrorNum WlzLBTTestOutputNodesVtk (FILE *fP, WlzDomain dom)
 Outputs the nodes of the LBT as VTK polydata for testing.
WlzObjectWlzSkeleton (WlzObject *srcObj, int smoothpasses, WlzConnectType minCon, WlzErrorNum *dstErr)
 Computes the skeleton of the given object using Hilditch's method. See detail.
WlzLong WlzVolume (WlzObject *obj, WlzErrorNum *wlzErr)
 Calculate the volume of the input 3D domain object.

Function Documentation

WlzObject* WlzDiffDomain3d ( WlzObject obj1,
WlzObject obj2,
WlzErrorNum dstErr 
)

Calculates the domain difference between two 3D objects This function assumes that the object pointers have been checked to be non-NULL, non-empty, both 3D types and with non-NULL domains. This is the case if the function is accessed via WlzDiffDomain which is recommended.

Returns:
The difference object, NULL on error.
Parameters:
obj1First object.
obj2Second object.
dstErrDestination error pointer, may be NULL.

References _WlzObject::assoc, _WlzVoxelValues::bckgrnd, _WlzValues::core, _WlzDomain::core, _WlzObject::domain, _WlzPlaneDomain::domains, _WlzPlaneDomain::kol1, _WlzPlaneDomain::lastkl, _WlzPlaneDomain::lastln, _WlzVoxelValues::lastpl, _WlzPlaneDomain::lastpl, _WlzPlaneDomain::line1, _WlzObject::linkcount, _WlzDomain::p, _WlzVoxelValues::plane1, _WlzPlaneDomain::plane1, _WlzObject::plist, _WlzObject::type, _WlzVoxelValues::type, _WlzPlaneDomain::type, _WlzCoreDomain::type, _WlzVoxelValues::values, _WlzObject::values, _WlzValues::vox, _WlzPlaneDomain::voxel_size, WLZ_2D_DOMAINOBJ, WLZ_3D_DOMAINOBJ, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_NONE, WlzAssignDomain(), WlzAssignValues(), WlzCopyDomain(), WlzDiffDomain(), WlzFreeObj(), WlzMakeMain(), WlzMakePlaneDomain(), WlzMakeVoxelValueTb(), and WlzStandardPlaneDomain().

Referenced by WlzDiffDomain().

WlzObjectType WlzDomainType ( WlzDomain  dom)

Gets the type of the given domain.

Returns:
The type of the domain, WLZ_NULL if the domain is NULL.
Parameters:
domGiven domain.

References _WlzDomain::core, _WlzCoreDomain::type, and WLZ_NULL.

void WlzBitLnSetItv ( WlzUByte bitLnP,
int  iLft,
int  iRgt,
int  size 
)

Sets bits in the given byte packed bit line which are within the given interval.

Returns:
void
Parameters:
bitLnPThe bit line pointer.
iLftLeft coordinate of interval.
iRgtRight coordinate of interval.
sizeNumber of bits in the bit line.

Referenced by WlzContourGrdObj2D().

WlzErrorNum WlzDynItvLnFromBitLn ( WlzIntervalDomain iDom,
WlzUByte bitLn,
int  line,
int  width,
WlzDynItvPool iPool 
)

Adds an interval line to a interval domain given an allocated interval domain a byte packed bitmask for the interval line and a pool of available intervals.

Returns:
Woolz error code.
Parameters:
iDomGiven interval domain.
bitLnByte packed bitmap for line.
lineThe line coordinate.
widthWidth of the line, ie number of valid bits in bitmask.
iPoolInterval pool.

References _WlzIntervalDomain::type, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_NONE, WLZ_ERR_PARAM_NULL, WLZ_INTERVALDOMAIN_INTVL, and WlzDynItvAdd().

WlzErrorNum WlzDynItvAdd ( WlzIntervalDomain iDom,
WlzDynItvPool iPool,
int  line,
int  iLft,
int  iLen 
)

Adds an interval to a interval domain given an allocated interval domain, a pool of available intervals, the line, the intervals left most column and the intertvals width.

Returns:
Woolz error code.
Parameters:
iDomGiven interval domain.
iPoolInterval pool.
lineThe line.
iLftLeft most column of interval.
iLenWidth of the interval.

References ALC_ER_NONE, AlcFreeStackPush(), AlcMalloc(), _WlzIntervalDomain::freeptr, _WlzInterval::ileft, _WlzIntervalDomain::intvlines, _WlzIntervalLine::intvs, _WlzInterval::iright, _WlzDynItvPool::itvBlock, _WlzDynItvPool::itvsInBlock, _WlzIntervalDomain::lastln, _WlzIntervalDomain::line1, _WlzIntervalLine::nintvs, _WlzDynItvPool::offset, _WlzIntervalDomain::type, WLZ_ERR_DOMAIN_DATA, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_PARAM_NULL, and WLZ_INTERVALDOMAIN_INTVL.

Referenced by WlzDynItvLnFromBitLn().

WlzErrorNum WlzStandardPlaneDomain ( WlzPlaneDomain pdom,
WlzVoxelValues voxtb 
)

Standardizes a plane domain and corresponding voxel-table (voxel-tables must have exactly matching valuetables) by stripping leading and trailing NULL domains and standardising each domain in turn. The bounding box is reset to be minimal. Both the domain and values may be modified by this function. Any plane which has an invalid interval domain is discarded.

Returns:
Woolz error code.
Parameters:
pdomGiven plane domain, must NOT be NULL..
voxtbCorresponding voxel table, maybe NULL.

References _WlzObject::assoc, _WlzDomain::core, _WlzObject::domain, _WlzPlaneDomain::domains, _WlzDomain::i, _WlzPlaneDomain::kol1, _WlzPlaneDomain::lastkl, _WlzPlaneDomain::lastln, _WlzVoxelValues::lastpl, _WlzPlaneDomain::lastpl, _WlzPlaneDomain::line1, _WlzIntervalDomain::line1, _WlzVoxelValues::plane1, _WlzPlaneDomain::plane1, _WlzObject::plist, _WlzObject::type, _WlzValues::v, _WlzObject::values, _WlzVoxelValues::values, WLZ_2D_DOMAINOBJ, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, WLZ_ERR_PLANEDOMAIN_DATA, WlzFreeIntervalDomain(), WlzFreeValueTb(), WlzIsEmpty(), and WlzStandardIntervalDomain().

Referenced by Wlz3DSectionSegmentObject(), WlzClipObjToBox3D(), WlzConstruct3DObjFromFile(), WlzConstruct3DObjFromObj(), WlzCutObjToValBox3D(), WlzDiffDomain3d(), WlzIntersect3d(), WlzMakeCuboidObject(), WlzMakeSphereObject(), WlzSampleObjPoint3D(), and WlzUnion3d().

WlzObject* WlzDrawDomainObj ( WlzDVertex2  org,
WlzThreeDViewStruct view,
int  keep2D,
char *  cmdStr,
int *  dstErrIdx,
WlzErrorNum dstErr 
)

Constructs a 3D spatial domain object (without values) by drawing on a section in 3D space, using commands in the given command string.

Returns:
New 3D spatial domain object, an empty object or NULL on error.

The command string must have the following syntax:

 		<command string> = <init command>[<command>]+<end command>
 		<init command> = <ident>:<version>;
 		<end command> = END:;
 		<ident> = WLZ_DRAW_DOMAIN
 		<version> = 1
 		<command> = <command name>:[<parameter>[,<parameter>]*];
 		<command name> = PEN | LINE | CIRCLE
 		

In addition to the init and end commands, the following drawing commands are recognised:

		CIRCLE:<action>:<radius>,<x>,<y>;
		LINE:<action>:<width>,<x>,<y>,<x>,<y>;
                PEN:<action>,<width>,<x>,<y>[,<x>,<y>]*;
 		

Where

		<action> = DRAW | ERASE
 		

A simple example is:

		WLZ_DRAW_DOMAIN:1;
		CIRCLE:DRAW,100,200,200;
		LINE:ERASE,10,0,0,200,200;
		PEN,DRAW,4,0,0,200,0,200,200,0,200,0,0;
		END:;
 		

The circle command draws or erases a filled circle which is specified by it's radius and centre parameters. The line command draws a rectangle using the given width and end coordinates of the mid-line. The pen command draws a polyline which is composed of a series of rectangular segments, with each segment ending in a semi-circular cap. The parameters of the pen command are the width and line segment end point coordinates. All widths, radii and coordinates may be in any floating point format recognised by scanf().

Other commands may be present provided they have the same syntax described above, but they will be ignored.

All white space characters are ignored.

The drawn domain is offset by the given origin before being transformed to the section plane given by the view structure.

Parameters:
orgOrigin of the 2D drawing frame with respect to the 2D Woolz object cut using the given view transform.
viewThe section plane in 3D space on which the domain is drawn. May be NULL, in which case the view transform is the default transform created by WlzMake3DViewStruct().
keep2DIgnore the view struct and keep the object 2D if this flag is non-zero.
cmdStrString with drawing commands using the syntax described above.
dstErrIdxUsed to return the index of the last character parsed in the command string. May be NULL.
dstErrDestination error pointer, may be NULL.

References AlcFree(), _WlzDrawDomWSp::buf, _WlzDrawDomWSp::bufMax, _WlzDrawDomWSp::cmdStr, _WlzDrawDomWSp::cmdStrIdx, _WlzThreeDViewStruct::view_mode, _WlzDVertex2::vtX, _WlzDVertex2::vtY, Wlz3DViewTransformObj(), WLZ_3D_VIEW_STRUCT, WLZ_DRAWDOM_CMD_ERROR, WLZ_DRAWDOM_CMD_INIT, WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, WLZ_ERR_PARAM_NULL, WLZ_NINT, WLZ_UP_IS_UP_MODE, WlzAssignObject(), WlzFree3DViewStruct(), WlzFreeObj(), WlzInit3DViewStruct(), WlzMake3DViewStruct(), and WlzShiftObject().

WlzErrorNum WlzFillBlankPlanes ( WlzObject obj,
int  min_domain 
)

Fill in blank planes of a 3D object.

Detail
A Woolz 3D object can be generated with NULL domains for any plane value (except first and last). This is equivalent to empty planes (empty domains should be used here). This procedure generates new domains to of size determined by the 3D bounding box and will add grey-tables if required. This was primarily of use if it is required to generate a sparse object, e.g. of selected key-sections, which needs to be painted.
Returns:
Woolz error.
Parameters:
objInput 3D woolz domain object.
min_domainMinimum domain value.
Source:
WlzFillBlankPlanes.c

References _WlzDomain::core, _WlzValues::core, _WlzObject::domain, _WlzPlaneDomain::domains, _WlzDomain::i, _WlzPlaneDomain::kol1, _WlzPlaneDomain::lastkl, _WlzPlaneDomain::lastln, _WlzPlaneDomain::line1, _WlzDomain::p, _WlzPlaneDomain::plane1, _WlzIntervalDomain::type, _WlzCoreValues::type, _WlzPlaneDomain::type, _WlzObject::type, _WlzValues::v, _WlzVoxelValues::values, _WlzObject::values, _WlzValues::vox, WLZ_2D_DOMAINOBJ, WLZ_3D_DOMAINOBJ, WLZ_EMPTY_OBJ, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_OBJECT_TYPE, WLZ_GREY_TAB_RAGR, WLZ_INTERVALDOMAIN_RECT, WLZ_NULL, WLZ_PLANEDOMAIN_DOMAIN, WlzAssignDomain(), WlzAssignValues(), WlzFreeObj(), WlzGetBackground(), WlzGreyTableType(), WlzGreyTableTypeToGreyType(), WlzMakeIntervalDomain(), WlzMakeMain(), WlzNewIDomain(), WlzNewValueTb(), and WlzUnion2().

int WlzIDomMaxItvLn ( WlzIntervalDomain iDom)

Computes the maximum number of intervals on any line.

Returns:
Maximum number of intervals on a line.
Parameters:
iDomGiven interval domain.

References _WlzIntervalDomain::intvlines, _WlzIntervalDomain::lastln, _WlzIntervalDomain::line1, _WlzIntervalDomain::type, WLZ_INTERVALDOMAIN_INTVL, and WLZ_INTERVALDOMAIN_RECT.

Referenced by WlzDilation(), WlzErosion(), WlzErosion4(), WlzStructDilation(), and WlzStructErosion().

int WlzIntervalCount ( WlzIntervalDomain idom,
WlzErrorNum dstErr 
)

Count the number of intervals or equivalent if rectangular.

Returns:
Number of intervals if the domain type is WLZ_INTERVALDOMAIN_INTVL else the number of lines.
Parameters:
idomInput domain.
dstErrDestination error pointer, may be NULL.

References _WlzIntervalDomain::intvlines, _WlzIntervalDomain::lastln, _WlzIntervalDomain::line1, _WlzIntervalDomain::type, WLZ_ERR_INTERVALDOMAIN_NULL, WLZ_ERR_INTERVALDOMAIN_TYPE, WLZ_ERR_NONE, WLZ_ERR_UNSPECIFIED, WLZ_INTERVALDOMAIN_INTVL, and WLZ_INTERVALDOMAIN_RECT.

Referenced by Wlz3DSectionSegmentObject(), Wlz3DViewTransformObj(), WlzDiffDomain(), WlzDilation(), WlzErosion(), WlzErosion4(), WlzIntersectN(), WlzIntervalCountObj(), WlzMakeIntervalValues(), WlzObjToBoundary(), WlzStructDilation(), WlzStructErosion(), and WlzUnionN().

WlzLong WlzIntervalCountObj ( WlzObject obj,
WlzErrorNum dstErr 
)

Counts the number of intervals in an object, where the object type is WLZ_EMPTY_OBJ, WLZ_2D_DOMAINOBJ or WLZ_3D_DOMAINOBJ. Any other object type (including compound objects is an error).

Returns:
Number of intervals in object. This is always zero on error but may also be zero if the object has no intervals.
Parameters:
objGiven object.
dstErrDestination error pointer, may be NULL.

References _WlzDomain::core, _WlzObject::domain, _WlzPlaneDomain::domains, _WlzDomain::i, _WlzPlaneDomain::lastpl, _WlzDomain::p, _WlzPlaneDomain::plane1, _WlzObject::type, WLZ_2D_DOMAINOBJ, WLZ_3D_DOMAINOBJ, WLZ_EMPTY_OBJ, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_OBJECT_TYPE, and WlzIntervalCount().

WlzErrorNum WlzInitRasterScan ( WlzObject obj,
WlzIntervalWSpace iwsp,
WlzRasterDir  raster 
)
WlzRasterDir WlzRasterDir2D ( WlzRasterDir  dir)

Masks a 2 or 3D raster direction so that it is valid for 2D.

Returns:
Returns a 2D raster direction.
Parameters:
dirGiven raster direction.

References WLZ_RASTERDIR_DLDC.

Referenced by WlzIterateInit().

WlzIterateWSpace* WlzIterateInit ( WlzObject obj,
WlzRasterDir  dir,
int  grey,
WlzErrorNum dstErr 
)

Creates a new domain object iteration workspace that may be used to iterate through either a 2 or 3D domain object.

Returns:
A new domain object iteration workspace.
Parameters:
objGiven object which must be either of the type WLZ_2D_DOMAINOBJ or WLZ_3D_DOMAINOBJ.
dirRaster scan direction.
greyNon-zero if grey value access is needed (not required if the object does not have grey values).
dstErrDestination error pointer, may be NULL.

References _WlzDomain::core, _WlzObject::domain, _WlzObject::type, WLZ_2D_DOMAINOBJ, WLZ_3D_DOMAINOBJ, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_OBJECT_TYPE, WlzIterateWSpFree(), and WlzRasterDir2D().

Referenced by WlzCMeshClosePointDom2D5().

void WlzIterateWSpFree ( WlzIterateWSpace itWSp)

Frees the given iteration workspace including it's interval and grey workspaces. The object and 2D object are freed if non NULL.

Parameters:
itWSpGiven iteration workspace.

References AlcFree(), _WlzIterateWSpace::gWSp, _WlzIterateWSpace::iWSp, _WlzIterateWSpace::obj2D, and WlzFreeObj().

Referenced by WlzCMeshClosePointDom2D5(), and WlzIterateInit().

WlzErrorNum WlzIterate ( WlzIterateWSpace itWSp)

Iterates through an object for which the given workspace was initialised. This function will return WLZ_ERR_EOO when there are no more pixels/voxels remaining.

Returns:
Woolz error code.
Parameters:
itWSpGiven iteration workspace.

References _WlzIterateWSpace::obj, _WlzObject::type, WLZ_2D_DOMAINOBJ, WLZ_3D_DOMAINOBJ, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_OBJECT_TYPE, and WLZ_ERR_PARAM_NULL.

Referenced by WlzCMeshClosePointDom2D5().

WlzDomain WlzLBTDomainFromObj ( WlzObject obj,
WlzErrorNum dstErr 
)

Creates a new 2D or 3D linear binary tree domain from the given object's domain. The given object must be either a 2D or 3D domain object. domain.

Returns:
New 2D or 3D linear binary tree domain.
Parameters:
objGiven object.
dstErrDestination error pointer, may be NULL.

References _WlzDomain::core, _WlzObject::domain, _WlzDomain::l2, _WlzDomain::l3, _WlzObject::type, WLZ_2D_DOMAINOBJ, WLZ_3D_DOMAINOBJ, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_OBJECT_TYPE, WlzLBTDomain2DFromDomain(), and WlzLBTDomain3DFromDomain().

WlzLBTDomain2D* WlzLBTDomain2DFromDomain ( WlzDomain  dom,
WlzErrorNum dstErr 
)

Creates a new 2D linear binary tree domain from the given domain.

Returns:
New 2D linear binary tree domain.
Parameters:
domGiven domain, which must be 2D.
dstErrDestination error pointer, may be NULL.

References _WlzDomain::core, _WlzDomain::i, _WlzCoreDomain::type, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_NONE, WLZ_INTERVALDOMAIN_INTVL, WLZ_INTERVALDOMAIN_RECT, and WlzLBTDomain2DFromIDomain().

Referenced by WlzCMeshFromObj2D(), and WlzLBTDomainFromObj().

WlzLBTDomain3D* WlzLBTDomain3DFromDomain ( WlzDomain  dom,
WlzErrorNum dstErr 
)

Creates a new 2D linear binary tree domain from the given domain.

Returns:
New 2D linear binary tree domain.
Parameters:
domGiven domain, which must be 2D.
dstErrDestination error pointer, may be NULL.

References _WlzDomain::core, _WlzDomain::p, _WlzCoreDomain::type, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_NONE, WLZ_PLANEDOMAIN_DOMAIN, and WlzLBTDomain3DFromPDomain().

Referenced by WlzCMeshFromObj3D(), and WlzLBTDomainFromObj().

WlzIntervalDomain* WlzLBTDomainToIDomain ( WlzLBTDomain2D lDom,
WlzErrorNum dstErr 
)
WlzIntervalDomain* WlzIDomainFromPItv2D ( int  line1,
int  lastln,
int  kol1,
int  lastkl,
int  nPItv,
WlzPartialItv2D pItv,
WlzErrorNum dstErr 
)

Allocates and computes an interval domain from the given table of partial intervals. The given partial intervals must fit within the given domain bounding box.

Returns:
Woolz interval domain or NULL on error.
Parameters:
line1First line.
lastlnLast line.
kol1First column.
lastkllast column.
nPItvNumber of partial intervals.
pItvArray of partial intervals.
dstErrDestination error pointer, may be NULL.

References AlcCalloc(), AlcFreeStackPush(), AlgQSort(), _WlzIntervalDomain::freeptr, _WlzInterval::ileft, _WlzPartialItv2D::ileft, _WlzIntervalDomain::intvlines, _WlzIntervalLine::intvs, _WlzInterval::iright, _WlzPartialItv2D::iright, _WlzIntervalDomain::line1, _WlzPartialItv2D::ln, _WlzIntervalLine::nintvs, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, WLZ_INTERVALDOMAIN_INTVL, WlzFreeIntervalDomain(), and WlzMakeIntervalDomain().

Referenced by WlzLBTDomainToIDomain().

WlzPlaneDomain* WlzPDomainFromPItv3D ( int  plane1,
int  lastpl,
int  line1,
int  lastln,
int  kol1,
int  lastkl,
int  nPItv,
WlzPartialItv3D pItv,
WlzErrorNum dstErr 
)

Allocates and computes a plane domain from the given table of partial intervals. The given partial intervals must fit within the given domain bounding box.

Returns:
Woolz interval domain or NULL on error.
Parameters:
plane1First plane.
lastplLast plane.
line1First line.
lastlnLast line.
kol1First column.
lastkllast column.
nPItvNumber of partial intervals.
pItvArray of partial intervals.
dstErrDestination error pointer, may be NULL.

References AlcCalloc(), AlcFreeStackPush(), AlgQSort(), _WlzPlaneDomain::domains, _WlzIntervalDomain::freeptr, _WlzDomain::i, _WlzInterval::ileft, _WlzPartialItv3D::ileft, _WlzIntervalDomain::intvlines, _WlzIntervalLine::intvs, _WlzInterval::iright, _WlzPartialItv3D::iright, _WlzIntervalDomain::line1, _WlzPartialItv3D::ln, _WlzIntervalLine::nintvs, _WlzPartialItv3D::pl, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, WLZ_INTERVALDOMAIN_INTVL, WLZ_PLANEDOMAIN_DOMAIN, WlzAssignDomain(), WlzFreePlaneDomain(), WlzMakeIntervalDomain(), WlzMakePlaneDomain(), _WlzIBox2::xMax, _WlzIBox2::xMin, _WlzIBox2::yMax, and _WlzIBox2::yMin.

Referenced by WlzLBTDomainToPDomain().

WlzLBTDomain3D* WlzLBTDomain3DFromPDomain ( WlzPlaneDomain pDom,
WlzErrorNum dstErr 
)

Creates a new 3D linear binary tree domain from the given interval domain.

Returns:
New 3D linear binary tree domain.
Todo:
There are two possible algorithms here: Create all possible nodes for in Morton order condensing nodes on the fly or the simpler and slower algorithm create all possible nodes in scan order and then sort to get the Morton order. Currently the latter algorithm is used but this should be replaced with the former when there's working code. time than
Parameters:
pDomGiven plane domain.
dstErrDestination error pointer, may be NULL.

References ALC_ER_NONE, AlcCalloc(), AlcFreeStackPush(), _WlzIntervalWSpace::colrmn, _WlzDomain::core, _WlzValues::core, _WlzPlaneDomain::domains, _WlzLBTNode3D::flags, _WlzLBTDomain3D::freeptr, _WlzLBTNode3D::keys, _WlzPlaneDomain::kol1, _WlzPlaneDomain::lastkl, _WlzPlaneDomain::lastln, _WlzPlaneDomain::lastpl, _WlzIntervalWSpace::lftpos, _WlzPlaneDomain::line1, _WlzIntervalWSpace::linpos, _WlzLBTDomain3D::maxNodes, _WlzLBTDomain3D::nNodes, _WlzLBTDomain3D::nodes, _WlzDomain::p, _WlzPlaneDomain::plane1, _WlzIntervalWSpace::rgtpos, _WlzCoreDomain::type, _WlzIVertex3::vtX, _WlzIVertex3::vtY, _WlzIVertex3::vtZ, WLZ_26_CONNECTED, WLZ_2D_DOMAINOBJ, WLZ_3D_DOMAINOBJ, WLZ_EMPTY_DOMAIN, WLZ_ERR_EOO, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_LBT_NODE_FLAG_BOUNDARY, WLZ_LBTDOMAIN_3D, WLZ_RASTERDIR_ILIC, WlzErosion(), WlzFreeObj(), WlzInitRasterScan(), WlzInsideDomain(), WlzLBTPosToKey3D(), WlzMakeLBTDomain3D(), WlzMakeMain(), and WlzNextInterval().

Referenced by WlzLBTDomain3DFromDomain().

WlzLBTDomain2D* WlzLBTDomain2DFromIDomain ( WlzIntervalDomain iDom,
WlzErrorNum dstErr 
)

Creates a new 2D linear binary tree domain from the given interval domain.

Returns:
New 2D linear binary tree domain.
Todo:
There are two possible algorithms here: Create all possible nodes for in Morton order condensing nodes on the fly or the simpler and slower algorithm create all possible nodes in scan order and then sort to get the Morton order. Currently the latter algorithm is used but this should be replaced with the former when there's working code. time than
Parameters:
iDomGiven domain, which must be an interval domain.
dstErrDestination error pointer, may be NULL.

References ALC_ER_NONE, AlcCalloc(), AlcFreeStackPush(), _WlzIntervalWSpace::colrmn, _WlzValues::core, _WlzLBTNode2D::flags, _WlzLBTDomain2D::freeptr, _WlzDomain::i, _WlzLBTNode2D::keys, _WlzIntervalDomain::kol1, _WlzIntervalDomain::lastkl, _WlzIntervalDomain::lastln, _WlzIntervalWSpace::lftpos, _WlzIntervalDomain::line1, _WlzIntervalWSpace::linpos, _WlzLBTDomain2D::maxNodes, _WlzLBTDomain2D::nNodes, _WlzLBTDomain2D::nodes, _WlzIntervalWSpace::rgtpos, _WlzIVertex2::vtX, _WlzIVertex2::vtY, WLZ_2D_DOMAINOBJ, WLZ_8_CONNECTED, WLZ_ERR_EOO, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_LBT_NODE_FLAG_BOUNDARY, WLZ_LBTDOMAIN_2D, WLZ_RASTERDIR_ILIC, WlzErosion(), WlzFreeObj(), WlzInitRasterScan(), WlzInsideDomain(), WlzLBTPosToKey2D(), WlzMakeLBTDomain2D(), WlzMakeMain(), and WlzNextInterval().

Referenced by WlzLBTDomain2DFromDomain().

WlzErrorNum WlzLBTBalanceDomain2D ( WlzLBTDomain2D lDom,
WlzObject iObj,
int  maxSz,
int  maxBndSz 
)

Balances the given LBT domain so that the neighbouring nodes of each node are either of the same size or differ in size by a ratio of 2:1. The function also enforces maximum node size for all nodes and boundary nodes. The neighbour finding algorithm used is quick and simple but it requires an object in which the values are set to the corresponding LBT domain indices. For efficiency an associated interval domain may be given, if the associated domain pointer is NULL then a domain will be computed.

Returns:
Woolz error code.
Parameters:
lDomGiven LBT domain.
iObjIndex object for finding neighbours of nodes.
maxSzMaximum node size.
maxBndSzMaximum boundary node size

References AlcCPQQueueFree(), AlcCPQQueueNew(), AlcHashTableFree(), AlcHashTableNew(), AlcRealloc(), AlgBitNextPowerOfTwo(), AlgQSort(), _WlzLBTNode2D::keys, _WlzLBTDomain2D::maxNodes, _WlzLBTDomain2D::nNodes, _WlzLBTDomain2D::nodes, WLZ_DIRECTION_DC, WLZ_DIRECTION_DL, WLZ_DIRECTION_IC, WLZ_DIRECTION_IL, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WlzGreyValueFreeWSp(), WlzGreyValueMakeWSp(), WlzLBTNodeLogSz2D(), and WlzLBTNodeSz2D().

Referenced by WlzCMeshFromObj2D().

WlzErrorNum WlzLBTBalanceDomain3D ( WlzLBTDomain3D lDom,
WlzObject iObj,
int  maxSz,
int  maxBndSz 
)

Balances the given LBT domain so that the neighbouring nodes of each node are either of the same size or differ in size by a ratio of 2:1. The function also enforces maximum node size for all nodes and boundary nodes. The neighbour finding algorithm used is quick and simple but it requires an object in which the values are set to the corresponding LBT domain indices. For efficiency an associated interval domain may be given, if the associated domain pointer is NULL then a domain will be computed.

Returns:
Woolz error code.
Parameters:
lDomGiven LBT domain.
iObjIndex object for finding neighbours of nodes.
maxSzMaximum node size.
maxBndSzMaximum boundary node size

References AlcCPQQueueFree(), AlcCPQQueueNew(), AlcHashTableFree(), AlcHashTableNew(), AlcRealloc(), AlgBitNextPowerOfTwo(), AlgQSort(), _WlzLBTNode3D::keys, _WlzLBTDomain3D::maxNodes, _WlzLBTDomain3D::nNodes, _WlzLBTDomain3D::nodes, WLZ_DIRECTION_DC, WLZ_DIRECTION_DL, WLZ_DIRECTION_DP, WLZ_DIRECTION_IC, WLZ_DIRECTION_IL, WLZ_DIRECTION_IP, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WlzGreyValueFreeWSp(), WlzGreyValueMakeWSp(), WlzLBTNodeLogSz3D(), and WlzLBTNodeSz3D().

Referenced by WlzCMeshFromObj3D().

WlzObject* WlzLBTMakeNodeIndexObj2D ( WlzLBTDomain2D lDom,
WlzIntervalDomain iDom,
WlzErrorNum dstErr 
)

Creates a new 2D domain object with integer values which are the indices of the nodes containing the pixels of the domain.

Returns:
New object with node indices or NULL on error.
Parameters:
lDomGiven LBT domain.
iDomCorresponding interval domain, may be NULL.
dstErrDestination error pointer, may be NULL.

References _WlzValues::core, _WlzDomain::core, _WlzDomain::i, _WlzGreyV::inv, _WlzLBTDomain2D::nNodes, _WlzIntervalDomain::type, _WlzPixelV::type, _WlzGreyV::ubv, _WlzValues::v, _WlzPixelV::v, _WlzObject::values, WLZ_2D_DOMAINOBJ, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_NONE, WLZ_GREY_INT, WLZ_GREY_TAB_RAGR, WLZ_INTERVALDOMAIN_INTVL, WLZ_INTERVALDOMAIN_RECT, WlzAssignValues(), WlzFreeIntervalDomain(), WlzFreeObj(), WlzFreeValueTb(), WlzGreyTableType(), WlzGreyValueFreeWSp(), WlzGreyValueMakeWSp(), WlzLBTDomainToIDomain(), WlzMakeMain(), WlzNewValueTb(), and WlzSetBackground().

Referenced by WlzCMeshFromObj2D().

WlzObject* WlzLBTMakeNodeIndexObj3D ( WlzLBTDomain3D lDom,
WlzPlaneDomain pDom,
WlzErrorNum dstErr 
)

Creates a new 3D domain object with integer values which are the indices of the nodes containing the pixels of the domain.

Returns:
New object with node indices or NULL on error.
Parameters:
lDomGiven LBT domain.
pDomCorresponding interval domain, may be NULL.
dstErrDestination error pointer, may be NULL.

References _WlzValues::core, _WlzDomain::core, _WlzDomain::i, _WlzGreyV::inv, _WlzLBTDomain3D::nNodes, _WlzDomain::p, _WlzPixelV::type, _WlzGreyV::ubv, _WlzValues::v, _WlzPixelV::v, _WlzObject::values, _WlzValues::vox, WLZ_3D_DOMAINOBJ, WLZ_ERR_NONE, WLZ_GREY_INT, WLZ_GREY_TAB_RAGR, WlzAssignValues(), WlzFreeIntervalDomain(), WlzFreeObj(), WlzFreeValueTb(), WlzGreyTableType(), WlzGreyValueFreeWSp(), WlzGreyValueMakeWSp(), WlzLBTDomainToPDomain(), WlzMakeMain(), WlzNewValuesVox(), and WlzSetBackground().

Referenced by WlzCMeshFromObj3D().

WlzErrorNum WlzLBTIndexObjSetAllNodes2D ( WlzLBTDomain2D lDom,
WlzObject iObj 
)

Sets all index values in an existing 2D LBT node index object.

Returns:
Woolz error code.
Parameters:
lDom
iObj

References _WlzGreyV::inv, _WlzLBTDomain2D::nNodes, _WlzPixelV::type, _WlzPixelV::v, WLZ_ERR_NONE, WLZ_GREY_INT, WlzGreyValueFreeWSp(), WlzGreyValueMakeWSp(), and WlzSetBackground().

Referenced by WlzCMeshFromObj2D().

WlzErrorNum WlzLBTIndexObjSetAllNodes3D ( WlzLBTDomain3D lDom,
WlzObject iObj 
)

Sets all index values in an existing 3D LBT node index object.

Returns:
Woolz error code.
Parameters:
lDom
iObj

References _WlzGreyV::inv, _WlzLBTDomain3D::nNodes, _WlzPixelV::type, _WlzPixelV::v, WLZ_ERR_NONE, WLZ_GREY_INT, WlzGreyValueFreeWSp(), WlzGreyValueMakeWSp(), and WlzSetBackground().

Referenced by WlzCMeshFromObj3D().

void WlzLBTClassifyNode2D ( WlzLBTDomain2D lDom,
WlzGreyValueWSpace iGVWSp,
int  idN,
WlzLBTNodeClass2D dstCls,
int *  dstRot 
)

Classifies the given LBT node by it's connectivity and returns it's class and the counter-clockwise rotation of the basic class pattern in multiples of 90 degrees.

Returns:
void
Parameters:
lDomLinear binary tree domain.
iGVWSpGrey workspace for index object.
idNIndex of the LBT node.
dstClsDestination pointer for the class.
dstRotDestination pointer for the rotation.

References _WlzGreyValueWSpace::gVal, _WlzGreyV::inv, _WlzLBTDomain2D::nodes, WLZ_LBT_NODE_CLASS_2D_0, WlzGreyValueGet(), WlzLBTKeyToBox2I(), WlzLBTNodeSz2D(), _WlzIBox2::xMax, _WlzIBox2::xMin, _WlzIBox2::yMax, and _WlzIBox2::yMin.

void WlzLBTClassifyNodeFace3D ( WlzLBTDomain3D lDom,
WlzGreyValueWSpace iGVWSp,
int  idN,
int  idF,
WlzDVertex3 vtx,
WlzLBTNodeClass2D dstCls,
int *  dstRot 
)

Classifies the given LBT node's face by it's connectivity and returns it's class and the counter-clockwise rotation of the basic class pattern, when viewed from outside of the node's cube looking at the face, in multiples of 90 degrees. This function uses the face index and orientation system defined in WlzCMeshFromBalLBTDom3D().

Returns:
void
Parameters:
lDomLinear binary tree domain.
iGVWSpGrey workspace for index object.
idNIndex of the LBT node.
idFIndex of the face.
vtxCoordinates of the 6 vertices at the origin of faces of the LBT node's bounding box.
dstClsDestination pointer for the class.
dstRotDestination pointer for the rotation.

References _WlzGreyValueWSpace::bkdFlag, _WlzGreyValueWSpace::gPtr, _WlzGreyP::inp, _WlzLBTDomain3D::nodes, _WlzDVertex3::vtX, _WlzDVertex3::vtY, _WlzDVertex3::vtZ, WLZ_LBT_NODE_CLASS_2D_0, WLZ_VTX_3_ADD, WlzGreyValueGet(), and WlzLBTNodeSz3D().

int WlzLBTCountNodNbrDir2D ( WlzLBTDomain2D lDom,
WlzGreyValueWSpace iGVWSp,
int  idN,
WlzDirection  dir 
)

Counts the number of neighbours of the given node in the given direction.

Returns:
Number of neighbours in given direction.
Parameters:
lDomGiven LBT domain.
iGVWSpGrey workspace for index object.
idNIndex of node in the LBT domain.
dirGiven direction.

References _WlzGreyValueWSpace::gVal, _WlzGreyV::inv, _WlzLBTNode2D::keys, _WlzLBTDomain2D::nodes, WLZ_DIRECTION_DC, WLZ_DIRECTION_DL, WLZ_DIRECTION_IC, WLZ_DIRECTION_IL, WlzGreyValueGet(), WlzLBTKeyToBox2I(), _WlzIBox2::xMax, _WlzIBox2::xMin, _WlzIBox2::yMax, and _WlzIBox2::yMin.

int WlzLBTNodeSz2D ( WlzLBTNode2D nod)

Computes the size of a 2D linear binary tree node.

Returns:
Node size: 0 on error else 1, 2, 4, ....
Parameters:
nodGiven node.

References _WlzLBTNode2D::keys.

Referenced by WlzLBTBalanceDomain2D(), WlzLBTClassifyNode2D(), and WlzLBTDomainToIDomain().

int WlzLBTNodeLogSz2D ( WlzLBTNode2D nod)

Computes the log (base 2) of the size of a 2D linear binary tree node.

Returns:
Node size: -1 on error else 0, 1, 2, ....
Parameters:
nodGiven node.

References _WlzLBTNode2D::keys.

Referenced by WlzLBTBalanceDomain2D().

int WlzLBTNodeSz3D ( WlzLBTNode3D nod)

Computes the size of a 3D linear binary tree node.

Returns:
Node size: 0 on error else 1, 2, 4, ....
Parameters:
nodGiven node.

References _WlzLBTNode3D::keys.

Referenced by WlzLBTBalanceDomain3D(), WlzLBTClassifyNodeFace3D(), and WlzLBTDomainToPDomain().

int WlzLBTNodeLogSz3D ( WlzLBTNode3D nod)

Computes the log (base 2) of the size of a 3D linear binary tree node.

Returns:
Node size: -1 on error else 0, 1, 2, ....
Parameters:
nodGiven node.

References _WlzLBTNode3D::keys.

Referenced by WlzLBTBalanceDomain3D().

void WlzLBTPosToKey3D ( WlzIVertex3  pos,
unsigned *  keys 
)

Sets the value of the LBT key for the given position, where the position is relative to the first line and column of the domain. The key is encoded by interleaving the bits of the column coordinate, line coordinate, plane coordinate and term value in that order. The keys are ordered so that bit 0 is least significant.

Returns:
void
Parameters:
posPosition.
keysKeys to be set in line, column and term order.

References _WlzIVertex3::vtX, _WlzIVertex3::vtY, and _WlzIVertex3::vtZ.

Referenced by WlzLBTDomain3DFromPDomain().

void WlzLBTPosToKey2D ( WlzIVertex2  pos,
unsigned *  keys 
)

Sets the value of the LBT key for the given position, where the position is relative to the first line and column of the domain. The key is encoded by interleaving the bits of the column coordinate, line coordinate and term value in that order. The keys are ordered so that bit 0 is least significant.

Returns:
void
Parameters:
posPosition.
keysKeys to be set in line, column and term order.

References _WlzIVertex2::vtX, and _WlzIVertex2::vtY.

Referenced by WlzLBTDomain2DFromIDomain().

void WlzLBTGetKeyDigits3D ( unsigned *  keys,
WlzUByte digits 
)

Gets an array of WLZ_LBTDOMAIN_MAXDIGITS location digits from the given 3D keys.

Returns:
void
Parameters:
keysKeys to be read.
digitsArray of WLZ_LBTDOMAIN_MAXDIGITS digits.

References WLZ_LBTDOMAIN_MAXDIGITS.

Referenced by WlzLBTTestOutputNodesTxt().

void WlzLBTGetKeyDigits2D ( unsigned *  keys,
WlzUByte digits 
)

Gets an array of WLZ_LBTDOMAIN_MAXDIGITS location digits from the given 2D keys.

Returns:
void
Parameters:
keysKeys to be read.
digitsArray of WLZ_LBTDOMAIN_MAXDIGITS digits.

References WLZ_LBTDOMAIN_MAXDIGITS.

Referenced by WlzLBTTestOutputNodesTxt().

void WlzLBTKeyToPos3I ( unsigned *  key,
WlzIVertex3 pos 
)

Sets position (relative to the first line and column of the domain) which corresponds to the given 3D LBT key.

Returns:
void
Parameters:
keyKeys in line, column and term order.
posPosition to be set.

References _WlzIVertex3::vtX, _WlzIVertex3::vtY, and _WlzIVertex3::vtZ.

Referenced by WlzLBTDomainToPDomain().

void WlzLBTKeyToPos2I ( unsigned *  key,
WlzIVertex2 pos 
)

Sets position (relative to the first line and column of the domain) which corresponds to the given 3D LBT key.

Returns:
void
Parameters:
keyKeys in line, column and term order.
posPosition to be set.

References _WlzIVertex2::vtX, and _WlzIVertex2::vtY.

Referenced by WlzLBTDomainToIDomain().

void WlzLBTKeyToBox3I ( unsigned *  key,
WlzIBox3 box 
)

Sets bounding box which corresponds to the given 3D LBT key.

Returns:
void
Parameters:
keyKeys in line, column and term order.
boxPosition to be set.

References _WlzIBox3::xMax, _WlzIBox3::xMin, _WlzIBox3::yMax, _WlzIBox3::yMin, _WlzIBox3::zMax, and _WlzIBox3::zMin.

Referenced by WlzLBTTestOutputNodesTxt(), and WlzLBTTestOutputNodesVtk().

void WlzLBTKeyToBox2I ( unsigned *  key,
WlzIBox2 box 
)

Sets bounding box which corresponds to the given 2D LBT key.

Returns:
void
Parameters:
keyKeys in line, column and term order.
boxPosition to be set.

References _WlzIBox2::xMax, _WlzIBox2::xMin, _WlzIBox2::yMax, and _WlzIBox2::yMin.

Referenced by WlzLBTClassifyNode2D(), WlzLBTCountNodNbrDir2D(), WlzLBTTestOutputNodesTxt(), and WlzLBTTestOutputNodesVtk().

WlzObject* WlzSkeleton ( WlzObject srcObj,
int  smoothpasses,
WlzConnectType  minCon,
WlzErrorNum dstErr 
)

Computes the skeleton of the given object using Hilditch's method. See detail.

Returns:
Skeleton object, NULL on error.
Skeleton algorithm
Performs a proper interval-domain skeletonisation by Hilditch's method.

This algorithm iterates a two-stage process with three interval domain objects as follows:

Stage 1 - remove points according to algorithm:

  • (i) is current input object.
  • (ii) is current subset of (i) where a point deletion is possible.
  • (iii) is the set of points deleted during this pass

Stage 2 - tidy up for next pass:

  1. check for termination - object (iii) above empty
  2. construct new, thinned input object (i) by subtracting object (iii) from old object (i).
  3. construct new object (ii) by taking dilation of (iii) and intersecting with new (i).

The method can be further improved by reducing the number of points scanned in the first pass to edge points. These are extracted as the difference between the original object and its erosion. Implement Hilditch's tests 1-6 by table look up (48 words, 32 bits). Neighbour order is as follows:

3 2* 1
4*   0=8
5 6 7

asterisk marks neighbourswhere "removed this pass" (RTP) is relevant to algorithm

Use neighbours 0 - 4 and RTP 2 to generate an address in range 0 - 47 (neighbour 2 has three effective values: not in object previously, in object now, removed this pass), bit values as follows:

8 16/32* 4
2 - 1
- - -

or without 4 connected points:

2 16/32* 1
8 - 4
- - -

Use neighbours 5-7, RTP 4, and the smoothing criterion to generate a 5 bit bit-address, look at corresponding bit in addressed word in look-up table. If zero, retain point. Address values as follows:

- - -
8* - -
2 4 1

Thus lookup table is 48 words long, 32 bit unsigned values.

Notes
Look-up table constructed by separate program "newskelsetup.c". We must intersect potDelObj and skObj on each iteration or alternatively explicitly look at each element of potDelObj and see if a member of skObj otherwise we may decide to delete points outside skObj and then muck up points within skObj.
Source:
WlzSkeleton.c
Parameters:
srcObjInput object.
smoothpassesNumber of smoothing passes to be applied.
minConMinimum connectivity required.
dstErrError return.

References _WlzDomain::core, _WlzObject::domain, _WlzObject::type, WLZ_2D_DOMAINOBJ, WLZ_3D_DOMAINOBJ, WLZ_EMPTY_OBJ, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_OBJECT_TYPE, WlzMakeEmpty(), and WlzSkeleton3D().