PartSegCore_compiled_backend.sprawl_utils.find_split

This module contains function to perform multiple component sprawl (watershed like)

PartSegCore_compiled_backend.sprawl_utils.find_split.euclidean_sprawl(data_m: ndarray, components: ndarray, components_count: int, neigh_arr, dist_arr, distance_cache=None, data_cache=None) ndarray

Calculate euclidean sprawl (watershed)

Parameters:
  • data_m (np.ndarray) – Area for sprawl.

  • components (np.ndarray) – Core components as labeled array.

  • components_count (int) – Number of components.

  • neigh_arr (object) – Information about neighbourhood, shift array.

  • dist_arr (object) – Information about neighbourhood, distance array for shifted position.

  • distance_cache (np.ndarray, optional) – Cache array for reducing memory allocation. Shape of data_m, dtype is np.float64.

  • data_cache (np.ndarray, optional) – Cache array for reducing memory allocation. Shape of data_m, dtype is data_m.dtype (use np.uint8 instead of np.bool).

Returns:

Array with updated labels.

Return type:

np.ndarray

PartSegCore_compiled_backend.sprawl_utils.find_split.fdt_sprawl(data_m: ndarray, components: ndarray, components_count: int, neigh_arr, dist_arr, lower_bound, upper_bound, distance_cache=None, data_cache=None) ndarray

Calculate the FDT (Fuzzy Distance Transform) sprawl.

Parameters:
  • data_m (np.ndarray) – The sprawl area.

  • components (np.ndarray) – Core components as labeled array.

  • components_count (int) – Number of components.

  • neigh_arr (array-like) – Information about the neighborhood, shift array.

  • dist_arr (array-like) – Information about the neighborhood, distance array for shifted position.

  • lower_bound (float) – Lower bound for calculating the mu value.

  • upper_bound (float) – Upper bound for calculating the mu value.

  • distance_cache (np.ndarray, optional) – Cache array for reducing memory allocation. Shape of data_m, dtype is np.float64.

  • data_cache (np.ndarray, optional) – Cache array for reducing memory allocation. Shape of data_m, dtype is data_m.dtype (use np.uint8 instead of np.bool).

Returns:

Array with updated labels.

Return type:

np.ndarray

PartSegCore_compiled_backend.sprawl_utils.find_split.path_maximum_sprawl(data_f: ndarray, components: ndarray, components_count: int, neighbourhood: ndarray, distance_cache: ndarray | None = None, data_cache: ndarray | None = None) ndarray

Calculate sprawl in respect to brightness. Distance between voxels is the maximum brightness on all paths connecting them.

Parameters:
  • data_f (np.ndarray) – Array with brightness.

  • components (np.ndarray) – Core components as labeled array.

  • components_count (int) – Number of components.

  • neighbourhood (np.ndarray) – Information about neighbourhood, shift array.

  • distance_cache (np.ndarray, optional) – Cache array for reducing memory allocation. Shape of data_m, dtype is np.float64.

  • data_cache (np.ndarray, optional) – Cache array for reducing memory allocation. Shape of data_m, dtype is data_m.dtype (use np.uint8 instead of np.bool)

Returns:

Array with updated labels.

Return type:

np.ndarray

PartSegCore_compiled_backend.sprawl_utils.find_split.path_minimum_sprawl(data_f: ndarray, components: ndarray, components_count: int, neighbourhood: ndarray, distance_cache: ndarray | None = None, data_cache: ndarray | None = None) ndarray

Calculate sprawl in respect to brightness. Distance between voxels is the maximum brightness on all paths connecting them.

Parameters:
  • data_f (np.ndarray) – Array with brightness.

  • components (np.ndarray) – Core components as labeled array.

  • components_count (int) – Number of components.

  • neighbourhood (np.ndarray) – Information about neighbourhood, shift array.

  • distance_cache (np.ndarray, optional) – Cache array for reducing memory allocation. Shape of data_m, dtype is np.float64.

  • data_cache (np.ndarray, optional) – Cache array for reducing memory allocation. Shape of data_m, dtype is data_m.dtype (use np.uint8 instead of np.bool).

Returns:

Array with updated labels.

Return type:

np.ndarray

PartSegCore_compiled_backend.sprawl_utils.find_split.sprawl_component(data_m: ndarray, components: ndarray, component_number: int, neigh_arr: ndarray, dist_arr: ndarray, calculate_operator: Callable) ndarray

Calculate the sprawl for a single component.

Parameters:
  • data_m (np.ndarray) – The sprawl area.

  • components (np.ndarray) – Array of components.

  • component_number (int) – Chosen component number.

  • neigh_arr (np.ndarray) – Information about the neighborhood, shift array.

  • dist_arr (np.ndarray) – Information about the neighborhood, distance array for shifted position.

  • calculate_operator (Callable) – Function to be called to calculate sprawl.

Returns:

Array with updated labels.

Return type:

np.ndarray