From 22b9162eb1e07f91644a1999e02cac7e737c0bb5 Mon Sep 17 00:00:00 2001 From: Saad Jbabdi <saad@fmrib.ox.ac.uk> Date: Fri, 9 Feb 2007 15:55:51 +0000 Subject: [PATCH] mask bug corrected (masks nolonger have to be binary) --- pt_alltracts.cc | 4 ++-- pt_seeds_to_targets.cc | 8 ++++---- pt_simple.cc | 5 +++-- pt_twomasks.cc | 14 +++++++------- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/pt_alltracts.cc b/pt_alltracts.cc index 2a1fb8f..d297f9a 100644 --- a/pt_alltracts.cc +++ b/pt_alltracts.cc @@ -81,7 +81,7 @@ void alltracts(){ cout<<Sz<<endl; for(int Sy=Seeds.miny();Sy<=Seeds.maxy();Sy++){ for(int Sx=Seeds.minx();Sx<=Seeds.maxx();Sx++){ - if(Seeds(Sx,Sy,Sz)>0){ + if(Seeds(Sx,Sy,Sz)!=0){ ColumnVector xyz_seeds(3),dim_seeds(3),xyz_dti; xyz_seeds << Sx << Sy << Sz; @@ -100,7 +100,7 @@ void alltracts(){ part.restart_reverse(); //go again in the opposite direction } for( int it = 1 ; it <= nsteps/2; it++){ - if( (mask( round(part.x()), round(part.y()), round(part.z())) > 0) ){ + if( (mask( round(part.x()), round(part.y()), round(part.z())) != 0) ){ /////////////////////////////////// //loopchecking diff --git a/pt_seeds_to_targets.cc b/pt_seeds_to_targets.cc index c9d2d77..4193840 100644 --- a/pt_seeds_to_targets.cc +++ b/pt_seeds_to_targets.cc @@ -109,7 +109,7 @@ void seeds_to_targets() cout<<Sz<<endl; for(int Sy=Seeds.miny();Sy<=Seeds.maxy();Sy++){ for(int Sx=Seeds.minx();Sx<=Seeds.maxx();Sx++){ - if(Seeds(Sx,Sy,Sz)>0){ + if(Seeds(Sx,Sy,Sz)!=0){ ColumnVector xyz_seeds(3),dim_seeds(3),xyz_dti; xyz_seeds << Sx << Sy << Sz; dim_seeds <<Seeds.xdim()<<Seeds.ydim()<<Seeds.zdim(); @@ -129,7 +129,7 @@ void seeds_to_targets() for( int it = 1 ; it < nsteps/2; it++){ - if( (mask( round(part.x()), round(part.y()), round(part.z())) == 1) ){ + if( (mask( round(part.x()), round(part.y()), round(part.z())) != 0) ){ if(opts.loopcheck.value()){ float oldrx=loopcheck((int)round(part.x()/lcrat),(int)round(part.y()/lcrat),(int)round(part.z()/lcrat),0); float oldry=loopcheck((int)round(part.x()/lcrat),(int)round(part.y()/lcrat),(int)round(part.z()/lcrat),1); @@ -159,7 +159,7 @@ void seeds_to_targets() if(opts.rubbishfile.value()!=""){ - if(RUBBISH(x_s,y_s,z_s)>0) break; + if(RUBBISH(x_s,y_s,z_s)!=0) break; } path(it+(direc-1)*nsteps/2,1)=round(part.x()); @@ -167,7 +167,7 @@ void seeds_to_targets() path(it+(direc-1)*nsteps/2,3)=round(part.z()); //stopping path in DTI space here for(unsigned int m=0;m<masknames.size();m++){ - if(target_masks[m](x_s,y_s,z_s)>0 && flags[m]==0){ + if(target_masks[m](x_s,y_s,z_s)!=0 && flags[m]==0){ thal_segs[m](Sx,Sy,Sz)=thal_segs[m](Sx,Sy,Sz)+1;flags[m]=1; } } diff --git a/pt_simple.cc b/pt_simple.cc index c81b03f..8ba9858 100644 --- a/pt_simple.cc +++ b/pt_simple.cc @@ -107,7 +107,7 @@ void track(){ } for( int it = 1 ; it <= nsteps/2; it++){ - if( (mask( round(part.x()), round(part.y()), round(part.z())) == 1) ){ + if( (mask( round(part.x()), round(part.y()), round(part.z())) != 0) ){ if(opts.loopcheck.value()){ float oldrx=loopcheck((int)round(part.x()/lcrat),(int)round(part.y()/lcrat),(int)round(part.z()/lcrat),0); float oldry=loopcheck((int)round(part.x()/lcrat),(int)round(part.y()/lcrat),(int)round(part.z()/lcrat),1); @@ -147,7 +147,7 @@ void track(){ if(opts.rubbishfile.value()!="") { - if(RUBBISH(x_s,y_s,z_s)>0) break; + if(RUBBISH(x_s,y_s,z_s)!=0) break; } path(it+(direc-1)*nsteps/2,1)=x_s; @@ -202,5 +202,6 @@ void track(){ } // Close Particle Number Loop string thisout=opts.outfile.value()+num2str(Seeds(SN,1))+(string)"_"+num2str(Seeds(SN,2))+(string)"_"+num2str(Seeds(SN,3)); save_volume(prob,logger.appendDir(thisout)); + //save_volume(prob,thisout); } //Close Seed number Loop } diff --git a/pt_twomasks.cc b/pt_twomasks.cc index f23dde9..f2b721e 100644 --- a/pt_twomasks.cc +++ b/pt_twomasks.cc @@ -93,7 +93,7 @@ void twomasks_symm(){ cout<<Sz<<endl; for(int Sy=Seeds.miny();Sy<=Seeds.maxy();Sy++){ for(int Sx=Seeds.minx();Sx<=Seeds.maxx();Sx++){ - if(Seeds(Sx,Sy,Sz)>0){ + if(Seeds(Sx,Sy,Sz)!=0){ int maskno=Seeds(Sx,Sy,Sz); ColumnVector xyz_seeds(3),dim_seeds(3),xyz_dti; xyz_seeds << Sx << Sy << Sz; @@ -113,7 +113,7 @@ void twomasks_symm(){ int partlength=0; bool keepflag=false; /// only keep it if this direction went through the masks for( int it = 1 ; it <= nsteps/2; it++){ - if( (mask( round(part.x()), round(part.y()), round(part.z())) > 0) ){ + if( (mask( round(part.x()), round(part.y()), round(part.z())) != 0) ){ /////////////////////////////////// //loopchecking @@ -333,7 +333,7 @@ void waypoints(){ cout<<Sz<<endl; for(int Sy=Seeds.miny();Sy<=Seeds.maxy();Sy++){ for(int Sx=Seeds.minx();Sx<=Seeds.maxx();Sx++){ - if(Seeds(Sx,Sy,Sz)>0){ + if(Seeds(Sx,Sy,Sz)!=0){ ColumnVector xyz_seeds(3),dim_seeds(3),xyz_dti; xyz_seeds << Sx << Sy << Sz; dim_seeds <<Seeds.xdim()<<Seeds.ydim()<<Seeds.zdim(); @@ -356,7 +356,7 @@ void waypoints(){ } uberkeepflag=true; for( int it = 1 ; it <= nsteps/2; it++){ - if( (mask( round(part.x()), round(part.y()), round(part.z())) > 0) ){ + if( (mask( round(part.x()), round(part.y()), round(part.z())) != 0) ){ /////////////////////////////////// //loopchecking @@ -385,13 +385,13 @@ void waypoints(){ int y_s =(int)round((float)xyz_seeds(2)); int z_s =(int)round((float)xyz_seeds(3)); if(opts.uberrubbishfile.value()!=""){ - if(UBERRUBBISH(x_s,y_s,z_s)>0) { + if(UBERRUBBISH(x_s,y_s,z_s)!=0) { uberkeepflag=false; break; } } if(opts.rubbishfile.value()!=""){ - if(RUBBISH(x_s,y_s,z_s)>0) break; + if(RUBBISH(x_s,y_s,z_s)!=0) break; } path(it,1)=x_s; path(it,2)=y_s; @@ -400,7 +400,7 @@ void waypoints(){ //update every passed_flag for( unsigned int wm=0;wm<waymasks.size();wm++ ){ - if( waymasks[wm](x_s,y_s,z_s)>0 ) + if( waymasks[wm](x_s,y_s,z_s)!=0 ) passed_flags[wm]=true; } -- GitLab