tlc.helpers.annotation_helper¶
Annotation column discovery and inspection.
Provides AnnotationHelper and AnnotationColumn for locating annotation columns in a table
without hard-coding column names or schema field names. The structural shape (legacy bb_list, new geometry
sample types, segmentation RLEs, etc.) is enough to identify the annotation type and its label path.
Module Contents¶
Classes¶
Class |
Description |
|---|---|
Structural view of an annotation column. |
|
Discover and inspect annotation columns in a table without depending on column names or schema constants. |
|
Supported annotation column types. |
API¶
- class AnnotationColumn¶
Structural view of an annotation column.
- Variables:
name – Top-level column name in the table.
type – The detected annotation type.
label_path – Full dot-separated path to the label leaf, or
Noneif the column has no label field.
- type: AnnotationType = None¶
- class AnnotationHelper¶
Discover and inspect annotation columns in a table without depending on column names or schema constants.
- static find(
- table: Table,
- *,
- type: AnnotationType | None = None,
Locate the annotation column in a table.
The detection is purely structural — column names are not consulted; sample-type config and well-known sub-field names are. Asking for
type=BOUNDING_BOXESmatches both new and legacy bounding box columns;type=LEGACY_BOUNDING_BOXESmatches legacy only. All other type filters are exact.- Parameters:
table – The table to inspect.
type – Optional type filter. If omitted, any annotation column matches.
- Returns:
The single matching
AnnotationColumn, orNoneif no annotation column matches.- Raises:
ValueError – If more than one column matches. The error lists the candidate names; pass
AnnotationHelper.get()with an explicitcolumn_nameto disambiguate.
- static get( ) AnnotationColumn¶
Classify a known annotation column by name.
- Parameters:
table – The table containing the column.
column_name – Top-level column name.
- Returns:
The
AnnotationColumnview of the column.- Raises:
KeyError – If the column does not exist in the table.
ValueError – If the column exists but is not annotation-shaped.