AFNI version info (afni -ver): 24.0 Ubuntu
Hi everyone,
I've started working with 7T data and found that the command for resampling my EPI (resolution=1.5 mm3 isotropic) to T1 (resolution=0.7mm3 isotropic) is being killed due to the work station running out of memory. I don't think it's really necessary (or has real benefit) to resample the EPI to that high of a resolution. I've come up with two potential solutions and wanted to see which way I should go. Would appreciate any advice on this. If there is a 3rd better solution I'm all ears! Thanks so much.
The command that's being killed is 3dresample (following 3dAllineate)
3dAllineate -final 'wsinc5' -1Dmatrix_apply ${reg_dir}/example_func_al_mat.aff12.1D -prefix ${reg_dir}/rest_pp_highres_temp.nii.gz -input ${func_dir}/rest_pp.nii.gz
3dresample -master ${reg_dir}/highres.nii.gz -prefix ${reg_dir}/rest_pp_highres.nii.gz -inset ${reg_dir}/rest_pp_highres_temp.nii.gz
Option 1: downsample T1 to 1.5 mm3 and then 3dAllineate
# make a 1.5 mm T1 once
3dresample -inset ${reg_dir}/highres.nii.gz -dxyz 1.5 1.5 1.5 -prefix ${reg_dir}/highres_1p5.nii.gz
# apply EPI→T1 transform in one resample
3dAllineate \
-input ${func_dir}/rest_pp.nii.gz \
-1Dmatrix_apply ${reg_dir}/example_func_al_mat.aff12.1D \
-master ${reg_dir}/highres_1p5.nii.gz \
-final wsinc5 \
-prefix ${reg_dir}/rest_pp_inT1_1p5.nii.gz
Option 2: Just 3dAllineate with mast_dxyz
3dAllineate \
-input ${func_dir}/rest_pp.nii.gz \
-1Dmatrix_apply ${reg_dir}/example_func_al_mat.aff12.1D \
-master ${reg_dir}/highres.nii.gz \
-mast_dxyz 1.5 \
-final wsinc5 \
-prefix ${reg_dir}/rest_pp_inT1_1p5.nii.gz
Howdy-
In general, you want to minimize the number of times you resample/regrid your data during processing. For example, in afni_proc.py processing, individual alignment/registration steps are calculated (often generating a dataset that can be used to check how well that step went), but then the script concatenates those individual stages into one omnibus transformation to apply to the original EPI data, so that only one regridding of it is done (as opposed to a set of applications of regridding transformations at each step).
So, it might help to know whether this is part of a larger stream of processing, or a one-off task?
For the two options presented here, Option 1 does regridding twice: once before 3dAllineate, and once during it. That seems non-optimal. Option 2 only does regridding one, which is preferable.
-> However, if this is part of a larger processing stream, then this should really be thought of within the full context. Using afni_proc.py, for example, would help navigate these kinds of issues (as well as likely other similar methological ones).
--pt
Oh, and another thing, there is align_epi_anat.py, which is a wrapper for 3dAllineate that has some special options for dealing with EPI-anatomical alignment specifically. That is what afni_proc.py would use, for example.
In either case, typically we would recommend first using the "lpc+ZZ" cost function for EPI-anatomical alignment, because that is suited to finding alignment between datasets with differing/opposite tissue contrasts. This and other useful tips are covered in the AFNI Academy playlist on Alignment, which covers both general alignment and EPI-anatomical considerations, specifically (as well as motion and nonlinear registration to a template).
And for some FMRI processing and afni_proc.py tips, including some of these alignment considerations, there is this text:
- Reynolds RC, Glen DR, Chen G, Saad ZS, Cox RW, Taylor PA (2024). Processing, evaluating and understanding FMRI data with afni_proc.py. Imaging Neuroscience 2:1-52.
https://doi.org/10.1162/imag_a_00347
--pt