Class ObjectFilterPredicate
Object
AnchorBean<ObjectFilter>
InitializableBean<ObjectFilter, ImageInitialization>
ImageBean<ObjectFilter>
ObjectFilter
ObjectFilterPredicate
- Direct Known Subclasses:
DiscardOutliers,GreaterIntersectionWith,IntensityGreaterEqualThan,IntersectsWith,NotTouchingSceneBorder,ObjectFilterRelation
public abstract class ObjectFilterPredicate
extends ObjectFilter
Uses a predicate to make a decision whether to keep objects or not.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidend()Performs any necessary cleanup after filtering is complete.ObjectCollectionprotected abstract booleanA predicate condition for an object to be kept in the collection.protected abstract booleanprecondition(ObjectCollection objectsToFilter) A precondition, which if evaluates to false, cancels the filter i.e.protected voidPerforms any necessary initialization before filtering begins.Methods 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
-
ObjectFilterPredicate
public ObjectFilterPredicate()
-
-
Method Details
-
filter
public ObjectCollection filter(ObjectCollection objectsToFilter, Optional<Dimensions> dimensions) throws OperationFailedException - Specified by:
filterin classObjectFilter- Throws:
OperationFailedException
-
precondition
protected abstract boolean precondition(ObjectCollection objectsToFilter) A precondition, which if evaluates to false, cancels the filter i.e. nothing is removed.- Parameters:
objectsToFilter- theObjectCollectionto be filtered- Returns:
- true if the filter should be applied, false otherwise
-
start
protected void start(Optional<Dimensions> dimensions, ObjectCollection objectsToFilter) throws OperationFailedException Performs any necessary initialization before filtering begins.- Parameters:
dimensions- optionalDimensionsof the objectsobjectsToFilter- theObjectCollectionto be filtered- Throws:
OperationFailedException- if the initialization fails
-
match
protected abstract boolean match(ObjectMask object, Optional<Dimensions> dimensions) throws OperationFailedException A predicate condition for an object to be kept in the collection.- Parameters:
object- theObjectMaskto be evaluateddimensions- optionalDimensionsof the object- Returns:
- true if the object should be kept, false otherwise
- Throws:
OperationFailedException- if the matching operation fails
-
end
protected abstract void end() throws OperationFailedExceptionPerforms any necessary cleanup after filtering is complete.- Throws:
OperationFailedException- if the cleanup operation fails
-