changeset 1882:4f060d43902e

* Changes to mincstats - Fixed bug in calculation of BiModalT - changed default # of histogram bins to 65536 (from 10000)
author rotor <rotor>
date Mon, 18 Oct 2004 08:20:35 +0000
parents d6ba467edc86
children 37e5bfa0b3a7
files ChangeLog conversion/ana2mnc/ana2mnc progs/mincstats/mincstats.c
diffstat 3 files changed, 19 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
 MINC 2:
+2004-10-18 Andrew Janke <rotor@cmr.uq.edu.au>
+	* Fixed bug in mincstats -BimodalT code to
+           exactly replicate (within reason) volume_stats
+	* Changed default # of int histogram bins from 10000 to 65536
+
 2004-08-11 Bert Vincent <bert@bic.mni.mcgill.ca>
 	* Fix minc.h for netCDF 3.5.1
 	
--- a/conversion/ana2mnc/ana2mnc
+++ b/conversion/ana2mnc/ana2mnc
@@ -78,7 +78,7 @@
      ["-coronal", "const", "-coronal", \$opt{orientation}, 
         "force files to be treated as coronal" ],
      ["-flip|-noflip", "boolean", 0, \$opt{flip}, 
-        "Flip left-right (radiological format)" ],
+        "Flip left-right ie: assuming Analyze Image is in radiological format" ],
      );
 
 if   ($me eq "ana2mnc"){   @files = ('<in.hdr>', '<out.mnc>'); }
--- a/progs/mincstats/mincstats.c
+++ b/progs/mincstats/mincstats.c
@@ -5,7 +5,12 @@
  * University of Queensland, Australia
  *
  * $Log: mincstats.c,v $
- * Revision 1.15  2004-04-27 15:29:22  bert
+ * Revision 1.16  2004-10-18 08:20:35  rotor
+ *  * Changes to mincstats
+ *     - Fixed bug in calculation of BiModalT
+ *     - changed default # of histogram bins to 65536 (from 10000)
+ *
+ * Revision 1.15  2004/04/27 15:29:22  bert
  * Added milog_init() call during initialization
  *
  * Revision 1.14  2003/09/05 18:29:40  bert
@@ -218,7 +223,7 @@
 static double hist_range[2] = { -DBL_MAX, DBL_MAX };
 static int discrete_histogram = FALSE;
 static int integer_histogram = FALSE;
-static int max_bins = 10000;
+static int max_bins = 65536;
 
 /* Global Variables to store info for stats */
 Stats_Info **stats_info = NULL;
@@ -524,7 +529,7 @@
 
       if((discrete_histogram || integer_histogram) && (hist_bins > max_bins)) {
          (void)fprintf(stderr,
-                       "Too many bins in histogram (%d) - please increase -max_bins if appropriate\n",
+                       "Too many bins in histogram (%d) - please increase -int_max_bins if appropriate\n",
                        hist_bins);
          exit(EXIT_FAILURE);
       }
@@ -638,18 +643,18 @@
                }
 
                /* BiModal Threshold */
+               zero_moment += pdf[c];
+               first_moment += hist_centre[c] * pdf[c];
+
                if(c > 0) {
-                  zero_moment += pdf[c];
-                  first_moment += hist_centre[c] * pdf[c];
-
                   var = SQR((stats->mean * zero_moment) - first_moment) /
                      (zero_moment * (1 - zero_moment));
-
+                  
                   if(var > max_var) {
                      bimodalt_bin = c;
                      max_var = var;
                   }
-               }
+               }  
 
                /* pct Threshold */
                if(cdf[c] < pctT) {