SMSSinusoidalGain.cxx
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 #include "SMSSinusoidalGain.hxx"
00023 #include "ProcessingFactory.hxx"
00024
00025
00026 namespace CLAM
00027 {
00028
00029 namespace Hidden
00030 {
00031 static const char * metadata[] = {
00032 "key", "SMSSinusoidalGain",
00033 "category", "SMS Transformations",
00034 "description", "SMSSinusoidalGain",
00035 0
00036 };
00037 static FactoryRegistrator<ProcessingFactory, SMSSinusoidalGain> reg = metadata;
00038 }
00039
00040
00041 bool SMSSinusoidalGain::Do(const SpectralPeakArray& in, SpectralPeakArray& out)
00042 {
00043 out = in;
00044
00045 TSize nPeaks=in.GetnPeaks();
00046 out.SetnMaxPeaks(in.GetnMaxPeaks());
00047 out.SetnPeaks(nPeaks);
00048
00049 TData amount=mGain.GetLastValue();
00050 SpectralPeak tmpPeak;
00051 IndexArray indexArray=in.GetIndexArray();
00052 for(int i=0;i<nPeaks;i++)
00053 {
00054 tmpPeak=in.GetSpectralPeak(i);
00055 tmpPeak.SetMag(tmpPeak.GetMag()+amount);
00056 out.SetSpectralPeak(i,tmpPeak,indexArray[i]);
00057 }
00058 return true;
00059 }
00060
00061 }
00062