Woolz Image Processing  Version 1.7.5
AlgRank

## Files

file  AlgRank.c
Rank selection algorithms which provide fast rank selection from an array of values. This is the general case of mimimum, median and maximum value rank selection.

## Functions

void AlgRankSelectI (int *elm, int nElm, int rank)
Performs the minimum of sorting on an array of integers such that the n'th value in the array has rank n. That is all values before the n'th are less than or equal to it and all values after the n'th are greater than or equal to it. More...

void AlgRankSelectUB (unsigned char *elm, int nElm, int rank)
Performs the minimum of sorting on an array of unsigned bytes such that the n'th value in the array has rank n. That is all values before the n'th are less than or equal to it and all values after the n'th are greater than or equal to it. More...

void AlgRankSelectS (short *elm, int nElm, int rank)
Performs the minimum of sorting on an array of shorts such that the n'th value in the array has rank n. That is all values before the n'th are less than or equal to it and all values after the n'th are greater than or equal to it. More...

void AlgRankSelectF (float *elm, int nElm, int rank)
Performs the minimum of sorting on an array of floats such that the n'th value in the array has rank n. That is all values before the n'th are less than or equal to it and all values after the n'th are greater than or equal to it. More...

void AlgRankSelectD (double *elm, int nElm, int rank)
Performs the minimum of sorting on an array of doubles such that the n'th value in the array has rank n. That is all values before the n'th are less than or equal to it and all values after the n'th are greater than or equal to it. More...

void AlgRankSelectV (void *elm, int nElm, unsigned int elmSz, int rank, void *buf, int(*compFn)(void *, void *))
Performs the minimum of sorting on an array of values such that the n'th value in the array has rank n. That is all values before the n'th are less than or equal to it and all values after the n'th are greater than or equal to it. More...

## Function Documentation

 void AlgRankSelectI ( int * elm, int nElm, int rank )

Performs the minimum of sorting on an array of integers such that the n'th value in the array has rank n. That is all values before the n'th are less than or equal to it and all values after the n'th are greater than or equal to it.

Returns
void
Parameters
 elm Array of elements. nElm Number of elements. rank Required rank in the range [0 - (nElm - 1)].

Referenced by WlzFilterNObjValues(), and WlzRankFilter().

 void AlgRankSelectUB ( unsigned char * elm, int nElm, int rank )

Performs the minimum of sorting on an array of unsigned bytes such that the n'th value in the array has rank n. That is all values before the n'th are less than or equal to it and all values after the n'th are greater than or equal to it.

Returns
void
Parameters
 elm Array of elements. nElm Number of elements. rank Required rank in the range [0 - (nElm - 1)].

Referenced by WlzFilterNObjValues(), and WlzRankFilter().

 void AlgRankSelectS ( short * elm, int nElm, int rank )

Performs the minimum of sorting on an array of shorts such that the n'th value in the array has rank n. That is all values before the n'th are less than or equal to it and all values after the n'th are greater than or equal to it.

Returns
void
Parameters
 elm Array of elements. nElm Number of elements. rank Required rank in the range [0 - (nElm - 1)].

Referenced by WlzFilterNObjValues(), and WlzRankFilter().

 void AlgRankSelectF ( float * elm, int nElm, int rank )

Performs the minimum of sorting on an array of floats such that the n'th value in the array has rank n. That is all values before the n'th are less than or equal to it and all values after the n'th are greater than or equal to it.

Returns
void
Parameters
 elm Array of elements. nElm Number of elements. rank Required rank in the range [0 - (nElm - 1)].

Referenced by WlzFilterNObjValues(), and WlzRankFilter().

 void AlgRankSelectD ( double * elm, int nElm, int rank )

Performs the minimum of sorting on an array of doubles such that the n'th value in the array has rank n. That is all values before the n'th are less than or equal to it and all values after the n'th are greater than or equal to it.

Returns
void
Parameters
 elm Array of elements. nElm Number of elements. rank Required rank in the range [0 - (nElm - 1)].
 void AlgRankSelectV ( void * elm, int nElm, unsigned int elmSz, int rank, void * buf, int(*)(void *, void *) compFn )

Performs the minimum of sorting on an array of values such that the n'th value in the array has rank n. That is all values before the n'th are less than or equal to it and all values after the n'th are greater than or equal to it.

Returns
void
Parameters
 elm Array of values. nElm Number of values. elmSz Size of each value. rank Required rank in the range [0 - (nElm - 1)]. buf A pointer to a single value to be used as a workspace. compFn A value comparison function in the same form as qsort(3).