ANTs brain extraction

Hello,

I have recently installed ANTs and was planning on running brain extraction. But needed to set my Path first, what commands could I use on Linux terminal using tcsh?

I attempted the following command:

set path= (/path/to/home/bin/ants/bin path)
set path ANTSPATH= /path/to/home/bin/ants/bin

But received an error message when I ran antsBrainExtraction.sh.

thanks!

Ahoi hoi @ihashi3,

how did you install ANTs? Via a pre-built package or did you compile it
from source?

Maybe try something like this:

export PATH=/path/to/antsbin/bin:$PATH
export ANTSPATH=/path/to/antsbin/bin/ 

Could you maybe include the complete error message, as this helps folks here understanding the problem better!?

HTH, best, Peer

P.S.: Just a small add on, but could you maybe include tags in all further posts, as this allows for better documentation, indexing and searches, as well as pointing experts, that will most likely be able to help you, into the direction of your question.

Hello @PeerHerholz

Thank you for your help, I really appreciate it!

I compiled from git hub: https://github.com/ANTsX/ANTs/wiki/Compiling-ANTs-on-Linux-and-Mac-OS

I’m having problems setting the path for ANTs using tcsh script, when I use the following commands I receive an error message:

~/bin/ants> setenv ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS

~/bin/ants> export ANTSPATH=${HOME}/bin/ants/bin/

export: Command not found.

~/bin/ants> export PATH=${ANTSPATH}:$PATH

ANTSPATH: Undefined variable.

Any suggestions on how I could change the command for tcsh script?

I’m new to Neurostar. How can I add in tags for different software?

Thank you!

ihashi3

Hey @ihashi3,

no biggie. Hm, I haven’t seen a tcsh shell in a while.
Sorry for my misleading answer, export is a bash shell thingy.

Something in the line of this could work:
setenv ANTS_HOME /path/to/ants
setenv PATH ${PATH}:${ANTS_HOME}/bin

You should be able check it with:
echo $ANTS_HOME
or e.g.
which antsRegistration

BTW: any particular reason you can’t use a bash shell?

HTH, best, Peer

P.S.: creating a new topic on neurostars, you can set tags beneath the section where you type the title

Hello @PeerHerholz,

Thank you so much!!! I was able to export ANTs, and my terminal now recognizes its commands! I really appreciate it.

I’m not able to use bash shell, because I had AFNI installed on my system which requires a tcsh shell. So I had to change from bash to tcsh.

For running different scripts of ANTs, such as Brain Extraction, I copied all the scripts to the ants folder in bin. Do I have to modify the scripts for them to run through commands in terminal?

When I type in antsBrainExtraction.sh, I receive the following message:

we can’t find the N4 program – does not seem to exist. please (re)define $ANTSPATH in your environment.

How can I add in the scripts into the $ANTSPATH?

Thank you so much!
Best,
ihashi3

Hi @ihashi3,

I’m truly sorry for the late response.

Fair enough. However, even though AFNI might need tcsh “under the hood”, you can still use bash in your all day life (no tcsh hate, just saying). Just include export PATH=/path/to/afni/bin:$PATH in your .bashrc or .bash_profile file.

While you’re working on your .bashrc or .bash_profile file, also include
export PATH=/path/to/antsbin/bin:$PATH
export ANTSPATH=/path/to/antsbin/bin/

That should enable you to extract some brains with ANTs and use AFNI.

HTH, best, Peer

Hello @PeerHerholz,

Thank you so much! I ran ANTs using the bash terminal. It now recognizes antsBrainExtraction. Thank you so much for your help, I really appreciate it!

Best,
ihashi3

Hi @ihashi3,

sure thing, no biggie. Glad it worked.
HF with your analyses!

Best, Peer

Thanks @PeerHerholz!