antsApplyTransforms

ants
nilearn
nipype

#1

Dear All,
how should nipype antsApplyTransforms be used?
in jupyter i execute the command:

from nipype.interfaces.ants import ApplyTransforms
at = ApplyTransforms()
at.inputs.input_image = 'sub-Maryashina_task-resting_state_bold_space- 
MNI152NLin2009cAsym-preproc_Motor_sub01_component_ica_s1_.nii'
at.inputs.reference_image = 'sub-Maryashina_task-resting_state_bold_space- 
MNI152NLin2009cAsym-preproc_Motor_sub01_component_ica_s1_.nii'
at.inputs.output_image = '/home/Yarkin/transformed_T1w_preproc.nii'
at.inputs.transforms = ['sub-Maryashina_T1w_space-MNI152NLin2009cAsym_target- 
T1w_warp.h5']
print(at.cmdline)
at.run()

but it outputs, whats is a mistake?:

OSError: No command "antsApplyTransforms" found on host 693bba5d0d9e. Please 
check that the corresponding package is installed.

#2

Hi!

My first guess is that ants is not installed on the machine/environment you’re running nipype on. inside the jupyter notebook if you type in a cell !which antsApplyTransforms, I’m hypothesizing the output will be empty meaning your environment does not have access to ants commands.

Assumption: using mac or linux

The solution will be to install ants or through neurodebian, and then make sure the binaries (such as antsApplyTransforms) is accessible through your $PATH variable. (what’s a $PATH variable?)

Hope this helps!
James


#3

Der @jdkent, thanks for you reply. Is there an docker container of ants? can’t install it on windows.


#4

I do not know an official ants docker container, but one should be able to make one with neurodocker or manually making your own docker image one of the neurodebian images as a base

The dockerfile may look something like this:

FROM neurodebian:xenial

RUN apt-get update && \
         apt-get install -y --no-install-recommends ants

(or something like that, I’m pretty sure it’s neurodebian:xenial, not neurodebian/xenial)

But if you also like to run jupyter and nipype, you would need to install that too in the container (which means it may be easier to use neurodocker)