Struct RasterHistogramResult

Result of counting a single numeric raster plane into caller-owned bins.

struct RasterHistogramResult;

The histogram bins are not retained in this result: the caller owns the destination slice supplied to histogramInto. On success, belowRange and aboveRange count values outside the closed requested range; nanCount counts floating-point NaNs (zero for integer inputs). Infinite floating samples belong to the corresponding out-of-range category.

On error, all three result counters AND the entire caller-supplied bins slice are zero. The default .init state is an invalid-plane failure.

Fields

NameTypeDescription
aboveRange ulongSamples strictly above the upper bound, including +Infinity.
belowRange ulongSamples strictly below the lower bound, including -Infinity.
nanCount ulongNaN samples, for floating-point sources only.

Properties

NameTypeDescription
error[get] RasterHistogramErrorThe operation's result or error category.
ok[get] boolWhether all counts were produced successfully.

Example

Example checking the failing default result and zero counts.

import raster;
RasterHistogramResult result;
assert(!result.ok);
assert(result.error == RasterHistogramError.invalidPlane);
assert(result.belowRange == 0);
assert(result.aboveRange == 0);
assert(result.nanCount == 0);