add ubuntu package to INSTALL
[snark14.git] / src / snark / bh_correction.h
1 /*      
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/bh_correction.h $
5  $LastChangedRevision: 85 $
6  $Date: 2014-07-02 16:07:08 -0400 (Wed, 02 Jul 2014) $
7  $Author: agulati $
8  ***********************************************************
9
10  * Description:
11  *
12  * The class bh_correction is responsible for performing beam hardening
13  * correction for polychromatic input data. Given the prjfil that was calculated
14  * based on weighted average of attenuations at different energy levels and 
15  * corrections coefficients [1,2] it approximates monochromatic projection data 
16  * which is then used by the reconstruction algorithms.
17  *
18  * 
19  *
20  * References:
21  * [1] G. T. Herman, Image Reconstruction from Projections, 1980
22  * [2] SNARK08 manual
23  *
24  */
25
26 #include "creacm.h"
27 #include "spctrm.h"
28 #include "uiod.h"
29
30 #include "snark.h"
31 #include "recfile.h"
32 #include "file11.h"
33 #include "projfile.h"
34 #include "infile.h"
35
36 #ifndef _BH_CORRECTION_H
37 #define _BH_CORRECTION_H
38
39 //jk 8/26/08   for use with beam hardening correction by non-parametric 
40 // function
41 class bin
42 {
43 public:
44         unsigned int noOfItems;
45         double aveOfValues;
46         double midValue;
47
48 };
49
50 class binCollection
51 {
52 public:
53
54 };
55
56 class point
57 {
58 public:
59         REAL x;REAL y;
60 };
61
62 class bh_correction
63 {
64 private:
65
66 public:
67
68         BOOLEAN bhc;BOOLEAN bhc_poly;
69
70         char tempDir[256];
71
72         INTEGER nerg;       //number of energy levels read from the input file
73         //should be the same as Spectrm.nergy
74
75         INTEGER noIter;          //number of iterations
76
77         //POLY
78         REAL * a;           //array of polynomial coefficients
79         INTEGER noDegree;       //degree of the polynomial
80         INTEGER noDegreeConv;   //degree of the polynomials for converting
81         //phantom data from energy[0] to other energy levels
82         REAL * b[7];        //array of polynomial coefficients for converting
83                                                 //phantom data from energy[0] to other energy levels
84
85         INTEGER noPointsConv; //number of points used for piecewise linear conversion
86         point * c[7];       //list of points for each energy level that are used
87                                                 //in piecewise linear conversion
88
89                                                 //BOOLEAN bhc_copied;
90         bh_correction()
91         {
92                 bhc = FALSE;
93                 bhc_poly = FALSE;
94                 a = NULL;
95                 for (int i = 0; i < 7; i++)
96                         c[i] = NULL;
97         }
98
99         ~bh_correction()
100         {
101                 if (a != NULL)
102                         delete[] a;
103                 for (int i = 6; i >= 0; i--)
104                 {
105                         if (c[i] != NULL)
106                                 delete[] c[i];
107                 }
108         }
109
110         INTEGER readInputFilePoly();
111
112         INTEGER correction(SnarkPrjFile * BHC_PrjFile);INTEGER idr_correction(
113                         INTEGER r);
114
115 };
116 #endif  /* _BH_CORRECTION_H */
117