Hi all,
I have a problem about alignment. Hopefully someone could help me.
I collected data from two separate days and the localizer runs were only scanned in the first day. Now I’m trying to align all the data together, including anat scans, epi scans and also the masks (created with the localizers and the anat image of the first day). Here are the code and steps that I’m using right now.
At first, I used freesurfer to generate an anat template. Then I aligned all the epi data to the template. I checked the aligned epi data visually. They looked really good. And then I tried to align the masks to the temple, too. Sadly, it failed. The mask couldn’t align to the template. What’s worse, different rois in the mask file overlapped with each other. I’m so confused that why the code could get a perfect alignment between the epi data and the template, but failed when I tried to align the masks to the template. Does anyone have any idea about how I can align the mask to the template correctly? Many thanks~
The code is as below:
outputdir=/Volumes/fMRI_Data/AFNI_PROCESSED_DATA/MP_RG_NewBlur/sub01.intersession
sessions=‘S01’
sessions_pre=‘/Users/sarah/AFNI_PROCESSED_DATA/MP_RG_NewBlur/’
filestotrans=‘New_mask_resample+orig.HEAD’
templatename=S01_TPL
######################################################################################
for session_name in $sessions
do
for file in $filestotrans
do
dirfile=${sessions_pre}${session_name}/$file
matrixfile=$outputdir/${session_name}al${templatename}mat.aff12.1D
phase_dist_mtfile=${sessions_pre}${session_name}/unWarpOutput${session_name}/03_${session_name}_MidWarped_Forward_WARP.nii.gz
# if there are phase inverted run to correct phase distortion, then we catenate the transforming matrix together
if [ -e $phase_dist_mtfile ]
then
3dNwarpApply -prefix $outputdir/DATA_al.$session_name.${file%+*} \
-nwarp "$matrixfile $phase_dist_mtfile" \
-source $dirfile -overwrite
else
3dAllineate -base $dirfile \
-input $dirfile \
-1Dmatrix_apply $matrixfile \
-prefix DATA_al.$session_name.${file%+*} -overwrite
fi
done
done
Many thanks,
Sarah