Woolz Image Processing  Version 1.7.5
WlzValueUtils.c File Reference

Many small functions for setting, copying and converting values. More...

Functions

void WlzValueSetInt (int *vec, int value, size_t count)
 Sets the elements of the given vector to a given value, where the vector type is int. More...
 
void WlzValueSetShort (short *vec, short value, size_t count)
 Sets the elements of the given vector to a given value, where the vector type is short. More...
 
void WlzValueSetUByte (WlzUByte *vec, WlzUByte value, size_t count)
 Sets the elements of the given vector to a given value, where the vector type is WlzUByte. More...
 
void WlzValueSetFloat (float *vec, float value, size_t count)
 Sets the elements of the given vector to a given value, where the vector type is float. More...
 
void WlzValueSetDouble (double *vec, double value, size_t count)
 Sets the elements of the given vector to a given value, where the vector type is double. More...
 
void WlzValueSetRGBA (WlzUInt *vec, WlzUInt value, size_t count)
 Sets the elements of the given vector to a given value, where the vector type is rgb-alpha. More...
 
void WlzValueSetDVertex (WlzDVertex2 *vec, WlzDVertex2 value, size_t count)
 Sets the elements of the given vector to a given value, where the vector type is WlzDVertex2. More...
 
void WlzValueSetFVertex (WlzFVertex2 *vec, WlzFVertex2 value, size_t count)
 Sets the elements of the given vector to a given value, where the vector type is WlzFVertex2. More...
 
void WlzValueSetIVertex (WlzIVertex2 *vec, WlzIVertex2 value, size_t count)
 Sets the elements of the given vector to a given value, where the vector type is WlzIVertex2. More...
 
void WlzValueSetGrey (WlzGreyP vec, size_t vecOff, WlzGreyV value, WlzGreyType gType, size_t count)
 Sets the elements of the given vector to a given value, where the vector type is any one of int, short, WlzUByte, float, double. More...
 
WlzGreyP WlzValueSetGreyP (WlzGreyP base, WlzGreyType gType, size_t off)
 Sets a grey pointer using the given base grey pointer and an offset. More...
 
void WlzValueClampIntToShort (int *vec, size_t count)
 Clamps a vector of int values to the limits of short. More...
 
void WlzValueClampIntToUByte (int *vec, size_t count)
 Clamps a vector of int values to the limits of WlzUByte. More...
 
void WlzValueClampShortToUByte (short *vec, size_t count)
 Clamps a vector of short values to the limits of WlzUByte. More...
 
void WlzValueClampDoubleToInt (double *vec, size_t count)
 Clamps a vector of double values to the limits of int. More...
 
void WlzValueClampDoubleToShort (double *vec, size_t count)
 Clamps a vector of double values to the limits of short. More...
 
void WlzValueClampDoubleToUByte (double *vec, size_t count)
 Clamps a vector of double values to the limits of WlzUByte. More...
 
void WlzValueClampDoubleToRGBA (double *vec, size_t count)
 Clamps a vector of double values to the limits of RGBA. More...
 
void WlzValueClampDoubleToFloat (double *vec, size_t count)
 Clamps a vector of double values to the limits of float. More...
 
void WlzValueClampFloatToInt (float *vec, size_t count)
 Clamps a vector of float values to the limits of int. More...
 
void WlzValueClampFloatToShort (float *vec, size_t count)
 Clamps a vector of float values to the limits of short. More...
 
void WlzValueClampFloatToUByte (float *vec, size_t count)
 Clamps a vector of float values to the limits of WlzUByte. More...
 
void WlzValueClampIntIntoShort (short *dst, int *src, size_t count)
 Clamps a vector of int values into a vector of short values. More...
 
void WlzValueClampIntIntoUByte (WlzUByte *dst, int *src, size_t count)
 Clamps a vector of nt values into a vector of WlzUByte values. More...
 
void WlzValueClampShortIntoUByte (WlzUByte *dst, short *src, size_t count)
 Clamps a vector of short values into a vector of WlzUByte values. More...
 
void WlzValueClampFloatIntoInt (int *dst, float *src, size_t count)
 Clamps a vector of float values into a vector of int values. More...
 
void WlzValueClampFloatIntoShort (short *dst, float *src, size_t count)
 Clamps a vector of float values into a vector of short values. More...
 
void WlzValueClampFloatIntoUByte (WlzUByte *dst, float *src, size_t count)
 Clamps a vector of float values into a vector of WlzUByte values. More...
 
void WlzValueClampDoubleIntoInt (int *dst, double *src, size_t count)
 Clamps a vector of into double values into a vector of int values. More...
 
void WlzValueClampDoubleIntoShort (short *dst, double *src, size_t count)
 Clamps a vector of double values into a vector of short values. More...
 
void WlzValueClampDoubleIntoUByte (WlzUByte *dst, double *src, size_t count)
 Clamps a vector of double values into a vector of WlzUByte values. More...
 
void WlzValueClampDoubleIntoFloat (float *dst, double *src, size_t count)
 Clamps a vector of double values into a vector of float values. More...
 
void WlzValueClampIntIntoRGBA (WlzUInt *dst, int *src, size_t count)
 Clamps a vector of int values into a vector of RGBA values. More...
 
void WlzValueClampShortIntoRGBA (WlzUInt *dst, short *src, size_t count)
 Clamps a vector of short values into a vector of RGBA values. More...
 
void WlzValueClampFloatIntoRGBA (WlzUInt *dst, float *src, size_t count)
 Clamps a vector of float values into a vector of RGBA values. More...
 
void WlzValueClampDoubleIntoRGBA (WlzUInt *dst, double *src, size_t count)
 Clamps a vector of double values into a vector of RGBA values. More...
 
void WlzValueClampGreyIntoGrey (WlzGreyP dst, size_t dstOff, WlzGreyType dstType, WlzGreyP src, size_t srcOff, WlzGreyType srcType, size_t count)
 Clamps a source vector into a destination vector, where the source and destination types are any combination of int, short, WlzUByte, float or double. More...
 
void WlzValueCopyIntToInt (int *dst, int *src, size_t count)
 Copies a vector of int to a vector of int. More...
 
void WlzValueCopyIntToShort (short *dst, int *src, size_t count)
 Copies a vector of int to a vector of short. More...
 
void WlzValueCopyIntToUByte (WlzUByte *dst, int *src, size_t count)
 Copies a vector of int to a vector of WlzUByte. More...
 
void WlzValueCopyIntToFloat (float *dst, int *src, size_t count)
 Copies a vector of int to a vector of float. More...
 
void WlzValueCopyIntToDouble (double *dst, int *src, size_t count)
 Copies a vector of int to a vector of double. More...
 
void WlzValueCopyIntToRGBA (WlzUInt *dst, int *src, size_t count)
 Copies a vector of int to a vector of RGBA. More...
 
void WlzValueCopyShortToInt (int *dst, short *src, size_t count)
 Copies a vector of short to a vector of int. More...
 
void WlzValueCopyShortToShort (short *dst, short *src, size_t count)
 Copies a vector of short to a vector of short. More...
 
void WlzValueCopyShortToUByte (WlzUByte *dst, short *src, size_t count)
 Copies a vector of short to a vector of WlzUByte. More...
 
void WlzValueCopyShortToFloat (float *dst, short *src, size_t count)
 Copies a vector of short to a vector of float. More...
 
void WlzValueCopyShortToDouble (double *dst, short *src, size_t count)
 Copies a vector of short to a vector of double. More...
 
void WlzValueCopyUByteToInt (int *dst, WlzUByte *src, size_t count)
 Copies a vector of WlzUByte to a vector of int. More...
 
void WlzValueCopyShortToRGBA (WlzUInt *dst, short *src, size_t count)
 Copies a vector of short to a vector of RGBA. More...
 
void WlzValueCopyUByteToShort (short *dst, WlzUByte *src, size_t count)
 Copies a vector of WlzUByte to a vector of short. More...
 
void WlzValueCopyUByteToUByte (WlzUByte *dst, WlzUByte *src, size_t count)
 Copies a vector of WlzUByte to a vector of WlzUByte. More...
 
void WlzValueCopyUByteToFloat (float *dst, WlzUByte *src, size_t count)
 Copies a vector of WlzUByte to a vector of float. More...
 
void WlzValueCopyUByteToDouble (double *dst, WlzUByte *src, size_t count)
 Copies a vector of WlzUByte to a vector of double. More...
 
void WlzValueCopyUByteToRGBA (WlzUInt *dst, WlzUByte *src, size_t count)
 Copies a vector of WlzUByte to a vector of RGBA. More...
 
void WlzValueCopyFloatToInt (int *dst, float *src, size_t count)
 Copies a vector of float to a vector of int. More...
 
void WlzValueCopyFloatToShort (short *dst, float *src, size_t count)
 Copies a vector of float to a vector of short. More...
 
void WlzValueCopyFloatToUByte (WlzUByte *dst, float *src, size_t count)
 Copies a vector of float to a vector of WlzUByte. More...
 
void WlzValueCopyFloatToFloat (float *dst, float *src, size_t count)
 Copies a vector of float to a vector of float. More...
 
void WlzValueCopyFloatToDouble (double *dst, float *src, size_t count)
 Copies a vector of float to a vector of double. More...
 
void WlzValueCopyFloatToRGBA (WlzUInt *dst, float *src, size_t count)
 Copies a vector of float to a vector of RGBA. More...
 
void WlzValueCopyDoubleToInt (int *dst, double *src, size_t count)
 Copies a vector of double to a vector of int. More...
 
void WlzValueCopyDoubleToShort (short *dst, double *src, size_t count)
 Copies a vector of double to a vector of short. More...
 
void WlzValueCopyDoubleToUByte (WlzUByte *dst, double *src, size_t count)
 Copies a vector of double to a vector of WlzUByte. More...
 
void WlzValueCopyDoubleToFloat (float *dst, double *src, size_t count)
 Copies a vector of double to a vector of float. More...
 
void WlzValueCopyDoubleToDouble (double *dst, double *src, size_t count)
 Copies a vector of double to a vector of double. More...
 
void WlzValueCopyDoubleToRGBA (WlzUInt *dst, double *src, size_t count)
 Copies a vector of double to a vector of RGBA. More...
 
void WlzValueCopyRGBAToInt (int *dst, WlzUInt *src, size_t count)
 Copies a vector of RGBA to a vector of int - uses modulus. More...
 
void WlzValueCopyRGBAToShort (short *dst, WlzUInt *src, size_t count)
 Copies a vector of RGBA to a vector of short - uses modulus. More...
 
void WlzValueCopyRGBAToUByte (WlzUByte *dst, WlzUInt *src, size_t count)
 Copies a vector of RGBA to a vector of WlzUByte - uses modulus. More...
 
void WlzValueCopyRGBAToFloat (float *dst, WlzUInt *src, size_t count)
 Copies a vector of RGBA to a vector of float - uses modulus. More...
 
void WlzValueCopyRGBAToDouble (double *dst, WlzUInt *src, size_t count)
 Copies a vector of RGBA to a vector of double - uses modulus. More...
 
void WlzValueCopyRGBAToRGBA (WlzUInt *dst, WlzUInt *src, size_t count)
 Copies a vector of RGBA to a vector of RGBA. More...
 
void WlzValueCopyGreyToGrey (WlzGreyP dst, size_t dstOff, WlzGreyType dstType, WlzGreyP src, size_t srcOff, WlzGreyType srcType, size_t count)
 Copies a source vector to a destination vector, where the source and destination types are any combination of int, short, WlzUByte, float or double. More...
 
void WlzValueCopyDVertexToDVertex (WlzDVertex2 *dst, WlzDVertex2 *src, size_t count)
 Copies a vector of 2D double vertices to a vector of 2D double vertices. More...
 
void WlzValueCopyDVertexToFVertex (WlzFVertex2 *dst, WlzDVertex2 *src, size_t count)
 Copies a vector of 2D double vertices to a vector of 2D float vertices. More...
 
void WlzValueCopyDVertexToIVertex (WlzIVertex2 *dst, WlzDVertex2 *src, size_t count)
 Copies a vector of 2D double vertices to a vector of 2D int vertices. More...
 
void WlzValueCopyFVertexToDVertex (WlzDVertex2 *dst, WlzFVertex2 *src, size_t count)
 Copies a vector of 2D float vertices to a vector of 2D double vertices. More...
 
void WlzValueCopyFVertexToFVertex (WlzFVertex2 *dst, WlzFVertex2 *src, size_t count)
 Copies a vector of 2D float vertices to a vector of 2D float vertices. More...
 
void WlzValueCopyFVertexToIVertex (WlzIVertex2 *dst, WlzFVertex2 *src, size_t count)
 Copies a vector of 2D float vertices to a vector of 2D int vertices. More...
 
void WlzValueCopyIVertexToDVertex (WlzDVertex2 *dst, WlzIVertex2 *src, size_t count)
 Copies a vector of 2D int vertices to a vector of 2D double vertices. More...
 
void WlzValueCopyIVertexToFVertex (WlzFVertex2 *dst, WlzIVertex2 *src, size_t count)
 Copies a vector of 2D int vertices to a vector of 2D float vertices. More...
 
void WlzValueCopyIVertexToIVertex (WlzIVertex2 *dst, WlzIVertex2 *src, size_t count)
 Copies a vector of 2D int vertices to a vector of 2D int vertices. More...
 
void WlzValueCopyDVertexToDVertex3 (WlzDVertex3 *dst, WlzDVertex3 *src, size_t count)
 Copies a vector of 3D double vertices to a vector of 3D double vertices. More...
 
void WlzValueCopyDVertexToFVertex3 (WlzFVertex3 *dst, WlzDVertex3 *src, size_t count)
 Copies a vector of 3D double vertices to a vector of 3D float vertices. More...
 
void WlzValueCopyDVertexToIVertex3 (WlzIVertex3 *dst, WlzDVertex3 *src, size_t count)
 Copies a vector of 3D double vertices to a vector of 3D int vertices. More...
 
void WlzValueCopyFVertexToDVertex3 (WlzDVertex3 *dst, WlzFVertex3 *src, size_t count)
 Copies a vector of 3D float vertices to a vector of 3D double vertices. More...
 
void WlzValueCopyFVertexToFVertex3 (WlzFVertex3 *dst, WlzFVertex3 *src, size_t count)
 Copies a vector of 3D float vertices to a vector of 3D float vertices. More...
 
void WlzValueCopyFVertexToIVertex3 (WlzIVertex3 *dst, WlzFVertex3 *src, size_t count)
 Copies a vector of 3D float vertices to a vector of 3D int vertices. More...
 
void WlzValueCopyIVertexToDVertex3 (WlzDVertex3 *dst, WlzIVertex3 *src, size_t count)
 Copies a vector of 3D int vertices to a vector of 3D double vertices. More...
 
void WlzValueCopyIVertexToFVertex3 (WlzFVertex3 *dst, WlzIVertex3 *src, size_t count)
 Copies a vector of 3D int vertices to a vector of 3D float vertices. More...
 
void WlzValueCopyIVertexToIVertex3 (WlzIVertex3 *dst, WlzIVertex3 *src, size_t count)
 Copies a vector of 3D int vertices to a vector of 3D int vertices. More...
 
WlzErrorNum WlzValueConvertPixel (WlzPixelV *dstPix, WlzPixelV srcPix, WlzGreyType dstType)
 Converts a single pixel value. Source values are clamped to the the destination value range. More...
 
int WlzValueMedianInt (int *values, size_t nVal)
 Computes the median of the given vector (the vector's values are overwritten), where the vector type is of int values. The algorithm is based on min-max elimination as used by Peath A W. Median finding on a 3x3 Grid. Graphics Gems, 171-175. Academic Press. 1990. If the vector has less than 1 element 0 is returned. In the trivial case of 1 or 2 elements, the first element's value is returned. If the vector has more than 3 elements: More...
 
double WlzValueMedianDouble (double *values, size_t nVal)
 Computes the median of the given vector (the vector's values are overwritten), where the vector type is of double values. The algorithm is based on min-max elimination as used by Peath A W. Median finding on a 3x3 Grid. Graphics Gems, 171-175. Academic Press. 1990. If the vector has less than 1 element 0 is returned. In the trivial case of 1 or 2 elements, the first element's value is returned. If the vector has more than 3 elements: More...
 
int WlzValueDitherI (int p0, int p1, int p2)
 Given three consecutive values, possibly in an integer look up table, this function returns a value dithered to lie between the means of the first and last pairs of values with equal probability. Because this function calls AlgRandUniform() is may be slow. More...
 
void WlzIndexedValueBufWeight (WlzGreyP gP, int gO, WlzIndexedValues *ixv, double *wgt, int nIdx, int *idx, int ixi)
 Given an indexed values, weights and an array of indices into the indexed values; weights and sums the indexed values setting the grey value to the sum of the weighted values. The type of the grey pointer must be the same as the type of the indexed values. More...
 
size_t WlzIndexedValueSize (WlzIndexedValues *ixv, size_t *dstNDat, WlzErrorNum *dstErr)
 Computes the size of the data at each location of the indxed values. More...
 
size_t WlzValueSqueeze (size_t n, void *val, size_t sz, WlzUByte *keep, WlzErrorNum *dstErr)
 Squeezes out values from an array by replacing those that are to be removed so that the values remain contiguous. More...
 
WlzErrorNum WlzGreyValueFromGreyP (WlzGreyV *gV, WlzGreyP gP, size_t n, WlzGreyType gType)
 Sets Woolz grey values using the given Woolz grey pointer as the source of contiguous values. More...
 

Detailed Description

Many small functions for setting, copying and converting values.

Author
Bill Hill
Date
March 1999
Version
Id
bfa8fb0815dd47cf5aa602b5406f29b63210f0b7
Address: MRC Human Genetics Unit, MRC Institute of Genetics and Molecular Medicine, University of Edinburgh, Western General Hospital, Edinburgh, EH4 2XU, UK.
Copyright (C), [2012], The University Court of the University of Edinburgh, Old College, Edinburgh, UK.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Function Documentation

void WlzValueClampGreyIntoGrey ( WlzGreyP  dst,
size_t  dstOff,
WlzGreyType  dstType,
WlzGreyP  src,
size_t  srcOff,
WlzGreyType  srcType,
size_t  count 
)

Clamps a source vector into a destination vector, where the source and destination types are any combination of int, short, WlzUByte, float or double.

Returns
void
Parameters
dstDestination vector.
dstOffDestination offset.
dstTypeDestination type, eg: WLZ_GREY_INT.
srcSource vector.
srcOffSource offset.
srcTypeSource type, eg: WLZ_GREY_SHORT.
countNumber of vector elements to be clamped and copied.

References _WlzGreyP::dbp, _WlzGreyP::flp, _WlzGreyP::inp, _WlzGreyP::rgbp, _WlzGreyP::shp, _WlzGreyP::ubp, WLZ_GREY_DOUBLE, WLZ_GREY_FLOAT, WLZ_GREY_INT, WLZ_GREY_RGBA, WLZ_GREY_SHORT, WLZ_GREY_UBYTE, WlzValueClampDoubleIntoFloat(), WlzValueClampDoubleIntoInt(), WlzValueClampDoubleIntoRGBA(), WlzValueClampDoubleIntoShort(), WlzValueClampDoubleIntoUByte(), WlzValueClampFloatIntoInt(), WlzValueClampFloatIntoRGBA(), WlzValueClampFloatIntoShort(), WlzValueClampFloatIntoUByte(), WlzValueClampIntIntoRGBA(), WlzValueClampIntIntoShort(), WlzValueClampIntIntoUByte(), WlzValueClampShortIntoRGBA(), WlzValueClampShortIntoUByte(), WlzValueCopyDoubleToDouble(), WlzValueCopyFloatToDouble(), WlzValueCopyFloatToFloat(), WlzValueCopyIntToDouble(), WlzValueCopyIntToFloat(), WlzValueCopyIntToInt(), WlzValueCopyRGBAToDouble(), WlzValueCopyRGBAToFloat(), WlzValueCopyRGBAToInt(), WlzValueCopyRGBAToRGBA(), WlzValueCopyRGBAToShort(), WlzValueCopyRGBAToUByte(), WlzValueCopyShortToDouble(), WlzValueCopyShortToFloat(), WlzValueCopyShortToInt(), WlzValueCopyShortToShort(), WlzValueCopyUByteToDouble(), WlzValueCopyUByteToFloat(), WlzValueCopyUByteToInt(), WlzValueCopyUByteToRGBA(), WlzValueCopyUByteToShort(), and WlzValueCopyUByteToUByte().

Referenced by WlzCMeshExpValues(), and WlzRsvFilterBuffer().

void WlzValueCopyIntToInt ( int *  dst,
int *  src,
size_t  count 
)

Copies a vector of int to a vector of int.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

Referenced by WlzEffWriteObjNifti(), WlzSampleObjPoint2D(), WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyIntToShort ( short *  dst,
int *  src,
size_t  count 
)

Copies a vector of int to a vector of short.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References WLZ_CLAMP.

Referenced by WlzValueCopyGreyToGrey().

void WlzValueCopyIntToUByte ( WlzUByte dst,
int *  src,
size_t  count 
)

Copies a vector of int to a vector of WlzUByte.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References WLZ_CLAMP.

Referenced by WlzValueCopyGreyToGrey().

void WlzValueCopyIntToFloat ( float *  dst,
int *  src,
size_t  count 
)

Copies a vector of int to a vector of float.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

Referenced by WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyIntToDouble ( double *  dst,
int *  src,
size_t  count 
)

Copies a vector of int to a vector of double.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

Referenced by WlzContourFromPoints(), WlzHistogramConvolve(), WlzHistogramRsvFilter(), WlzScalarMulAdd(), WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyIntToRGBA ( WlzUInt dst,
int *  src,
size_t  count 
)

Copies a vector of int to a vector of RGBA.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References WlzValueClampIntIntoRGBA().

Referenced by WlzValueCopyGreyToGrey().

void WlzValueCopyShortToInt ( int *  dst,
short *  src,
size_t  count 
)

Copies a vector of short to a vector of int.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

Referenced by WlzSampleObjPoint2D(), WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyShortToShort ( short *  dst,
short *  src,
size_t  count 
)

Copies a vector of short to a vector of short.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

Referenced by WlzEffWriteObjNifti(), WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyShortToUByte ( WlzUByte dst,
short *  src,
size_t  count 
)

Copies a vector of short to a vector of WlzUByte.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References WLZ_CLAMP.

Referenced by WlzValueCopyGreyToGrey().

void WlzValueCopyShortToFloat ( float *  dst,
short *  src,
size_t  count 
)

Copies a vector of short to a vector of float.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

Referenced by WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyShortToDouble ( double *  dst,
short *  src,
size_t  count 
)

Copies a vector of short to a vector of double.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

Referenced by WlzContourFromPoints(), WlzScalarMulAdd(), WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyUByteToInt ( int *  dst,
WlzUByte src,
size_t  count 
)

Copies a vector of WlzUByte to a vector of int.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

Referenced by WlzSampleObjPoint2D(), WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyShortToRGBA ( WlzUInt dst,
short *  src,
size_t  count 
)

Copies a vector of short to a vector of RGBA.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References WlzValueClampShortIntoRGBA().

Referenced by WlzValueCopyGreyToGrey().

void WlzValueCopyUByteToShort ( short *  dst,
WlzUByte src,
size_t  count 
)

Copies a vector of WlzUByte to a vector of short.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

Referenced by WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyUByteToUByte ( WlzUByte dst,
WlzUByte src,
size_t  count 
)

Copies a vector of WlzUByte to a vector of WlzUByte.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

Referenced by WlzEffWriteObjNifti(), WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyUByteToFloat ( float *  dst,
WlzUByte src,
size_t  count 
)

Copies a vector of WlzUByte to a vector of float.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

Referenced by WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyUByteToDouble ( double *  dst,
WlzUByte src,
size_t  count 
)

Copies a vector of WlzUByte to a vector of double.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

Referenced by WlzContourFromPoints(), WlzScalarMulAdd(), WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyUByteToRGBA ( WlzUInt dst,
WlzUByte src,
size_t  count 
)

Copies a vector of WlzUByte to a vector of RGBA.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References WLZ_RGBA_RGBA_SET.

Referenced by WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyFloatToInt ( int *  dst,
float *  src,
size_t  count 
)

Copies a vector of float to a vector of int.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References WLZ_CLAMP, and WLZ_NINT.

Referenced by WlzValueCopyGreyToGrey().

void WlzValueCopyFloatToShort ( short *  dst,
float *  src,
size_t  count 
)

Copies a vector of float to a vector of short.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References WLZ_CLAMP, and WLZ_NINT.

Referenced by WlzValueCopyGreyToGrey().

void WlzValueCopyFloatToUByte ( WlzUByte dst,
float *  src,
size_t  count 
)

Copies a vector of float to a vector of WlzUByte.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References WLZ_CLAMP, and WLZ_NINT.

Referenced by WlzValueCopyGreyToGrey().

void WlzValueCopyFloatToFloat ( float *  dst,
float *  src,
size_t  count 
)

Copies a vector of float to a vector of float.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

Referenced by WlzEffWriteObjNifti(), WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyFloatToDouble ( double *  dst,
float *  src,
size_t  count 
)

Copies a vector of float to a vector of double.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

Referenced by WlzContourFromPoints(), WlzSampleObjPoint2D(), WlzScalarMulAdd(), WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyFloatToRGBA ( WlzUInt dst,
float *  src,
size_t  count 
)

Copies a vector of float to a vector of RGBA.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References WlzValueClampFloatIntoRGBA().

Referenced by WlzValueCopyGreyToGrey().

void WlzValueCopyDoubleToInt ( int *  dst,
double *  src,
size_t  count 
)

Copies a vector of double to a vector of int.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References WLZ_CLAMP, and WLZ_NINT.

Referenced by WlzHistogramConvolve(), WlzHistogramRsvFilter(), and WlzValueCopyGreyToGrey().

void WlzValueCopyDoubleToShort ( short *  dst,
double *  src,
size_t  count 
)

Copies a vector of double to a vector of short.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References WLZ_CLAMP, and WLZ_NINT.

Referenced by WlzValueCopyGreyToGrey().

void WlzValueCopyDoubleToUByte ( WlzUByte dst,
double *  src,
size_t  count 
)

Copies a vector of double to a vector of WlzUByte.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References WLZ_CLAMP, and WLZ_NINT.

Referenced by WlzValueCopyGreyToGrey().

void WlzValueCopyDoubleToFloat ( float *  dst,
double *  src,
size_t  count 
)

Copies a vector of double to a vector of float.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References WLZ_CLAMP.

Referenced by WlzValueCopyGreyToGrey().

void WlzValueCopyDoubleToDouble ( double *  dst,
double *  src,
size_t  count 
)

Copies a vector of double to a vector of double.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

Referenced by WlzContourFromPoints(), WlzEffWriteObjNifti(), WlzHistogramConvolve(), WlzHistogramRsvFilter(), WlzSampleObjPoint2D(), WlzScalarMulAdd(), WlzSepFilter(), WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyDoubleToRGBA ( WlzUInt dst,
double *  src,
size_t  count 
)

Copies a vector of double to a vector of RGBA.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References WlzValueClampDoubleIntoRGBA().

Referenced by WlzValueCopyGreyToGrey().

void WlzValueCopyRGBAToInt ( int *  dst,
WlzUInt src,
size_t  count 
)

Copies a vector of RGBA to a vector of int - uses modulus.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References WLZ_RGBA_MODULUS.

Referenced by WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyRGBAToShort ( short *  dst,
WlzUInt src,
size_t  count 
)

Copies a vector of RGBA to a vector of short - uses modulus.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References WLZ_RGBA_MODULUS.

Referenced by WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyRGBAToUByte ( WlzUByte dst,
WlzUInt src,
size_t  count 
)

Copies a vector of RGBA to a vector of WlzUByte - uses modulus.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References WLZ_CLAMP, and WLZ_RGBA_MODULUS.

Referenced by WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyRGBAToFloat ( float *  dst,
WlzUInt src,
size_t  count 
)

Copies a vector of RGBA to a vector of float - uses modulus.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References WLZ_RGBA_MODULUS.

Referenced by WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyRGBAToDouble ( double *  dst,
WlzUInt src,
size_t  count 
)

Copies a vector of RGBA to a vector of double - uses modulus.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References WLZ_RGBA_MODULUS.

Referenced by WlzContourFromPoints(), WlzScalarMulAdd(), WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyRGBAToRGBA ( WlzUInt dst,
WlzUInt src,
size_t  count 
)

Copies a vector of RGBA to a vector of RGBA.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

Referenced by WlzEffWriteObjNifti(), WlzValueClampGreyIntoGrey(), and WlzValueCopyGreyToGrey().

void WlzValueCopyGreyToGrey ( WlzGreyP  dst,
size_t  dstOff,
WlzGreyType  dstType,
WlzGreyP  src,
size_t  srcOff,
WlzGreyType  srcType,
size_t  count 
)

Copies a source vector to a destination vector, where the source and destination types are any combination of int, short, WlzUByte, float or double.

Returns
void
Parameters
dstDestination vector.
dstOffDestination offset.
dstTypeDestination type, eg WLZ_GREY_INT.
srcSource vector.
srcOffSource offset.
srcTypeSource type, eg WLZ_GREY_SHORT.
countNumber of vector elements to copy.

References _WlzGreyP::dbp, _WlzGreyP::flp, _WlzGreyP::inp, _WlzGreyP::rgbp, _WlzGreyP::shp, _WlzGreyP::ubp, WLZ_GREY_DOUBLE, WLZ_GREY_FLOAT, WLZ_GREY_INT, WLZ_GREY_RGBA, WLZ_GREY_SHORT, WLZ_GREY_UBYTE, WlzValueCopyDoubleToDouble(), WlzValueCopyDoubleToFloat(), WlzValueCopyDoubleToInt(), WlzValueCopyDoubleToRGBA(), WlzValueCopyDoubleToShort(), WlzValueCopyDoubleToUByte(), WlzValueCopyFloatToDouble(), WlzValueCopyFloatToFloat(), WlzValueCopyFloatToInt(), WlzValueCopyFloatToRGBA(), WlzValueCopyFloatToShort(), WlzValueCopyFloatToUByte(), WlzValueCopyIntToDouble(), WlzValueCopyIntToFloat(), WlzValueCopyIntToInt(), WlzValueCopyIntToRGBA(), WlzValueCopyIntToShort(), WlzValueCopyIntToUByte(), WlzValueCopyRGBAToDouble(), WlzValueCopyRGBAToFloat(), WlzValueCopyRGBAToInt(), WlzValueCopyRGBAToRGBA(), WlzValueCopyRGBAToShort(), WlzValueCopyRGBAToUByte(), WlzValueCopyShortToDouble(), WlzValueCopyShortToFloat(), WlzValueCopyShortToInt(), WlzValueCopyShortToRGBA(), WlzValueCopyShortToShort(), WlzValueCopyShortToUByte(), WlzValueCopyUByteToDouble(), WlzValueCopyUByteToFloat(), WlzValueCopyUByteToInt(), WlzValueCopyUByteToRGBA(), WlzValueCopyUByteToShort(), and WlzValueCopyUByteToUByte().

Referenced by WlzCMeshExpValues(), WlzCMeshStrainTensorAtPts(), WlzCMeshValueTransfer(), WlzCompoundArrayToScalar(), WlzContourGrdObj2D(), WlzConvertPix(), WlzCopyDomain(), WlzCopyObjectGreyValues(), WlzCutObjToValBox2D(), WlzFromArray2D(), WlzFromArray3D(), WlzGreyTransfer(), WlzHistogramCopy(), WlzRsvFilterBuffer(), WlzScalarFn(), WlzSepFilter(), WlzTiledValuesCopyLine(), WlzToArray1D(), and WlzToArray3D().

void WlzValueCopyDVertexToDVertex ( WlzDVertex2 dst,
WlzDVertex2 src,
size_t  count 
)

Copies a vector of 2D double vertices to a vector of 2D double vertices.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

Referenced by nrerror(), WlzBasisFnGauss2DFromCPts(), WlzBasisFnIMQ2DFromCPts(), WlzBasisFnMQ2DFromCPts(), WlzBasisFnTPS2DFromCPts(), WlzConvertPolyType(), WlzMeshPolyDomAdd(), WlzVertexHeapSortIdxFnD3(), and WlzVerticesFromObj3I().

void WlzValueCopyDVertexToFVertex ( WlzFVertex2 dst,
WlzDVertex2 src,
size_t  count 
)

Copies a vector of 2D double vertices to a vector of 2D float vertices.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References _WlzFVertex2::vtX, and _WlzFVertex2::vtY.

Referenced by WlzConvertPolyType().

void WlzValueCopyDVertexToIVertex ( WlzIVertex2 dst,
WlzDVertex2 src,
size_t  count 
)

Copies a vector of 2D double vertices to a vector of 2D int vertices.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

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

Referenced by WlzConvertPolyType(), WlzConvexHullCopy2(), and WlzPolyTo8Polygon().

void WlzValueCopyFVertexToDVertex ( WlzDVertex2 dst,
WlzFVertex2 src,
size_t  count 
)

Copies a vector of 2D float vertices to a vector of 2D double vertices.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References _WlzFVertex2::vtX, _WlzDVertex2::vtX, _WlzFVertex2::vtY, and _WlzDVertex2::vtY.

Referenced by WlzConvertPolyType(), WlzMeshPolyDomAdd(), WlzRegICPObjWSD2D(), and WlzSnapFit().

void WlzValueCopyFVertexToFVertex ( WlzFVertex2 dst,
WlzFVertex2 src,
size_t  count 
)

Copies a vector of 2D float vertices to a vector of 2D float vertices.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

Referenced by WlzConvertPolyType(), WlzVertexHeapSortIdxFnD3(), and WlzVerticesFromObj3I().

void WlzValueCopyFVertexToIVertex ( WlzIVertex2 dst,
WlzFVertex2 src,
size_t  count 
)

Copies a vector of 2D float vertices to a vector of 2D int vertices.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

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

Referenced by WlzConvertPolyType(), and WlzPolyTo8Polygon().

void WlzValueCopyIVertexToDVertex ( WlzDVertex2 dst,
WlzIVertex2 src,
size_t  count 
)

Copies a vector of 2D int vertices to a vector of 2D double vertices.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

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

Referenced by WlzConvertPolyType(), WlzConvexHullCopy2(), WlzMeshPolyDomAdd(), WlzRegICPObjWSD2D(), and WlzSnapFit().

void WlzValueCopyIVertexToFVertex ( WlzFVertex2 dst,
WlzIVertex2 src,
size_t  count 
)

Copies a vector of 2D int vertices to a vector of 2D float vertices.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References _WlzFVertex2::vtX, and _WlzFVertex2::vtY.

Referenced by WlzConvertPolyType().

void WlzValueCopyIVertexToIVertex ( WlzIVertex2 dst,
WlzIVertex2 src,
size_t  count 
)

Copies a vector of 2D int vertices to a vector of 2D int vertices.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

Referenced by WlzConvertPolyType(), WlzVertexHeapSortIdxFnD3(), and WlzVerticesFromObj3I().

void WlzValueCopyDVertexToDVertex3 ( WlzDVertex3 dst,
WlzDVertex3 src,
size_t  count 
)

Copies a vector of 3D double vertices to a vector of 3D double vertices.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

Referenced by WlzBasisFnIMQ3DFromCPts(), WlzBasisFnMQ3DFromCPts(), WlzBasisFnScalarMOS3DFromCPts(), WlzContourFromPoints(), and WlzGeometryTrackUpAndDown_s().

void WlzValueCopyDVertexToFVertex3 ( WlzFVertex3 dst,
WlzDVertex3 src,
size_t  count 
)

Copies a vector of 3D double vertices to a vector of 3D float vertices.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

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

void WlzValueCopyDVertexToIVertex3 ( WlzIVertex3 dst,
WlzDVertex3 src,
size_t  count 
)

Copies a vector of 3D double vertices to a vector of 3D int vertices.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

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

Referenced by WlzConvexHullCopy3().

void WlzValueCopyFVertexToDVertex3 ( WlzDVertex3 dst,
WlzFVertex3 src,
size_t  count 
)

Copies a vector of 3D float vertices to a vector of 3D double vertices.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

References _WlzFVertex3::vtX, _WlzDVertex3::vtX, _WlzFVertex3::vtY, _WlzDVertex3::vtY, _WlzFVertex3::vtZ, and _WlzDVertex3::vtZ.

Referenced by WlzContourFromPoints(), and WlzRegICPObjWSD2D().

void WlzValueCopyFVertexToFVertex3 ( WlzFVertex3 dst,
WlzFVertex3 src,
size_t  count 
)

Copies a vector of 3D float vertices to a vector of 3D float vertices.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.
void WlzValueCopyFVertexToIVertex3 ( WlzIVertex3 dst,
WlzFVertex3 src,
size_t  count 
)

Copies a vector of 3D float vertices to a vector of 3D int vertices.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

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

void WlzValueCopyIVertexToDVertex3 ( WlzDVertex3 dst,
WlzIVertex3 src,
size_t  count 
)

Copies a vector of 3D int vertices to a vector of 3D double vertices.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

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

Referenced by WlzContourFromPoints(), WlzConvexHullCopy3(), WlzRegICPObjWSD2D(), and WlzSnapFit().

void WlzValueCopyIVertexToFVertex3 ( WlzFVertex3 dst,
WlzIVertex3 src,
size_t  count 
)

Copies a vector of 3D int vertices to a vector of 3D float vertices.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.

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

void WlzValueCopyIVertexToIVertex3 ( WlzIVertex3 dst,
WlzIVertex3 src,
size_t  count 
)

Copies a vector of 3D int vertices to a vector of 3D int vertices.

Returns
void
Parameters
dstDestination vector.
srcSource vector.
countNumber of vector elements to copy.
WlzErrorNum WlzValueConvertPixel ( WlzPixelV dstPix,
WlzPixelV  srcPix,
WlzGreyType  dstType 
)

Converts a single pixel value. Source values are clamped to the the destination value range.

Returns
Woolz error code.
Parameters
dstPixDestination pointer for pixel.
srcPixSource pixel.
dstTypeDestination type, eg WLZ_GREY_INT.

References _WlzGreyV::dbv, _WlzGreyV::flv, _WlzGreyV::inv, _WlzGreyV::rgbv, _WlzGreyV::shv, _WlzPixelV::type, _WlzGreyV::ubv, _WlzPixelV::v, WLZ_CLAMP, WLZ_ERR_NONE, WLZ_ERR_PARAM_NULL, WLZ_ERR_VALUES_TYPE, WLZ_GREY_DOUBLE, WLZ_GREY_FLOAT, WLZ_GREY_INT, WLZ_GREY_RGBA, WLZ_GREY_SHORT, WLZ_GREY_UBYTE, WLZ_NINT, WLZ_RGBA_MODULUS, WLZ_RGBA_RGBA_SET, WlzValueClampDoubleToFloat(), WlzValueClampDoubleToInt(), WlzValueClampDoubleToShort(), WlzValueClampDoubleToUByte(), WlzValueClampFloatToInt(), WlzValueClampFloatToShort(), WlzValueClampFloatToUByte(), WlzValueClampIntToShort(), WlzValueClampIntToUByte(), and WlzValueClampShortToUByte().

Referenced by WlzAffineTransformGMShell(), WlzClassValCon4(), WlzCMeshToDomObjValues(), WlzCMeshTransformManyObjAsIdx(), WlzCMeshValueTransfer(), WlzCompoundToRGBA(), WlzCompThresholdVT(), WlzConComThreshold(), WlzConvertPix(), WlzCutObjToValBox2D(), WlzCutObjToValBox3D(), WlzEffWriteObjNifti(), WlzEffWriteObjStack(), WlzGaussNoise(), WlzGreyCrossing(), WlzGreyInvertMinMax(), WlzGreyMask(), WlzGreySetRange(), WlzGreySetRangeLut(), WlzGreySetValue(), WlzGreyVariance(), WlzHistogramObj(), WlzHyThreshold(), WlzIndexObjToCompound(), WlzMakeRectValueTb(), WlzMakeTiledValuesObj2D(), WlzMakeTiledValuesObj3D(), WlzMakeValueTb(), WlzMeshFromObjBox(), WlzNewObjectValueTable(), WlzRegCCorObjs(), WlzScalarFn(), WlzScalarMulAdd(), WlzSetBackground(), and WlzSplitMontageObj().

int WlzValueMedianInt ( int *  values,
size_t  nVal 
)

Computes the median of the given vector (the vector's values are overwritten), where the vector type is of int values. The algorithm is based on min-max elimination as used by Peath A W. Median finding on a 3x3 Grid. Graphics Gems, 171-175. Academic Press. 1990. If the vector has less than 1 element 0 is returned. In the trivial case of 1 or 2 elements, the first element's value is returned. If the vector has more than 3 elements:

Returns
Median value.
  • The given vector is partitioned into two portions: the 1st having ((n + 1) / 2) + 1 elements.
  • While all the elements have not been examined:
    • Find maximum and minimum values in the 1st
    • Replace the min value with the first in the partition and the max with the last in the partition.
    • Replace the first value in the first partition with the next value from the second partition.
    • Reduce the length of the first partion by 1, ie omit the last value.
  • This leaves 3 values in the 1st partion, their median is found by direct comparison.
Parameters
valuesVector of int values.
nValNumber of values in vector.

Referenced by WlzSampleObjPoint2D().

double WlzValueMedianDouble ( double *  values,
size_t  nVal 
)

Computes the median of the given vector (the vector's values are overwritten), where the vector type is of double values. The algorithm is based on min-max elimination as used by Peath A W. Median finding on a 3x3 Grid. Graphics Gems, 171-175. Academic Press. 1990. If the vector has less than 1 element 0 is returned. In the trivial case of 1 or 2 elements, the first element's value is returned. If the vector has more than 3 elements:

Returns
Median value.
  • The given vector is partitioned into two portions: the 1st having ((n + 1) / 2) + 1 elements.
  • While all the elements have not been examined:
    • Find maximum and minimum values in the 1st
    • Replace the min value with the first in the partition and the max with the last in the partition.
    • Replace the first value in the first partition with the next value from the second partition.
    • Reduce the length of the first partion by 1, ie omit the last value.
  • This leaves 3 values in the 1st partion, their median is found by direct comparison.
Parameters
valuesVector of double values.
nValNumber of values in vector.

Referenced by WlzSampleObjPoint2D().

int WlzValueDitherI ( int  p0,
int  p1,
int  p2 
)

Given three consecutive values, possibly in an integer look up table, this function returns a value dithered to lie between the means of the first and last pairs of values with equal probability. Because this function calls AlgRandUniform() is may be slow.

Returns
Dithered value.
Parameters
p0First integral value.
p1Second integral value.
p2Third integral value.

References AlgRandUniform(), and WLZ_NINT.

Referenced by WlzLUTTransformGreyValues().

void WlzIndexedValueBufWeight ( WlzGreyP  gP,
int  gO,
WlzIndexedValues ixv,
double *  wgt,
int  nIdx,
int *  idx,
int  ixi 
)

Given an indexed values, weights and an array of indices into the indexed values; weights and sums the indexed values setting the grey value to the sum of the weighted values. The type of the grey pointer must be the same as the type of the indexed values.

Parameters
gPGrey pointer.
gOGrey pointer offset.
ixvIndexed values.
wgtWeights.
nIdxNumber of indices into the indexed values and the number of weights.
idxIndices into the indexed values.
ixiIndex into the indexed values.

References _WlzKrigModelFn::a, _WlzGreyP::dbp, _WlzGreyP::flp, _WlzGreyP::inp, _WlzGreyP::rgbp, _WlzGreyP::shp, _WlzGreyP::ubp, _WlzIndexedValues::vType, WLZ_CLAMP, WLZ_GREY_DOUBLE, WLZ_GREY_FLOAT, WLZ_GREY_INT, WLZ_GREY_RGBA, WLZ_GREY_SHORT, WLZ_GREY_UBYTE, WLZ_RGBA_ALPHA_GET, WLZ_RGBA_BLUE_GET, WLZ_RGBA_GREEN_GET, WLZ_RGBA_RED_GET, WLZ_RGBA_RGBA_SET, and WlzIndexedValueGet().

Referenced by WlzCMeshToDomObjValues().

size_t WlzIndexedValueSize ( WlzIndexedValues ixv,
size_t *  dstNDat,
WlzErrorNum dstErr 
)

Computes the size of the data at each location of the indxed values.

Returns
Size of data at each location of the indxed values.
Parameters
ixvGiven indexed values structure.
dstNDatDestination pointer for the number of data at each location of the indxed values, may be NULL.
dstErrDestination error pointer, may be NULL.

References _WlzIndexedValues::dim, _WlzIndexedValues::rank, _WlzIndexedValues::type, _WlzIndexedValues::vType, WLZ_ERR_GREY_TYPE, WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, WLZ_ERR_VALUES_DATA, WLZ_ERR_VALUES_NULL, WLZ_ERR_VALUES_TYPE, WLZ_GREY_BIT, WLZ_INDEXED_VALUES, and WlzGreySize().

Referenced by WlzCMeshDispToField(), WlzCopyIndexedValues(), and WlzCopyObject().

size_t WlzValueSqueeze ( size_t  n,
void *  val,
size_t  sz,
WlzUByte keep,
WlzErrorNum dstErr 
)

Squeezes out values from an array by replacing those that are to be removed so that the values remain contiguous.

Returns
Number of values remaining.
Parameters
nNumber of values in the array.
valArray of values.
szSize of an element in the array.
keepArray of byte values. Values are kept when the keep value (with the corresponding index) is non zero.
dstErrDestination error pointer, may be NULL.

References WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, and WLZ_ERR_PARAM_NULL.

Referenced by WlzCMeshTransformObj().

WlzErrorNum WlzGreyValueFromGreyP ( WlzGreyV gV,
WlzGreyP  gP,
size_t  n,
WlzGreyType  gType 
)

Sets Woolz grey values using the given Woolz grey pointer as the source of contiguous values.

Returns
Woolz error code.
Parameters
gVDestination pointer for grey value(s).
gPSource grep value pointer.
nNumber of values to be set.
gTypeGrey type.

References _WlzGreyP::dbp, _WlzGreyV::dbv, _WlzGreyP::flp, _WlzGreyV::flv, _WlzGreyP::inp, _WlzGreyV::inv, _WlzGreyP::lnp, _WlzGreyV::lnv, _WlzGreyP::rgbp, _WlzGreyV::rgbv, _WlzGreyP::shp, _WlzGreyV::shv, _WlzGreyP::ubp, _WlzGreyV::ubv, WLZ_ERR_GREY_TYPE, WLZ_ERR_NONE, WLZ_GREY_DOUBLE, WLZ_GREY_FLOAT, WLZ_GREY_INT, WLZ_GREY_LONG, WLZ_GREY_RGBA, WLZ_GREY_SHORT, and WLZ_GREY_UBYTE.