Skip to content
Snippets Groups Projects
Commit 55fe275f authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

RF: Major re-arrangement of eddy tests so that job submission / monitoring

code is shared across all tests in a common "runEddy" script. Also test both
$FSLDIR/bin/eddy_openmp and $FSLDIR/bin/eddy_cpu if either exist.
parent f8cda2a3
No related branches found
No related tags found
1 merge request!37Major re-arrangement of eddy tests
Showing
with 222 additions and 796 deletions
File moved
File moved
EddyHigh_b_TestData/eddyData
#! /bin/sh
#
# This script runs eddy followed by some
# tests on the output.
# It uses some b=7000 data from the pilot phase
# of the HCP. The "ground truth" is simply the
# output from eddy at a time when it seemed to
# do a good job. The tolerance is quite high. That
# reflects both that the data has a quite high
# scale (b=0 values ~2000) and also that the
# run-to-run variability of eddy is quite high
# on these data.
#
odir=$1
indir=$2
#
# Inputs 1--3 are the once neccessary for feeds to work
# Additional inputs are optional and intended for testing
# outside of the feeds context.
#
# Input 4 is alternative location of executable
#
if [ "$#" -gt 3 ]; then
exedir=$4
echo "Directory for eddy executables set to ${exedir}"
else
exedir="${FSLDIR}/bin"
fi
# Find all eddy_cuda* executables
cuda_exes=""
cpu_exe=""
for cuda_exe in ${exedir}/eddy_cuda*;
do
if [ -x "${cuda_exe}" ]; then
cuda_exes="${cuda_exes} ${cuda_exe}"
fi
done
# Find the eddy_cpu executable
if [ -x "${exedir}/eddy_openmp" ]; then
cpu_exe="${exedir}/eddy_openmp"
fi
if [ "${cuda_exes}" == "" ] && [ "${cpu_exe}" == "" ]; then
echo "Cannot find any eddy executables in ${exedir}!"
exit 1
fi
if [ ! -d "$odir" ]; then
echo "Output directory ${odir} does not exist"
exit 1;
fi
if [ ! -d "$indir" ]; then
echo "Input directory ${indir} does not exist"
exit 1;
fi
# Launch both GPU and CPU versions
cuda_jid=""
for cuda_exe in ${cuda_exes};
do
tmp=`basename $cuda_exe`
version=`echo $tmp | sed 's/eddy_cuda//'`
cuda_jid="$cuda_jid `fsl_sub -l ${odir} -q cuda.q ${cuda_exe} --imain=${indir}/EddyHigh_b_TestData/eddyData/testData --mask=${indir}/EddyHigh_b_TestData/eddyData/testMask --bvals=${indir}/EddyHigh_b_TestData/eddyData/testBvals --bvecs=${indir}/EddyHigh_b_TestData/eddyData/testBvecs --index=${indir}/EddyHigh_b_TestData/eddyData/testIndex --acqp=${indir}/EddyHigh_b_TestData/eddyData/testAcqparams --topup=${indir}/EddyHigh_b_TestData/eddyData/testTopup --nvoxhp=5000 --repol --fwhm=10,0,0,0,0 --dont_peas --out=${odir}/eddyCudaOutput${version} --very_verbose`"
done
if [ "${cpu_exe}" != "" ]; then
cpu_jid=`fsl_sub -l ${odir} -q long.q -s openmp,6 ${cpu_exe} --imain=${indir}/EddyHigh_b_TestData/eddyData/testData --mask=${indir}/EddyHigh_b_TestData/eddyData/testMask --bvals=${indir}/EddyHigh_b_TestData/eddyData/testBvals --bvecs=${indir}/EddyHigh_b_TestData/eddyData/testBvecs --index=${indir}/EddyHigh_b_TestData/eddyData/testIndex --acqp=${indir}/EddyHigh_b_TestData/eddyData/testAcqparams --topup=${indir}/EddyHigh_b_TestData/eddyData/testTopup --nvoxhp=5000 --repol --fwhm=10,0,0,0,0 --dont_peas --out=${odir}/eddyCpuOutput --very_verbose`
fi
# If running on a cluster, ensure that
# slots are being reserved on the queue,
# and wait until all jobs have finished
if [ ! -z "${SGE_ROOT}" ]; then
if [ "${cpu_exe}" != "" ]; then
qalter ${cpu_jid} -R y
fi
while [ : ]; do
for jid in ${cuda_jid};
do
tmp=`qstat -j ${jid} | wc`
tmp=`echo $tmp | awk '{print $1}'`
if [ $tmp -ne 0 ]; then
break
fi
done
if [ "${cpu_exe}" != "" ]; then
if [ $tmp -eq 0 ]; then
tmp=`qstat -j ${cpu_jid} | wc`
tmp=`echo $tmp | awk '{print $1}'`
if [ $tmp -eq 0 ]; then
break
fi
fi
fi
sleep 5m
done
fi
# Check that eddy output exists
for cuda_exe in ${cuda_exes};
do
tmp=`basename $cuda_exe`
version=`echo $tmp | sed 's/eddy_cuda//'`
if [ ! -f ${odir}/eddyCudaOutput${version}.nii* ]; then
exit 1
fi
done
if [ "${cpu_exe}" != "" ]; then
if [ ! -f ${odir}/eddyCpuOutput.nii* ]; then
echo "eddyCpuOutput missing"
exit 1
fi
fi
# Define some constants
max_mean_ima_diff=15.0
max_max_ima_diff=20.0
# Check the results against ground truth
cuda_exit_status=0
for cuda_exe in ${cuda_exes};
do
tmp=`basename $cuda_exe`
version=`echo $tmp | sed 's/eddy_cuda//'`
./EddyHigh_b_Feeds.py ${odir} Cuda${version} `imglob -extension ${indir}/EddyHigh_b_TestData/eddyData/testMask` `imglob -extension ${odir}/eddyCudaOutput${version}` `imglob -extension ${indir}/EddyHigh_b_TestData/eddyData/Precomputed/eddy_cuda_output` $max_mean_ima_diff $max_max_ima_diff
cuda_exit_status=$(($cuda_exit_status + $?))
done
cpu_exit_status=0
if [ "${cpu_exe}" != "" ]; then
./EddyHigh_b_Feeds.py ${odir} Cpu `imglob -extension ${indir}/EddyHigh_b_TestData/eddyData/testMask` `imglob -extension ${odir}/eddyCpuOutput` `imglob -extension ${indir}/EddyHigh_b_TestData/eddyData/Precomputed/eddy_openmp_output` $max_mean_ima_diff $max_max_ima_diff
cpu_exit_status=$?
fi
if [ $cuda_exit_status -gt 0 ] || [ $cpu_exit_status -gt 0 ]; then
echo "Test failed"
exit 1
else
echo "Test passed"
exit 0
fi
File moved
#! /bin/bash
export exedir="/home/fs0/jesper/fsl/src/BuildingEddy_5_0_11_for_PreRelease/eddy/"
export indir="/vols/Data/fsldev/dataSets/EddyLSRTestData/eddyData"
export odir="/vols/Data/fsldev/dataSets/EddyLSRTestData/eddyData/Precomputed"
fsl_sub -q long.q -s openmp,6 ${exedir}/eddy_openmp --imain=${indir}/testData --mask=${indir}/testMask --bvals=${indir}/testBvals --bvecs=${indir}/testBvecs --index=${indir}/testIndex --acqp=${indir}/testAcqparams --topup=${indir}/testTopup --out=${odir}/eddy_openmp_output --resamp=lsr --fep --nvoxhp=5000 --dont_sep_offs_move --very_verbose
fsl_sub -q cuda.q ${exedir}/eddy_cuda7.5 --imain=${indir}/testData --mask=${indir}/testMask --bvals=${indir}/testBvals --bvecs=${indir}/testBvecs --index=${indir}/testIndex --acqp=${indir}/testAcqparams --topup=${indir}/testTopup --out=${odir}/eddy_cuda_output --resamp=lsr --fep --nvoxhp=5000 --dont_sep_offs_move --very_verbose
#
# Run new eddy as well, as a kind of pre-test
#
export exedir="/home/fs0/jesper/DebugEddyNewNewimage/eddy_new/eddy"
export indir="/vols/Data/fsldev/dataSets/EddyLSRTestData/eddyData"
export odir="/vols/Scratch/HCP/Diffusion/jesper/EddyLSRFeedsTest20190129"
fsl_sub -q long.q -s openmp,6 ${exedir}/eddy_openmp --imain=${indir}/testData --mask=${indir}/testMask --bvals=${indir}/testBvals --bvecs=${indir}/testBvecs --index=${indir}/testIndex --acqp=${indir}/testAcqparams --topup=${indir}/testTopup --out=${odir}/eddy_openmp_output --resamp=lsr --fep --nvoxhp=5000 --dont_sep_offs_move --very_verbose
fsl_sub -q cuda.q ${exedir}/eddy_cuda --imain=${indir}/testData --mask=${indir}/testMask --bvals=${indir}/testBvals --bvecs=${indir}/testBvecs --index=${indir}/testIndex --acqp=${indir}/testAcqparams --topup=${indir}/testTopup --out=${odir}/eddy_cuda_output --resamp=lsr --fep --nvoxhp=5000 --dont_sep_offs_move --very_verbose
EddyLSRTestData/eddyData
#! /bin/sh
#
# This script runs eddy followed by some
# tests on the output.
# It uses some data from the pilot phase
# of the HCP where each diffusion direction was
# scanned twice with opposing PE-directions.
# The "ground truth" is simply the output from eddy
# prior to Armadillo and NewNewimage.
#
odir=$1
indir=$2
#
# Inputs 1--3 are the once neccessary for feeds to work
# Additional inputs are optional and intended for testing
# outside of the feeds context.
#
# Input 4 is alternative location of executable
#
if [ "$#" -gt 3 ]; then
exedir=$4
echo "Directory for eddy executables set to ${exedir}"
else
exedir="${FSLDIR}/bin"
fi
# Find all eddy_cuda* executables
cuda_exes=""
cpu_exe=""
for cuda_exe in ${exedir}/eddy_cuda*;
do
if [ -x "${cuda_exe}" ]; then
cuda_exes="${cuda_exes} ${cuda_exe}"
fi
done
# Find the eddy_cpu executable
if [ -x "${exedir}/eddy_openmp" ]; then
cpu_exe="${exedir}/eddy_openmp"
fi
if [ "${cuda_exes}" == "" ] && [ "${cpu_exe}" == "" ]; then
echo "Cannot find any eddy executables in ${exedir}!"
exit 1
fi
if [ ! -d "$odir" ]; then
echo "Output directory ${odir} does not exist"
exit 1;
fi
if [ ! -d "$indir" ]; then
echo "Input directory ${indir} does not exist"
exit 1;
fi
# Launch both GPU and CPU versions
cuda_jid=""
for cuda_exe in ${cuda_exes};
do
tmp=`basename $cuda_exe`
version=`echo $tmp | sed 's/eddy_cuda//'`
cuda_jid="$cuda_jid `fsl_sub -l ${odir} -q cuda.q ${cuda_exe} --imain=${indir}/EddyLSRTestData/eddyData/testData --mask=${indir}/EddyLSRTestData/eddyData/testMask --bvals=${indir}/EddyLSRTestData/eddyData/testBvals --bvecs=${indir}/EddyLSRTestData/eddyData/testBvecs --index=${indir}/EddyLSRTestData/eddyData/testIndex --acqp=${indir}/EddyLSRTestData/eddyData/testAcqparams --topup=${indir}/EddyLSRTestData/eddyData/testTopup --out=${odir}/eddyCudaOutput${version} --resamp=lsr --fep --nvoxhp=5000 --repol --fwhm=10,0,0,0,0 --dont_peas --very_verbose`"
done
if [ "${cpu_exe}" != "" ]; then
cpu_jid=`fsl_sub -l ${odir} -q long.q -s openmp,6 ${cpu_exe} --imain=${indir}/EddyLSRTestData/eddyData/testData --mask=${indir}/EddyLSRTestData/eddyData/testMask --bvals=${indir}/EddyLSRTestData/eddyData/testBvals --bvecs=${indir}/EddyLSRTestData/eddyData/testBvecs --index=${indir}/EddyLSRTestData/eddyData/testIndex --acqp=${indir}/EddyLSRTestData/eddyData/testAcqparams --topup=${indir}/EddyLSRTestData/eddyData/testTopup --out=${odir}/eddyCpuOutput --resamp=lsr --fep --nvoxhp=5000 --repol --fwhm=10,0,0,0,0 --dont_peas --very_verbose`
fi
# If running on a cluster, ensure that
# slots are being reserved on the queue,
# and wait until all jobs have finished
if [ ! -z "${SGE_ROOT}" ]; then
if [ "${cpu_exe}" != "" ]; then
qalter ${cpu_jid} -R y
fi
while [ : ]; do
for jid in ${cuda_jid};
do
tmp=`qstat -j ${jid} | wc`
tmp=`echo $tmp | awk '{print $1}'`
if [ $tmp -ne 0 ]; then
break
fi
done
if [ "${cpu_exe}" != "" ]; then
if [ $tmp -eq 0 ]; then
tmp=`qstat -j ${cpu_jid} | wc`
tmp=`echo $tmp | awk '{print $1}'`
if [ $tmp -eq 0 ]; then
break
fi
fi
fi
sleep 5m
done
fi
# Check that eddy output exists
for cuda_exe in ${cuda_exes};
do
tmp=`basename $cuda_exe`
version=`echo $tmp | sed 's/eddy_cuda//'`
if [ ! -f ${odir}/eddyCudaOutput${version}.nii* ]; then
exit 1
fi
done
if [ "${cpu_exe}" != "" ]; then
if [ ! -f ${odir}/eddyCpuOutput.nii* ]; then
echo "eddyCpuOutput missing"
exit 1
fi
fi
# Define some constants
max_mean_ima_diff=15.0
max_max_ima_diff=20.0
# Check the results against ground truth
cuda_exit_status=0
for cuda_exe in ${cuda_exes};
do
tmp=`basename $cuda_exe`
version=`echo $tmp | sed 's/eddy_cuda//'`
./EddyLSRFeeds.py ${odir} Cuda${version} `imglob -extension ${indir}/EddyLSRTestData/eddyData/testMask` `imglob -extension ${odir}/eddyCudaOutput${version}` `imglob -extension ${indir}/EddyLSRTestData/eddyData/Precomputed/eddy_cuda_output` $max_mean_ima_diff $max_max_ima_diff
cuda_exit_status=$(($cuda_exit_status + $?))
done
cpu_exit_status=0
if [ "${cpu_exe}" != "" ]; then
./EddyLSRFeeds.py ${odir} Cpu `imglob -extension ${indir}/EddyLSRTestData/eddyData/testMask` `imglob -extension ${odir}/eddyCpuOutput` `imglob -extension ${indir}/EddyLSRTestData/eddyData/Precomputed/eddy_openmp_output` $max_mean_ima_diff $max_max_ima_diff
cpu_exit_status=$?
fi
if [ $cuda_exit_status -gt 0 ] || [ $cpu_exit_status -gt 0 ]; then
echo "Test failed"
exit 1
else
echo "Test passed"
exit 0
fi
EddyMBSTestData/eddyData
#! /bin/sh
#
# This script runs eddy for testing the
# movement-by-susceptibility functionality
# followed by some tests on the output.
# It uses simulated data supplied by Mark
# Graham, UCL.
# The data is a subset of that used for
# the MBS paper. We don't have an "actual"
# ground truth so instead we compare against
# the results from the paper (calculated with
# the Cuda version).
# The actual data used for the test is
# .../SecondSetOfSimulations/ap/ec-volumetric-3x/images_SNR40_1
#
odir=$1
indir=$2
#
# Inputs 1--3 are the once neccessary for feeds to work
# Additional inputs are optional and intended for testing
# outside of the feeds context.
#
# Input 4 is alternative location of executable
#
if [ "$#" -gt 3 ]; then
exedir=$4
echo "Directory for eddy executables set to ${exedir}"
else
exedir="${FSLDIR}/bin"
fi
# Find all eddy_cuda* executables
cuda_exes=""
cpu_exe=""
for cuda_exe in ${exedir}/eddy_cuda*;
do
if [ -x "${cuda_exe}" ]; then
cuda_exes="${cuda_exes} ${cuda_exe}"
fi
done
# Find the eddy_cpu executable
if [ -x "${exedir}/eddy_openmp" ]; then
cpu_exe="${exedir}/eddy_openmp"
fi
if [ "${cuda_exes}" == "" ] && [ "${cpu_exe}" == "" ]; then
echo "Cannot find any eddy executables in ${exedir}!"
exit 1
fi
if [ ! -d "$odir" ]; then
echo "Output directory ${odir} does not exist"
exit 1;
fi
if [ ! -d "$indir" ]; then
echo "Input directory ${indir} does not exist"
exit 1;
fi
# Define some constants
max_mean_dfield_diff=0.03
max_max_dfield_diff=0.06
max_mean_ima_diff=0.3
max_max_ima_diff=0.6
# Launch both GPU and CPU versions
cuda_jid=""
for cuda_exe in ${cuda_exes};
do
tmp=`basename $cuda_exe`
version=`echo $tmp | sed 's/eddy_cuda//'`
cuda_jid="$cuda_jid `fsl_sub -l ${odir} -q cuda.q ${cuda_exe} --imain=${indir}/EddyMBSTestData/eddyData/testData --acqp=${indir}/EddyMBSTestData/eddyData/testAcqparams --mask=${indir}/EddyMBSTestData/eddyData/testMask --index=${indir}/EddyMBSTestData/eddyData/testIndex --bvecs=${indir}/EddyMBSTestData/eddyData/testBvecs --bvals=${indir}/EddyMBSTestData/eddyData/testBvals --topup=${indir}/EddyMBSTestData/eddyData/testTopup --fwhm=10,5,2,0,0,0,0,0 --niter=8 --nvoxhp=2000 --flm=quadratic --dont_peas --estimate_move_by_susceptibility --mbs_niter=20 --mbs_lambda=10 --mbs_ksp=10 --out=${odir}/eddyCudaOutput${version} --very_verbose`"
done
if [ "${cpu_exe}" != "" ]; then
cpu_jid=`fsl_sub -l ${odir} -q long.q -s openmp,6 ${cpu_exe} --imain=${indir}/EddyMBSTestData/eddyData/testData --acqp=${indir}/EddyMBSTestData/eddyData/testAcqparams --mask=${indir}/EddyMBSTestData/eddyData/testMask --index=${indir}/EddyMBSTestData/eddyData/testIndex --bvecs=${indir}/EddyMBSTestData/eddyData/testBvecs --bvals=${indir}/EddyMBSTestData/eddyData/testBvals --topup=${indir}/EddyMBSTestData/eddyData/testTopup --fwhm=10,5,2,0,0,0,0,0 --niter=8 --nvoxhp=2000 --flm=quadratic --dont_peas --estimate_move_by_susceptibility --mbs_niter=20 --mbs_lambda=10 --mbs_ksp=10 --out=${odir}/eddyCpuOutput --very_verbose`
fi
# If running on a cluster, ensure that
# slots are being reserved on the queue,
# and wait until all jobs have finished
if [ ! -z "${SGE_ROOT}" ]; then
if [ "${cpu_exe}" != "" ]; then
qalter ${cpu_jid} -R y
fi
while [ : ]; do
for jid in ${cuda_jid};
do
tmp=`qstat -j ${jid} | wc`
tmp=`echo $tmp | awk '{print $1}'`
if [ $tmp -ne 0 ]; then
break
fi
done
if [ "${cpu_exe}" != "" ]; then
if [ $tmp -eq 0 ]; then
tmp=`qstat -j ${cpu_jid} | wc`
tmp=`echo $tmp | awk '{print $1}'`
if [ $tmp -eq 0 ]; then
break
fi
fi
fi
sleep 5m
done
fi
# Check that eddy output exists
for cuda_exe in ${cuda_exes};
do
tmp=`basename $cuda_exe`
version=`echo $tmp | sed 's/eddy_cuda//'`
if [ ! -f ${odir}/eddyCudaOutput${version}.nii* ]; then
exit 1
fi
done
if [ "${cpu_exe}" != "" ]; then
if [ ! -f ${odir}/eddyCpuOutput.nii* ]; then
exit 1
fi
fi
# Check the results against precomputed results
cuda_exit_status=0
for cuda_exe in ${cuda_exes};
do
tmp=`basename $cuda_exe`
version=`echo $tmp | sed 's/eddy_cuda//'`
./MoveBySuscFeeds.py ${odir} Cuda${version} `imglob -extension ${indir}/EddyMBSTestData/eddyData/Precomputed/BrainMaskForComparison` `imglob -extension ${odir}/eddyCudaOutput${version}` `imglob -extension ${indir}/EddyMBSTestData/eddyData/Precomputed/PrecomputedResults` `imglob -extension ${odir}/eddyCudaOutput${version}.eddy_mbs_first_order_fields` `imglob -extension ${indir}/EddyMBSTestData/eddyData/Precomputed/PrecomputedResults.eddy_mbs_first_order_fields` ${max_mean_ima_diff} ${max_max_ima_diff} ${max_mean_dfield_diff} ${max_max_dfield_diff}
cuda_exit_status=$(($cuda_exit_status + $?))
done
cpu_exit_status=0
if [ "${cpu_exe}" != "" ]; then
./MoveBySuscFeeds.py ${odir} Cpu `imglob -extension ${indir}/EddyMBSTestData/eddyData/Precomputed/BrainMaskForComparison` `imglob -extension ${odir}/eddyCpuOutput` `imglob -extension ${indir}/EddyMBSTestData/eddyData/Precomputed/PrecomputedResults` `imglob -extension ${odir}/eddyCpuOutput.eddy_mbs_first_order_fields` `imglob -extension ${indir}/EddyMBSTestData/eddyData/Precomputed/PrecomputedResults.eddy_mbs_first_order_fields` ${max_mean_ima_diff} ${max_max_ima_diff} ${max_mean_dfield_diff} ${max_max_dfield_diff}
cpu_exit_status=$?
fi
if [ $cuda_exit_status -gt 0 ] || [ $cpu_exit_status -gt 0 ]; then
echo "Test failed"
exit 1
else
echo "Test passed"
exit 0
fi
EddyS2VTestData/eddyData
#! /bin/sh
#
# This script runs eddy on data with intra-volume movement,
# followed by some tests on the output.
# It uses simulated data supplied by Mark
# Graham, UCL, which allows us to have a ground
# truth. The data is a subset of that used
# for the s2v paper.
# The script was updated in May 2021 to test also the openmp
# version.
#
odir=$1
indir=$2
#
# Inputs 1--3 are the ones neccessary for feeds to work
# Additional inputs are optional and intended for testing
# outside of the feeds context.
#
# Input 4 is alternative location of executable
#
if [ "$#" -gt 3 ]; then
exedir=$4
echo "Directory for eddy executables set to ${exedir}"
else
exedir="${FSLDIR}/bin"
fi
# Find all eddy_cuda* executables
cuda_exes=""
cpu_exe=""
for cuda_exe in ${exedir}/eddy_cuda*;
do
if [ -x "${cuda_exe}" ]; then
cuda_exes="${cuda_exes} ${cuda_exe}"
fi
done
# Find the eddy_cpu executable
if [ -x "${exedir}/eddy_openmp" ]; then
cpu_exe="${exedir}/eddy_openmp"
fi
if [ "${cuda_exes}" == "" ] && [ "${cpu_exe}" == "" ]; then
echo "Cannot find any eddy executables in ${exedir}!"
exit 1
fi
if [ ! -d "$odir" ]; then
echo "Output directory ${odir} does not exist"
exit 1;
fi
if [ ! -d "$indir" ]; then
echo "Input directory ${odir} does not exist"
exit 1;
fi
# Launch both GPU and CPU versions
cuda_jid=""
for cuda_exe in ${cuda_exes};
do
tmp=`basename $cuda_exe`
version=`echo $tmp | sed 's/eddy_cuda//'`
cuda_jid="$cuda_jid `fsl_sub -l ${odir} -q cuda.q ${cuda_exe} --imain=${indir}/EddyS2VTestData/eddyData/testData --mask=${indir}/EddyS2VTestData/eddyData/testMask --bvals=${indir}/EddyS2VTestData/eddyData/testBvals --bvecs=${indir}/EddyS2VTestData/eddyData/testBvecs --index=${indir}/EddyS2VTestData/eddyData/testIndex --acqp=${indir}/EddyS2VTestData/eddyData/testAcqparams --repol --ol_type=slice --ol_nstd=6 --ol_nvox=500 --niter=8 --fwhm=10,6,4,2,0,0,0,0 --out=${odir}/eddyCudaOutput${version} --nvoxhp=5000 --mporder=16 --s2v_niter=10 --s2v_interp=trilinear --s2v_lambda=1 --slspec=${indir}/EddyS2VTestData/eddyData/testSlspec --very_verbose`"
done
if [ "${cpu_exe}" != "" ]; then
cpu_jid=`fsl_sub -l ${odir} -q long.q -s openmp,6 ${cpu_exe} --imain=${indir}/EddyS2VTestData/eddyData/testData --mask=${indir}/EddyS2VTestData/eddyData/testMask --bvals=${indir}/EddyS2VTestData/eddyData/testBvals --bvecs=${indir}/EddyS2VTestData/eddyData/testBvecs --index=${indir}/EddyS2VTestData/eddyData/testIndex --acqp=${indir}/EddyS2VTestData/eddyData/testAcqparams --repol --ol_type=slice --ol_nstd=6 --niter=8 --fwhm=10,6,4,2,0,0,0,0 --out=${odir}/eddyCpuOutput --nvoxhp=5000 --mporder=16 --s2v_niter=10 --s2v_interp=trilinear --s2v_lambda=1 --slspec=${indir}/EddyS2VTestData/eddyData/testSlspec --very_verbose`
fi
# If running on a cluster, ensure that
# slots are being reserved on the queue,
# and wait until all jobs have finished
if [ ! -z "${SGE_ROOT}" ]; then
if [ "${cpu_exe}" != "" ]; then
qalter ${cpu_jid} -R y
fi
while [ : ]; do
for jid in ${cuda_jid};
do
tmp=`qstat -j ${jid} | wc`
tmp=`echo $tmp | awk '{print $1}'`
if [ $tmp -ne 0 ]; then
break
fi
done
if [ "${cpu_exe}" != "" ]; then
if [ $tmp -eq 0 ]; then
tmp=`qstat -j ${cpu_jid} | wc`
tmp=`echo $tmp | awk '{print $1}'`
if [ $tmp -eq 0 ]; then
break
fi
fi
fi
sleep 5m
done
fi
# Check that eddy output exists
for cuda_exe in ${cuda_exes};
do
tmp=`basename $cuda_exe`
version=`echo $tmp | sed 's/eddy_cuda//'`
if [ ! -f ${odir}/eddyCudaOutput${version}.nii* ]; then
echo "Cuda output eddyCudaOutput${version} missing"
exit 1
fi
done
if [ "${cpu_exe}" != "" ]; then
if [ ! -f ${odir}/eddyCpuOutput.nii* ]; then
echo "eddyCpuOutput missing"
exit 1
fi
fi
# Define some constants
# These are for the comparison of output images divided on b=0, b=700 and b=2000
max_ima_diff="2.0 2.5 0.6 0.7 0.5 0.6"
# Translations
max_trans_diff="0.2 1.0"
# Rotations
max_rot_diff="0.2 2.0"
# Outliers
max_false_pos=10
max_false_neg=10
# Check the results against ground truth
cuda_exit_status=0
for cuda_exe in ${cuda_exes};
do
tmp=`basename $cuda_exe`
version=`echo $tmp | sed 's/eddy_cuda//'`
echo "./S2VFeeds.py ${odir} Cuda${version} `imglob -extension ${indir}/EddyS2VTestData/eddyData/testMask` ${indir}/EddyS2VTestData/eddyData/testBvals `imglob -extension ${odir}/eddyCudaOutput${version}` `imglob -extension $\
{indir}/EddyS2VTestData/eddyData/GroundTruth/ground_truth` ${odir}/eddyCudaOutput${version}.eddy_movement_over_time ${indir}/EddyS2VTestData/eddyData/MovementTruth/ground_truth.eddy_movement_over_time ${odir}/eddyCudaO\
utput${version}.eddy_outlier_map ${indir}/EddyS2VTestData/eddyData/OutlierTruth/dropoutLog_1.txt ${max_ima_diff} ${max_false_pos} ${max_false_neg} ${max_trans_diff} ${max_rot_diff}"
./S2VFeeds.py ${odir} Cuda${version} `imglob -extension ${indir}/EddyS2VTestData/eddyData/testMask` ${indir}/EddyS2VTestData/eddyData/testBvals `imglob -extension ${odir}/eddyCudaOutput${version}` `imglob -extension ${indir}/EddyS2VTestData/eddyData/GroundTruth/ground_truth` ${odir}/eddyCudaOutput${version}.eddy_movement_over_time ${indir}/EddyS2VTestData/eddyData/MovementTruth/ground_truth.eddy_movement_over_time ${odir}/eddyCudaOutput${version}.eddy_outlier_map ${indir}/EddyS2VTestData/eddyData/OutlierTruth/dropoutLog_1.txt ${max_ima_diff} ${max_false_pos} ${max_false_neg} ${max_trans_diff} ${max_rot_diff}
cuda_exit_status=$(($cuda_exit_status + $?))
done
cpu_exit_status=0
if [ "${cpu_exe}" != "" ]; then
./S2VFeeds.py ${odir} Cpu `imglob -extension ${indir}/EddyS2VTestData/eddyData/testMask` ${indir}/EddyS2VTestData/eddyData/testBvals `imglob -extension ${odir}/eddyCpuOutput` `imglob -extension ${indir}/EddyS2VTestData/eddyData/GroundTruth/ground_truth` ${odir}/eddyCpuOutput.eddy_movement_over_time ${indir}/EddyS2VTestData/eddyData/MovementTruth/ground_truth.eddy_movement_over_time ${odir}/eddyCpuOutput.eddy_outlier_map ${indir}/EddyS2VTestData/eddyData/OutlierTruth/dropoutLog_1.txt ${max_ima_diff} ${max_false_pos} ${max_false_neg} ${max_trans_diff} ${max_rot_diff}
cpu_exit_status=$?
fi
if [ $cuda_exit_status -gt 0 ] || [ $cpu_exit_status -gt 0 ]; then
echo "Test failed"
exit 1
else
echo "Test passed"
exit 0
fi
export indir=/vols/Data/fsldev/dataSets
export odir=/vols/Scratch/HCP/Diffusion/jesper/EddyS2VFeedsTest20190129
exedir=/home/fs0/jesper/DebugEddyNewNewimage/eddy_new/eddy
${exedir}/eddy_cuda --imain=${indir}/EddyS2VTestData/eddyData/testData --mask=${indir}/EddyS2VTestData/eddyData/testMask --bvals=${indir}/EddyS2VTestData/eddyData/testBvals --bvecs=${indir}/EddyS2VTestData/eddyData/testBvecs --index=${indir}/EddyS2VTestData/eddyData/testIndex --acqp=${indir}/EddyS2VTestData/eddyData/testAcqparams --repol --ol_type=slice --niter=8 --fwhm=10,6,4,2,0,0,0,0 --out=${odir}/NewEddyCudaOutput --nvoxhp=5000 --mporder=16 --s2v_niter=10 --s2v_interp=trilinear --s2v_lambda=1 --slspec=${indir}/EddyS2VTestData/eddyData/testSlspec --very_verbose
export indir=/vols/Data/fsldev/dataSets
export odir=/vols/Scratch/HCP/Diffusion/jesper/EddyS2VFeedsTest20190129
exedir=/home/fs0/jesper/fsl/src/BuildingEddyForHCP_2017_09_29/eddy
${exedir}/eddy_cuda8.0 --imain=${indir}/EddyS2VTestData/eddyData/testData --mask=${indir}/EddyS2VTestData/eddyData/testMask --bvals=${indir}/EddyS2VTestData/eddyData/testBvals --bvecs=${indir}/EddyS2VTestData/eddyData/testBvecs --index=${indir}/EddyS2VTestData/eddyData/testIndex --acqp=${indir}/EddyS2VTestData/eddyData/testAcqparams --repol --ol_type=slice --niter=8 --fwhm=10,6,4,2,0,0,0,0 --out=${odir}/OldEddyCudaOutput --nvoxhp=5000 --mporder=16 --s2v_niter=10 --s2v_interp=trilinear --s2v_lambda=1 --slspec=${indir}/EddyS2VTestData/eddyData/testSlspec --very_verbose
EddyTestData/eddyData
#!/bin/sh
#
# This script runs eddy followed by some
# tests on the output.
# It uses simulated data supplied by Mark
# Graham, UCL, which allows us to have a ground
# truth. The data is a subset of that used
# for the outlier paper.
#
odir=$1
indir=$2
#
# Inputs 1--3 are the once neccessary for feeds to work
# Additional inputs are optional and intended for testing
# outside of the feeds context.
#
# Input 4 is alternative location of executable
#
if [ "$#" -gt 3 ]; then
exedir=$4
echo "Directory for eddy executables set to ${exedir}"
else
exedir="${FSLDIR}/bin"
fi
# Find all eddy_cuda* executables
cuda_exes=""
cpu_exe=""
for cuda_exe in ${exedir}/eddy_cuda*;
do
if [ -x "${cuda_exe}" ]; then
cuda_exes="${cuda_exes} ${cuda_exe}"
fi
done
# Find the eddy_cpu executable
if [ -x "${exedir}/eddy_openmp" ]; then
cpu_exe="${exedir}/eddy_openmp"
fi
if [ "${cuda_exes}" == "" ] && [ "${cpu_exe}" == "" ]; then
echo "Cannot find any eddy executables in ${exedir}!"
exit 1
fi
if [ ! -d "$odir" ]; then
echo "Output directory ${odir} does not exist"
exit 1;
fi
if [ ! -d "$indir" ]; then
echo "Input directory ${indir} does not exist"
exit 1;
fi
# Define some constants
max_mean_dfield_diff=0.5
max_max_dfield_diff=1.0
max_mean_ima_diff=1.5
max_max_ima_diff=3.0
allowed_false_positives=1
allowed_false_negatives=1
# Launch both GPU and CPU versions
cuda_jid=""
for cuda_exe in ${cuda_exes};
do
tmp=`basename $cuda_exe`
version=`echo $tmp | sed 's/eddy_cuda//'`
cuda_jid="$cuda_jid `fsl_sub -l ${odir} -q cuda.q ${cuda_exe} --imain=${indir}/EddyTestData/eddyData/testData --mask=${indir}/EddyTestData/eddyData/testMask --bvals=${indir}/EddyTestData/eddyData/testBvals --bvecs=${indir}/EddyTestData/eddyData/testBvecs --index=${indir}/EddyTestData/eddyData/testIndex --acqp=${indir}/EddyTestData/eddyData/testAcqparams --repol --fwhm=10,0,0,0,0 --out=${odir}/eddyCudaOutput${version} --dfields -v`"
done
if [ "${cpu_exe}" != "" ]; then
cpu_jid=`fsl_sub -l ${odir} -q long.q -s openmp,6 ${cpu_exe} --imain=${indir}/EddyTestData/eddyData/testData --mask=${indir}/EddyTestData/eddyData/testMask --bvals=${indir}/EddyTestData/eddyData/testBvals --bvecs=${indir}/EddyTestData/eddyData/testBvecs --index=${indir}/EddyTestData/eddyData/testIndex --acqp=${indir}/EddyTestData/eddyData/testAcqparams --repol --fwhm=10,0,0,0,0 --out=${odir}/eddyCpuOutput --dfields -v`
fi
# If running on a cluster, ensure that
# slots are being reserved on the queue,
# and wait until all jobs have finished
if [ ! -z "${SGE_ROOT}" ]; then
if [ "${cpu_exe}" != "" ]; then
qalter ${cpu_jid} -R y
fi
while [ : ]; do
for jid in ${cuda_jid};
do
tmp=`qstat -j ${jid} | wc`
tmp=`echo $tmp | awk '{print $1}'`
if [ $tmp -ne 0 ]; then
break
fi
done
if [ "${cpu_exe}" != "" ]; then
if [ $tmp -eq 0 ]; then
tmp=`qstat -j ${cpu_jid} | wc`
tmp=`echo $tmp | awk '{print $1}'`
if [ $tmp -eq 0 ]; then
break
fi
fi
fi
sleep 5m
done
fi
# Check that eddy output exists
for cuda_exe in ${cuda_exes};
do
tmp=`basename $cuda_exe`
version=`echo $tmp | sed 's/eddy_cuda//'`
if [ ! -f ${odir}/eddyCudaOutput${version}.nii* ]; then
exit 1
fi
done
if [ "${cpu_exe}" != "" ]; then
if [ ! -f ${odir}/eddyCpuOutput.nii* ]; then
echo "eddyCpuOutput missing"
exit 1
fi
fi
# Check the results against ground truth
cuda_exit_status=0
for cuda_exe in ${cuda_exes};
do
tmp=`basename $cuda_exe`
version=`echo $tmp | sed 's/eddy_cuda//'`
./EddyFeeds.py ${odir} Cuda${version} `imglob -extension ${indir}/EddyTestData/eddyData/testMask` `imglob -extension ${odir}/eddyCudaOutput${version}` `imglob -extension ${indir}/EddyTestData/eddyData/GroundTruth/ground_truth` ${odir}/eddyCudaOutput${version}.eddy_displacement_fields ${indir}/EddyTestData/eddyData/DisplacementFields/DisplacementField ${odir}/eddyCudaOutput${version}.eddy_outlier_map ${indir}/EddyTestData/eddyData/OutlierTruth/dropoutLog_1.txt ${max_mean_ima_diff} ${max_max_ima_diff} ${max_mean_dfield_diff} ${max_max_dfield_diff} ${allowed_false_positives} ${allowed_false_negatives}
cuda_exit_status=$(($cuda_exit_status + $?))
done
cpu_exit_status=0
if [ "${cpu_exe}" != "" ]; then
./EddyFeeds.py ${odir} Cpu `imglob -extension ${indir}/EddyTestData/eddyData/testMask` `imglob -extension ${odir}/eddyCpuOutput` `imglob -extension ${indir}/EddyTestData/eddyData/GroundTruth/ground_truth` ${odir}/eddyCpuOutput.eddy_displacement_fields ${indir}/EddyTestData/eddyData/DisplacementFields/DisplacementField ${odir}/eddyCpuOutput.eddy_outlier_map ${indir}/EddyTestData/eddyData/OutlierTruth/dropoutLog_1.txt ${max_mean_ima_diff} ${max_max_ima_diff} ${max_mean_dfield_diff} ${max_max_dfield_diff} ${allowed_false_positives} ${allowed_false_negatives}
cpu_exit_status=$?
fi
if [ $cuda_exit_status -gt 0 ] || [ $cpu_exit_status -gt 0 ]; then
echo "Test failed"
exit 1
else
echo "Test passed"
exit 0
fi
File moved
File moved
#! /bin/sh
#
# This script runs eddy followed by some
# tests on the output.
# It uses some b=7000 data from the pilot phase
# of the HCP. The "ground truth" is simply the
# output from eddy at a time when it seemed to
# do a good job. The tolerance is quite high. That
# reflects both that the data has a quite high
# scale (b=0 values ~2000) and also that the
# run-to-run variability of eddy is quite high
# on these data.
#
set -e
thisdir=$(cd $(dirname $0) && pwd)
odir=$1
indir=$2
#
# Inputs 1--3 are the once neccessary for feeds to work
# Additional inputs are optional and intended for testing
# outside of the feeds context.
#
# Input 4 is alternative location of executable
#
if [ "$#" -gt 3 ]; then
exedir=$4
echo "Directory for eddy executables set to ${exedir}"
else
exedir="${FSLDIR}/bin"
fi
if [ ! -d "$odir" ]; then
echo "Output directory ${odir} does not exist"
exit 1;
fi
if [ ! -d "$indir" ]; then
echo "Input directory ${indir} does not exist"
exit 1;
fi
# Prepare arguments to pass to eddy
eddy_args="--imain=${indir}/EddyHigh_b_TestData/eddyData/testData " \
"--mask=${indir}/EddyHigh_b_TestData/eddyData/testMask " \
"--bvals=${indir}/EddyHigh_b_TestData/eddyData/testBvals " \
"--bvecs=${indir}/EddyHigh_b_TestData/eddyData/testBvecs " \
"--index=${indir}/EddyHigh_b_TestData/eddyData/testIndex " \
"--acqp=${indir}/EddyHigh_b_TestData/eddyData/testAcqparams " \
"--topup=${indir}/EddyHigh_b_TestData/eddyData/testTopup " \
"--nvoxhp=5000 --repol --fwhm=10,0,0,0,0 --dont_peas --very_verbose"
# run eddy
output_prefixes=$(${thisdir}/runEddy ${exedir} ${odir} ${eddy_args} | tail -n1)
# Define some constants
max_mean_ima_diff=15.0
max_max_ima_diff=20.0
# Check the results against ground truth
for prefix in ${output_prefixes}; do
if [[ "${prefix}" = *cuda* ]]; then
precomputed="${indir}/EddyHigh_b_TestData/eddyData/Precomputed/eddy_cuda_output"
else
precomputed="${indir}/EddyHigh_b_TestData/eddyData/Precomputed/eddy_openmp_output"
fi
${thisdir}/EddyHigh_b_Feeds.py ${odir} `basename ${prefix}` \
`imglob -extension ${indir}/EddyHigh_b_TestData/eddyData/testMask` \
`imglob -extension ${prefix}` \
`imglob -extension ${precomputed}` \
$max_mean_ima_diff $max_max_ima_diff
done
#! /bin/sh
#
# This script runs eddy followed by some
# tests on the output.
# It uses some data from the pilot phase
# of the HCP where each diffusion direction was
# scanned twice with opposing PE-directions.
# The "ground truth" is simply the output from eddy
# prior to Armadillo and NewNewimage.
#
set -e
thisdir=$(cd $(dirname $0) && pwd)
odir=$1
indir=$2
#
# Inputs 1--3 are the once neccessary for feeds to work
# Additional inputs are optional and intended for testing
# outside of the feeds context.
#
# Input 4 is alternative location of executable
#
if [ "$#" -gt 3 ]; then
exedir=$4
echo "Directory for eddy executables set to ${exedir}"
else
exedir="${FSLDIR}/bin"
fi
if [ ! -d "$odir" ]; then
echo "Output directory ${odir} does not exist"
exit 1;
fi
if [ ! -d "$indir" ]; then
echo "Input directory ${indir} does not exist"
exit 1;
fi
# Prepare arguments to pass to eddy
eddy_args="--imain=${indir}/EddyLSRTestData/eddyData/testData " \
"--mask=${indir}/EddyLSRTestData/eddyData/testMask " \
"--bvals=${indir}/EddyLSRTestData/eddyData/testBvals " \
"--bvecs=${indir}/EddyLSRTestData/eddyData/testBvecs " \
"--index=${indir}/EddyLSRTestData/eddyData/testIndex " \
"--acqp=${indir}/EddyLSRTestData/eddyData/testAcqparams " \
"--topup=${indir}/EddyLSRTestData/eddyData/testTopup " \
"--resamp=lsr --fep --nvoxhp=5000 --repol --fwhm=10,0,0,0,0 " \
"--dont_peas --very_verbose"
# run eddy
output_prefixes=$(${thisdir}/runEddy ${exedir} ${odir} ${eddy_args} | tail -n1)
# Define some constants
max_mean_ima_diff=15.0
max_max_ima_diff=20.0
# Check the results against ground truth
for prefix in ${output_prefixes}; do
if [[ "${prefix}" = *cuda* ]]; then
precomputed="${indir}/EddyLSRTestData/eddyData/Precomputed/eddy_cuda_output"
else
precomputed="${indir}/EddyLSRTestData/eddyData/Precomputed/eddy_openmp_output"
fi
${thisdir}/EddyLSRFeeds.py ${odir} `basename ${prefix}` \
`imglob -extension ${indir}/EddyLSRTestData/eddyData/testMask` \
`imglob -extension ${prefix}` \
`imglob -extension ${precomputed}` \
$max_mean_ima_diff $max_max_ima_diff
done
#! /bin/sh
#
# This script runs eddy for testing the
# movement-by-susceptibility functionality
# followed by some tests on the output.
# It uses simulated data supplied by Mark
# Graham, UCL.
# The data is a subset of that used for
# the MBS paper. We don't have an "actual"
# ground truth so instead we compare against
# the results from the paper (calculated with
# the Cuda version).
# The actual data used for the test is
# .../SecondSetOfSimulations/ap/ec-volumetric-3x/images_SNR40_1
#
set -e
thisdir=$(cd $(dirname $0) && pwd)
odir=$1
indir=$2
#
# Inputs 1--3 are the once neccessary for feeds to work
# Additional inputs are optional and intended for testing
# outside of the feeds context.
#
# Input 4 is alternative location of executable
#
if [ "$#" -gt 3 ]; then
exedir=$4
echo "Directory for eddy executables set to ${exedir}"
else
exedir="${FSLDIR}/bin"
fi
if [ ! -d "$odir" ]; then
echo "Output directory ${odir} does not exist"
exit 1;
fi
if [ ! -d "$indir" ]; then
echo "Input directory ${indir} does not exist"
exit 1;
fi
# Prepare arguments to pass to eddy
eddy_args="--imain=${indir}/EddyMBSTestData/eddyData/testData " \
"--acqp=${indir}/EddyMBSTestData/eddyData/testAcqparams " \
"--mask=${indir}/EddyMBSTestData/eddyData/testMask " \
"--index=${indir}/EddyMBSTestData/eddyData/testIndex " \
"--bvecs=${indir}/EddyMBSTestData/eddyData/testBvecs " \
"--bvals=${indir}/EddyMBSTestData/eddyData/testBvals " \
"--topup=${indir}/EddyMBSTestData/eddyData/testTopup " \
"--fwhm=10,5,2,0,0,0,0,0 --niter=8 --nvoxhp=2000 " \
"--flm=quadratic --dont_peas --estimate_move_by_susceptibility " \
"--mbs_niter=20 --mbs_lambda=10 --mbs_ksp=10 --very_verbose"
# run eddy
output_prefixes=$(${thisdir}/runEddy ${exedir} ${odir} ${eddy_args} | tail -n1)
# Define some constants
max_mean_dfield_diff=0.03
max_max_dfield_diff=0.06
max_mean_ima_diff=0.3
max_max_ima_diff=0.6
# Check the results against precomputed results
for prefix in ${output_prefixes}; do
${thisdir}/MoveBySuscFeeds.py ${odir} `basename ${prefix}` \
`imglob -extension ${indir}/EddyMBSTestData/eddyData/Precomputed/BrainMaskForComparison` \
`imglob -extension ${prefix}` \
`imglob -extension ${indir}/EddyMBSTestData/eddyData/Precomputed/PrecomputedResults` \
`imglob -extension ${prefix}.eddy_mbs_first_order_fields` \
`imglob -extension ${indir}/EddyMBSTestData/eddyData/Precomputed/PrecomputedResults.eddy_mbs_first_order_fields` \
${max_mean_ima_diff} ${max_max_ima_diff} ${max_mean_dfield_diff} ${max_max_dfield_diff}
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment