R/reconstructImageFromPatches.R
reconstructImageFromPatches.Rd
Reconstruct image from a list of patches.
reconstructImageFromPatches( patches, domainImage, strideLength = 1, domainImageIsMask = FALSE )
patches | List or array of patches defining an image. Patches are assumed
to have the same format as returned by |
---|---|
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
|
domainImageIsMask | boolean specifying whether the domain image is a mask used to limit the region of reconstruction from the patches. |
an ANTs image.
Tustison NJ
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 2594286 138.6 4570014 244.1 NA 4570014 244.1 #> Vcells 7150046 54.6 14786712 112.9 65536 12254504 93.5#> used (Mb) gc trigger (Mb) limit (Mb) max used (Mb) #> Ncells 2592270 138.5 4570014 244.1 NA 4570014 244.1 #> Vcells 4588571 35.1 14786712 112.9 65536 12254504 93.5#> used (Mb) gc trigger (Mb) limit (Mb) max used (Mb) #> Ncells 2592264 138.5 4570014 244.1 NA 4570014 244.1 #> Vcells 4588597 35.1 14786712 112.9 65536 12254504 93.5