Class IfPredicateBase
Object
AnchorBean<MaskProvider>
InitializableBean<MaskProvider, ImageInitialization>
ImageBean<MaskProvider>
BeanProviderAsStackBase<MaskProvider, Mask>
MaskProvider
MaskProviderUnary
IfPredicateBase
- All Implemented Interfaces:
Provider<Mask>,ProviderAsStack
- Direct Known Subclasses:
IfKeyValueCondition,IfNotEmpty,IfObjectFilter,IfStackExists
public abstract class IfPredicateBase
extends MaskProviderUnary
Base class which multiplexes between the current mask and an alternative depending if a condition
is met.
This class extends MaskProviderUnary to provide a mechanism for conditional mask
selection.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected MaskcreateFromMask(Mask mask) MaskProviderReturned instead ofmaskif the predicate is not satisfied.protected abstract booleanpredicate(Mask mask) Evaluates a predicate condition on the input mask.voidsetMaskElse(MaskProvider maskElse) Returned instead ofmaskif the predicate is not satisfied.Methods inherited from class org.anchoranalysis.image.bean.provider.MaskProviderUnary
get, getMask, setMaskMethods inherited from class org.anchoranalysis.image.bean.provider.MaskProvider
getAsStackMethods inherited from class org.anchoranalysis.bean.initializable.InitializableBean
getInitialization, getLogger, getPropertyInitializer, initialize, initializeRecursive, initRecursiveWithInitializer, isInitialized, onInitializationMethods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
IfPredicateBase
public IfPredicateBase()
-
-
Method Details
-
createFromMask
protected Mask createFromMask(Mask mask) throws ProvisionFailedException - Specified by:
createFromMaskin classMaskProviderUnary- Throws:
ProvisionFailedException
-
predicate
protected abstract boolean predicate(Mask mask) throws ProvisionFailedException Evaluates a predicate condition on the input mask.- Parameters:
mask- the inputMaskto evaluate- Returns:
- true if the predicate condition is satisfied, false otherwise
- Throws:
ProvisionFailedException- if there's an error during predicate evaluation
-
getMaskElse
public MaskProvider getMaskElse()Returned instead ofmaskif the predicate is not satisfied.This
MaskProvideris used to generate an alternative mask when the predicate condition is not met. -
setMaskElse
public void setMaskElse(MaskProvider maskElse) Returned instead ofmaskif the predicate is not satisfied.This
MaskProvideris used to generate an alternative mask when the predicate condition is not met.
-