reconstructImageFromPatches.RdReconstruct image from a list of patches.
reconstructImageFromPatches(
patches,
domainImage,
strideLength = 1,
domainImageIsMask = FALSE
)List or array of patches defining an image. Patches are assumed
to have the same format as returned by extractImagePatches.
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.
Defines the sequential patch overlap for
maxNumberOfPatches = all. Can be a image-dimensional vector or a scalar.
boolean specifying whether the domain image is a mask used to limit the region of reconstruction from the patches.
an ANTs image.
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 4320340 230.8 6681702 356.9 NA 6681702 356.9
#> Vcells 9862331 75.3 16551593 126.3 102400 16551592 126.3
rm(patchSet); gc()
#> used (Mb) gc trigger (Mb) limit (Mb) max used (Mb)
#> Ncells 4318301 230.7 6681702 356.9 NA 6681702 356.9
#> Vcells 7300826 55.8 16551593 126.3 102400 16551592 126.3
rm(imageReconstructed); gc()
#> used (Mb) gc trigger (Mb) limit (Mb) max used (Mb)
#> Ncells 4318293 230.7 6681702 356.9 NA 6681702 356.9
#> Vcells 7300849 55.8 16551593 126.3 102400 16551592 126.3