Woolz Image Processing  Version 1.8.3
WlzArithmetic

Files

file  WlzImageArithmetic.c
 Functions for performing arithmetic on a pair of domain objects with grey values.
 
file  WlzRGBAImageArithmetic.c
 Performs image arithmetic on RGBA data. Both input files must be RGBA value type.
 
file  WlzRGBAScalarBinaryOp.c
 Apply a scalar binary operation to an RGBA image.
 
file  WlzRGBChanRatio.c
 Computes log ratio of RGB channels in a RGBA object.
 
file  WlzScalarArithmeticOp.c
 Functions which apply scalar arithmetic operations to domain objects.
 
file  WlzScalarBinaryOp.c
 Applies scalar binary operators to objects.
 
file  WlzScalarFn.c
 Code to apply scalar functions to scalar image values in Woolz objects.
 

Enumerations

enum  _WlzBinaryOperatorType {
  WLZ_BO_ADD = 0,
  WLZ_BO_SUBTRACT,
  WLZ_BO_MULTIPLY,
  WLZ_BO_DIVIDE,
  WLZ_BO_MODULUS,
  WLZ_BO_EQ,
  WLZ_BO_NE,
  WLZ_BO_GT,
  WLZ_BO_GE,
  WLZ_BO_LT,
  WLZ_BO_LE,
  WLZ_BO_AND,
  WLZ_BO_OR,
  WLZ_BO_XOR,
  WLZ_BO_MAX,
  WLZ_BO_MIN,
  WLZ_BO_MAGNITUDE
}
 Binary operators.
Typedef: WlzBinaryOperatorType. More...
 

Functions

WlzObjectWlzRGBAImageArithmetic (WlzObject *obj0, WlzObject *obj1, WlzBinaryOperatorType op, int overwrite, WlzErrorNum *dstErr)
 Performs image arithmetic on objects with RGBA values. See WlzImageArithmetic(). More...
 
WlzObjectWlzRGBChanRatio (WlzObject *rgbObj, WlzRGBAColorChannel num, WlzRGBAColorChannel den, WlzRGBAColorChannel mul, int useMul, int norm, WlzErrorNum *dstErr)
 Computes log ratio of RGB channels in a RGBA object for each pixel using ratio \(r\) with

\[ r = m \log(1 + \frac{n}{1 + d}). \]

where m is the multipler channel value or unity if not used. This results in either an object with float values or if the normalise parameter is non-zero an object with unsigned byte values normalised to the range 0-255. The numerator and denominator channels must be red, green blue, yellow, magenta, cyan, hue, staturation, brightness, or grey (modulus). More...

 
WlzErrorNum WlzGreyIncValuesInDomain (WlzObject *gObj, WlzObject *dObj)
 Increments all valus of the firstobjct which are within the domain of the second object. The domain of the first object must cover that of the second. More...
 
WlzErrorNum WlzGreyIncValues2D (WlzObject *obj)
 Increments all values within the given object. More...
 
WlzObjectWlzScalarBinaryOp2 (WlzObject *o1, WlzPixelV pval, WlzBinaryOperatorType op, WlzErrorNum *dstErr)
 Apply a binary operation (add subtract etc) to each pixel value in the given object. The operand value is in pval. More...
 
WlzObjectWlzScalarAdd (WlzObject *o1, WlzPixelV pval, WlzErrorNum *dstErr)
 Add a value to each pixel of an object. More...
 
WlzObjectWlzScalarSubtract (WlzObject *o1, WlzPixelV pval, WlzErrorNum *dstErr)
 Subtract a value from each pixel of an object. More...
 
WlzObjectWlzScalarMultiply (WlzObject *o1, WlzPixelV pval, WlzErrorNum *dstErr)
 Multiply each pixel of an object. More...
 
WlzObjectWlzScalarDivide (WlzObject *o1, WlzPixelV pval, WlzErrorNum *dstErr)
 Divide each pixel of an object. More...
 
WlzObjectWlzScalarMulAdd (WlzObject *iObj, WlzPixelV m, WlzPixelV a, WlzGreyType rGType, WlzErrorNum *dstErr)
 Scales the values of the given Woolz object so that \(v_{new} = m v_{given} + a.\). More...
 
WlzErrorNum WlzScalarBinaryOp (WlzObject *o1, WlzPixelV pval, WlzObject *o3, WlzBinaryOperatorType op)
 Perform the given binary operation for each grey value in image o1 with val putting the result in o3. The value table of o3 can be identical to that of o1 to allow overwriting. This function assumes that the domains of each object are the same. Unless overwriting is required then the functions WlzImageAdd, WlzImageSubtract etc. should be used. These return an object which is the intersection of the input objects. More...
 
WlzObjectWlzScalarFn (WlzObject *sObj, WlzFnType fn, WlzErrorNum *dstErr)
 Computes a new object which shares the domain of the given object, but which has grey values that are the result of applying the given function to the grey values of the given object. More...
 

Detailed Description

Enumeration Type Documentation

◆ _WlzBinaryOperatorType

Binary operators.
Typedef: WlzBinaryOperatorType.

Enumerator
WLZ_BO_ADD 
WLZ_BO_SUBTRACT 
WLZ_BO_MULTIPLY 
WLZ_BO_DIVIDE 
WLZ_BO_MODULUS 
WLZ_BO_EQ 
WLZ_BO_NE 
WLZ_BO_GT 
WLZ_BO_GE 
WLZ_BO_LT 
WLZ_BO_LE 
WLZ_BO_AND 
WLZ_BO_OR 
WLZ_BO_XOR 
WLZ_BO_MAX 
WLZ_BO_MIN 
WLZ_BO_MAGNITUDE 

Function Documentation

◆ WlzRGBAImageArithmetic()

WlzObject* WlzRGBAImageArithmetic ( WlzObject obj0,
WlzObject obj1,
WlzBinaryOperatorType  op,
int  overwrite,
WlzErrorNum dstErr 
)

Performs image arithmetic on objects with RGBA values. See WlzImageArithmetic().

Returns
New object.
Parameters
obj0First object.
obj1Second object.
opBinary operator.
overwriteAllow the destination object to share values with one of the given objects if non zero.
dstErrDestination error pointer, may be NULL.

References _WlzCompoundArray::o, _WlzObject::type, WLZ_COMPOUND_ARR_1, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_OBJECT_TYPE, WLZ_ERR_PARAM_DATA, WLZ_GREY_RGBA, WLZ_RGBA_SPACE_RGB, WlzCompoundToRGBA(), WlzFreeObj(), WlzGreyTypeFromObj(), WlzImageArithmetic(), WlzMakeCompoundArray(), and WlzRGBAToCompound().

Referenced by WlzShadeCorrectBFDF().

◆ WlzRGBChanRatio()

WlzObject* WlzRGBChanRatio ( WlzObject rgbObj,
WlzRGBAColorChannel  num,
WlzRGBAColorChannel  den,
WlzRGBAColorChannel  mul,
int  useMul,
int  norm,
WlzErrorNum dstErr 
)

Computes log ratio of RGB channels in a RGBA object for each pixel using ratio \(r\) with

\[ r = m \log(1 + \frac{n}{1 + d}). \]

where m is the multipler channel value or unity if not used. This results in either an object with float values or if the normalise parameter is non-zero an object with unsigned byte values normalised to the range 0-255. The numerator and denominator channels must be red, green blue, yellow, magenta, cyan, hue, staturation, brightness, or grey (modulus).

Returns
Ratio object or NULL on error.
Parameters
rgbObjThe input RGBA object.
numChannel for numerator in ratio.
denChannel for denominator in ratio.
mulChannel for multiplier value.
useMulMultiplier used if non zero.
normNormalise the object values and return a ubyte object.
dstErrDestination error pointer, may be NULL.

References _WlzValues::core, _WlzDomain::core, _WlzObject::domain, _WlzPixelV::type, _WlzCoreValues::type, _WlzGreyV::ubv, _WlzPixelV::v, _WlzObject::values, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_VALUES_NULL, WLZ_ERR_VALUES_TYPE, WLZ_GREY_UBYTE, and WlzGreyTableIsTiled().

◆ WlzGreyIncValuesInDomain()

WlzErrorNum WlzGreyIncValuesInDomain ( WlzObject gObj,
WlzObject dObj 
)

Increments all valus of the firstobjct which are within the domain of the second object. The domain of the first object must cover that of the second.

Returns
Woolz error code.
Parameters
gObjFirst object.
dObjSecond object.

References _WlzValues::core, _WlzDomain::core, _WlzObject::domain, _WlzObject::type, _WlzCoreValues::type, _WlzObject::values, WLZ_2D_DOMAINOBJ, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_OBJECT_TYPE, WLZ_ERR_VALUES_NULL, WLZ_ERR_VALUES_TYPE, and WlzGreyTableIsTiled().

Referenced by WlzDomainOccupancy().

◆ WlzGreyIncValues2D()

◆ WlzScalarBinaryOp2()

◆ WlzScalarAdd()

WlzObject* WlzScalarAdd ( WlzObject o1,
WlzPixelV  pval,
WlzErrorNum dstErr 
)

Add a value to each pixel of an object.

Returns
Object with value added to each pixel.
Parameters
o1Input object
pvalValue to be added.
dstErrError return.

References WLZ_BO_ADD, and WlzScalarBinaryOp2().

◆ WlzScalarSubtract()

WlzObject* WlzScalarSubtract ( WlzObject o1,
WlzPixelV  pval,
WlzErrorNum dstErr 
)

Subtract a value from each pixel of an object.

Returns
Object with value subtacted from each pixel.
Parameters
o1Input object
pvalValue to be subtracted.
dstErrError return.

References WLZ_BO_SUBTRACT, and WlzScalarBinaryOp2().

◆ WlzScalarMultiply()

WlzObject* WlzScalarMultiply ( WlzObject o1,
WlzPixelV  pval,
WlzErrorNum dstErr 
)

Multiply each pixel of an object.

Returns
Object with multiplied pixel values.
Parameters
o1Input object
pvalMultiplication factor.
dstErrError return.
Source:
WlzScalarArithmeticOp.c

References WLZ_BO_MULTIPLY, and WlzScalarBinaryOp2().

◆ WlzScalarDivide()

WlzObject* WlzScalarDivide ( WlzObject o1,
WlzPixelV  pval,
WlzErrorNum dstErr 
)

Divide each pixel of an object.

Returns
Object with each pixel divided.
Parameters
o1Input object
pvalDivision value.
dstErrError return.
Source:
WlzScalarArithmeticOp.c

References WLZ_BO_DIVIDE, and WlzScalarBinaryOp2().

◆ WlzScalarMulAdd()

WlzObject* WlzScalarMulAdd ( WlzObject iObj,
WlzPixelV  m,
WlzPixelV  a,
WlzGreyType  rGType,
WlzErrorNum dstErr 
)

Scales the values of the given Woolz object so that \(v_{new} = m v_{given} + a.\).

Returns
New woolz object or NULL on error.
Parameters
iObjGiven object.
mValue to multiply object values by.
aValue to add to product.
rGTypeRequired grey type for returned object.
dstErrDestination error pointer, may be NULL.

References _WlzValues::core, _WlzDomain::core, _WlzObject::domain, _WlzCompoundArray::n, _WlzCompoundArray::o, _WlzObject::type, _WlzObject::values, WLZ_2D_DOMAINOBJ, WLZ_COMPOUND_ARR_1, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_VALUES_NULL, WLZ_NULL, WlzFreeObj(), and WlzMakeCompoundArray().

◆ WlzScalarBinaryOp()

WlzErrorNum WlzScalarBinaryOp ( WlzObject o1,
WlzPixelV  pval,
WlzObject o3,
WlzBinaryOperatorType  op 
)

Perform the given binary operation for each grey value in image o1 with val putting the result in o3. The value table of o3 can be identical to that of o1 to allow overwriting. This function assumes that the domains of each object are the same. Unless overwriting is required then the functions WlzImageAdd, WlzImageSubtract etc. should be used. These return an object which is the intersection of the input objects.

Returns
Woolz error.
Parameters
o1Input object.
pvalOperand value.
o3Oject for the return values. Setting equal to o1 means values will be overwritten.
opOpertor to be applied.
Source:
WlzScalarBinaryOp.c

References _WlzValues::core, _WlzDomain::core, _WlzObject::domain, _WlzObject::type, _WlzCoreValues::type, _WlzObject::values, WLZ_2D_DOMAINOBJ, WLZ_3D_DOMAINOBJ, WLZ_EMPTY_OBJ, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_DOMAIN_TYPE, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_OBJECT_TYPE, WLZ_ERR_VALUES_NULL, WLZ_ERR_VALUES_TYPE, WLZ_TRANS_OBJ, and WlzGreyTableIsTiled().

Referenced by WlzRGBAScalarBinaryOp(), and WlzScalarBinaryOp2().

◆ WlzScalarFn()

WlzObject* WlzScalarFn ( WlzObject sObj,
WlzFnType  fn,
WlzErrorNum dstErr 
)

Computes a new object which shares the domain of the given object, but which has grey values that are the result of applying the given function to the grey values of the given object.

Returns
New domain object.
Parameters
sObjGiven source domainn object with values.
fnScalar function to be applied.
dstErrDestination error pointer, may be NULL.

References _WlzValues::core, _WlzDomain::core, _WlzObject::domain, _WlzObject::type, _WlzObject::values, WLZ_2D_DOMAINOBJ, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, and WLZ_ERR_VALUES_NULL.