3BandFilter.hxx
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _ThreeBandFilter_
00025 #define _ThreeBandFilter_
00026
00027 #include "InPort.hxx"
00028 #include "OutPort.hxx"
00029 #include "InControl.hxx"
00030 #include "Frame.hxx"
00031 #include "FrameTransformation.hxx"
00032 #include "FrameTransformationConfig.hxx"
00033
00034 namespace CLAM{
00035
00050 class ThreeBandFilter: public FrameTransformationTmpl<Spectrum>
00051 {
00052 InPort<Spectrum> mIn;
00053 OutPort<Spectrum> mOut;
00054
00055 FloatInControl mLowCutoffFreqCtl;
00056 FloatInControl mHighCutoffFreqCtl;
00057 FloatInControl mLowGainCtl;
00058 FloatInControl mMidGainCtl;
00059 FloatInControl mHighGainCtl;
00060 public:
00061 const char* GetClassName() const
00062 {
00063 return "ThreeBandFilter";
00064 }
00065
00066 ThreeBandFilter()
00067 : mIn("In Spectrum", this)
00068 , mOut("Out Spectrum", this)
00069 , mLowCutoffFreqCtl("LowCutoff", this)
00070 , mHighCutoffFreqCtl("HighCutoff", this)
00071 , mLowGainCtl("LowGain", this)
00072 , mMidGainCtl("MidGain", this)
00073 , mHighGainCtl("HighGain", this)
00074 {
00075 Configure( FrameTransformationConfig() );
00076 }
00077
00078 ~ThreeBandFilter() {}
00079
00080 bool ConcreteConfigure( const ProcessingConfig& config )
00081 {
00082 mLowCutoffFreqCtl.SetBounds(0.,1000000.);
00083 mLowCutoffFreqCtl.DoControl(1000.);
00084
00085 mHighCutoffFreqCtl.SetBounds(0.,1000000.);
00086 mHighCutoffFreqCtl.DoControl(5000.);
00087
00088 mLowGainCtl.SetBounds(0,100);
00089 mLowGainCtl.DoControl(0);
00090
00091 mMidGainCtl.SetBounds(0,100);
00092 mMidGainCtl.DoControl(0);
00093
00094 mHighGainCtl.SetBounds(0,100);
00095 mHighGainCtl.DoControl(0);
00096 return true;
00097 }
00098
00099 bool Do(const Frame& in, Frame& out)
00100 {
00101 return Do(in.GetSpectrum(),
00102 out.GetSpectrum());
00103 }
00104
00105 bool Do(const Spectrum& in, Spectrum& out);
00106
00107 bool Do()
00108 {
00109 bool result = Do(mIn.GetData(), mOut.GetData());
00110 mIn.Consume();
00111 mOut.Produce();
00112 return result;
00113 }
00114 };
00115 };
00116
00117 #endif // _ThreeBandFilter_