From 6d7fc1c534a12eb9a334578cf4db10fac831194c Mon Sep 17 00:00:00 2001
From: Saad Jbabdi <saad@fmrib.ox.ac.uk>
Date: Mon, 6 Aug 2007 20:11:23 +0000
Subject: [PATCH] fix waypoint management in nmasks

---
 ptx_nmasks.cc  | 13 +++++++------
 streamlines.cc | 16 ++++------------
 streamlines.h  |  1 +
 3 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/ptx_nmasks.cc b/ptx_nmasks.cc
index 947ef86..f09aafc 100644
--- a/ptx_nmasks.cc
+++ b/ptx_nmasks.cc
@@ -42,17 +42,18 @@ void nmasks()
   Counter counter(seeds[0],stline);
   counter.initialise();
   Seedmanager seedmanager(counter);
+  
 
-  for(unsigned int i=0;i<seeds.size();i++){
-    stline.clear_waymasks();
+  for(unsigned int i=0;i<seeds.size();i++){ 
     tmpvol=0;
-    for(unsigned int j=0;j<seeds.size();j++){
+    for(unsigned int j=0;j<seeds.size();j++)
       if(j!=i)
-	tmpvol += seeds[j];
-      //	stline.add_waymask(seeds[j]);
-    }
+	tmpvol+=seeds[j];
+    if(i<=1)
+      stline.pop_waymasks();
     stline.add_waymask(tmpvol);
 
+    cout << "Tracking from mask " << i+1 << endl;
     for(int z=0;z<seeds[i].zsize();z++){
       for(int y=0;y<seeds[i].ysize();y++){
 	for(int x=0;x<seeds[i].xsize();x++){
diff --git a/streamlines.cc b/streamlines.cc
index b925337..dc8d685 100644
--- a/streamlines.cc
+++ b/streamlines.cc
@@ -201,17 +201,9 @@ namespace TRACT{
     
     bool accept_path=true;
     if(m_passed_flags.size()!=0){
-      if(!opts.network.value()){
-	for(unsigned int i=0; i<m_passed_flags.size();i++)
-	  if(!m_passed_flags[i])
-	    accept_path=false;
-      }
-      else{
-	accept_path=false;
-	for(unsigned int i=0; i<m_passed_flags.size();i++)
-	  if(m_passed_flags[i])
-	    accept_path=true;
-      }
+      for(unsigned int i=0; i<m_passed_flags.size();i++)
+	if(!m_passed_flags[i])
+	  accept_path=false;
     }   
     if(rubbish_passed)
       accept_path=false;
@@ -627,7 +619,7 @@ namespace TRACT{
     //onewayonly for mesh things..
     cout <<x<<" "<<y<<" "<<z<<endl;
     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..
+      fibst=0;//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()){
       float tmp=rand()/RAND_MAX * float(m_stline.nfibres()-1);
diff --git a/streamlines.h b/streamlines.h
index 1fef0a5..37ce57a 100644
--- a/streamlines.h
+++ b/streamlines.h
@@ -69,6 +69,7 @@ namespace TRACT{
 	pop_waymasks();
     }
 
+
     inline int nfibres() const {return vols.nfibres();}
     inline const float get_x_seed() const {return m_x_s_init;}
     inline const float get_y_seed() const {return m_y_s_init;}
-- 
GitLab