evaluate
fun SampleExpression.evaluate(pixel: ByteArray, channels: List<ColorBand>, map: (Int) -> Double = { it.toDouble() }): Double?
Evaluates this expression against an RGBA pixel using named channels.
Return
A single scalar value, or null if inputs are insufficient.
Parameters
pixel
RGBA pixel data as ByteArray (pixel.size >= 4). Each byte will be treated as an unsigned value (0-255).
channels
Channels to use in order of relevance to the expression. - NUMBER uses channels0 - VECTOR, SUM, DIFFERENCE, ANGLE use channels0 and channels1
map
Optional mapping function from an unsigned byte value (0-255) to a Double.
fun SampleExpression.evaluate(pixel: ByteArray, channels: List<ColorBand>, mappingRange: ClosedFloatingPointRange<Double>): Double?
Convenience: evaluates while linearly mapping unsigned byte values (0…255) into a target range.
Return
A single scalar value, or null if inputs are insufficient.
Parameters
pixel
RGBA pixel data as ByteArray (pixel.size >= 4).
channels
Channels to use.
mapping Range
The target range to map the 0-255 channel values into.