Our imaging team is running a pre-processing script on our imaging data, and we are getting the error message ""Could not open matrix file epi2anat.mat"
Here is what our script looks like:
#!/bin/tcsh
# This script does motion correction, field-map correction and registers the functional to the anatomical.
# To QC the results, you need to overlay coreg_slice_e2a over the anatomical image to make sure the alignment
# is good.
set rawDataDirectory = /Users/naiirlab/Documents/MRI_Raw_Data
set subjectsDirectory = /Users/naiirlab/Documents/MRI_Scan_Data
foreach subj ( TD004 )
echo
echo "Processing functional for ${subj}... "
echo
echo "Motion correction..."
cd ${subjectsDirectory}/${subj}/rest
mkdir motion
3dvolreg -zpad 4 -tshift 0 -base 90 \
-1Dmatrix_save motion/${subj}_vr -nomaxdisp -1Dfile motion/${subj}_vr_motion.1D \
-prefix ${subj}_resting_moco.nii.gz rest.nii.gz
echo
echo "Reorienting to LPI..."
cd ${subjectsDirectory}/${subj}
fslreorient2std ${subj}_resting_moco.nii.gz ${subj}_resting_moco_LPI
echo
echo "Coregistering EPI to anatomical..."
cd ${subjectsDirectory}/${subj}/rest
3dcalc -a ${subj}_resting_moco.nii.gz'[0]' -prefix coreg_slice.nii.gz -expr "a"
flirt -ref ${subjectsDirectory}/${subj}/anat/${subj}_anat_biascorr_brain.nii.gz -in coreg_slice.nii.gz -out coreg_slice_e2a.nii.gz -omat epi2anat.mat -cost corratio -dof 6 -interp trilinear
end
The above script creates the matrix file, but it defaults to a Matlab file with the suffix .mat. We have tried running it as a 1D file as well, but we still get the same result, that we cannot open the matrix file. So we are thinking that there is a problem in this step. How can we correct this?