Woolz Image Processing
Version 1.7.5

Files  
file  AlgBits.c 
Provides bit fiddling functions.  
file  AlgGrayCode.c 
Provides functions for computing Gray codes and their inverse. See Christopher H. Hamilton. "Range Searching Data Structures with Cache Locality" PhD Thesis, Dalhousie University, March 20011. The code within this file is derived from this thesis and the software it refers to.  
file  AlgHilbertIndex.c 
Provides functions for Hilbert indices and their inverse. See J. K. Lawder "Calculation of Mappings Between One an ndimensional Values Using the Hilbert Spacefilling Curve", Birkbeck, University of London Research Report BBKCS0001, 2000. The code in this technical report has been modifiied to support ndimensions and variable bit orders without recompilation.  
Functions  
unsigned int  AlgBitSetCount (unsigned long gMsk) 
Counts the number of bits set in the given mask. More...  
int  AlgBitMostSigSet (unsigned long gMsk) 
Finds the most significant bit set in the given mask. The value returned will be zero if the mask was zero one if the mask had the value 1 or higher integer if the most significant bit set in the mask is greater. More...  
int  AlgBitMostSigSetLL (unsigned long long gMsk) 
Finds the most significant bit set in the given mask. The value returned will be zero if the mask was zero one if the mask had the value 1 or higher integer if the most significant bit set in the mask is greater. More...  
unsigned int  AlgBitSetPositions (unsigned int *posA, unsigned long gMsk) 
Counts the number of bits set in the given mask and sets the first elements of the given bit position array. More...  
unsigned int  AlgBitRotateRight (unsigned int g, unsigned int n, unsigned int d) 
Rotates the given bit mask d places to the right (towards less significant bits) where there are n valid bits in the given bit mask. More...  
unsigned long  AlgBitNextNOfM (unsigned long curMsk, int n, int m) 
Computes a bit mask which has n bits set and is <= maxMsk, the new bit mask is the next after the given current mask. The maximum number of bits that can be stored in an unsigned long is assumed to be 32. If the actual number is less than this then this code won't work, if it's higher everything should be fine. This function can be used together with AlgBitSetPositions() to select all ordered combinations of N of M. Eg to select all ordered combinations of 3 out of 5 this function would return 00111, 01011, 01101, 01110, 10110, 11010, 11100. More...  
int  AlgBitNextSet (unsigned long msk, int idC) 
Computes the index of the next bit set in the given mask using the index to the current bit as the start index. maxMsk, the new bit mask is the next after the given current mask. More...  
int  AlgBitNextPowerOfTwo (unsigned int *dstP2I, unsigned int gI) 
Computes the next integer that is >= the given integer and has only a single bit set. More...  
int  AlgBitIsPowerOfTwo (unsigned int gI) 
Checks that the given integer is an integral power of two. More...  
unsigned int  AlgGrayCode (unsigned int g) 
Computes the Gray code of the given value. More...  
unsigned long long  AlgGrayCodeLL (unsigned long long g) 
Computes the Gray code of the given value. More...  
unsigned int  AlgGrayCodeInv (unsigned int g) 
Computes the inverse Gray code, ie the value corresponding to the given Gray code. More...  
unsigned long long  AlgGrayCodeInvLL (unsigned long long g) 
Computes the inverse Gray code, ie the value corresponding to the given Gray code. More...  
void  AlgHilbertIndex (unsigned int *h, unsigned int *p, int n, int o) 
Computes the Hilbert index of a point in n dimensions. More...  
void  AlgHilbertIndexInv (unsigned int *h, unsigned int *p, int n, int o) 
Computes the coordinates of the point in n dimensions corresponding to the given Hilbert index. More...  
unsigned int AlgBitSetCount  (  unsigned long  gMsk  ) 
Counts the number of bits set in the given mask.
gMsk  Given bit mask. 
int AlgBitMostSigSet  (  unsigned long  gMsk  ) 
Finds the most significant bit set in the given mask. The value returned will be zero if the mask was zero one if the mask had the value 1 or higher integer if the most significant bit set in the mask is greater.
gMsk  Given bit mask. 
Referenced by WlzGreySetHilbertRankValues().
int AlgBitMostSigSetLL  (  unsigned long long  gMsk  ) 
Finds the most significant bit set in the given mask. The value returned will be zero if the mask was zero one if the mask had the value 1 or higher integer if the most significant bit set in the mask is greater.
gMsk  Given bit mask. 
unsigned int AlgBitSetPositions  (  unsigned int *  posA, 
unsigned long  gMsk  
) 
Counts the number of bits set in the given mask and sets the first elements of the given bit position array.
posA  Bit set position array, MUST have a length >= the number of bits in the unsigned long bit mask. 
gMsk  Given bit mask. 
unsigned int AlgBitRotateRight  (  unsigned int  g, 
unsigned int  n,  
unsigned int  d  
) 
Rotates the given bit mask d places to the right (towards less significant bits) where there are n valid bits in the given bit mask.
g  Given bit mask. 
n  Number of valid bits in the bit mask. 
d  Number of places to rotate right. 
unsigned long AlgBitNextNOfM  (  unsigned long  curMsk, 
int  n,  
int  m  
) 
Computes a bit mask which has n bits set and is <= maxMsk, the new bit mask is the next after the given current mask. The maximum number of bits that can be stored in an unsigned long is assumed to be 32. If the actual number is less than this then this code won't work, if it's higher everything should be fine. This function can be used together with AlgBitSetPositions() to select all ordered combinations of N of M. Eg to select all ordered combinations of 3 out of 5 this function would return 00111, 01011, 01101, 01110, 10110, 11010, 11100.
curMsk  Current mask value. If the current value is zero then the first valid mask will be computed, otherwise the current mask is assumed to be valid. 
n  Number of bits to be set. 
m  Maximum number of bits to use. 
int AlgBitNextSet  (  unsigned long  msk, 
int  idC  
) 
Computes the index of the next bit set in the given mask using the index to the current bit as the start index. maxMsk, the new bit mask is the next after the given current mask.
msk  Given bit mask. 
idC  Current bit index, ve to find first bit set. 
int AlgBitNextPowerOfTwo  (  unsigned int *  dstP2I, 
unsigned int  gI  
) 
Computes the next integer that is >= the given integer and has only a single bit set.
dstP2I  Destination ptr for integer that's >= the given integer and is a power of two. 
gI  Given integer. 
Referenced by AlgAutoCorrelate2D(), AlgBitIsPowerOfTwo(), AlgCrossCorrelate2D(), WlzAutoCor(), WlzFourierTransformObj(), WlzLBTBalanceDomain2D(), WlzLBTBalanceDomain3D(), WlzMakeLBTDomain2D(), WlzMakeLBTDomain3D(), WlzMakeTiledValuesObj2D(), WlzMakeTiledValuesObj3D(), and WlzRegCCorObjs().
int AlgBitIsPowerOfTwo  (  unsigned int  gI  ) 
Checks that the given integer is an integral power of two.
gI  Given integer. 
References AlgBitNextPowerOfTwo().
unsigned int AlgGrayCode  (  unsigned int  g  ) 
Computes the Gray code of the given value.
g  Given integer. 
unsigned long long AlgGrayCodeLL  (  unsigned long long  g  ) 
Computes the Gray code of the given value.
g  Given long integer. 
unsigned int AlgGrayCodeInv  (  unsigned int  g  ) 
Computes the inverse Gray code, ie the value corresponding to the given Gray code.
g  Given Gray code. 
unsigned long long AlgGrayCodeInvLL  (  unsigned long long  g  ) 
Computes the inverse Gray code, ie the value corresponding to the given Gray code.
g  Given Gray code. 
void AlgHilbertIndex  (  unsigned int *  h, 
unsigned int *  p,  
int  n,  
int  o  
) 
Computes the Hilbert index of a point in n dimensions.
h  Hilbert index (set on return). 
p  Position of the n dimensional point. 
n  Number of dimensions. 
o  Order (number of bits for coordinate). 
Referenced by WlzGreySetHilbertRankValues().
void AlgHilbertIndexInv  (  unsigned int *  h, 
unsigned int *  p,  
int  n,  
int  o  
) 
Computes the coordinates of the point in n dimensions corresponding to the given Hilbert index.
h  The given Hilbert index. 
p  Decoded point coordinates (set on return). 
n  Number of dimensions. 
o  Order (number of bits for coordinate). 