1 | #ifndef ATROUS_H |
---|
2 | #define ATROUS_H |
---|
3 | |
---|
4 | #ifndef PARAM_H |
---|
5 | #include <param.hh> |
---|
6 | #endif |
---|
7 | |
---|
8 | #include <vector> |
---|
9 | using std::vector; |
---|
10 | #include <string> |
---|
11 | using std::string; |
---|
12 | |
---|
13 | class Filter |
---|
14 | { |
---|
15 | public: |
---|
16 | // these are all in atrous.cc |
---|
17 | Filter(); ///< Constructor |
---|
18 | ~Filter(); ///< Destructor |
---|
19 | void define(int code); ///< Define the parameters for a given filter. |
---|
20 | int getNumScales(long length); ///< Calculate the number of scales possible with a given filter and data size. |
---|
21 | int getMaxSize(int scale); ///< Calculate the maximum number of pixels able to be analysed with a filter at a given scale. |
---|
22 | |
---|
23 | // these are inline functions. |
---|
24 | string getName(); ///< Return filter name. |
---|
25 | double coeff(int i); ///< Return ith filter coefficient |
---|
26 | void setCoeff(int i, double val); ///< Set the ith filter coefficient |
---|
27 | int width(); ///< Return the filter width |
---|
28 | int maxFactor(int dim); ///< Return maximum number of scales possible. |
---|
29 | void setMaxFactor(int dim, int val); ///< Set the maximum number of scales. |
---|
30 | double sigmaFactor(int dim, int scale); ///< Return the sigma correction factor. |
---|
31 | void setSigmaFactor(int dim, int scale, double val); ///< Set the sigma correction factor. |
---|
32 | |
---|
33 | private: |
---|
34 | string name; ///< what is the filter called? |
---|
35 | vector <double> filter1D; ///< filter coefficients. |
---|
36 | vector <int> maxNumScales; ///< max number of scales for the sigmaFactor arrays, for each dim. |
---|
37 | vector < vector <double>* > sigmaFactors; ///< arrays of sigmaFactors, one for each dim. |
---|
38 | |
---|
39 | // these are all in atrous.cc |
---|
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 | // INLINE definitions for Filter member functions |
---|
47 | inline string Filter::getName(){return name;}; |
---|
48 | inline double Filter::coeff(int i){return filter1D[i];}; |
---|
49 | inline void Filter::setCoeff(int i, double val){filter1D[i] = val;}; |
---|
50 | inline int Filter::width(){return filter1D.size();}; |
---|
51 | inline int Filter::maxFactor(int dim){return maxNumScales[dim-1];}; |
---|
52 | inline void Filter::setMaxFactor(int dim, int val){maxNumScales[dim-1] = val;}; |
---|
53 | inline double Filter::sigmaFactor(int dim, int scale){return (*sigmaFactors[dim-1])[scale];}; |
---|
54 | inline void Filter::setSigmaFactor(int dim, int scale, double val){(*sigmaFactors[dim])[scale] = val;}; |
---|
55 | |
---|
56 | |
---|
57 | |
---|
58 | // The tolerance in the reconstruction. |
---|
59 | const float reconTolerance = 0.005; |
---|
60 | |
---|
61 | ////////////////////////////////////////////////////////////////////////////////////// |
---|
62 | |
---|
63 | void atrous1DReconstruct(long &size, float *&input, float *&output, Param &par); |
---|
64 | void atrous2DReconstruct(long &xdim, long &ydim, float *&input,float *&output, Param &par); |
---|
65 | void atrous3DReconstruct(long &xdim, long &ydim, long &zdim, float *&input,float *&output, Param &par); |
---|
66 | void atrous2DReconstructOLD(long &xdim, long &ydim, float *input,float *output, Param &par); |
---|
67 | void atrous3DReconstructOLD(long &xdim, long &ydim, long &zdim, float *&input,float *&output, Param &par); |
---|
68 | |
---|
69 | void atrousTransform(long &length, int &numScales, float *spectrum, double *coeffs, double *wavelet); |
---|
70 | void atrousTransform(long &length, float *spectrum, float *coeffs, float *wavelet); |
---|
71 | void atrousTransform2D(long &xdim, long &ydim, int &numScales, float *input, double *coeffs, double *wavelet, Param &par); |
---|
72 | void atrousTransform2D(long &xdim, long &ydim, int &numScales, float *input, double *coeffs, double *wavelet); |
---|
73 | void atrousTransform3D(long &xdim, long &ydim, long &zdim, int &numScales, float *&input, float *&coeffs, float *&wavelet, Param &par); |
---|
74 | void atrousTransform3D(long &xdim, long &ydim, long &zdim, int &numScales, float *input, float *coeffs, float *wavelet); |
---|
75 | |
---|
76 | void baselineSubtract(long numSpec, long specLength, float *originalCube, float *baseline, Param &par); |
---|
77 | void getBaseline(long size, float *input, float *baseline, Param &par); |
---|
78 | void getBaseline(long size, float *input, float *baseline); |
---|
79 | |
---|
80 | #endif |
---|