traccuracy.loaders._ctc

Module Contents

Functions

ctc_to_graph(→ networkx.DiGraph)

Create a Graph from DataFrame of CTC info with node attributes.

load_tiffs(→ numpy.ndarray)

Load a directory of individual frames into a stack.

load_ctc_data(→ traccuracy._tracking_graph.TrackingGraph)

Read the CTC segmentations and track file and create a TrackingGraph.

Attributes

logger

traccuracy.loaders._ctc.logger
traccuracy.loaders._ctc.ctc_to_graph(df: pandas.DataFrame, detections: pandas.DataFrame) networkx.DiGraph[source]

Create a Graph from DataFrame of CTC info with node attributes.

Parameters:
  • df (pd.DataFrame) – CTC-style dataframe with columns [segmentation_id, start_frame, end_frame, parent_id]

  • detections (pd.DataFrame) – Dataframe from _get_node_attributes with position and segmentation label for each cell detection

Returns:

Graph representation of the CTC data.

Return type:

networkx.DiGraph

traccuracy.loaders._ctc.load_tiffs(data_dir: str) numpy.ndarray[source]

Load a directory of individual frames into a stack.

Parameters:

data_dir (str) – Path to directory of tiff files

Raises:

FileNotFoundError – No tif files found in data_dir

Returns:

4D array with dims TYXC

Return type:

np.array

traccuracy.loaders._ctc.load_ctc_data(data_dir: str, track_path: str | None = None, name: str | None = None, run_checks: bool = True) traccuracy._tracking_graph.TrackingGraph[source]

Read the CTC segmentations and track file and create a TrackingGraph.

Parameters:
  • data_dir (str) – Path to directory containing CTC tiffs.

  • track_path (optional, str) – Path to CTC track file. If not passed, finds *_track.txt in data_dir.

  • name (optional, str) – Name of data to store in TrackingGraph

  • run_checks (optional, bool) – If set to True (default), runs checks on the data to ensure valid CTC format.

Returns:

TrackingGraph object containing segmentations and graph.

Return type:

traccuracy.TrackingGraph

Raises:

ValueError – If the tracks file is not found. If run_checks is True, whenever any of the CTC format checks are violated. If run_checks is False, whenever any other Exception occurs while creating the graph.