ERROR when running dwibiascorrect: Could not find ANTS program N4BiasFieldCorrection

Hi everyone,

I’ve been met an issue with dwibiascorrect -ants while processing a diffusion MRI data. Has anyone encountered the same problem? My personal computer system is macOS 10.14.6 on Macbook Pro 2015, with FSL version 6.0, and installed the newest version of MRtrix3 a month ago.

The command I’ve been trying to use is:
dwibiascorrect -ants dwi_denoised_unringed_preproc.mif dwi_denoised_unringed_preproc_unbiased.mif

Here’s the error message:

JallysondeMBP:006_control Jallyson$ dwibiascorrect -ants dwi_denoised_unringed_preproc.mif dwi_denoised_unringed_preproc_unbiased.mif


dwibiascorrect: Note that this script makes use of commands / algorithms that have relevant articles for citation; INCLUDING FROM EXTERNAL SOFTWARE PACKAGES. Please consult the help page (-help option) for more information.


dwibiascorrect: **[ERROR] Could not find ANTS program N4BiasFieldCorrection; please check installation**

When I use help option in the terminal, it returns below, does it mean there is nothing wrong with my MRtrix installation?

JallysondeMacBook-Pro:~ Jallyson$ dwibiascorrect
MRtrix cac05b6f dwibiascorrect   bin version: cac05b6f
dwibiascorrect: Script using the MRtrix3 Python library
     Perform B1 field inhomogeneity correction for a DWI volume series
     dwibiascorrect [ options ] input output
        input        The input image series to be corrected
        output       The output corrected image series
Options for the dwibiascorrect script
  -mask MASK
     Manually provide a mask image for bias field estimation
  -bias BIAS
     Output the estimated bias field
     Use ANTS N4 to estimate the inhomogeneity field

Could you help me to deal with the problem?


Did you check whether N4BiasFieldCorrection works on itself by applying it directly to an image?
As dwibiascorrect calls ANTs N4 correction I would first try to check that ANTs is correctly installed (with also the $ANTSPATH variable set and added to your $PATH)

Kind regards,


Thank you! I have installed N4BiasFieldCorrection correctly, but I have a problem to add to my PATH. Could you help me to write a code to add the path? My computer is macOS.

You add ANTs to your path to your bash_profile the following way.

export ANTSPATH=/(yourpathtoants)/ANTs/bin