ANTS - dwibiascorrect

ERROR when running dwibiascorrect: Could not find ANTS program N4BiasFieldCorrection

thanks,
Rosella

I’m not sure what you’re asking here…? If you’ve encountered this issue, did the post you link to not provide enough information to fix the problem?

I am trying to clean some Spinal Cord data from artifacts. However, when applying dwibiascorrect command it gives me the following error : [ERROR when running dwibiascorrect: Could not find ANTS program N4BiasFieldCorrection
However, by typing which ANTs it returns a path, which means ANTs has been installed in my computer and thus cannot understand where the problem is.

The specific command that dwibiascorrect is looking for is N4BiasFieldCorrection, which is shipped with ANTs, but not necessarily in the path. I think the ANTs command might be inserted in the path by default, but not the rest (I’m not sure what it does, to be honest). If which N4BiasFieldCorrection returns something, then this would really be unexpected… But otherwise, you’ll need to make sure that particular command is in the path.

With which kind of command can I insert N4BiasFieldCorrection in the path?
Thank you,
Rosella

Hi Rosella,

Did you have any luck with the following kinds of commands?

You need to add these kinds of lines to your .bashrc file or .bash_profile, depending on what kind of system you use. In that way, these lines are run for you each time you open a terminal. Note that in the above example, you need to replace “yourpathtoants” by your path to ANTs.

Cheers,
Thijs

Hi ,
thank you for your answer. Unfortunately, I have already tried to use these commands without success.
Rosella

If this bit works, then you should know where ANTs is installed. Once you know that, navigate to this folder and explore the contents. My install dates back to 2015 or something, so maybe this isn’t relevant anymore, but I seem to not have a bin sub-folder; all relevant commands are directly in my ANTs installation folder. In any case, explore it, and look for a file / command called N4BiasFieldCorrection. That’s the one you need to locate. Once you’ve found that, just add the folder where it’s located in to your path with a command like the above. Don’t literally copy-paste command or even the /bin bit: use the folder that’s relevant for your system. I once compiled this one manually, if I remember well, and put it straight in my home folder; so e.g. in my case I’ve got a line in my .bashrc file looking like this:

export PATH=$PATH:~/ANTs.2.1.0.Debian-Ubuntu_X64
1 Like