Dear Jesper,
Thank you for your help! In the following, please find our
script. We have uploaded the data of one subject for which
the eddy_openmp did not work. As the FSL-server also did
not work, we made the dataset available at:
https://gigamove.rz.rwth-aachen.de/d/id/uCmzTWPBS2MeAo
Your help is greatly appreciated!
Best,
Theodor.
#!/bin/bash
my_ref="LS2003 LS3019"
for sbj in $my_ref
do
cd ${sbj}/unprocessed/3T/Diffusion/
echo "Extraction of b0..."
for i in {0..64..16}
do
fslroi ${sbj}_3T_DWI_dir81_LR_gdc ${sbj}_b0_LR_nr${i}
${i} 1
fslroi ${sbj}_3T_DWI_dir81_RL_gdc ${sbj}_b0_RL_nr${i}
${i} 1
done
echo "b0 merging..."
fslmerge -t ${sbj}_b0_merged ${sbj}_b0_LR_nr0
${sbj}_b0_LR_nr16 ${sbj}_b0_LR_nr32 ${sbj}_b0_LR_nr48
${sbj}_b0_LR_nr64 ${sbj}_b0_RL_nr0 ${sbj}_b0_RL_nr16
${sbj}_b0_RL_nr32 ${sbj}_b0_RL_nr48 ${sbj}_b0_RL_nr64
printf -- "-1 0 0 0.112\n-1 0 0 0.112\n-1 0 0 0.112\n-1 0
0 0.112\n-1 0 0 0.112\n1 0 0 0.112\n1 0 0 0.112\n1 0 0
0.112\n1 0 0 0.112\n1 0 0 0.112" > acqparms.txt
echo "Starting topup processing..."
topup --imain=${sbj}_b0_merged.nii.gz
--datain=acqparms.txt --out=${sbj}_b0_topup_results
--iout=${sbj}_b0_topup_corr
echo "Topup finished!"
echo "Merging data files..."
fslmerge -t ${sbj}_dir81_merged_LR_RL_gdc
${sbj}_3T_DWI_dir81_LR_gdc.nii.gz
${sbj}_3T_DWI_dir81_RL_gdc.nii.gz
echo "Merging txt files..."
rm eddy_param.txt
for i in {1..81}; do printf -- "1 " >> eddy_param.txt;
done
for i in {1..80}; do printf -- "6 " >> eddy_param.txt;
done; printf -- "6" >> eddy_param.txt
fslmaths ${sbj}_b0_topup_corr -Tmean
${sbj}_b0_topup_corr_mean
echo "Brain extracting topup results..."
bet ${sbj}_b0_topup_corr_mean ${sbj}_b0_topup_brain -m
perl -pe 'chomp if eof' ${sbj}_3T_DWI_dir81_LR.bval >
temp.bval
cat temp.bval ${sbj}_3T_DWI_dir81_RL.bval >
${sbj}_dir81_merged_LR_RL.bval
paste -d'\0' ${sbj}_3T_DWI_dir81_LR.bvec
${sbj}_3T_DWI_dir81_RL.bvec >
${sbj}_dir81_merged_LR_RL.bvec
echo "Starting eddy..."
eddy_openmp --imain=${sbj}_dir81_merged_LR_RL_gdc
--mask=${sbj}_b0_topup_brain_mask --acqp=acqparms.txt
--index=eddy_param.txt
--bvecs=${sbj}_dir81_merged_LR_RL.bvec
--bvals=${sbj}_dir81_merged_LR_RL.bval
--topup=${sbj}_b0_topup_results
--out=${sbj}_eddy_corr_data
echo "Eddy done for ${sbj}!"
cd ../../../../
done
echo "Done."
|