dacapo.experiments.tasks.predictors.affinities_predictor

Classes

AffinitiesPredictor

A predictor for generating affinity predictions from input data.

Module Contents

class dacapo.experiments.tasks.predictors.affinities_predictor.AffinitiesPredictor(neighborhood: List[funlib.geometry.Coordinate], lsds: bool = True, num_voxels: int = 20, downsample_lsds: int = 1, grow_boundary_iterations: int = 0, affs_weight_clipmin: float = 0.05, affs_weight_clipmax: float = 0.95, lsd_weight_clipmin: float = 0.05, lsd_weight_clipmax: float = 0.95, background_as_object: bool = False)

A predictor for generating affinity predictions from input data.

neighborhood

The neighborhood.

Type:

List[Coordinate]

lsds

Whether to compute local shape descriptors.

Type:

bool

num_voxels

The number of voxels.

Type:

int

downsample_lsds

The downsample rate for LSDs.

Type:

int

grow_boundary_iterations

The number of iterations to grow the boundary.

Type:

int

affs_weight_clipmin

The minimum weight for affinities.

Type:

float

affs_weight_clipmax

The maximum weight for affinities.

Type:

float

lsd_weight_clipmin

The minimum weight for LSDs.

Type:

float

lsd_weight_clipmax

The maximum weight for LSDs.

Type:

float

background_as_object

Whether to treat the background as an object.

Type:

bool

__init__(

self, neighborhood: List[Coordinate], lsds: bool = True, num_voxels: int = 20, downsample_lsds: int = 1, grow_boundary_iterations: int = 0, affs_weight_clipmin: float = 0.05, affs_weight_clipmax: float = 0.95, lsd_weight_clipmin: float = 0.05, lsd_weight_clipmax: float = 0.95, background_as_object: bool = False

)

Initializes the AffinitiesPredictor.

extractor(self, voxel_size)

Get the LSD extractor.

dims()

Get the number of dimensions.

sigma(self, voxel_size)

Compute the sigma value for LSD computation.

lsd_pad(self, voxel_size)

Compute the padding for LSD computation.

num_channels()

Get the number of channels.

create_model(self, architecture)

Create the model.

create_target(self, gt)

Create the target data.

_grow_boundaries(self, mask, slab)

Grow the boundaries of the mask.

create_weight(self, gt, target, mask, moving_class_counts=None)

Create the weight data.

gt_region_for_roi(self, target_spec)

Get the ground truth region for the target region of interest (ROI).

output_array_type()

Get the output array type.

Notes

This is a subclass of Predictor.

neighborhood
lsds
num_voxels
grow_boundary_iterations
affs_weight_clipmin
affs_weight_clipmax
lsd_weight_clipmin
lsd_weight_clipmax
background_as_object
extractor(voxel_size)

Get the LSD extractor.

Parameters:

voxel_size (Coordinate) – The voxel size.

Returns:

The LSD extractor.

Return type:

LsdExtractor

Raises:

NotImplementedError – This method is not implemented.

Examples

>>> extractor = predictor.extractor(voxel_size)
property dims
Get the number of dimensions.
Returns:

The number of dimensions.

Return type:

int

Raises:

NotImplementedError – This method is not implemented.

Examples

>>> predictor.dims
sigma(voxel_size)

Compute the sigma value for LSD computation.

Parameters:

voxel_size (Coordinate) – The voxel size.

Returns:

The sigma value.

Return type:

Coordinate

Raises:

NotImplementedError – This method is not implemented.

Examples

>>> predictor.sigma(voxel_size)
lsd_pad(voxel_size)

Compute the padding for LSD computation.

Parameters:

voxel_size (Coordinate) – The voxel size.

Returns:

The padding value.

Return type:

Coordinate

Raises:

NotImplementedError – This method is not implemented.

Examples

>>> predictor.lsd_pad(voxel_size)
property num_channels
Get the number of channels.
Returns:

The number of channels.

Return type:

int

Raises:

NotImplementedError – This method is not implemented.

Examples

>>> predictor.num_channels
create_model(architecture)

Create the model.

Parameters:

architecture – The architecture for the model.

Returns:

The created model.

Return type:

Model

Raises:

NotImplementedError – This method is not implemented.

Examples

>>> model = predictor.create_model(architecture)
create_target(gt)

Create the target data.

Parameters:

gt – The ground truth data.

Returns:

The created target data.

Return type:

NumpyArray

Raises:

NotImplementedError – This method is not implemented.

Examples

>>> predictor.create_target(gt)
create_weight(gt, target, mask, moving_class_counts=None)

Create the weight data.

Parameters:
  • gt – The ground truth data.

  • target – The target data.

  • mask – The mask data.

  • moving_class_counts – The moving class counts.

Returns:

The created weight data and moving class counts.

Return type:

Tuple[NumpyArray, Tuple]

Raises:

NotImplementedError – This method is not implemented.

Examples

>>> predictor.create_weight(gt, target, mask, moving_class_counts)
gt_region_for_roi(target_spec)

Get the ground truth region for the target region of interest (ROI).

Parameters:

target_spec – The target region of interest (ROI) specification.

Returns:

The ground truth region specification.

Raises:

NotImplementedError – This method is not implemented.

property output_array_type
Get the output array type.
Returns:

The output array type.

Return type:

EmbeddingArray

Raises:

NotImplementedError – This method is not implemented.

Examples

>>> predictor.output_array_type