Feature functions

class tomni.annotation_manager.main.AnnotationManager(annotations: List[tomni.annotation_manager.annotations.annotation.main.Annotation])[source]

Bases: object

filter(feature: str, min_val: float, max_val: float, feature_multiplier: float = 1.0, inplace: bool = False)[source]

Filter annotations based on a specified feature.

This method filters annotations in the AnnotationManager based on a given feature within a specified value range. Annotations that meet the filtering criteria are included in the result.

Parameters
  • feature (str) – The name of the feature to use for filtering, e.g., ‘roundness’ or ‘area’.

  • min_val (float) – The minimum threshold value for the feature.

  • max_val (float) – The maximum threshold value for the feature.

  • feature_multiplier (float, optional) – A multiplier used in feature calculations. Defaults to 1.

  • inplace (bool, optional) – If True, filter annotations in-place, modifying the object internally. If False, return a collection of filtered annotations without modifying the original object. Defaults to False.

Returns

If inplace=True, returns the AnnotationManager object with the filtered annotations. If inplace=False, returns a list of filtered annotations.

Return type

Union[AnnotationManager, List[Annotation]]

Note

  • This method filters annotations based on a specified feature within the provided value range.

  • The feature_multiplier parameter allows scaling of the feature calculation if needed.