dacapo.blockwise.watershed_function

Functions

segment_function(input_array, block, offsets, bias)

Segment the input array using the multicut watershed algorithm.

Module Contents

dacapo.blockwise.watershed_function.segment_function(input_array, block, offsets, bias)

Segment the input array using the multicut watershed algorithm.

Parameters:
  • input_array (np.ndarray) – The input array.

  • block (daisy.Block) – The block to be processed.

  • offsets (List[Tuple[int]]) – The offsets.

  • bias (float) – The bias.

Returns:

The segmented array.

Return type:

np.ndarray

Examples

>>> input_array = np.random.rand(128, 128, 128)
>>> total_roi = daisy.Roi((0, 0, 0), (128, 128, 128))
>>> read_roi = daisy.Roi((0, 0, 0), (64, 64, 64))
>>> write_roi = daisy.Roi((0, 0, 0), (32, 32, 32))
>>> block_id = 0
>>> task_id = "task_id"
>>> block = daisy.Block(total_roi, read_roi, write_roi, block_id, task_id)
>>> offsets = [(0, 1, 0), (1, 0, 0), (0, 0, 1)]
>>> bias = 0.1
>>> segmentation = segment_function(input_array, block, offsets, bias)

Note

DGA: had to add in flatten and reshape since remap (in particular indices) didn’t seem to work with ndarrays for the input