Hello,
I've been working on a Bash script to estimate motion for each frame in a 4D smoothed PET image using mcflirt, then apply each transformation matrix to an individual unsmoothed frame in subject space using flirt. My script is as appears below
cd $dir
##Just doing for one subject at first
for subj in CLBP001; do
SUV_dir=$dir/$subj/NII_PET_images/SUV_images
cd $SUV_dir
img="$subj"_no-mc_SUV_6mmsm.nii.gz
img_name=`basename $img .nii.gz`
#estimate motion in 4d image, write out MAT files
mcflirt -in $img -meanvol -mats -cost normmi
#assign transformation matrices to array
cd $SUV_dir/"$img_name"_mcf.mat
xforms=(`pwd`/MAT*)
#assign subject space frames to array
cd $SUV_dir/indiv_frames_MNI-SS
frames=(*MNI-SS*)
#iterate over each frame, applying that frame's transform matrix
for (( i=0; i<=${#frames}; i++ )); do
flirt -in ${frames[$i]} -ref ${frames[$i]} -applyxfm -init ${xforms[$i]} -out r_"${frames[$i]}"
done
The script appears to be working, but I always get several lines of warnings/errors at the end, saying "Unrecognised option r", which makes me somewhat uncomfortable.
Does anybody know why this is happening/able to help me figure out a way to rename my output volumes without getting an error?
Thanks!
Dan
|