AFNI version info (afni -ver
): Precompiled binary linux_ubuntu_16_64: Dec 2 2022 (Version AFNI_22.3.07 'Lucius Verus')
Hello,
I am working with some legacy data where two gradient echo images were acquired for distortion correction. The B-field is created using this command:
#Compute the delta phase (radians) per second map
3dcalc -a IQ_Short_TE+orig[0] \
-b IQ_Short_TE+orig[1] \
-c IQ_Long_TE+orig[0] \
-d IQ_Long_TE+orig[1] \
-e MASK+orig \
-prefix BField \
-expr "e * atan2( (c*b-a*d)/(c*c+d*d), (a*c+b*d)/(c*c+d*d) ) / ($DELTATE)"
where IQ_Short_TE is the gradient echo image with the shorter TE, IQ_Long_TE is the gradient echo image with the longer TE, and DELTATE is the difference between the long and short TE. If anyone is interested, I uploaded the full in-house script here. The script uses this fugue
command for the distortion correction:
fugue -i EPI.nii.gz --dwell=0.000524 --asym=1 --loadfmap=BFieldMasked.nii.gz --unwarpdir=y- --poly=3 -v -u epi_Bcorrect
I want stick with AFNI for the distortion correction. I found this post distortion correction using field maps in AFNI - #4 by roopchansinghv. Since I have a B-field in radians per second, could I just follow these steps to perform the distortion correction? I believe the phase encoding direction for the functional images is posterior to anterior. Here are the commands I plan on trying:
# # Convert rad/s to Hz
3dcalc -a ${fmaprads} -expr 'a * 1/(2*PI)' -prefix fmapInHz.nii.gz -datum float
# # Scale the frequency map
3dcalc -a fmapInHz.nii.gz -expr 'a * '${dwell}' * '${fov} -prefix fmapInHz_scaled.nii.gz -datum float
## smooth frequency map
3dmerge -1blur_sigma 9 -doall -datum float -prefix fmapInHz-smoothed-scaled.nii.gz fmapInHz_scaled.nii.gz
# Distort scaled field map in phase encoding direction (A >> P)
3dNwarpApply -warp AP:1:fmapInHz-smoothed-scaled.nii.gz -prefix fmapInHz-smoothed-scaled_warp2epi.nii.gz -source fmapInHz-smoothed-scaled.nii.gz
# Unwarp EPI using warped field map (unwarp direction: -y)
3dNwarpApply -warp AP:-1:fmapInHz-smoothed-scaled_warp2epi.nii.gz -prefix func_corrected.nii.gz -source func.nii.gz