ants.deeplearn.reconstruct_image_from_patches

reconstruct_image_from_patches(patches, domain_image, stride_length=1, domain_image_is_mask=False)[source]

Reconstruct image from a list of patches.

Parameters:
  • patches (list or numpy.ndarray of patches) – List or array of patches defining an image. Patches are assumed to have the same format as returned by extract_image_patches.

  • domain_image (ANTs image) – Image or mask to define the geometric information of the reconstructed image. If this is a mask image, the reconstruction will only use patches in the mask.

  • stride_length (int or typing.Tuple) – Defines the sequential patch overlap for max_number_of_patches = “all”. Can be a image-dimensional vector or a scalar.

  • domain_image_is_mask (bool) – Boolean specifying whether the domain image is a mask used to limit the region of reconstruction from the patches.

Return type:

An ANTs image.

Example

>>> import ants
>>> image = ants.image_read(ants.get_ants_data('r16'))
>>> image_patches = extract_image_patches(image, patch_size=(16, 16), stride_length=4)
>>> reconstructed_image = reconstruct_image_from_patches(image_patches, image, stride_length=4)