From 2415ef03f35436f522a1d7f3080e59ea2c6ff20c Mon Sep 17 00:00:00 2001
From: Stephen Smith <steve@fmrib.ox.ac.uk>
Date: Wed, 15 Nov 2000 15:36:31 +0000
Subject: [PATCH] loadsa stuff

---
 cluster.cc | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/cluster.cc b/cluster.cc
index c0bd484..621ff8d 100644
--- a/cluster.cc
+++ b/cluster.cc
@@ -11,6 +11,7 @@
 #include "fmribmain.h"
 #include "newimageall.h"
 #include "infer.h"
+#include <iomanip>
 
 using namespace NEWIMAGE;
 
@@ -195,7 +196,7 @@ int fmrib_main(int argc, char *argv[])
     get_stats(labelim,vin,size,maxvals,meanvals,max,cog,invert);
   }
 
-  cout << "CLUSTERS " << size.size()-1 << endl;
+  // cout << "CLUSTERS " << size.size()-1 << endl;
 
   // save the results
   if (outform==0) {
@@ -245,14 +246,12 @@ int fmrib_main(int argc, char *argv[])
 	nozeroclust++;
       }
     }
-    cout << "No of sub-threshold p-clusters = " << nozeroclust << endl;
+    // cout << "No of sub-threshold p-clusters = " << nozeroclust << endl;
     idx = get_sortindex(pthreshsize);
 
     // Print results
-    cout << "Cluster\tNumber\tMaximum\tp\t-log(p)\tMax Pos\tMax Pos\tMax Pos" 
-	 << "\tCOG\tCOG\tCOG\tMaximum\tMax Pos\tMax Pos\tMax Pos\tMean" << endl;
-    cout << "Index\tVoxels\tValue\t\t\t X \t Y \t Z \t X \t Y \t Z \tCope" 
-	 << "\t X \t Y \t Z \tCope" << endl;
+    cout << "Cluster Index\tVoxels\tP\t-log10(P)\tMax Z\tX\tY\tZ" 
+	 << "\tCOG X\tCOG Y\tCOG Z\tMax COPE\tX\tY\tZ\tMean COPE" << endl;
     std::vector<int> pthreshindex(length,0);
     for (int n=length-1; n>=1; n--) {
       int index=idx[n];
@@ -260,12 +259,15 @@ int fmrib_main(int argc, char *argv[])
       float p = infer(k);
       if (pthreshsize[index]>0) {
 	pthreshindex[index] = n - nozeroclust;
-	cout << pthreshindex[index] << "\t" << k << "\t" 
+	float mlog10p;
+	if (p>1e-38) mlog10p=-log10(p);
+	else mlog10p=42;
+	cout << setprecision(3) << pthreshindex[index] << "\t" << k << "\t" 
+	     << p << "\t" << mlog10p << "\t" 
 	     << maxvals[index] << "\t" 
-	     << p << "\t" << -log10(p) << "\t" << max[index].x << "\t" 
-	     << max[index].y << "\t" << max[index].z << "\t"
-	     << cog[index].x << "\t" << cog[index].y << "\t" 
-	     << cog[index].z << "\t" << copemaxval[index] << "\t"
+	     << max[index].x << "\t" << max[index].y << "\t" << max[index].z << "\t"
+	     << cog[index].x << "\t" << cog[index].y << "\t" << cog[index].z << "\t"
+	     << copemaxval[index] << "\t"
 	     << copemax[index].x << "\t" << copemax[index].y << "\t" 
 	     << copemax[index].z << "\t" << copemean[index] << endl;
       }
-- 
GitLab