Skip to content

Commit

Permalink
Merge pull request #96 from Washington-University/feature/freesurfer_…
Browse files Browse the repository at this point in the history
…v6_latest

Feature/freesurfer v6 latest
  • Loading branch information
tbbrown authored Mar 14, 2019
2 parents b19a32f + b5f94c5 commit f5704c9
Show file tree
Hide file tree
Showing 80 changed files with 13,441 additions and 8,641 deletions.
33 changes: 32 additions & 1 deletion DiffusionPreprocessing/DiffPreprocPipeline_Eddy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ PARAMETERs are: [ ] = optional; < > = user supplied value
--extra-eddy-arg=--verbose --extra-eddy-arg=T
will ultimately be translated to --verbose T when
passed to the eddy binary.
[--no-gpu] If specified, use the non-GPU-enabled version of eddy.
Defaults to using the GPU-enabled version of eddy.
[--cuda-version=X.Y] If using the GPU-enabled version of eddy, then this
option can be used to specify which eddy_cuda binary
version to use. If specified, FSLDIR/bin/eddy_cudaX.Y
will be used.
Return Status Value:
Expand Down Expand Up @@ -205,6 +211,11 @@ EOF
# ${ol_nstd_value} Value of user specified --ol_nstd= parameter
# ${extra_eddy_args} Value of user specified --extra-eddy-arg parameters, space
# separated tokens
# ${no_gpu} TRUE if we should use the non-GPU-enabled version of eddy
# Anything else or unset means use the GPU-enabled version of eddy
# ${cuda_version} If using the GPU-enabled version, this value _may_ be
# given to specify the version of the CUDA libraries in use.
#
#
get_options()
{
Expand All @@ -226,6 +237,8 @@ get_options()
resamp_value=""
unset ol_nstd_value
extra_eddy_args=""
no_gpu=""
cuda_version=""

# parse arguments
local index=0
Expand Down Expand Up @@ -325,6 +338,14 @@ get_options()
extra_eddy_args+=" ${extra_eddy_arg} "
index=$(( index + 1 ))
;;
--no-gpu)
no_gpu="TRUE"
index=$(( index + 1 ))
;;
--cuda-version=*)
cuda_version=${argument#*=}
index=$(( index + 1 ))
;;
*)
usage
echo "ERROR: Unrecognized Option: ${argument}"
Expand Down Expand Up @@ -372,6 +393,8 @@ get_options()
echo " resamp_value: ${resamp_value}"
echo " ol_nstd_value: ${ol_nstd_value}"
echo " extra_eddy_args: ${extra_eddy_args}"
echo " no_gpu: ${no_gpu}"
echo " cuda-version: ${cuda_version}"
echo "-- ${SCRIPT_NAME}: Specified Command-Line Parameters - End --"
}

Expand Down Expand Up @@ -484,7 +507,15 @@ main()
run_eddy_cmd+=" ${rms_option} "
run_eddy_cmd+=" ${ff_option} "
run_eddy_cmd+=" ${ol_nstd_value_option} "
run_eddy_cmd+=" -g "

if [ "${no_gpu}" != "TRUE" ]; then
# default is to use the GPU-enabled version
run_eddy_cmd+=" -g "
if [ ! -z "${cuda_version}" ]; then
run_eddy_cmd+=" --cuda-version=${cuda_version}"
fi
fi

run_eddy_cmd+=" -w ${outdir}/eddy "

if [ ! -z "${dont_peas}" ] ; then
Expand Down
1 change: 1 addition & 0 deletions DiffusionPreprocessing/scripts/DiffusionToStructural.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,6 @@ ${FSLDIR}/bin/fslmaths "$T1wOutputDirectory"/data -Tmean "$T1wOutputDirectory"/t
${FSLDIR}/bin/immv "$T1wOutputDirectory"/nodif_brain_mask.nii.gz "$T1wOutputDirectory"/nodif_brain_mask_old.nii.gz
${FSLDIR}/bin/fslmaths "$T1wOutputDirectory"/nodif_brain_mask_old.nii.gz -mas "$T1wOutputDirectory"/temp "$T1wOutputDirectory"/nodif_brain_mask
${FSLDIR}/bin/imrm "$T1wOutputDirectory"/temp
${FSLDIR}/bin/imrm "$T1wOutputDirectory"/nodif_brain_mask_old

echo " END: DiffusionToStructural"
19 changes: 9 additions & 10 deletions DiffusionPreprocessing/scripts/eddy_postproc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,24 @@ datadir=${workingdir}/data
# cp ${eddydir}/Pos.bvec ${datadir}/bvecs
# $FSLDIR/bin/imcp ${eddydir}/eddy_unwarped_images ${datadir}/data
#else
if [ ${CombineDataFlag} -eq 2 ]; then
if [ ${CombineDataFlag} -eq 2 ]; then
${FSLDIR}/bin/imcp ${eddydir}/eddy_unwarped_images ${datadir}/data
cp ${eddydir}/Pos_Neg.bvals ${datadir}/bvals
cp ${eddydir}/Pos_Neg.bvecs ${datadir}/bvecs
else
else
echo "JAC resampling has been used. Eddy Output is now combined."
PosVols=`wc ${eddydir}/Pos.bval | awk {'print $2'}`
NegVols=`wc ${eddydir}/Neg.bval | awk {'print $2'}` #Split Pos and Neg Volumes
${FSLDIR}/bin/fslroi ${eddydir}/eddy_unwarped_images ${eddydir}/eddy_unwarped_Pos 0 ${PosVols}
${FSLDIR}/bin/fslroi ${eddydir}/eddy_unwarped_images ${eddydir}/eddy_unwarped_Neg ${PosVols} ${NegVols}
${FSLDIR}/bin/eddy_combine ${eddydir}/eddy_unwarped_Pos ${eddydir}/Pos.bval ${eddydir}/Pos.bvec ${eddydir}/Pos_SeriesVolNum.txt \
${eddydir}/eddy_unwarped_Neg ${eddydir}/Neg.bval ${eddydir}/Neg.bvec ${eddydir}/Neg_SeriesVolNum.txt ${datadir} ${CombineDataFlag}
${eddydir}/eddy_unwarped_Neg ${eddydir}/Neg.bval ${eddydir}/Neg.bvec ${eddydir}/Neg_SeriesVolNum.txt ${datadir} ${CombineDataFlag}

${FSLDIR}/bin/imrm ${eddydir}/eddy_unwarped_Pos
${FSLDIR}/bin/imrm ${eddydir}/eddy_unwarped_Neg
cp ${datadir}/bvals ${datadir}/bvals_noRot
cp ${datadir}/bvecs ${datadir}/bvecs_noRot

#rm ${eddydir}/Pos.bv*
#rm ${eddydir}/Neg.bv*

Expand All @@ -61,7 +61,7 @@ datadir=${workingdir}/data
echo $Posline1 > ${eddydir}/Pos_rotated.bvec
echo $Posline2 >> ${eddydir}/Pos_rotated.bvec
echo $Posline3 >> ${eddydir}/Pos_rotated.bvec

Negline1=""
Negline2=""
Negline3=""
Expand All @@ -79,11 +79,11 @@ datadir=${workingdir}/data
# Average Eddy-Rotated bvecs. Get for each direction the two b matrices, average those and then eigendecompose the average b-matrix to get the new bvec and bval.
# Also outputs an index file (1-based) with the indices of the input (Pos/Neg) volumes that have been retained in the output
${globalscriptsdir}/average_bvecs.py ${eddydir}/Pos.bval ${eddydir}/Pos_rotated.bvec ${eddydir}/Neg.bval ${eddydir}/Neg_rotated.bvec ${datadir}/avg_data ${eddydir}/Pos_SeriesVolNum.txt ${eddydir}/Neg_SeriesVolNum.txt

mv ${datadir}/avg_data.bval ${datadir}/bvals
mv ${datadir}/avg_data.bvec ${datadir}/bvecs
rm -f ${datadir}/avg_data.bv??
fi
fi
#fi


Expand All @@ -109,8 +109,7 @@ fi

#Remove negative intensity values (caused by spline interpolation) from final data
${FSLDIR}/bin/fslmaths ${datadir}/data -thr 0 ${datadir}/data
${FSLDIR}/bin/bet ${datadir}/data ${datadir}/nodif_brain -m -f 0.1
$FSLDIR/bin/fslroi ${datadir}/data ${datadir}/nodif 0 1
${FSLDIR}/bin/fslroi ${datadir}/data ${datadir}/nodif 0 1
${FSLDIR}/bin/bet ${datadir}/nodif ${datadir}/nodif_brain -m -f 0.1

echo -e "\n END: eddy_postproc"

Loading

0 comments on commit f5704c9

Please sign in to comment.