Back to FabImage Library website
You are here: Start » Function Reference » All Functions » Conditional Processing » ChooseByPredicate
This is Filter Equivalent. This function may be present in generated code, but should not be used in hand-written code.
Header: | STD.h |
---|---|
Namespace: | fil |
Module: | FoundationLite |
Returns one of the two input objects depending on the specified condition.
Applications: E.g. to choose GREEN color to visualize correct objects or RED to visualize defective ones.
Syntax
void fil::ChooseByPredicate ( const Type& inObjectIfTrue, const Type& inObjectIfFalse, bool inCondition, Type& outObject )
Parameters
Name | Type | Default | Description | |
---|---|---|---|---|
![]() |
inObjectIfTrue | const Type& | Object to be chosen if the condition is met | |
![]() |
inObjectIfFalse | const Type& | Object to be chosen if the condition is NOT met | |
![]() |
inCondition | bool | Determines which object is to be chosen | |
![]() |
outObject | Type& | Chosen object |
Hints
- Also consider the ternary operator ?: in Formula Blocks.
- This filter creates a full copy of one of the input objects. Thus, if you need the highest possible speed, use this filter only with primitive types. An alternative is to use Variant Step macrofilters which are fast and elegant.
Examples
![]() |
![]() |
inObjectIfTrue = "Mike" inObjectIfFalse = "Bill" inCondition = False |
outObject = "Bill" |
Remarks
This filter can be replaced with the following formula:

See Also
- ChooseByRange – Returns one of the three input objects depending on whether the associated input value falls below, in or above the specified range.
- ChooseByCase – Returns one of the input objects depending on the specified case index.