Transfrom MNI mask to native space using fmriprep output

Dear Neurostars community,

I am trying to transform a binary ROI mask in MNI space to native space using the fmriprep outputs.
I recently followed this post:

I am using spyder 5.1.5 with Python 3.8 and this is the code:

#%% Import modules
import nipype
from nipype.interfaces.ants import ApplyTransforms

at = ApplyTransforms()
at.inputs.input_image = “E:/ERDeg/BIDS/loris_berlin_project/ROIs/occ_cortex.nii”
at.inputs.reference_image = “E:/ERDeg/BIDS/loris_berlin_project/derivatives/fmriprep/sub-
3000/anat/sub-3000_desc-preproc_T1w.nii”
at.inputs.output_image = “E:/ERDeg/BIDS/loris_berlin_project/ROIs/tempFILEINNATIVE.nii”
at.inputs.transforms = “E:/ERDeg/BIDS/loris_berlin_project/derivatives/fmriprep/sub-3000/anat/sub-3000_from-MNI152NLin2009cAsym_to-T1w_mode-image_xfm.h5”
at.inputs.default_value = 0
at.inputs.dimension = 3
at.inputs.float = False
at.inputs.interpolation = ‘Linear’
at.cmdline
at.run()

Here, input_image is the mask in MNI space (“occ_cortex.nii”), reference_image is the “desc-preproc_T1W” of the subject, output_image is the name of the new ROI, and I guess that input_transforms are the coordinate to transform from MNI to native space, a file which is found in the “anat” folder.

However, I get this error: OSError: No command “antsApplyTransforms” found on host DESKTOP-0KTFB22. Please check that the corresponding package is installed.

Can anyone kindly suggest me what I do wrong here please?
Many thanks

Lollo

If I were to guess, these python commands are simply wrappers that create terminal commands. And in your local terminal you do not have ANTs installed. Try installing ants and run again. If you have the fmriprep singularity image, you can also enter a terminal with all the fmriprep dependencies including ANTs by running singularity shell $img. Hope this helps.

Steven

1 Like

Hi Steven,

Thank you for your reply. How stupid, of course! I am now using the Ubuntu terminal in which I installed ANTs and call straight away the function from there. I think it is faster.

Thank you
Loris

1 Like