Skip to content
Snippets Groups Projects
Commit 23ebe4aa authored by Tim Behrens's avatar Tim Behrens
Browse files

*** empty log message ***

parent df7f66f7
No related branches found
No related tags found
No related merge requests found
...@@ -20,9 +20,9 @@ Clean_Exit(){ ...@@ -20,9 +20,9 @@ Clean_Exit(){
for j in ${i};do for j in ${i};do
host=`echo $j | awk -F _fdt_ '{print $1}'` host=`echo $j | awk -F _fdt_ '{print $1}'`
pid=`echo $j | awk -F _fdt_ '{print $2}'` pid=`echo $j | awk -F _fdt_ '{print $2}'`
if [ "x${FSL_MACHINE_LIST}" != "x" ]; then if [ "x${FSLMACHINELIST}" != "x" ]; then
# ${FSL_REMOTE_CALL} $host "kill -KILL $pid" #this leaves one child process per processor - what can you do? # ${FSLREMOTECALL} $host "kill -KILL $pid" #this leaves one child process per processor - what can you do?
$FSL_REMOTE_CALL $host "if [ -r /etc/fslconf/fsl.sh ];then . /etc/fslconf/fsl.sh; elif [ -r /usr/local/etc/fslconf/fsl.sh ];then . /usr/local/etc/fslconf/fsl.sh; elif [ -r \${HOME}/.fslconf/fsl.sh ]; then . \${HOME}/.fslconf/fsl.sh; fi; if [ x\${FSLDIR} != "x" ];then \${FSLDIR}/bin/bedpost_kill_pid ${pid} >/dev/null 2>&1; else echo FSLDIR not set in any default location on machine `hostname`;fi" >/dev/null 2>&1 & $FSLREMOTECALL $host "if [ -r /usr/local/etc/fslconf/fsl.sh ];then . /usr/local/etc/fslconf/fsl.sh;fi; if [ -r /etc/fslconf/fsl.sh ];then . /etc/fslconf/fsl.sh;fi; if [ -r \${HOME}/.fslconf/fsl.sh ]; then . \${HOME}/.fslconf/fsl.sh; fi; if [ x\${FSLDIR} != "x" ];then \${FSLDIR}/bin/bedpost_kill_pid ${pid} >/dev/null 2>&1; else echo FSLDIR not set in any default location on machine `hostname`;fi" >/dev/null 2>&1 &
else else
${FSLDIR}/bin/bedpost_kill_pid ${pid} ${FSLDIR}/bin/bedpost_kill_pid ${pid}
fi fi
...@@ -33,14 +33,14 @@ Clean_Exit(){ ...@@ -33,14 +33,14 @@ Clean_Exit(){
} }
Lock(){ Lock(){
if [ "x${FSL_LOCK_DIR}" != "x" ];then if [ "x${FSLLOCKDIR}" != "x" ];then
touch ${FSL_LOCK_DIR}/.bedpost.lock touch ${FSLLOCKDIR}/.bedpost.lock
fi fi
} }
ExitUnlock(){ ExitUnlock(){
if [ -e ${FSL_LOCK_DIR}/.bedpost.lock ];then if [ -e ${FSLLOCKDIR}/.bedpost.lock ];then
rm ${FSL_LOCK_DIR}/.bedpost.lock rm ${FSLLOCKDIR}/.bedpost.lock
fi fi
#clean up slices #clean up slices
...@@ -58,9 +58,9 @@ ExitUnlock(){ ...@@ -58,9 +58,9 @@ ExitUnlock(){
} }
LockTest(){ LockTest(){
if [ "x${FSL_LOCK_DIR}" = "x" ];then if [ "x${FSLLOCKDIR}" = "x" ];then
echo 1; echo 1;
elif [ ! -e ${FSL_LOCK_DIR}/.bedpost.lock ];then elif [ ! -e ${FSLLOCKDIR}/.bedpost.lock ];then
echo 1; echo 1;
else else
echo 0; echo 0;
...@@ -148,21 +148,20 @@ ${FSLDIR}/bin/avwslice ${subjdir}/data ...@@ -148,21 +148,20 @@ ${FSLDIR}/bin/avwslice ${subjdir}/data
${FSLDIR}/bin/avwslice ${subjdir}/nodif_brain_mask ${FSLDIR}/bin/avwslice ${subjdir}/nodif_brain_mask
#for parallel processing, the following need to be setup elsewhere #for parallel processing, the following need to be setup elsewhere
#FSL_MACHINE_LIST="list of machines (can be duplicated for two processors etc.)" #FSLMACHINELIST="list of machines (can be duplicated for two processors etc.)"
#FSL_REMOTE_CALL="ssh (or rsh or whatever you want to use)" #FSLREMOTECALL="ssh (or rsh or whatever you want to use)"
if [ "x$FSL_MACHINE_LIST" = "x" ] ; then if [ "x$FSLMACHINELIST" = "x" ] ; then
echo "processing data on local host" echo "processing data on local host"
${FSLDIR}/bin/bedpost_proc $subjdir $nslices ${subjdir}.bedpost/logs/pid_${$} & ${FSLDIR}/bin/bedpost_proc $subjdir $nslices ${subjdir}.bedpost/logs/pid_${$} &
else else
echo "processing data on hosts: $FSL_MACHINE_LIST" echo "processing data on hosts: $FSLMACHINELIST"
for machine in $FSL_MACHINE_LIST; do for machine in $FSLMACHINELIST; do
$FSL_REMOTE_CALL $machine "if [ -r /etc/fslconf/fsl.sh ];then . /etc/fslconf/fsl.sh; elif [ -r /usr/local/etc/fslconf/fsl.sh ];then . /usr/local/etc/fslconf/fsl.sh; elif [ -r \${HOME}/.fslconf/fsl.sh ]; then . \${HOME}/.fslconf/fsl.sh; fi; if [ x\${FSLDIR} != "x" ];then \${FSLDIR}/bin/bedpost_proc $subjdir $nslices ${subjdir}.bedpost/logs/pid_${$}; else echo FSLDIR not set in any default location on machine `hostname`;fi" & $FSLREMOTECALL $machine "if [ -r /usr/local/etc/fslconf/fsl.sh ];then . /usr/local/etc/fslconf/fsl.sh;fi; if [ -r /etc/fslconf/fsl.sh ];then . /etc/fslconf/fsl.sh;fi; if [ -r \${HOME}/.fslconf/fsl.sh ]; then . \${HOME}/.fslconf/fsl.sh; fi; if [ x\${FSLDIR} != "x" ];then \${FSLDIR}/bin/bedpost_proc $subjdir $nslices ${subjdir}.bedpost/logs/pid_${$}; else echo FSLDIR not set in any default location on machine `hostname`;fi" &
done done
fi fi
b=0 b=0
finished=0; finished=0;
while [ $finished -eq 0 ];do while [ $finished -eq 0 ];do
...@@ -191,6 +190,19 @@ ${FSLDIR}/bin/avwmaths ${subjdir}.bedpost/merged_thsamples -Tmean ${subjdir}.bed ...@@ -191,6 +190,19 @@ ${FSLDIR}/bin/avwmaths ${subjdir}.bedpost/merged_thsamples -Tmean ${subjdir}.bed
${FSLDIR}/bin/avwmaths ${subjdir}.bedpost/merged_phsamples -Tmean ${subjdir}.bedpost/mean_phsamples ${FSLDIR}/bin/avwmaths ${subjdir}.bedpost/merged_phsamples -Tmean ${subjdir}.bedpost/mean_phsamples
${FSLDIR}/bin/avwmaths ${subjdir}.bedpost/merged_fsamples -Tmean ${subjdir}.bedpost/mean_fsamples ${FSLDIR}/bin/avwmaths ${subjdir}.bedpost/merged_fsamples -Tmean ${subjdir}.bedpost/mean_fsamples
if [ ${finished} -eq 1 ];then
if [ `imtest ${subjdir}.bedpost/merged_thsamples` -eq 1 ];then
if [ `imtest ${subjdir}.bedpost/merged_phsamples` -eq 1 ];then
if [ `imtest ${subjdir}.bedpost/merged_fsamples` -eq 1 ];then
rm -rf ${subjdir}.bedpost/diff_slices
rm -f ${subjdir}/data_slice_*
rm -f ${subjdir}/nodif_brain_mask_slice_*
fi
fi
fi
fi
mkdir -p ${subjdir}.bedpost/xfms mkdir -p ${subjdir}.bedpost/xfms
xfmdir=${subjdir}.bedpost/xfms xfmdir=${subjdir}.bedpost/xfms
...@@ -200,7 +212,6 @@ echo 0 0 1 0 >> ${xfmdir}/eye.mat ...@@ -200,7 +212,6 @@ echo 0 0 1 0 >> ${xfmdir}/eye.mat
echo 0 0 0 1 >> ${xfmdir}/eye.mat echo 0 0 0 1 >> ${xfmdir}/eye.mat
echo "DONE" echo "DONE"
ExitUnlock() ExitUnlock()
......
#!/bin/sh #!/bin/sh
if [ "$FSL_MACHINE_LIST" = "" ] ; then if [ "x$FSLMACHINELIST" = "x" ] ; then
${FSLDIR}/bin/bedpost_kill_all ${FSLDIR}/bin/bedpost_kill_all
else else
unique_machines=`echo $FSL_MACHINE_LIST |tr " " \\\n |sort -u` unique_machines=`echo $FSLMACHINELIST |tr " " \\\n |sort -u`
echo $unique_machines; echo $unique_machines;
for machine in $unique_machines; do for machine in $unique_machines; do
$FSL_REMOTE_CALL $machine "if [ -r /etc/fslconf/fsl.sh ];then . /etc/fslconf/fsl.sh; elif [ -r /usr/local/etc/fslconf/fsl.sh ];then . /usr/local/etc/fslconf/fsl.sh; elif [ -r \${HOME}/.fslconf/fsl.sh ]; then . \${HOME}/.fslconf/fsl.sh; fi; if [ x\${FSLDIR} != "x" ];then \${FSLDIR}/bin/bedpost_kill_all; else echo FSLDIR not set in any default location on machine `hostname`;fi" & $FSLREMOTECALL $machine "if [ -r /usr/local/etc/fslconf/fsl.sh ];then . /usr/local/etc/fslconf/fsl.sh;fi; if [ -r /etc/fslconf/fsl.sh ];then . /etc/fslconf/fsl.sh;fi; if [ -r \${HOME}/.fslconf/fsl.sh ]; then . \${HOME}/.fslconf/fsl.sh; fi; if [ x\${FSLDIR} != "x" ];then \${FSLDIR}/bin/bedpost_kill_all; else echo FSLDIR not set in any default location on machine `hostname`;fi" &
done done
fi fi
...@@ -175,9 +175,14 @@ probtrackOptions* probtrackOptions::gopt = NULL; ...@@ -175,9 +175,14 @@ probtrackOptions* probtrackOptions::gopt = NULL;
void probtrackOptions::modehelp() void probtrackOptions::modehelp()
{ {
cout<<"tracking mode - Options are:\n\n simple (default)\n Input is text file defining start point.\n Output is dti space volume with connectivity values at each voxel.\n Note-everything in simple mode is in\n diffusion space.\n\n seeds_to_targets\n Inputs are a volume with ones at all seed points\n (requires a matrix taking it to DTI space (--xfm))\n and a text file with the name of a single target mask\n on each new line (--targetmasks).\n Output is a single volume for each target mask where the value of each\n volume within the seed mask corresponds to the number of particles \n seeded from this voxel reaching this target mask.\n\n seedmask\n Input is a volume with ones at all seed points\n (requires a matrix taking it to DTI space (--xfm))\n Output is seed space volume with connectivity values at each voxel\n summed from every seed.\n\n twomasks_symm\n Input is a binary volume for first mask (-x)\n also requires a binary volume for second mask (--mask2)\n (requires a matrix taking both seeds to DTI space (--xfm))\n Output is the sum of all paths the from first mask which pass\n through the second and vice-versa i.e. only paths\n which pass through both masks are retained.\n\n waypoints\n Input is a binary volume for seed mask (-x)\n also requires a binary waypoint mask or ascii list\n of waypoint masks (--mask2)\n (requires a matrix taking both seeds to DTI space (--xfm))\n Output is a volume containing all the paths from the\n seedmask which pass through ALL of the waypoint masks. \n\n matrix1\n Input is a volume with ones at all seed points\n (requires a matrix taking it to DTI space (--xfm))\n Output is an avw format nseeds x nseeds matrix \n where element ij contains the number of particles leaving seed \n voxel i and passing through seed voxel j. \n Second output is an nsees x 3 matrix containing the \n anatomical locations in Seed space of each matrix node.\n\n matrix2\n Inputs are a volume with ones at all seed points\n (requires a matrix taking it to DTI space (--xfm))\n and a low resolution binary mask in register with the\n seed volume (--lrmask)\n Output is a matrix of size nseeds x nlowres \n which contains the connectivity distributions from every seed voxel.\n Auxiliary outputs are index matrices for each axis \n of this matrix containing the anatomical location of each\n node in seed space (x-axis) and low res space (y-axis)\n\n maskmatrix\n Input is volume with integers in each seed location\n Integer values distinguish different clusters\n (e.g. output of Feat clustering)\n (requires a matrix taking it to DTI space (--xfm))\n Output is two matrices whose ij^th element is the\n mean and max number of particles seeded from cluster i which pass \n through cluster j\n"<<endl; cout<<"tracking mode - Options are:\n\n simple (default)\n Input is text file defining start point.\n Output is dti space volume with connectivity values at each voxel.\n Note-everything in simple mode is in\n diffusion space.\n\n seeds_to_targets\n Inputs are a volume with ones at all seed points\n (requires a matrix taking it to DTI space (--xfm))\n and a text file with the name of a single target mask\n on each new line (--targetmasks).\n Output is a single volume for each target mask where the value of each\n volume within the seed mask corresponds to the number of particles \n seeded from this voxel reaching this target mask.\n\n seedmask\n Input is a volume with ones at all seed points\n (requires a matrix taking it to DTI space (--xfm))\n Output is seed space volume with connectivity values at each voxel\n summed from every seed.\n\n twomasks_symm\n Input is a binary volume for first mask (-x)\n also requires a binary volume for second mask (--mask2)\n (requires a matrix taking both seeds to DTI space (--xfm))\n Output is the sum of all paths the from first mask which pass\n through the second and vice-versa i.e. only paths\n which pass through both masks are retained.\n\n waypoints\n Input is a binary volume for seed mask (-x)\n also requires a binary waypoint mask or ascii list\n of waypoint masks (--mask2)\n (requires a matrix taking both seeds to DTI space (--xfm))\n Output is a volume containing all the paths from the\n seedmask which pass through ALL of the waypoint masks.\n"<<endl;
} if ( getenv("FSLINFMRIB"))
matrixmodehelp();
}
void probtrackOptions::matrixmodehelp(){
cout<<" matrix1\n Input is a volume with ones at all seed points\n (requires a matrix taking it to DTI space (--xfm))\n Output is an avw format nseeds x nseeds matrix \n where element ij contains the number of particles leaving seed \n voxel i and passing through seed voxel j. \n Second output is an nsees x 3 matrix containing the \n anatomical locations in Seed space of each matrix node.\n\n matrix2\n Inputs are a volume with ones at all seed points\n (requires a matrix taking it to DTI space (--xfm))\n and a low resolution binary mask in register with the\n seed volume (--lrmask)\n Output is a matrix of size nseeds x nlowres \n which contains the connectivity distributions from every seed voxel.\n Auxiliary outputs are index matrices for each axis \n of this matrix containing the anatomical location of each\n node in seed space (x-axis) and low res space (y-axis)\n\n maskmatrix\n Input is volume with integers in each seed location\n Integer values distinguish different clusters\n (e.g. output of Feat clustering)\n (requires a matrix taking it to DTI space (--xfm))\n Output is two matrices whose ij^th element is the\n mean and max number of particles seeded from cluster i which pass \n through cluster j\n"<<endl;
}
void probtrackOptions::status() void probtrackOptions::status()
......
...@@ -37,11 +37,11 @@ class probtrackOptions { ...@@ -37,11 +37,11 @@ class probtrackOptions {
Option<string> outfile; Option<string> outfile;
Option<string> rubbishfile; Option<string> rubbishfile;
Option<string> seeds_to_dti; Option<string> seeds_to_dti;
Option<string> skipmask; FmribOption<string> skipmask;
Option<string> seedref; Option<string> seedref;
Option<string> mask2; Option<string> mask2;
Option<string> meshfile; Option<string> meshfile;
Option<string> lrmask; FmribOption<string> lrmask;
Option<string> logdir; Option<string> logdir;
Option<bool> forcedir; Option<bool> forcedir;
Option<int> nparticles; Option<int> nparticles;
...@@ -55,6 +55,7 @@ class probtrackOptions { ...@@ -55,6 +55,7 @@ class probtrackOptions {
void parse_command_line(int argc, char** argv,Log& logger); void parse_command_line(int argc, char** argv,Log& logger);
void modecheck(); void modecheck();
void modehelp(); void modehelp();
void matrixmodehelp();
void status(); void status();
private: private:
probtrackOptions(); probtrackOptions();
...@@ -112,7 +113,7 @@ class probtrackOptions { ...@@ -112,7 +113,7 @@ class probtrackOptions {
string("Reference vol to define seed space in simple mode - diffusion space assumed if absent"), string("Reference vol to define seed space in simple mode - diffusion space assumed if absent"),
false, requires_argument), false, requires_argument),
mask2(string("--mask2"), string(""), mask2(string("--mask2"), string(""),
string("second mask in both 2 mask modes."), string("second mask in twomask_symm mode. Waypoint mask or ascii list of masks in wapoints mode."),
false, requires_argument), false, requires_argument),
meshfile(string("--mesh"), string(""), meshfile(string("--mesh"), string(""),
string(""), string(""),
......
...@@ -311,15 +311,10 @@ int main ( int argc, char **argv ){ ...@@ -311,15 +311,10 @@ int main ( int argc, char **argv ){
} }
// write_ascii_matrix(newOMmat.t(),"preprecock"); // write_ascii_matrix(newOMmat.t(),"preprecock");
//Checking for and loading up Seed Coordinates //Checking for and loading up Seed Coordinates
string coordname="coords_for_"+ip+".hdr";
ifstream coordfile(coordname.c_str()); string coordname="coords_for_"+ip;
if(!coordfile){ if(fsl_imageexists(coordname)){
string coordname="coords_for_"+ip+".hdr.gz"; read_volume(coordvol,coordname);
ifstream coordfile(coordname.c_str());
}
if(coordfile){
coordfile.close();
read_volume(coordvol,"coords_for_"+ip);
coordbool=true; coordbool=true;
mycoordmat.ReSize(coordvol.xsize(),coordvol.ysize()); mycoordmat.ReSize(coordvol.xsize(),coordvol.ysize());
for(int j=0;j<coordvol.ysize();j++){ for(int j=0;j<coordvol.ysize();j++){
...@@ -333,15 +328,9 @@ int main ( int argc, char **argv ){ ...@@ -333,15 +328,9 @@ int main ( int argc, char **argv ){
} }
//Checking For and Loading Up Tract coordinates //Checking For and Loading Up Tract coordinates
string trcoordname="tract_space_coords_for_"+ip+".hdr"; string trcoordname="tract_space_coords_for_"+ip;
ifstream trcoordfile(trcoordname.c_str()); if(fsl_imageexists(trcoordname)){
if(!trcoordfile){ read_volume(tractcoordvol,trcoordname);
string trcoordname="tract_space_coords_for_"+ip+".hdr.gz";
ifstream trcoordfile(trcoordname.c_str());
}
if(trcoordfile){
trcoordfile.close();
read_volume(tractcoordvol,"tract_space_coords_for_"+ip);
tractcoordbool=true; tractcoordbool=true;
mytractcoordmat.ReSize(tractcoordvol.xsize(),tractcoordvol.ysize()); mytractcoordmat.ReSize(tractcoordvol.xsize(),tractcoordvol.ysize());
for(int j=0;j<tractcoordvol.ysize();j++){ for(int j=0;j<tractcoordvol.ysize();j++){
......
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