abpN4: MR image bias correction based on the N4 algorithm.

View source: R/abpN4.R

abpN4R Documentation

MR image bias correction based on the N4 algorithm.

Description

Truncate outlier intensities and bias correct with the N4 algorithm.

Usage

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(s)

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)


stnava/ANTsR documentation built on April 16, 2024, 12:17 a.m.