source: tags/release-0.9/ATrous/atrous.hh @ 1455

Last change on this file since 1455 was 3, checked in by Matthew Whiting, 18 years ago

This is the first full import of all working code to
the Duchamp repository.
Made three directories at top level:

branches/ tags/ trunk/

and trunk/ has the full set of code:
ATrous/ Cubes/ Detection/ InputComplete? InputExample? README Utils/ docs/ mainDuchamp.cc param.cc param.hh

File size: 4.5 KB
Line 
1#ifndef ATROUS_H
2#define ATROUS_H
3
4#ifndef PARAM_H
5#include <param.hh>
6#endif
7
8#include <vector>
9using std::vector;
10#include <string>
11using std::string;
12
13// namespace FilterSet
14// {
15//   const int maxDim = 3;
16
17class Filter
18{
19public:
20  Filter();
21  ~Filter(){};
22  void   define(int code);
23  int    getNumScales(long length);
24  int    getMaxSize(int scale);
25  string getName(){return name;};
26  double coeff(int i){return filter1D[i];};
27  void   setCoeff(int i, double val){filter1D[i] = val;};
28  int    width(){return filter1D.size();};
29  int    maxFactor(int dim){return maxNumScales[dim-1];};
30  void   setMaxFactor(int dim, int val){maxNumScales[dim-1] = val;};
31  double sigmaFactor(int dim, int scale){return (*sigmaFactors[dim-1])[scale];};
32  void   setSigmaFactor(int dim, int scale, double val){(*sigmaFactors[dim])[scale] = val;};
33
34private:
35  string name;                // what is the filter called?
36  vector <double> filter1D;   // filter coefficients.
37  vector <int> maxNumScales;  // max number of scales for the sigmaFactor arrays, for each dim.
38  vector < vector <double>* > sigmaFactors; // arrays of sigmaFactors, one for each dim.
39
40  void   loadSpline();        // set up parameters for using the B3 Spline filter.
41  void   loadTriangle();      // set up parameters for using the Triangle function.
42  void   loadHaar();          // set up parameters for using the Haar wavelet.
43
44};
45
46  //Filter basefilter;
47
48// }
49
50//------------------------------
51
52
53// Filter used for a trous reconstruction
54//   -- just defined in 1-dim, can expand it to 2- or 3-dim in code.
55/* B3spline function */
56// const int filterwidth = 5;
57// const double filter1D[filterwidth] = {1./16., 1./4., 3./8., 1./4., 1./16.};
58/* Triangle function */
59// const int filterwidth = 3;
60// const double filter1D[filterwidth] = {1./4., 1./2., 1./4.};
61/* Haar wavelet */
62//       const int filterwidth = 3;
63//       const double filter[filterwidth] = {0, 1./2., 1./2.};
64/* TopHat wavelet */
65//       const int filterwidth = 3;
66//       const double filter[filterwidth] = {1./3., 1./3., 1./3.};
67
68// The tolerance in the reconstruction.
69const float reconTolerance = 0.005;
70
71// The conversion factors for measured sigma in wavelet arrays to "real" sigma values.
72const int maxNumScales3D = 7;
73const double sigmaFactors3D[maxNumScales3D+1] = {1.00000000000,9.56543592e-1,1.20336499e-1,3.49500154e-2,
74                                                 1.18164242e-2,4.13233507e-3,1.45703714e-3,5.14791120e-4};
75
76const int maxNumScales2D = 11;
77const double sigmaFactors2D[maxNumScales2D+1] = {1.00000000000,8.90796310e-1,2.00663851e-1,8.55075048e-2,
78                                                 4.12474444e-2,2.04249666e-2,1.01897592e-2,5.09204670e-3,
79                                                 2.54566946e-3,1.27279050e-3,6.36389722e-4,3.18194170e-4};
80const int maxNumScales1D = 18;
81const double sigmaFactors1D[maxNumScales1D+1] = {1.00000000000,7.23489806e-1,2.85450405e-1,1.77947535e-1,
82                                                 1.22223156e-1,8.58113122e-2,6.05703043e-2,4.28107206e-2,
83                                                 3.02684024e-2,2.14024008e-2,1.51336781e-2,1.07011079e-2,
84                                                 7.56682272e-3,5.35055108e-3,3.78341085e-3,2.67527545e-3,
85                                                 1.89170541e-3,1.33763772e-3,9.45852704e-4};
86
87//////////////////////////////////////////////////////////////////////////////////////
88
89// int getNumScales(long length); // in atrous.cc
90
91void atrous1DReconstruct(long &size, float *&input, float *&output, Param &par);
92void atrous2DReconstruct(long &xdim, long &ydim, float *&input,float *&output, Param &par);
93void atrous3DReconstruct(long &xdim, long &ydim, long &zdim, float *&input,float *&output, Param &par);
94void atrous2DReconstructOLD(long &xdim, long &ydim, float *input,float *output, Param &par);
95void atrous3DReconstructOLD(long &xdim, long &ydim, long &zdim, float *&input,float *&output, Param &par);
96
97// template <class T> void atrousTransform(long &length, T *&spectrum, T *&coeffs, T *&wavelet);
98
99void atrousTransform(long &length, int &numScales, float *spectrum, double *coeffs, double *wavelet);
100void atrousTransform(long &length, float *spectrum, float *coeffs, float *wavelet);
101void atrousTransform2D(long &xdim, long &ydim, int &numScales, float *input, double *coeffs, double *wavelet, Param &par);
102void atrousTransform2D(long &xdim, long &ydim, int &numScales, float *input, double *coeffs, double *wavelet);
103void atrousTransform3D(long &xdim, long &ydim, long &zdim, int &numScales, float *&input, float *&coeffs, float *&wavelet, Param &par);
104void atrousTransform3D(long &xdim, long &ydim, long &zdim, int &numScales, float *input, float *coeffs, float *wavelet);
105
106void baselineSubtract(long numSpec, long specLength, float *originalCube, float *baseline, Param &par);
107
108#endif
Note: See TracBrowser for help on using the repository browser.