add_from_dat#

add_from_dat(store, fp, scale_factor=(1, 1), typedict=None, origin=(0, 0))[source]#

Add annotations from a .dat file to an existing store.

Make the best effort to create valid shapely geometries from provided contours.

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

  • scale_factor (float) – The scale factor 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, e.g.: {‘head1’: {1: ‘Epithelial Cell’, 2: ‘Lymphocyte’, 3: …}, ‘head2’: {1: ‘Gland’, 2: ‘Lumen’, 3: …}, …}.

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

  • float] – The x and y coordinates to use as the origin for the annotations.

  • origin (Tuple[float, float]) –

Return type:

None