From 56d07c01673f9331fca3bbd8cf204ae4fb587cd6 Mon Sep 17 00:00:00 2001 From: Saad Jbabdi <saad@fmrib.ox.ac.uk> Date: Wed, 6 Dec 2006 13:44:34 +0000 Subject: [PATCH] changes for Xgui --- old_bedpostX | 36 +++++++++++++++++------------------- old_bedpostX_proc | 14 +++++++++++--- probtrackxOptions.h | 15 ++++++++++----- streamlines.cc | 6 ++++-- xfibres.cc | 12 ++++++------ 5 files changed, 48 insertions(+), 35 deletions(-) diff --git a/old_bedpostX b/old_bedpostX index 7b499c5..00e407c 100644 --- a/old_bedpostX +++ b/old_bedpostX @@ -108,21 +108,6 @@ fi Lock; -#parse option arguments -nfibres=2 -fudge=1 -burnin=1000 -while [ ! -z "$2" ] -do - case "$2" in - -n) nfibres=$3;shift;; - -w) fudge=$3;shift;; - -b) burnin=$3;shift;; - *) break;; - esac - shift -done - subjdir=`make_absolute $1` subjdir=`echo $subjdir | sed 's/\/$/$/g'` @@ -163,6 +148,22 @@ if [ `${FSLDIR}/bin/imtest ${subjdir}/nodif_brain_mask` -eq 0 ]; then fi +#parse option arguments +nfibres=2 +fudge=1 +burnin=1000 +while [ ! -z "$2" ] +do + case "$2" in + -n) nfibres=$3;shift;; + -w) fudge=$3;shift;; + -b) burnin=$3;shift;; + *) break;; + esac + shift +done + + echo making bedpostX directory mkdir -p ${subjdir}.bedpostX/ mkdir -p ${subjdir}.bedpostX/diff_slices @@ -216,7 +217,7 @@ done numfib=`${FSLDIR}/bin/imglob -oneperimage ${subjdir}.bedpostX/diff_slices/data_slice_0000/f*samples |wc -w` - +echo number of fibres $numfib fib=1; while [ $fib -le $numfib ];do @@ -232,9 +233,6 @@ while [ $fib -le $numfib ];do fib=`echo "$fib +1"|bc`; done -${FSLDIR}/bin/avwmerge -z ${subjdir}.bedpostX/meanSignal `${FSLDIR}/bin/imglob -oneperimage ${subjdir}.bedpostX/diff_slices/data_slice_*/meanSignal` -${FSLDIR}/bin/avwmerge -z ${subjdir}.bedpostX/stdSignal `${FSLDIR}/bin/imglob -oneperimage ${subjdir}.bedpostX/diff_slices/data_slice_*/stdSignal` - echo Removing intermediate files if [ `imtest ${subjdir}.bedpostX/merged_th1samples` -eq 1 ];then diff --git a/old_bedpostX_proc b/old_bedpostX_proc index 56d192e..54814bc 100644 --- a/old_bedpostX_proc +++ b/old_bedpostX_proc @@ -14,6 +14,11 @@ Usage() { [ "$2" = "" ] && Usage + +subjdir=$1 +nslices=$2 + + #parse option arguments nfibres=2 fudge=1.5 @@ -29,13 +34,16 @@ do shift done +echo subjdir $subjdir +echo nslices $nslices +echo nfibres $nfibres +echo fudge $fudge +echo burnin $burnin +echo piddir $piddir [ "$piddir" = "" ] || touch ${piddir}/`hostname`_fdt_${$} -subjdir=$1 -nslices=$2 - slice=0 while [ $slice -lt $nslices ];do slicezp=`${FSLDIR}/bin/zeropad $slice 4` diff --git a/probtrackxOptions.h b/probtrackxOptions.h index 07724aa..9561768 100644 --- a/probtrackxOptions.h +++ b/probtrackxOptions.h @@ -48,6 +48,7 @@ class probtrackxOptions { Option<string> seedref; Option<string> mask2; Option<string> waypoints; + Option<bool> waypoints_and; Option<string> meshfile; FmribOption<string> lrmask; Option<string> logdir; @@ -129,8 +130,8 @@ class probtrackxOptions { outfile(string("-o,--out"), string(""), string("Output file (only for single seed voxel mode)"), false, requires_argument), - rubbishfile(string("--rubbish"), string(""), - string("Rubbish file"), + rubbishfile(string("--avoid"), string(""), + string("Reject pathways passing through locations given by this mask"), false, requires_argument), stopfile(string("--stop"), string(""), string("Stop tracking at locations given by this mask file"), @@ -147,13 +148,16 @@ class probtrackxOptions { string("second mask in twomask_symm mode."), false, requires_argument), waypoints(string("--waypoints"), string(""), - string("Waypoint mask or ascii list of waypoint masks."), - false, requires_argument), + string("Waypoint mask or ascii list of waypoint masks"), + false, requires_argument), + waypoints_and(string("--network"), true, + string("Searches for pathways connecting every seed to at least one waypoint"), + false, no_argument), meshfile(string("--mesh"), string(""), string(""), false, requires_argument), lrmask(string("--lrmask"), string(""), - string("low resolution binary brain mask for stroring connectivity distribution in matrix2 mode."), + string("low resolution binary brain mask for stroring connectivity distribution in matrix2 mode"), false, requires_argument), logdir(string("--dir"), string(""), string("Directory to put the final volumes in - code makes this directory"), @@ -206,6 +210,7 @@ class probtrackxOptions { options.add(skipmask); options.add(mask2); options.add(waypoints); + options.add(waypoints_and); options.add(meshfile); options.add(lrmask); options.add(seedref); diff --git a/streamlines.cc b/streamlines.cc index 5a4c6d6..341aa7e 100644 --- a/streamlines.cc +++ b/streamlines.cc @@ -94,6 +94,7 @@ namespace TRACT{ m_part.change_xyz(x,y,z); int partlength=0; bool rubbish_passed=false; + bool stop_flag=false; //NB - this only goes in one direction!! for(unsigned int pf=0;pf<m_passed_flags.size();pf++) { m_passed_flags[pf]=false; /// only keep it if this streamline went through all the masks @@ -150,9 +151,10 @@ namespace TRACT{ } if(opts.stopfile.value()!=""){ if(m_stop(x_s,y_s,z_s)!=0){ - m_path.pop_back(); - break; + stop_flag=true; } + else + if(stop_flag)break; } diff --git a/xfibres.cc b/xfibres.cc index 0baed21..53d4ed1 100644 --- a/xfibres.cc +++ b/xfibres.cc @@ -360,12 +360,12 @@ public: mean_fsamples_out.push_back(m_mean_fsamples[f]); Log& logger = LogSingleton::getInstance(); - tmp.setmatrix(m_dsamples,mask); - save_volume4D(tmp,logger.appendDir("dsamples")); - tmp.setmatrix(m_S0samples,mask); - save_volume4D(tmp,logger.appendDir("S0samples")); - tmp.setmatrix(m_lik_energy,mask); - save_volume4D(tmp,logger.appendDir("lik_energy")); + //tmp.setmatrix(m_dsamples,mask); + //save_volume4D(tmp,logger.appendDir("dsamples")); + //tmp.setmatrix(m_S0samples,mask); + //save_volume4D(tmp,logger.appendDir("S0samples")); + //tmp.setmatrix(m_lik_energy,mask); + //save_volume4D(tmp,logger.appendDir("lik_energy")); //Sort the output based on mean_fsamples // -- GitLab