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
)

Arguments

img

antsImage to be approximated / painted

paintMask

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.

imageList

a list containing antsImages

featureRadius

- radius of image neighborhood e.g. 2

scaleInpaintIntensity

- brighter or darker painted voxels, default of 0 sets this parameter automatically

sharpen

- sharpen the approximated image

feather

- value (e.g. 1) that helps feather the mask for smooth blending

predalgorithm

- string svm or lm

debug

- TRUE or FALSE

Value

inpainted image

Author

Brian B. Avants

Examples


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]]))