Truncate outlier intensities and bias correct with the N4 algorithm.

abpN4(
  img,
  intensityTruncation = c(0.025, 0.975, 256),
  mask,
  usen3 = FALSE,
  ...
)

Arguments

img

image to be bias corrected

intensityTruncation

quantiles for image truncation.

mask

optional antsImage mask

usen3

Use N3 algorithm instead of N4

...

additional arguments to pass to n4BiasFieldCorrection

Value

outputs a bias corrected image. 1 indicates failure.

Author

Tustison N, Avants BB

Examples


img <- antsImageRead(getANTsRData("r16"))
img2 <- abpN4(img)
img3 <- abpN4(img)
testthat::expect_equal(mean(img2), 82.6, tolerance = 1e-2)
testthat::expect_equal(img2, img3)