source: tags/release-1.1.12/src/ATrous/filter.hh

Last change on this file was 528, checked in by MatthewWhiting, 15 years ago

Changing the documentation comments to match the askapsoft style. Also have split ChanMap? and Object3D into separate files.

File size: 4.3 KB
Line 
1// -----------------------------------------------------------------------
2// filter.hh: Defining a filter function for wavelet reconstruction.
3// -----------------------------------------------------------------------
4// Copyright (C) 2006, Matthew Whiting, ATNF
5//
6// This program is free software; you can redistribute it and/or modify it
7// under the terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 2 of the License, or (at your
9// option) any later version.
10//
11// Duchamp is distributed in the hope that it will be useful, but WITHOUT
12// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14// for more details.
15//
16// You should have received a copy of the GNU General Public License
17// along with Duchamp; if not, write to the Free Software Foundation,
18// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
19//
20// Correspondence concerning Duchamp may be directed to:
21//    Internet email: Matthew.Whiting [at] atnf.csiro.au
22//    Postal address: Dr. Matthew Whiting
23//                    Australia Telescope National Facility, CSIRO
24//                    PO Box 76
25//                    Epping NSW 1710
26//                    AUSTRALIA
27// -----------------------------------------------------------------------
28#ifndef FILTER_H
29#define FILTER_H
30
31#include <vector>
32#include <string>
33
34namespace duchamp
35{
36
37  /// @brief A class to store details of the wavelet's filter.
38  /// @details This stores all details of and functions related to the
39  ///  filter used to generate the wavelets used in the reconstruction
40  ///  (and baseline subtraction) functions.
41  ///
42  /// It stores the coefficients of the filter, as well as the number of scales
43  /// associated with it, and the sigma factors, that relate the value of the rms
44  /// at a given scale with the measured value.
45
46  class Filter
47  {
48  public:
49    // these are all in atrous.cc
50    /// @brief Constructor
51    Filter();
52    /// @brief Copy Constructor
53    Filter(const Filter& f);
54    /// @brief Copy operator
55    Filter& operator=(const Filter& f);
56    /// @brief Destructor
57    virtual ~Filter();               
58
59    /// @brief Define the parameters for a given filter.
60    void   define(int code);
61
62    /// @brief Calculate the number of scales possible with a given filter and data size.
63    int    getNumScales(long length);
64
65    /// @brief Calculate the maximum number of pixels able to be analysed with a filter at a given scale.
66    int    getMaxSize(int scale);
67
68    /// @brief Return the width of the filter
69    int    width(){return filter1D.size();};
70
71    // these are inline functions.
72    /// @brief Return the text name of the filter
73    std::string getName(){return name;};
74
75    /// @brief Return the i-th value of the coefficient array.
76    double coeff(int i){return filter1D[i];};
77
78    /// @brief Set the i-th value of the coefficient array.
79    void   setCoeff(int i, double val){filter1D[i] = val;};
80
81    /// @brief Return the maximum number of scales in the sigmaFactor array for the given dimension
82    int    maxFactor(int dim){return maxNumScales[dim-1];};
83
84    /// @brief Set the maximum number of scales in the sigmaFactor array for the given dimension
85    void   setMaxFactor(int dim, int val){maxNumScales[dim-1] = val;};
86
87    /// @brief Return the sigma scaling factor for the given dimension and scale of the wavelet transform.
88    double sigmaFactor(int dim, int scale){return (*sigmaFactors[dim-1])[scale];};
89    /// @brief Set the sigma scaling factor for the given dimension and scale of the wavelet transform.
90    void   setSigmaFactor(int dim, int scale, double val){(*sigmaFactors[dim])[scale] = val;};
91
92  private:
93    std::string name;                ///< what is the filter called?
94    std::vector <double> filter1D;   ///< filter coefficients.
95    std::vector <int> maxNumScales;  ///< max number of scales for the sigmaFactor arrays, for each dim.
96    std::vector < std::vector <double>* > sigmaFactors; ///< arrays of sigmaFactors, one for each dim.
97
98    // these are all in atrous.cc
99    /// @brief Set up parameters for using the B3-Spline filter.
100    void   loadSpline(); 
101    /// @brief Set up parameters for using the Triangle function.     
102    void   loadTriangle();
103    /// @brief Set up parameters for using the Haar wavelet.
104    void   loadHaar(); 
105
106  };
107
108}
109
110#endif
111
Note: See TracBrowser for help on using the repository browser.