Skip to content

Instantly share code, notes, and snippets.

@tsalo
Last active March 28, 2022 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsalo/f9f38e9aba901e99ddb720465bb5222b to your computer and use it in GitHub Desktop.
Save tsalo/f9f38e9aba901e99ddb720465bb5222b to your computer and use it in GitHub Desktop.
Warp native-space tedana derivatives to standard space with fMRIPrep transforms.
# First, let's define some paths to the fMRIPrep and tedana outputs
fmriprep_dir="/path/to/fmriprep/derivatives/of/subject"
tedana_dir="/path/to/tedana/derivatives"
# Result of denoising the scanner-space multi-echo data with tedana
file_to_warp="${tedana_dir}/sub-01_task-rest_desc-optcomDenoised_bold.nii.gz"
# Name of the standard-space denoised data file to be written out
out_file="${tedana_dir}/sub-01_task-rest_space-MNI152NLin2009cAsym_desc-optcomDenoised_bold.nii.gz"
# An existing standard-space
standard_space_file="${fmriprep_dir}/func/sub-01_task-rest_space-MNI152NLin2009cAsym_boldref.nii.gz"
# Transforms
xform_native_to_t1w="${fmriprep_dir}/func/sub-01_task-rest_from-scanner_to-T1w_mode-image_xfm.txt"
xform_t1w_to_std="${fmriprep_dir}/anat/sub-01_from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5"
antsApplyTransforms \
-e 3 \
-i ${file_to_warp} \
-r ${standard_space_file} \
-o ${out_file} \
-n LanczosWindowedSinc \
-t ${xform_native_to_t1w} \
${xform_t1w_to_std}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment