Reconstruct image from a list of patches.

reconstructImageFromPatches(
  patches,
  domainImage,
  strideLength = 1,
  domainImageIsMask = FALSE
)

Arguments

patches

List or array of patches defining an image. Patches are assumed to have the same format as returned by extractImagePatches.

domainImage

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.

strideLength

Defines the sequential patch overlap for maxNumberOfPatches = all. Can be a image-dimensional vector or a scalar.

domainImageIsMask

boolean specifying whether the domain image is a mask used to limit the region of reconstruction from the patches.

Value

an ANTs image.

Author

Tustison NJ

Examples


library( ANTsR )

image <- antsImageRead( getANTsRData( "r16" ) )
patchSet <- extractImagePatches( image, c( 64, 64 ), "all", c( 8, 8 ) )
imageReconstructed <-
  reconstructImageFromPatches( patchSet, image, c( 8, 8 ) )
testthat::expect_equal(as.array(image), as.array(imageReconstructed))
rm(image); gc()
#>            used  (Mb) gc trigger  (Mb) limit (Mb) max used  (Mb)
#> Ncells  4255375 227.3    7574517 404.6         NA  7574517 404.6
#> Vcells 15010091 114.6   27422428 209.3     102400 22785327 173.9
rm(patchSet); gc()
#>            used  (Mb) gc trigger  (Mb) limit (Mb) max used  (Mb)
#> Ncells  4253351 227.2    7574517 404.6         NA  7574517 404.6
#> Vcells 12448611  95.0   27422428 209.3     102400 22785327 173.9
rm(imageReconstructed); gc()
#>            used  (Mb) gc trigger  (Mb) limit (Mb) max used  (Mb)
#> Ncells  4253343 227.2    7574517 404.6         NA  7574517 404.6
#> Vcells 12448634  95.0   27422428 209.3     102400 22785327 173.9