acia.tracking.output#

Tracking dataset exporters

class acia.tracking.output.CellTrackingChallengeDatasetGT[source]#

Bases: object

Utility class to create segmentation/tracking output in form of the Cell Tracking Challenge (CTC)

__init__()[source]#
add(content)[source]#
Parameters:

content (tuple[ImageSequenceSource, TrackingSource])

write(base_folder='data', offset=0)[source]#

Exports a ctc ground truth dataset

Parameters:

base_folder (str | Path, optional) – _description_. Defaults to “data”.

class acia.tracking.output.CellTrackingDatasetResult[source]#

Bases: object

Utility class to create segmentation/tracking output in form of the Cell Tracking Challenge (CTC)

__init__()[source]#
add(content)[source]#
Parameters:

content (tuple[TrackingSource, tuple[int, int]])

write(base_folder='data', offset=0)[source]#
Parameters:

base_folder (str | Path)

class acia.tracking.output.CTCTrackingHelper[source]#

Bases: object

Helper class for the CTC format generation

__init__(overlay, tracking_graph, height, width)[source]#

Create a new tracking helper object

Parameters:
  • tracking_graph (nx.DiGraph) – tracking graph consisting of contour nodes

  • overlay (Overlay)

  • height (int)

  • width (int)

to_ctc_format()[source]#

Generate CTC format

Returns:

Tuple[List[np.ndarray], List[str]] – Returns a List of segm/tracking masks and a list of lines for the ctc txt tracking format.

Return type:

tuple[list[ndarray], list[str]]

static compute_life_cycles(tracking_graph)[source]#

Track life cycles of contour observations (from birth to division).

Parameters:

tracking_graph (nx.DiGraph) – tracking graph

Returns:

List[List[str]] – List of life cycles (consisting of a list of contour ids)

Return type:

list[list[str]]

static txt_format(tracking_graph, life_cycles, contour_lookup, life_cycle_lookup)[source]#

Generate CTC tracking txt format

Parameters:
  • tracking_graph (nx.DiGraph) – tracking graph

  • life_cycles (List[List[str]]) – life_cycles

Raises:

Exception – when a life_cycle has multiple parents

Returns:

List[str] – list of ctc tracking lines

Return type:

list[str]

static create_life_cycle_lookup(life_cycles)[source]#

Computes a mapping from contour ids to life cycle ids

Parameters:

life_cycles (List[List[Contour]]) – _description_

Returns:

_type_ – _description_

static convert_overlay_to_ctc_mask(overlay, contour_life_cycle_lookup, height, width)[source]#

Creates a ctc mask with correct numbering for a frame overlay

Parameters:
  • overlay (Overlay) – overlay containing the contours

  • contour_life_cycle_lookup (Dict[str, int]) – lookup for the life cycle

  • height (int)

  • width (int)

Returns:

np.ndarray – the ctc mask for the frame

Return type:

ndarray

static load_ctc_format(segmentation_path, tracking_path)[source]#

Load ctc format from paths

Parameters:
  • segmentation_path (Path) – path to the segmentation masks

  • tracking_path (Path) – path to the tracking gt/st

Returns:

tuple[Overlay, nx.DiGraph] – the overlay and tracking graph

Return type:

tuple[Overlay, DiGraph]