Woolz Image Processing  Version 1.7.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  WlzDomainFill3D.c
Functions to fill holes in 3D voxel 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.

file  WlzXOR.c
Functions for computing the set exclusive or of 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. More...

WlzObjectWlzDiffDomain (WlzObject *obj1, WlzObject *obj2, WlzErrorNum *dstErr)
Calculates the domain difference between two objects. More...

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

WlzObjectWlzDomainFill (WlzObject *obj, WlzErrorNum *dstErr)
Fills holes in a Woolz domain object domain. The returned object will have a NULL valuetable. More...

WlzObjectWlzDomainFill3D (WlzObject *srcObj, WlzErrorNum *dstErr)
Fills the holes in the given object's domain (which are by definition not connected to the outside). When the given object's domain has more than one component part, the object should first be labeled, this function should then be called for each of the labeled parts and then the union of the filled domains should be formed. More...

WlzObjectType WlzDomainType (WlzDomain dom)
Gets the type of the given domain. More...

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

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

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

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". More...

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

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

int WlzIsEmpty (WlzObject *obj, WlzErrorNum *wlzErr)
Convenience procedure to check if an object is empty. This include objects with zero area or volume. More...

WlzErrorNum WlzFillBlankPlanes (WlzObject *obj, int min_domain)
Fill in blank planes of a 3D object. More...

int WlzIDomMaxItvLn (WlzIntervalDomain *iDom)
Computes the maximum number of intervals on any line. More...

int WlzIntervalCount (WlzIntervalDomain *idom, WlzErrorNum *dstErr)
Count the number of intervals or equivalent if rectangular. More...

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

WlzErrorNum WlzInitRasterScan (WlzObject *obj, WlzIntervalWSpace *iwsp, WlzRasterDir raster)
Initialise raster scanning. More...

WlzErrorNum WlzNextInterval (WlzIntervalWSpace *iwsp)
Get next interval in a standard object. More...

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

WlzErrorNum WlzInitLineScan (WlzObject *obj, WlzIntervalWSpace *iwsp, WlzRasterDir raster, int scale, int firstline)
Initialise line scanning, must be called before the first call of WlzNextLine(). More...

int WlzIWSpIntersection (WlzInterval *dstItv, WlzIntervalWSpace *iWSp0, WlzIntervalWSpace *iWSp1, int *dstIsn)
Classifies the possible intersections between the intervals of the two given interval workspaces. More...

WlzRasterDir WlzRasterDir2D (WlzRasterDir dir)
Masks a 2 or 3D raster direction so that it is valid for 2D. More...

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

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

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

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

WlzLBTDomain2DWlzLBTDomain2DFromDomain (WlzDomain dom, WlzErrorNum *dstErr)
Creates a new 2D linear binary tree domain from the given domain. More...

WlzLBTDomain3DWlzLBTDomain3DFromDomain (WlzDomain dom, WlzErrorNum *dstErr)
Creates a new 2D linear binary tree domain from the given domain. More...

WlzIntervalDomainWlzLBTDomainToIDomain (WlzLBTDomain2D *lDom, WlzErrorNum *dstErr)
Creates a new interval domain from the given 2D linear binary tree domain. More...

WlzPlaneDomainWlzLBTDomainToPDomain (WlzLBTDomain3D *lDom, WlzErrorNum *dstErr)
Creates a new plane domain from the given 3D linear binary tree domain. More...

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

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

WlzLBTDomain3DWlzLBTDomain3DFromPDomain (WlzPlaneDomain *pDom, WlzErrorNum *dstErr)
Creates a new 3D linear binary tree domain from the given interval domain. More...

WlzLBTDomain2DWlzLBTDomain2DFromIDomain (WlzIntervalDomain *iDom, WlzErrorNum *dstErr)
Creates a new 2D linear binary tree domain from the given interval domain. More...

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

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

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

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

WlzErrorNum WlzLBTIndexObjSetAllNodes2D (WlzLBTDomain2D *lDom, WlzObject *iObj)
Sets all index values in an existing 2D LBT node index object. More...

WlzErrorNum WlzLBTIndexObjSetAllNodes3D (WlzLBTDomain3D *lDom, WlzObject *iObj)
Sets all index values in an existing 3D LBT node index object. More...

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

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

int WlzLBTCountNodNbrDir2D (WlzLBTDomain2D *lDom, WlzGreyValueWSpace *iGVWSp, int idN, WlzDirection dir)
Counts the number of neighbours of the given node in the given direction. More...

int WlzLBTNodeSz2D (WlzLBTNode2D *nod)
Computes the size of a 2D linear binary tree node. More...

int WlzLBTNodeLogSz2D (WlzLBTNode2D *nod)
Computes the log (base 2) of the size of a 2D linear binary tree node. More...

int WlzLBTNodeSz3D (WlzLBTNode3D *nod)
Computes the size of a 3D linear binary tree node. More...

int WlzLBTNodeLogSz3D (WlzLBTNode3D *nod)
Computes the log (base 2) of the size of a 3D linear binary tree node. More...

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

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

void WlzLBTGetKeyDigits3D (unsigned *keys, WlzUByte *digits)
Gets an array of WLZ_LBTDOMAIN_MAXDIGITS location digits from the given 3D keys. More...

void WlzLBTGetKeyDigits2D (unsigned *keys, WlzUByte *digits)
Gets an array of WLZ_LBTDOMAIN_MAXDIGITS location digits from the given 2D keys. More...

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

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

void WlzLBTKeyToBox3I (unsigned *key, WlzIBox3 *box)
Sets bounding box which corresponds to the given 3D LBT key. More...

void WlzLBTKeyToBox2I (unsigned *key, WlzIBox2 *box)
Sets bounding box which corresponds to the given 2D LBT key. More...

WlzErrorNum WlzLBTTestOutputNodesTxt (FILE *fP, WlzDomain dom)
Outputs the nodes of the LBT ask text for testing. More...

WlzErrorNum WlzLBTTestOutputNodesVtk (FILE *fP, WlzDomain dom)
Outputs the nodes of the LBT as VTK polydata for testing. More...

WlzObjectWlzSkeleton (WlzObject *srcObj, int smoothpasses, WlzConnectType minCon, WlzErrorNum *dstErr)
Computes the skeleton of the given object using Hilditch's method. See detail. More...

WlzLong WlzVolume (WlzObject *obj, WlzErrorNum *wlzErr)
Calculate the volume of the input 3D domain object. More...

WlzObjectWlzXORDom (WlzObject *o0, WlzObject *o1, WlzErrorNum *dstErr)
Calculates the domain exclusive or of the two given objects. The exclusive or object $$O_x$$ is computed using

$O_x = (O_0 - O_1) \cup (O_1 - O_0)$

where $$-$$ and $$\cup$$ are the set difference and union operators respectively. This seems to be slightly quicker than the alternative:

$O_x = (O_0 \cup O_1) - (O_1 \cap O_0)$

## Function Documentation

 WlzObject* WlzClipObjToBox3D ( 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.

Returns
New object with clipped domain or NULL on error.
Parameters
 srcObj Given source object. clipBox Clip box. dstErrNum Destination pointer for error, may be NULL.

Referenced by WlzDomainFill3D(), WlzSplitMontageObj(), and WlzSplitObj().

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

Calculates the domain difference between two objects.

Returns
Object with domain equal to the set difference between the first and second object, with valuetable from the first object.
Parameters
 obj1 First object. obj2 Second object. dstErr Destination error pointer, may be NULL.
 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
 obj1 First object. obj2 Second object. dstErr Destination error pointer, may be NULL.

Referenced by WlzDiffDomain().

 WlzObject* WlzDomainFill ( WlzObject * obj, WlzErrorNum * dstErr )

Fills holes in a Woolz domain object domain. The returned object will have a NULL valuetable.

Returns
Domain object with holes filled.
Parameters
 obj Input domain object. dstErr Destination error pointer, may be NULL.

Referenced by WlzRegConCalcRCC().

 WlzObject* WlzDomainFill3D ( WlzObject * srcObj, WlzErrorNum * dstErr )

Fills the holes in the given object's domain (which are by definition not connected to the outside). When the given object's domain has more than one component part, the object should first be labeled, this function should then be called for each of the labeled parts and then the union of the filled domains should be formed.

Returns
New Woolz object without holes or NULL on error.
Parameters
 srcObj Given 3D domain object. dstErr Destination error pointer, may be NULL.

Referenced by WlzDomainFill().

 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
 dom Given 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
 bitLnP The bit line pointer. iLft Left coordinate of interval. iRgt Right coordinate of interval. size Number of bits in the bit line.
 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
 iDom Given interval domain. bitLn Byte packed bitmap for line. line The line coordinate. width Width of the line, ie number of valid bits in bitmask. iPool Interval pool.

Referenced by WlzCMeshToDomObjValues(), WlzCMeshTransformManyObjAsIdx(), and WlzFromArray2D().

 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
 iDom Given interval domain. iPool Interval pool. line The line. iLft Left most column of interval. iLen Width of the interval.

Referenced by WlzDynItvLnFromBitLn().

 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".

Returns
Woolz error code.
Parameters
 idom The given interval domain.
 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
 pdom Given plane domain, must NOT be NULL.. voxtb Corresponding voxel table, maybe NULL.
 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
 org Origin of the 2D drawing frame with respect to the 2D Woolz object cut using the given view transform. view The 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(). keep2D Ignore the view struct and keep the object 2D if this flag is non-zero. cmdStr String with drawing commands using the syntax described above. dstErrIdx Used to return the index of the last character parsed in the command string. May be NULL. dstErr Destination error pointer, may be NULL.
 int WlzIsEmpty ( WlzObject * obj, WlzErrorNum * wlzErr )

Convenience procedure to check if an object is empty. This include objects with zero area or volume.

Returns
Zero if non-empty, 1 if empty.
Parameters
 obj Input object wlzErr Error return
Source:
WlzEmpty.c
 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
 obj Input 3D woolz domain object. min_domain Minimum domain value.
Source:
WlzFillBlankPlanes.c
 int WlzIDomMaxItvLn ( WlzIntervalDomain * iDom )

Computes the maximum number of intervals on any line.

Returns
Maximum number of intervals on a line.
Parameters
 iDom Given interval domain.

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
 idom Input domain. dstErr Destination error pointer, may be NULL.
 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
 obj Given object. dstErr Destination error pointer, may be NULL.
 WlzErrorNum WlzInitRasterScan ( WlzObject * obj, WlzIntervalWSpace * iwsp, WlzRasterDir raster )
 WlzErrorNum WlzNextInterval ( WlzIntervalWSpace * iwsp )
 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)

Returns
Woolz error.
Parameters
 iwsp Interval scanning workspace. step Distance to the required line (1 - next line etc.)
Source:
WlzIntervalDomScan.c
 WlzErrorNum WlzInitLineScan ( WlzObject * obj, WlzIntervalWSpace * iwsp, WlzRasterDir raster, int scale, int firstline )

Initialise line scanning, must be called before the first call of WlzNextLine().

Returns
Woolz error.
Parameters
 obj Input object to be scanned. iwsp Interval scanning work space. raster Direction for the raster scan. scale Step for line increments. firstline Starting line for scanning.
Source:
WlzIntervalDomScan.c
 int WlzIWSpIntersection ( WlzInterval * dstItv, WlzIntervalWSpace * iWSp0, WlzIntervalWSpace * iWSp1, int * dstIsn )

Classifies the possible intersections between the intervals of the two given interval workspaces.

Returns
Value indicating which interval workspace should be advanced: 0 for first, 1 for second.

There are six possible cases which are returned as an intersection code. The destination interval pointer will have it's values set to cover the intersection where it exists. Given first interval F, second interval S and overlaps between the two intervals represented by O and gaps by - then the intersection codes returned are:

 Code Intersection 0 S-F 1 F-S 2 FOF or O 3 SOS 4 SOF 5 FOS
Parameters
 dstItv Destination pointer for the interval values, must be valid. iWSp0 First interval workspace, must be valid. iWSp1 Second interval workspace, must be valid. dstIsn Destination pointer for the intersection code, may be NULL.

Referenced by WlzCopyObjectGreyValues(), and WlzDGTensorSDFeature().

 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
 dir Given raster direction.

References WLZ_RASTERDIR_DLDC.

Referenced by WlzIterate(), and 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
 obj Given object which must be either of the type WLZ_2D_DOMAINOBJ or WLZ_3D_DOMAINOBJ. dir Raster scan direction. grey Non-zero if grey value access is needed (not required if the object does not have grey values). dstErr Destination error pointer, may be NULL.

Referenced by WlzCMeshClosePointDom2D5(), and WlzGreySetIncValues().

 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
 itWSp Given iteration workspace.

Referenced by WlzCMeshClosePointDom2D5(), WlzGreySetIncValues(), 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
 itWSp Given iteration workspace.

Referenced by WlzCMeshClosePointDom2D5(), and WlzGreySetIncValues().

 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
 obj Given object. dstErr Destination error pointer, may be NULL.

Referenced by WlzLBTTestOutputNodesVtk().

 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
 dom Given domain, which must be 2D. dstErr Destination error pointer, may be NULL.

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
 dom Given domain, which must be 2D. dstErr Destination error pointer, may be NULL.

Referenced by WlzCMeshFromObj3D(), and WlzLBTDomainFromObj().

 WlzIntervalDomain* WlzLBTDomainToIDomain ( WlzLBTDomain2D * lDom, WlzErrorNum * dstErr )

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

Returns
New 2D interval domain.
Parameters
 lDom Given 2D linear binary tree domain. dstErr Destination error pointer, may be NULL.

Referenced by WlzLBTMakeNodeIndexObj2D(), and WlzLBTTestOutputNodesVtk().

 WlzPlaneDomain* WlzLBTDomainToPDomain ( WlzLBTDomain3D * lDom, WlzErrorNum * dstErr )

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

Returns
New 3D plane domain.
Parameters
 lDom Given 3D linear binary tree domain. dstErr Destination error pointer, may be NULL.

Referenced by WlzLBTMakeNodeIndexObj3D(), and WlzLBTTestOutputNodesVtk().

 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
 line1 First line. lastln Last line. kol1 First column. lastkl last column. nPItv Number of partial intervals. pItv Array of partial intervals. dstErr Destination error pointer, may be NULL.

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
 plane1 First plane. lastpl Last plane. line1 First line. lastln Last line. kol1 First column. lastkl last column. nPItv Number of partial intervals. pItv Array of partial intervals. dstErr Destination error pointer, may be NULL.

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
 pDom Given plane domain. dstErr Destination error pointer, may be NULL.

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
 iDom Given domain, which must be an interval domain. dstErr Destination error pointer, may be NULL.

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
 lDom Given LBT domain. iObj Index object for finding neighbours of nodes. maxSz Maximum node size. maxBndSz Maximum boundary node size

Referenced by WlzCMeshFromObj2D(), and WlzLBTTestOutputNodesVtk().

 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
 lDom Given LBT domain. iObj Index object for finding neighbours of nodes. maxSz Maximum node size. maxBndSz Maximum boundary node size

Referenced by WlzCMeshFromObj3D(), and WlzLBTTestOutputNodesVtk().

 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
 lDom Given LBT domain. iDom Corresponding interval domain, may be NULL. dstErr Destination error pointer, may be NULL.

Referenced by WlzCMeshFromObj2D(), and WlzLBTTestOutputNodesVtk().

 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
 lDom Given LBT domain. pDom Corresponding interval domain, may be NULL. dstErr Destination error pointer, may be NULL.

Referenced by WlzCMeshFromObj3D(), and WlzLBTTestOutputNodesVtk().

 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

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

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
 lDom Linear binary tree domain. iGVWSp Grey workspace for index object. idN Index of the LBT node. dstCls Destination pointer for the class. dstRot Destination pointer for the rotation.

Referenced by WlzCMeshFromBalLBTDom3D().

 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
 lDom Linear binary tree domain. iGVWSp Grey workspace for index object. idN Index of the LBT node. idF Index of the face. vtx Coordinates of the 6 vertices at the origin of faces of the LBT node's bounding box. dstCls Destination pointer for the class. dstRot Destination pointer for the rotation.

Referenced by WlzCMeshFromBalLBTDom3D().

 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
 lDom Given LBT domain. iGVWSp Grey workspace for index object. idN Index of node in the LBT domain. dir Given direction.
 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
 nod Given node.

References _WlzLBTNode2D::keys.

 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
 nod Given node.

References _WlzLBTNode2D::keys.

Referenced by WlzLBTBalanceDomain2D(), WlzLBTClassifyNodeFace3D(), and WlzLBTCountNodNbrDir2D().

 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
 nod Given node.

References _WlzLBTNode3D::keys.

 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
 nod Given node.

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

 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
 pos Position. keys Keys 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
 pos Position. keys Keys 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
 keys Keys to be read. digits Array 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
 keys Keys to be read. digits Array 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
 key Keys in line, column and term order. pos Position to be set.

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

Referenced by WlzCMeshFromBalLBTDom3D(), WlzLBTDomainToPDomain(), and WlzLBTKeyToBox2I().

 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
 key Keys in line, column and term order. pos Position to be set.

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

Referenced by WlzCMeshFromBalLBTDom3D(), WlzLBTDomainToIDomain(), and WlzLBTKeyToBox2I().

 void WlzLBTKeyToBox3I ( unsigned * key, WlzIBox3 * box )

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

Returns
void
Parameters
 key Keys in line, column and term order. box Position to be set.
 void WlzLBTKeyToBox2I ( unsigned * key, WlzIBox2 * box )

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

Returns
void
Parameters
 key Keys in line, column and term order. box Position to be set.
 WlzErrorNum WlzLBTTestOutputNodesTxt ( FILE * fP, WlzDomain dom )

Outputs the nodes of the LBT ask text for testing.

Returns
Woolz error code.
Parameters
 fP Output file. dom The LBT domain to output.

Referenced by WlzLBTKeyToBox2I(), and WlzLBTTestOutputNodesVtk().

 WlzErrorNum WlzLBTTestOutputNodesVtk ( FILE * fP, WlzDomain dom )

Outputs the nodes of the LBT as VTK polydata for testing.

Returns
Woolz error code.
Parameters
 fP Output file. dom The LBT domain to output.
 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
 srcObj Input object. smoothpasses Number of smoothing passes to be applied. minCon Minimum connectivity required. dstErr Error return.
 WlzLong WlzVolume ( WlzObject * obj, WlzErrorNum * wlzErr )

Calculate the volume of the input 3D domain object.

Returns
Volume of input 3D object, -1 on error.
Parameters
 obj Input object pointer. wlzErr Error return.
Source:
WlzVolume.c
 WlzObject* WlzXORDom ( WlzObject * o0, WlzObject * o1, WlzErrorNum * dstErr )

Calculates the domain exclusive or of the two given objects. The exclusive or object $$O_x$$ is computed using

$O_x = (O_0 - O_1) \cup (O_1 - O_0)$

where $$-$$ and $$\cup$$ are the set difference and union operators respectively. This seems to be slightly quicker than the alternative:

$O_x = (O_0 \cup O_1) - (O_1 \cap O_0)$

.

Returns
Object with domain equal to the set exclusive or of the two given objects.
Parameters
 o0 First object. o1 Second object. dstErr Destination error pointer, may be NULL.

References WLZ_ERR_NONE, WlzAssignObject(), WlzDiffDomain(), WlzFreeObj(), and WlzUnion2().

Referenced by WlzRegConCalcRCC().