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 4288327 229.1 6338411 338.6 NA 6338411 338.6
#> Vcells 9815701 74.9 16439144 125.5 102400 16439144 125.5
rm(patchSet); gc()
#> used (Mb) gc trigger (Mb) limit (Mb) max used (Mb)
#> Ncells 4286300 229.0 6338411 338.6 NA 6338411 338.6
#> Vcells 7254216 55.4 16439144 125.5 102400 16439144 125.5
rm(imageReconstructed); gc()
#> used (Mb) gc trigger (Mb) limit (Mb) max used (Mb)
#> Ncells 4286292 229.0 6338411 338.6 NA 6338411 338.6
#> Vcells 7254239 55.4 16439144 125.5 102400 16439144 125.5