dacapo.gp.copy

Classes

CopyMask

A class to copy a mask into a new key with the option to drop channels via max collapse.

Module Contents

class dacapo.gp.copy.CopyMask(array_key: gunpowder.ArrayKey, copy_key: gunpowder.ArrayKey, drop_channels: bool = False)

A class to copy a mask into a new key with the option to drop channels via max collapse.

array_key

Original key of the array from where the mask will be copied.

Type:

gp.ArrayKey

copy_key

New key where the copied mask will reside.

Type:

gp.ArrayKey

drop_channels

If True, channels will be dropped via a max collapse.

Type:

bool

setup()

Sets up the filter by enabling autoskip and providing the copied key.

prepare()

Prepares the filter by copying the request of copy_key into a dependency.

process()

Processes the batch by copying the mask from the array_key to the copy_key.

Note

This class is a subclass of gunpowder.BatchFilter and is used to copy a mask into a new key with the option to drop channels via max collapse.

array_key
copy_key
drop_channels
setup()

Sets up the filter by enabling autoskip and providing the copied key.

Raises:

RuntimeError – If the key is already provided.

Examples

>>> copy_mask.setup()
prepare(request)

Prepares the filter by copying the request of copy_key into a dependency.

Parameters:

request – The request to prepare.

Returns:

The prepared dependencies.

Return type:

deps

Raises:

NotImplementedError – If the copy_key is not provided.

Examples

>>> request = gp.BatchRequest()
>>> request[self.copy_key] = gp.ArraySpec(roi=gp.Roi((0, 0, 0), (1, 1, 1)))
>>> copy_mask.prepare(request)
process(batch, request)

Processes the batch by copying the mask from the array_key to the copy_key.

If “drop_channels” attribute is True, it performs max collapse.

Parameters:
  • batch – The batch to process.

  • request – The request for processing.

Returns:

The processed outputs.

Return type:

outputs

Raises:

KeyError – If the requested key is not in the request.

Examples

>>> request = gp.BatchRequest()
>>> request[gp.ArrayKey("ARRAY")] = gp.ArraySpec(roi=gp.Roi((0, 0, 0), (1, 1, 1)))
>>> copy_mask.process(batch, request)