Skip to content

Tiled Patching

Source

Tiling patching strategy.

TiledPatching

Patching strategy used to extract overlapping tiles from an image.

The tiling strategy should be used for prediction. The get_patch_specs method returns TileSpec dictionaries that contains information on how to stitch the tiles back together to create the full image.

Parameters:

  • data_shapes (sequence of (sequence of int)) –

    Shapes of the underlying data (axes SC(Z)YX).

  • patch_size (sequence of int) –

    Tile size per spatial dimension (length 2 or 3).

  • overlaps (sequence of int) –

    Overlap with adjacent tiles per spatial dimension.

n_patches property

The number of patches that this patching strategy will return.

It also determines the maximum index that can be given to get_patch_spec.

Returns:

  • int

    Number of patches.

__init__(data_shapes, patch_size, overlaps)

Constructor.

Parameters:

  • data_shapes (sequence of (sequence of int)) –

    The shapes of the underlying data. Each element is the dimension of the axes SC(Z)YX.

  • patch_size (sequence of int) –

    The size of the tile. The sequence will have length 2 or 3, for 2D and 3D data respectively.

  • overlaps (sequence of int) –

    How much a tile will overlap with adjacent tiles in each spatial dimension.

get_patch_indices(data_idx)

Get the patch indices will return patches for a specific image_stack.

The image_stack corresponds to the 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, that when used to index the CAREamicsDataset will return a patch that comes from theimage_stackcorresponding to the givendata_idx`.

get_patch_spec(index)

Return the tile specs for a given index.

Parameters:

  • index (int) –

    A patch index.

Returns:

  • TileSpecs

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