robokudo.annotators.cas_check

CAS condition checking utilities.

This module provides annotators for checking conditions in the Common Analysis System (CAS). The annotators follow these principles:

  • Return SUCCESS if condition is true

  • Return FAILURE if condition is false

  • Never return RUNNING status

Note

For RUNNING status checks, use CASCondition from cas_condition.py instead.

Classes

CASCheckFunc

Function-based CAS condition checker.

CASCheckAnnotationTypeExists

Check for existence of specific annotation types.

CASCheckOHExists

Check for existence of ObjectHypothesis annotations.

Functions

any_of_type_present(→ bool)

Check if any annotations of a specific type exist in the CAS.

Module Contents

class robokudo.annotators.cas_check.CASCheckFunc(name: str = 'CASCheckFunc', func: typing_extensions.Optional[typing_extensions.Callable[[robokudo.cas.CAS], bool]] = None, raise_with_str: str = '')

Bases: robokudo.annotators.core.BaseAnnotator

Function-based CAS condition checker.

Evaluates a given function that checks conditions in the CAS and returns:

  • SUCCESS if function returns True

  • FAILURE if function returns False

Warning

Will raise an exception if initialized without a function.

func = None
raise_with_str = ''
update() py_trees.common.Status

Check the CAS condition.

Returns:

SUCCESS if condition is True, FAILURE if False

Raises:

Exception – If raise_with_str is set and condition is False

robokudo.annotators.cas_check.any_of_type_present(annotation_type: typing_extensions.Type, cas: robokudo.cas.CAS) bool

Check if any annotations of a specific type exist in the CAS.

Parameters:
  • annotation_type – Type of annotation to check for

  • cas – Common Analysis System instance

Returns:

True if at least one annotation exists, False otherwise

class robokudo.annotators.cas_check.CASCheckAnnotationTypeExists(name: str = 'CASCheckAnnotationTypeExists', annotation_type: typing_extensions.Optional[typing_extensions.Type] = None, raise_with_str: str = '')

Bases: CASCheckFunc

Check for existence of specific annotation types.

Specialized CASCheckFunc that:

  • Checks for presence of specific annotation types

  • Returns SUCCESS if at least one annotation exists

  • Returns FAILURE if no annotations exist

class robokudo.annotators.cas_check.CASCheckOHExists(name: str = 'CASCheckOHExists', raise_with_str: str = '')

Bases: CASCheckAnnotationTypeExists

Check for existence of ObjectHypothesis annotations.

Specialized CASCheckAnnotationTypeExists that:

  • Specifically checks for ObjectHypothesis annotations

  • Returns SUCCESS if any ObjectHypothesis exists

  • Returns FAILURE if no ObjectHypothesis exists