23 #ifndef otbWaveletOperatorBase_hxx
24 #define otbWaveletOperatorBase_hxx
33 template <Wavelet::Wavelet TMotherWaveletOperator,
class TPixel,
unsigned int VDimension,
class TAllocator>
36 os << i <<
"Wavelet kind : " << GetWaveletName() <<
"\n";
37 os << i <<
"Up-Sampling factor " << GetUpSampleFactor() <<
"\n";
38 Superclass::PrintSelf(os, i.GetNextIndent());
39 os << i <<
"Wavelet coeff: [ ";
40 for (
typename Superclass::ConstIterator iter = Superclass::Begin(); iter != Superclass::End(); ++iter)
47 template <Wavelet::Wavelet TMotherWaveletOperator,
class TPixel,
unsigned int VDimension,
class TAllocator>
50 if (m_UpSampleFactor <= 1)
53 unsigned long radius =
static_cast<unsigned long>(coeff.size()) >> 1;
54 unsigned long upSampleRadius = radius * m_UpSampleFactor;
57 upSampledCoeff.assign(2 * upSampleRadius + 1, 0.);
58 upSampledCoeff[upSampleRadius] = coeff[radius];
60 for (
unsigned int i = 1; i <= radius; ++i)
62 upSampledCoeff[upSampleRadius + m_UpSampleFactor * i] = coeff[radius + i];
63 upSampledCoeff[upSampleRadius - m_UpSampleFactor * i] = coeff[radius - i];
65 coeff = upSampledCoeff;
68 template <Wavelet::Wavelet TMotherWaveletOperator,
class TPixel,
unsigned int VDimension,
class TAllocator>
71 const unsigned int length = coeff.size();
72 const unsigned int medianPosition = length / 2;
75 newCoeff[medianPosition] = coeff[medianPosition];
76 for (
unsigned int i = 1; i <= medianPosition; ++i)
78 newCoeff[medianPosition + i] = coeff[medianPosition - i];
79 newCoeff[medianPosition - i] = coeff[medianPosition + i];
85 template <Wavelet::Wavelet TMotherWaveletOperator,
class TPixel,
unsigned int VDimension,
class TAllocator>
88 const unsigned int length = coeff.size();
93 for (
unsigned int i = 0; i < length; ++i)
95 highPassCoeff[i] = sign * coeff[i];
98 highPassCoeff[length] = 0.;
99 highPassCoeff[length + 1] = 0.;
101 coeff = highPassCoeff;
105 while ((coeff[0] == coeff[coeff.size() - 1]) && (coeff[0] == 0.0))
107 ReduceFilterLength(coeff);
111 template <Wavelet::Wavelet TMotherWaveletOperator,
class TPixel,
unsigned int VDimension,
class TAllocator>
114 const unsigned int length = coeff.size();
119 for (
unsigned int i = 0; i < length; ++i)
121 highPassCoeff[i] = sign * coeff[i];
124 highPassCoeff[length] = 0.;
125 highPassCoeff[length + 1] = 0.;
127 coeff = highPassCoeff;
131 while ((coeff[0] == coeff[coeff.size() - 1]) && (coeff[0] == 0.0))
133 assert(coeff.size() > 1);
134 ReduceFilterLength(coeff);
138 template <Wavelet::Wavelet TMotherWaveletOperator,
class TPixel,
unsigned int VDimension,
class TAllocator>
141 assert(coeff.size() >= 2);
143 coeff.erase(coeff.begin());