neuro_morpho.model.tiler

Image tiling and stitching.

Classes

Tiler

Image tiling and stitching.

Module Contents

class neuro_morpho.model.tiler.Tiler(tile_size: int = 512, tile_assembly: str = 'nn', x_coords: numpy.ndarray | None = None, y_coords: numpy.ndarray | None = None, nearest_map: numpy.ndarray | None = None)[source]

Image tiling and stitching.

This class provides methods for tiling an image into smaller patches and stitching them back together.

tile_size = 512
tile_assembly = 'nn'
x_coords
y_coords
get_tiling_attributes(image_size)[source]

Calculate the tiling attributes based on the image size.

This method calculates the x and y coordinates of the tiles and the nearest neighbor map if the tile assembly method is ‘nn’.

Parameters:

image_size (tuple[int, int]) – The size of the image.

extend_image_shape(orig_image: numpy.ndarray) tuple[numpy.ndarray, tuple[int, int]][source]

Create image with extended size to fit the tile size.

This method calculates models the distribution of noise/background as a gaussian and creates extended with pixels’ greylevels distributed in the same manner.

Parameters:

orig_image (np.ndarray) – Original image.

tile_image(image: numpy.ndarray) numpy.ndarray[source]

Tile an image into smaller patches.

Parameters:

image (np.ndarray) – The input image.

Returns:

An array of tiles.

Return type:

np.ndarray