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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Mask
    createFromMask(Mask mask)
     
    MaskProvider
    Returned instead of mask if the predicate is not satisfied.
    protected abstract boolean
    predicate(Mask mask)
    Evaluates a predicate condition on the input mask.
    void
    setMaskElse(MaskProvider maskElse)
    Returned instead of mask if the predicate is not satisfied.

    Methods inherited from class org.anchoranalysis.image.bean.provider.MaskProviderUnary

    get, getMask, setMask

    Methods inherited from class org.anchoranalysis.image.bean.provider.MaskProvider

    getAsStack

    Methods inherited from class org.anchoranalysis.bean.initializable.InitializableBean

    getInitialization, getLogger, getPropertyInitializer, initialize, initializeRecursive, initRecursiveWithInitializer, isInitialized, onInitialization

    Methods inherited from class org.anchoranalysis.bean.AnchorBean

    checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • IfPredicateBase

      public IfPredicateBase()
  • Method Details

    • createFromMask

      protected Mask createFromMask(Mask mask) throws ProvisionFailedException
      Specified by:
      createFromMask in class MaskProviderUnary
      Throws:
      ProvisionFailedException
    • predicate

      protected abstract boolean predicate(Mask mask) throws ProvisionFailedException
      Evaluates a predicate condition on the input mask.
      Parameters:
      mask - the input Mask to 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 of mask if the predicate is not satisfied.

      This MaskProvider is used to generate an alternative mask when the predicate condition is not met.

    • setMaskElse

      public void setMaskElse(MaskProvider maskElse)
      Returned instead of mask if the predicate is not satisfied.

      This MaskProvider is used to generate an alternative mask when the predicate condition is not met.