Clamp Values Filter

Ensures that specific values always fall within a given user-specified range.

Category

category_math Clamp Values

Node

clamping_node

Parameters

Replacement method: what to do when a value is outside the allowed range. The user may either choose Replace with min/max value to clamp the value to that range, or Replace with NaN or -1 to replace values outside of the allowed range with a default replacement value (NaN or -1, depending on which scalar data type is being used)

Clamp to: specifies which conditions of the allowed range are to be checked. Selecting Minimum and maximum ensures that all values will be forced to lie within the range specified. Selecting Minimum ensures that no value will be smaller than the allowed minimum (but may be arbitrarily large). Selecting Maximum ensures that no value will be larger than the allowed maximum (but may be arbitrarily small)

Min: the lower bound of the allowed range

Max: the upper bound of the allowed range

Inputs

Input: the input data

Outputs

Output: the output data

Effect of the Filter

The filter will ensure that no values are present that fall outside the user-specified range. It can either clamp the values to the boundary of the range (i.e. if the range is from 0 to 1, a value of -0.5 will be replaced by 0 and a value of 2.5 will be replaced by 1), or replace the values that exceed the range with either NaN (when floating point data is present) or -1 (when integer data is present) to indicate that these pixels didn’t have valid values.

The filter can also be used to only clamp the values to the minimum or the maximum alone (instead of both). For example, setting Clamp to to Minimum and Min to 0 ensures that all negative values will be replaced with either 0 or NaN (depending on the Replacement Method setting).

All values of all channels will be clamped equally.