store_from_dat#

store_from_dat(fp, scale_factor=(1, 1), typedict=None, origin=(0, 0), cls=<class 'tiatoolbox.annotation.storage.SQLiteStore'>)[source]#

Load annotations from a hovernet-style .dat file.

Parameters:
  • fp (Union[IO, str, Path]) – The file path or handle to load from.

  • scale_factor (Tuple[float, float]) – The scale factor in each dimension to use when loading the annotations. All coordinates will be multiplied by this factor to allow import of annotations saved at non-baseline resolution.

  • typedict (Dict[str, str]) – A dictionary mapping annotation types to annotation keys. Annotations with a type that is a key in the dictionary, will have their type replaced by the corresponding value. Useful for providing descriptive names to non-descriptive types, eg {1: ‘Epithelial Cell’, 2: ‘Lymphocyte’, 3: …}. For multi-head output, should be a dict of dicts, eg: {‘head1’: {1: ‘Epithelial Cell’, 2: ‘Lymphocyte’, 3: …}, ‘head2’: {1: ‘Gland’, 2: ‘Lumen’, 3: …}, …}.

  • origin (Tuple[float, float]) – The x and y coordinates to use as the origin for the annotations.

  • cls (AnnotationStore) – The class to use for the annotation store. Defaults to SQLiteStore.

Returns:

A new annotation store with the annotations loaded from the file.

Return type:

AnnotationStore