acia.tracking.processor.utils#

Utility functions for the tracking processors

acia.tracking.processor.utils.overlay_to_masks(segmentation, height, width)[source]#

Rasterize an overlay into the (T, height, width) label stack trackers want.

Every tracking backend takes its segmentation this way (Trackastra, LapTrack, PyUAT, Ultrack), so this is on the critical path of each of them.

Frame t of the returned stack holds the detections of frame t of the overlay – indexed absolutely. The previous implementation built the stack from Overlay.timeIterator(), which starts at the overlay’s first populated frame, so an overlay whose earliest detection sat on frame 3 put that frame’s cells into masks[0] and handed the tracker a segmentation silently shifted against its images.

Parameters:
  • segmentation (Overlay) – the detections to rasterize.

  • height (int) – frame height, in pixels.

  • width (int) – frame width, in pixels.

Returns:

np.ndarray

(T, height, width) label stack, 0 = background.

uint16, widened to uint32 if any label needs it.

Return type:

ndarray