exemplarInpainting.Rd
Employs a robust regression approach to learn the relationship between a sample image and a list of images that are mapped to the same space as the sample image. The regression uses data from an image neighborhood.
exemplarInpainting(
img,
paintMask,
imageList,
featureRadius = 2,
scaleInpaintIntensity = 0,
sharpen = FALSE,
feather = 1,
predalgorithm = "lm",
debug = FALSE
)
antsImage to be approximated / painted
painting mask with values 1 or values 1 and 2 - if there is a 2 then it will learn from label 1 to paint label 2. should cover the brain.
a list containing antsImages
- radius of image neighborhood e.g. 2
- brighter or darker painted voxels, default of 0 sets this parameter automatically
- sharpen the approximated image
- value (e.g. 1) that helps feather the mask for smooth blending
- string svm or lm
- TRUE or FALSE
inpainted image
set.seed(123)
fi <- abs(replicate(100, rnorm(100)))
fi[1:10, ] <- fi[, 1:10] <- fi[91:100, ] <- fi[, 91:100] <- 0
mask <- fi
mask[mask > 0] <- 1
mask2 <- mask
mask2[11:20, 11:20] <- 2
mask <- as.antsImage(mask, "float")
fi <- as.antsImage(fi, "float")
fi <- smoothImage(fi, 3)
mo <- as.antsImage(replicate(100, rnorm(100)), "float")
mo2 <- as.antsImage(replicate(100, rnorm(100)), "float")
ilist <- list(mo, mo2)
painted <- exemplarInpainting(fi, mask, ilist)
mask2 <- as.antsImage(mask2, "float")
painted2 <- exemplarInpainting(fi, mask2, ilist)
# just use 1 image, so no regression is performed
painted3 <- exemplarInpainting(fi, mask2, list(ilist[[1]]))