Skip to content

Fixed Patching

Source

A module for a fixed coordinate patching strategy, useful for validation.

FixedPatching

Patching strategy that returns patches from a fixed sequence.

Implements the PatchingStrategy protocol.

Parameters:

  • fixed_patch_specs (Sequence[PatchSpecs]) –

    Sequence of patch specifications to return in order.

n_patches property

Number of patches; max index for get_patch_spec.

Returns:

  • int

    Length of the fixed patch specs sequence.

__init__(fixed_patch_specs)

Constructor.

Parameters:

get_patch_indices(data_idx)

Return all patch indices belonging to a specific image_stack.

Each image_stack corresponds to a given data_idx.

Parameters:

  • data_idx (int) –

    An index that corresponds to a given image_stack.

Returns:

  • sequence of int

    A sequence of patch indices belonging to a particular image_stack that can be used to index the CAREamicsDataset.

get_patch_spec(index)

Return the patch specs for a given index.

Parameters:

  • index (int) –

    A patch index.

Returns:

  • PatchSpecs

    A dictionary that specifies a single patch in a series of ImageStacks.