Skip to content

Commit

Permalink
fix for 7T grad correction, and bedpost # of files
Browse files Browse the repository at this point in the history
  • Loading branch information
akhanf committed May 31, 2018
1 parent 1462710 commit 9922079
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 20 deletions.
33 changes: 33 additions & 0 deletions Singularity.0.0.7g
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Bootstrap: shub
From: khanlab/neuroglia-dwi:v1.3.1


%labels
Maintainer "Ali Khan"

#########
%setup
#########
mkdir -p $SINGULARITY_ROOTFS/opt/prepdwi
cp -Rv . $SINGULARITY_ROOTFS/opt/prepdwi


#########
%post
#########


echo addpath\(genpath\(\'/opt/prepdwi/octave\'\)\)\; >> /etc/octave.conf
apt-get install -y bc

#########
%environment
#########

export PATH=/opt/prepdwi/bin:$PATH

#########
%runscript
#########

exec /opt/prepdwi/prepdwi $@
16 changes: 1 addition & 15 deletions bin/importDWI
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

if [ "$#" -lt 4 ]
then
echo "Command-line Usage: $0 <out folder name - e.g. multiband or singleband> <number of dwi acquisitions> <input DWI blip 1 > <input DWI blip 2 > .. <subjid> <optional resample resolution>"
echo "Command-line Usage: $0 <out folder name - e.g. multiband or singleband> <number of dwi acquisitions> <input DWI blip 1 > <input DWI blip 2 > .. <subjid>"
exit 0
fi

Expand Down Expand Up @@ -38,13 +38,6 @@ done

subj=$1

resample_res=
if [ "$#" -gt 1 ]
then
resample_res=$2
fi





Expand Down Expand Up @@ -76,13 +69,6 @@ cp -v ${in_json[$i]} $uncorr_dir/dwi_$i.json
cp -v ${in_bvec[$i]} $uncorr_dir/dwi_$i.bvec
cp -v ${in_bval[$i]} $uncorr_dir/dwi_$i.bval

if [ -n "$resample_res" ]
then
echo "Resampling to isotropic resolution $resample_res"
echo mri_convert $uncorr_dir/dwi_$i.nii.gz $uncorr_dir/dwi_$i.nii.gz -vs $resample_res $resample_res $resample_res
mri_convert $uncorr_dir/dwi_$i.nii.gz $uncorr_dir/dwi_$i.nii.gz -vs $resample_res $resample_res $resample_res
fi


done

Expand Down
20 changes: 17 additions & 3 deletions bin/processBedpost
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,14 @@ subj_dir=$output_dir/$subj
dwi_dir=$subj_dir/dwi/${in_dwi}
out_dir=$subj_dir/dwi/${out_name}


bedpost_data=$dwi_dir/bedpost
mkdir -p $bedpost_data
if [ -n "$scratch_dir" ] #if running on compute cluster, use scratch dir
then
bedpost_data=$scratch_dir/bedpost
else
bedpost_data=$dwi_dir/bedpost
fi

mkdir -p $bedpost_data

dwi_bvec=$dwi_dir/dwi.bvec
dwi_bval=$dwi_dir/dwi.bval
Expand Down Expand Up @@ -71,7 +76,16 @@ fslmaths $nodif_brain_mask -bin $nodif_brain_mask

bedpostx-parallel $bedpost_data/ -c -P $n_cpus $gradopt

#remove unneeded diff_slice files:
rm -rf $bedpost_data.bedpostX/diff_slices


if [ -n "$scratch_dir" ] #if running on compute cluster, use scratch dir
then
final_bedpost_data=$dwi_dir/bedpost
mv -v $bedpost_data $final_bedpost_data
mv -v $bedpost_data.bedpostX $final_bedpost_data.bedpostX
fi

done

Expand Down
5 changes: 3 additions & 2 deletions bin/processGradUnwarp
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,9 @@ if [ "$do_regT1" = 1 ]
then

#rotate bvec
echo rotate_bvecs $dwi_bvec $xfm_b0_t1 $out_dir/dwi.bvec
rotate_bvecs $dwi_bvec $xfm_b0_t1 $out_dir/dwi.bvec
echo octave --eval "rotate_bvecs_imgorient('$dwi_bvec','$xfm_b0_t1','$b0','$b0_t1_ref','$out_dir/dwi.bvec')"
octave --eval "rotate_bvecs_imgorient('$dwi_bvec','$xfm_b0_t1','$b0','$b0_t1_ref','$out_dir/dwi.bvec')"


else
cp -v $dwi_bvec $out_dir/dwi.bvec
Expand Down

0 comments on commit 9922079

Please sign in to comment.