WeightedBulkTransform

Declaration: WeightedBulkTransform(ConversionMode: integer; BitMask: integer; TimeSlot, FirstLayer, LastLayer: integer; ParA, ParB: double; WgtMat: TDouble2DArray; FeedBack: boolean; var ErrCnt: integer): integer;
Performs a conversion of the time slot TimeSlot affecting the layers FirstLayer to LastLayer. All data points are multiplied by the value of the corresponding element of the matrix WgtMat before the transform is applied (there is one exception: conversion mode 15 weights the added noise and not the signal, see footnote (1) for details). You can turn off weighting by passing a NIL value to the parameter WgtMat.

The parameter ConversionMode specifies the type of conversion:

 0 ... Transmission to absorbance
 1 ... % Transmission to absorbance
 2 ... Absorbance to transmission
 3 ... Absorbance to % transmission
 4 ... Add (B*x + A)
 5 ... Multiply (x * A)
 6 ... Divide (x / A)
 7 ... Inverse (A / x)
 8 ... Power (x ^ A)
 9 ... Root (x^(1/A))
10 ... Fraction (frac(x*A))
11 ... Logarithm (base A)
12 ... Exponential (A^x)
13 ... Replace A by B
14 ... Apply sigmoid function (A = amplitude, B = slope)
15 ... Add Gaussian noise (A = homoscedastic part, B = heteroscedastic) (1)
The parameter BitMask specifies the index of a pixel mask which masks pixels not to be processed. The parameter parA and parB define the conversion parameters.

The parameter Feedback determines whether a visual feedback is provided. Please note that unless the script progress bar is already visible you have to make it visible before calling WeightedBulkTransform, otherwise the feedback will not be displayed. You can activate the script progress bar by calling the function ScriptBar(0).

The function returns the number of encountered errors in the variable parameter ErrCnt and the type of the error found at last as a return code:

 0 ... everything is OK
-1 ... ParA = 0 (division by zero)
-2 ... ParA <= 0 (negative or zero argument)
-3 ... negative data cannot be processed by selected conversion
-4 ... data must not be zero
-5 ... out of numeric range
-6 ... the BitMask parameter does not point to a valid pixel mask
-7 ... invalid ConversionMode
-8 ... calculation aborted by user, only parts of the data processed
-9 ... the weight matrix WgtMat does not match the image size
-10 ... log base must be greater than 1
-11 ... TimeSlot is out of range
-12 ... FirstLayer and/or LastLayer are out of range
Hint: further information on bulk conversions can be found in the section on Predefined Arithmetic Conversions.



(1) The parameter A controls the amount of homoscedastic noise, the parameter B the amount of heteroscedastic noise. Each data value x is transformed by the following equation:
x := x + nse*(ParA + ParB*x*WgtMat[*]),
with nse being a random value drawn from a standard normal distribution (µ = 0, s = 1), and WgtMat[*] being the weight value of the corresponding pixel.