Perform Bias Field Correction on the given image

n4BiasFieldCorrection(img, mask = NA, shrinkFactor = 4,
  convergence = list(iters = c(50, 50, 50, 50), tol = 1e-07),
  splineParam = 200, returnBiasField = FALSE, verbose = FALSE,
  weight_mask = NULL)

Arguments

img

input antsImage

mask

input mask, if one is not passed one will be made

shrinkFactor

Shrink factor for multi-resolution correction, typically integer less than 4

convergence

List of: iters, vector of maximum number of iterations for each shrinkage factor, and tol, the convergence tolerance.

splineParam

Parameter controlling number of control points in spline. Either single value, indicating how many control points, or vector with one entry per dimension of image, indicating the spacing in each direction.

returnBiasField

bool, return the field instead of the corrected image.

verbose

enables verbose output.

weight_mask

antsImage of weight mask

Value

outimg Bias-corrected image

Examples

dims = c(50, 50) img<-makeImage(imagesize = dims, rnorm(prod(dims)) ) n4img<-n4BiasFieldCorrection(img) testthat::expect_error(n4BiasFieldCorrection(img, weight_mask = "somepath")) testthat::expect_error(n4BiasFieldCorrection(img, splineParam = rep(200, 3))) n4img<-n4BiasFieldCorrection(img, splineParam = c(200, 20))