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

Fixed lots of little things in probtrackx to make command line usage much more...

Fixed lots of little things in probtrackx to make command line usage much more logical and to fix two mask mode.
parent a72e9e27
No related branches found
No related tags found
No related merge requests found
...@@ -34,9 +34,11 @@ int main ( int argc, char **argv ){ ...@@ -34,9 +34,11 @@ int main ( int argc, char **argv ){
} }
if(opts.mode.value()=="simple") if(opts.mode.value()=="simple")
track(); track();
else if(fsl_imageexists(opts.mask2.value())){ twomasks();} string tmpin=opts.seedfile.value();
if(fsl_imageexists(opts.mask2.value())){ twomasks();}
else if(fsl_imageexists(opts.seedfile.value())){ seedmask();} else if(fsl_imageexists(opts.seedfile.value())){ seedmask();}
//else if(fopen(tmpin.c_str(),"r")!=NULL ){ track();}
// else if(opts.mode.value()=="seeds_to_targets") // else if(opts.mode.value()=="seeds_to_targets")
// seeds_to_targets(); // seeds_to_targets();
// else if(opts.mode.value()=="seedmask") // else if(opts.mode.value()=="seedmask")
...@@ -57,9 +59,9 @@ int main ( int argc, char **argv ){ ...@@ -57,9 +59,9 @@ int main ( int argc, char **argv ){
// maskmatrix(); // maskmatrix();
// else if(opts.mode.value()=="meshlengths") // else if(opts.mode.value()=="meshlengths")
// mesh_lengths(); // mesh_lengths();
else{ //else{
cout <<"Invalid setting for option mode -- try setting mode=help"<<endl; // cout <<"Invalid setting for option mode -- try setting mode=help"<<endl;
} //}
return 0; return 0;
} }
......
...@@ -80,7 +80,7 @@ probtrackxOptions* probtrackxOptions::gopt = NULL; ...@@ -80,7 +80,7 @@ probtrackxOptions* probtrackxOptions::gopt = NULL;
check=false; check=false;
} }
} }
if(mode.value()=="seedmask"){ /* if(mode.value()=="seedmask"){
if(logdir.value()==""){ if(logdir.value()==""){
mesg+="You must set an output directory name in seedmask mode: --dir\n"; mesg+="You must set an output directory name in seedmask mode: --dir\n";
check=false; check=false;
...@@ -163,7 +163,7 @@ probtrackxOptions* probtrackxOptions::gopt = NULL; ...@@ -163,7 +163,7 @@ probtrackxOptions* probtrackxOptions::gopt = NULL;
mesg+="You must set an output name in maskmatrix mode: -o\n"; mesg+="You must set an output name in maskmatrix mode: -o\n";
check=false; check=false;
} }
} } */
if(!check){ if(!check){
cerr<<mesg; cerr<<mesg;
exit(2); exit(2);
...@@ -175,9 +175,10 @@ probtrackxOptions* probtrackxOptions::gopt = NULL; ...@@ -175,9 +175,10 @@ probtrackxOptions* probtrackxOptions::gopt = NULL;
void probtrackxOptions::modehelp() void probtrackxOptions::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 If your seed voxel is not in diffusion space\n you need to specify a volume in yuour input\n space (--seedref)\n and a matrix taking this space to diffusion space(--xfm).\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; /* 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 If your seed voxel is not in diffusion space\n you need to specify a volume in yuour input\n space (--seedref)\n and a matrix taking this space to diffusion space(--xfm).\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")) if ( getenv("FSLINFMRIB"))
matrixmodehelp(); matrixmodehelp();
*/
} }
void probtrackxOptions::matrixmodehelp(){ void probtrackxOptions::matrixmodehelp(){
......
...@@ -100,10 +100,10 @@ class probtrackxOptions { ...@@ -100,10 +100,10 @@ class probtrackxOptions {
seedfile(string("-x,--seed"), string("Seed"), seedfile(string("-x,--seed"), string("Seed"),
string("Seed volume or voxel depending on mode"), string("Seed volume or voxel depending on mode"),
true, requires_argument), true, requires_argument),
mode(string("--mode"), string("simple"), mode(string("--mode"), string(""),
string("tracking mode - To see list of options and explanations, use --mode=help"), string("use --mode=simple for single seed voxel"),
true, requires_argument), false, requires_argument),
targetfile(string("--targetmasks"), string("cmasks"), targetfile(string("--targetmasks"), string("cmasks"),
string("File containing a list of target masks - required for seeds_to_targets mode"), string("File containing a list of target masks - required for seeds_to_targets mode"),
false, requires_argument), false, requires_argument),
simpleout(string("--opd"), false, simpleout(string("--opd"), false,
...@@ -123,7 +123,7 @@ class probtrackxOptions { ...@@ -123,7 +123,7 @@ class probtrackxOptions {
false, no_argument), false, no_argument),
outfile(string("-o,--out"), string(""), outfile(string("-o,--out"), string(""),
string("Output file"), string("Output file (only for single seed voxel mode)"),
false, requires_argument), false, requires_argument),
rubbishfile(string("--rubbish"), string(""), rubbishfile(string("--rubbish"), string(""),
string("Rubbish file"), string("Rubbish file"),
......
...@@ -33,22 +33,20 @@ void twomasks() ...@@ -33,22 +33,20 @@ void twomasks()
for(int y=0;y<seeds.ysize();y++){ for(int y=0;y<seeds.ysize();y++){
for(int x=0;x<seeds.xsize();x++){ for(int x=0;x<seeds.xsize();x++){
if(seeds(x,y,z)>0){ if(seeds(x,y,z)>0){
seedmanager.run(x,y,z); seedmanager.run(x,y,z,false,-1);
} }
} }
} }
} }
cout<<"finished a"<<endl;
stline.pop_waymasks(); stline.pop_waymasks();
cout<<"popped"<<endl;
stline.add_waymask(seeds); stline.add_waymask(seeds);
cout<<"added"<<endl;
for(int z=0;z<seeds2.zsize();z++){ for(int z=0;z<seeds2.zsize();z++){
for(int y=0;y<seeds2.ysize();y++){ for(int y=0;y<seeds2.ysize();y++){
for(int x=0;x<seeds2.xsize();x++){ for(int x=0;x<seeds2.xsize();x++){
if(seeds2(x,y,z)>0){ if(seeds2(x,y,z)>0){
seedmanager.run(x,y,z); seedmanager.run(x,y,z,false,seeds2(x,y,z)-1);
} }
} }
} }
......
...@@ -493,7 +493,7 @@ namespace TRACT{ ...@@ -493,7 +493,7 @@ namespace TRACT{
} }
void Counter::save_pathdist(){ void Counter::save_pathdist(){
save_volume(m_prob,logger.appendDir(opts.outfile.value())); save_volume(m_prob,logger.appendDir("fdt_paths"));
} }
void Counter::save_pathdist(string add){ //for simple mode void Counter::save_pathdist(string add){ //for simple mode
...@@ -537,11 +537,12 @@ namespace TRACT{ ...@@ -537,11 +537,12 @@ namespace TRACT{
} }
void Seedmanager::run(const float& x,const float& y,const float& z,bool onewayonly){ void Seedmanager::run(const float& x,const float& y,const float& z,bool onewayonly, int fibst){
//onewayonly for mesh things.. //onewayonly for mesh things..
cout <<x<<" "<<y<<" "<<z<<endl; cout <<x<<" "<<y<<" "<<z<<endl;
int fibst=m_seeds(int(round(x)),int(round(y)),int(round(z)))-1;//fibre to start with is taken from seed volume.. if(fibst == -1){
fibst=m_seeds(int(round(x)),int(round(y)),int(round(z)))-1;//fibre to start with is taken from seed volume..
}
if(opts.randfib.value()){ if(opts.randfib.value()){
float tmp=rand()/RAND_MAX; float tmp=rand()/RAND_MAX;
if(tmp>0.5) if(tmp>0.5)
......
...@@ -196,7 +196,7 @@ namespace TRACT{ ...@@ -196,7 +196,7 @@ namespace TRACT{
m_seeddims.ReSize(3); m_seeddims.ReSize(3);
m_seeddims<<m_seeds.xdim()<<m_seeds.ydim()<<m_seeds.zdim(); m_seeddims<<m_seeds.xdim()<<m_seeds.ydim()<<m_seeds.zdim();
} }
void run(const float& x,const float& y,const float& z,bool onewayonly=false); void run(const float& x,const float& y,const float& z,bool onewayonly=false, int fibst=-1);
}; };
} }
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