From f0b01b9ddc450ac4036c88df69d38ea1111f108f Mon Sep 17 00:00:00 2001
From: Saad Jbabdi <saad@fmrib.ox.ac.uk>
Date: Mon, 28 Aug 2006 09:47:53 +0000
Subject: [PATCH] deals with mask containing non _1_ values

---
 ptx_seedmask.cc |  3 ++-
 ptx_twomasks.cc | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/ptx_seedmask.cc b/ptx_seedmask.cc
index 6c997c1..78dcd6a 100644
--- a/ptx_seedmask.cc
+++ b/ptx_seedmask.cc
@@ -26,7 +26,8 @@ void seedmask()
   Counter counter(seeds,stline);
   counter.initialise();
   Seedmanager seedmanager(counter);
-  
+
+
   for(int z=0;z<seeds.zsize();z++){
     cout <<"sl "<<z<<endl;
     for(int y=0;y<seeds.ysize();y++){
diff --git a/ptx_twomasks.cc b/ptx_twomasks.cc
index a1190df..beb9660 100644
--- a/ptx_twomasks.cc
+++ b/ptx_twomasks.cc
@@ -23,6 +23,25 @@ void twomasks()
   volume<int> seeds,seeds2;
   read_volume(seeds,opts.seedfile.value());
   read_volume(seeds2,opts.mask2.value());
+
+
+  // correct for non-1 values
+  // should be seeds.binarise();
+  for(int z=seeds.minz();z<=seeds.maxz();z++)
+    for(int y=seeds.miny();y<=seeds.maxy();y++)
+      for(int x=seeds.minx();x<=seeds.maxx();x++)
+	if(seeds(x,y,z)!=0)
+	  seeds(x,y,z)=1;
+  for(int z=seeds2.minz();z<=seeds2.maxz();z++)
+    for(int y=seeds2.miny();y<=seeds2.maxy();y++)
+      for(int x=seeds2.minx();x<=seeds2.maxx();x++)
+	if(seeds2(x,y,z)!=0)
+	  seeds2(x,y,z)=1;
+  
+
+
+
+
   Streamliner stline;
   Counter counter(seeds,stline);
   counter.initialise();
-- 
GitLab