2 ***********************************************************
3 $SNARK_Header: S N A R K 1 4 - A PICTURE RECONSTRUCTION PROGRAM $
4 $HeadURL: svn://dig.cs.gc.cuny.edu/snark/trunk/src/snark/contur.cpp $
5 $LastChangedRevision: 85 $
6 $Date: 2014-07-02 16:07:08 -0400 (Wed, 02 Jul 2014) $
8 ***********************************************************
10 A PROCEDURE TO CONTOUR A RECONSTRUCTION INTO A BLACK-WHITE PICTURE
17 #include "math.h" //added. hstau
23 void contur(REAL* a, INTEGER m, INTEGER n, REAL thresh, REAL w1, REAL w2, REAL w3)
25 INTEGER i, last = m * n;
28 if (w3 >= Consts.zero)
30 REAL min, max, amin, amax, ai, at;
32 if ((GeoPar.aveden <= w1) || (GeoPar.aveden >= w2))
35 "\n **** invalid parameters to contour - (aveden <= w1 or w2 <= aveden)");
36 fprintf(output, "\n **** contour failed to continue");
43 for (i = 1; i < last; i++)
52 if ((max - min) < Consts.zero)
54 fprintf(output, "\n **** picture is a constant");
55 fprintf(output, "\n **** contour failed to continue");
59 // perform a bisection search
63 while ((amin != GeoPar.aveden) && (amax != GeoPar.aveden) && (max - min > 0.00001))
65 t = (min + max) / 2.0;
67 for (i = 0; i < last; i++)
75 if (at < GeoPar.aveden)
87 if (amin - GeoPar.aveden < GeoPar.aveden - amax)
92 fprintf(output, "\n contour threshold = %10.4f", t);
95 for (i = 0; i < last; i++)