roi_utils

This module contains utility functions for handling Regions of Interest (ROIs) in SLAP2 data. It includes tools for defining, manipulating, and analyzing ROIs within the acquired image data.

Functions

slap2_utils.utils.roi_utils.roiBoolean(datafile, idx)

Return ROI coordinates as a 2D array of booleans.

The function returns a 2D array where pixels belonging to the ROI are marked with True, and all other pixels are marked with False. This format is used in the trace function.

Parameters:
  • datafile (SLAP2_Utils Datafile Object) – The datafile containing metadata and header information.

  • idx (int) – Index value of the ROI in the ROI list.

Returns:

booleanPixels – A 2D array with booleans indicating pixels belonging to the ROI.

Return type:

array

slap2_utils.utils.roi_utils.roiImg(datafile, idx)

Return ROI coordinates as a 2D array.

The function returns a 2D array where pixels belonging to the ROI are marked with 1, and all other pixels are marked with 0.

Parameters:
  • datafile (SLAP2_Utils Datafile Object) – The datafile containing metadata and header information.

  • idx (int) – Index value of the ROI in the ROI list.

Returns:

img – A 2D array with integers 0 or 1 indicating pixels belonging to the ROI.

Return type:

array

slap2_utils.utils.roi_utils.roiLabels(datafile, refStackPath=None)

Return ROI labels as a 3D array with each plane representing a Z-stack.

The function returns a 3D array where each plane represents a slice in a Z-stack, and labels indicate different ROIs. If a reference stack is provided, the function can use it for generating ROI labels.

Parameters:
  • datafile (SLAP2_Utils Datafile Object) – The datafile containing metadata and ROI information.

  • refstack (optional) – Reference stack to use for generating ROI labels. Default is None.

Returns:

roiLabels – A 3D array with each plane representing a Z-stack and labels indicating different ROIs.

Return type:

array