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(annotation_type, cas)

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

Module Contents

class robokudo.annotators.cas_check.CASCheckFunc(name='CASCheckFunc', func: 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()

Check the CAS condition.

Returns:

SUCCESS if condition is True, FAILURE if False

Return type:

py_trees.Status

Raises:

Exception – If raise_with_str is set and condition is False

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

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

Parameters:
  • annotation_type (type) – Type of annotation to check for

  • cas (robokudo.cas.CAS) – Common Analysis System instance

Returns:

True if at least one annotation exists, False otherwise

Return type:

bool

class robokudo.annotators.cas_check.CASCheckAnnotationTypeExists(name='CASCheckAnnotationTypeExists', annotation_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='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