dacapo.experiments.tasks.post_processors.watershed_post_processor

Classes

WatershedPostProcessor

A post-processor that applies a watershed transformation to the

Module Contents

class dacapo.experiments.tasks.post_processors.watershed_post_processor.WatershedPostProcessor(offsets: List[funlib.geometry.Coordinate])

A post-processor that applies a watershed transformation to the prediction.

offsets

List of offsets for the watershed transformation.

enumerate_parameters()

Enumerate all possible parameters of this post-processor.

set_prediction()

Set the prediction array.

process()

Process the prediction with the given parameters.

Note

This post-processor uses the watershed_function.py script to apply the watershed transformation. The offsets are used to define the neighborhood for the watershed transformation.

offsets
enumerate_parameters()

Enumerate all possible parameters of this post-processor. Should return instances of PostProcessorParameters.

Returns:

A generator of parameters.

Return type:

Generator[WatershedPostProcessorParameters]

Raises:

NotImplementedError – If the method is not implemented.

Examples

>>> for parameters in post_processor.enumerate_parameters():
...     print(parameters)

Note

This method should be implemented by the subclass. It should return a generator of instances of WatershedPostProcessorParameters.

set_prediction(prediction_array_identifier)

Set the prediction array identifier.

Parameters:

prediction_array_identifier – The identifier of the array containing the model’s prediction.

Raises:

NotImplementedError – If the method is not implemented in the subclass.

Examples

>>> post_processor = MyPostProcessor()
>>> post_processor.set_prediction("prediction")

Note

This method must be implemented in the subclass. It should set the prediction_array_identifier attribute.

process(parameters: dacapo.experiments.tasks.post_processors.watershed_post_processor_parameters.WatershedPostProcessorParameters, output_array_identifier: dacapo.store.array_store.LocalArrayIdentifier, num_workers: int = 16, block_size: funlib.geometry.Coordinate = Coordinate((256, 256, 256)))

Process the prediction with the given parameters.

Parameters:
  • parameters (WatershedPostProcessorParameters) – The parameters to use for processing.

  • output_array_identifier (LocalArrayIdentifier) – The output array identifier.

  • num_workers (int) – The number of workers to use for processing.

  • block_size (Coordinate) – The block size to use for processing.

Returns:

The output array identifier.

Return type:

LocalArrayIdentifier

Raises:

NotImplementedError – If the method is not implemented.

Examples

>>> post_processor.process(parameters, output_array_identifier)

Note

This method should be implemented by the subclass. To run the watershed transformation, the method uses the segment_blockwise function from the dacapo.blockwise.scheduler module.