OTB  6.7.0
Orfeo Toolbox
otbWaveletPacketTransform.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
3  * Copyright (C) 2007-2012 Institut Mines Telecom / Telecom Bretagne
4  *
5  * This file is part of Orfeo Toolbox
6  *
7  * https://www.orfeo-toolbox.org/
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 
23 #ifndef otbWaveletPacketTransform_h
24 #define otbWaveletPacketTransform_h
25 
26 #include "itkProgressAccumulator.h"
27 
30 #include "otbWaveletGenerator.h"
31 #include "otbWaveletOperatorBase.h"
33 
34 namespace otb {
35 
61 template <class TInputImage, class TOutputImage, class TFilter,
62  Wavelet::WaveletDirection TDirectionOfTransformation,
63  class TCost = FullyDecomposedWaveletPacketCost<TInputImage> >
64 class ITK_EXPORT WaveletPacketTransform
65  : public itk::ImageSource<TOutputImage>
66 {
67 public:
73 
75  itkNewMacro(Self);
76 
78  itkTypeMacro(WaveletPacketTransform, ImageSource);
79 
80 protected:
83  virtual ~WaveletPacketTransform();
85 
86 private:
87  WaveletPacketTransform (const Self &);
88  void operator =(const Self&);
89 };
90 
118 template <class TInputImage, class TOutputImage, class TFilter, class TCost>
119 class ITK_EXPORT WaveletPacketTransform<TInputImage, TOutputImage, TFilter, Wavelet::FORWARD, TCost>
120  : public ImageToImageListFilter<TInputImage, TOutputImage>
121 {
122 public:
128 
130  itkNewMacro(Self);
131 
134 
135  typedef TInputImage InputImageType;
136  typedef typename InputImageType::Pointer InputImagePointerType;
137  typedef typename InputImageType::ConstPointer InputImageConstPointerType;
138  typedef typename InputImageType::RegionType InputImageRegionType;
139  typedef typename InputImageType::PixelType InputImagePixelType;
141  typedef typename InputImageType::ValueType ValueType;
142 
143  typedef typename Superclass::OutputImageType OutputImageType;
144  typedef typename Superclass::OutputImagePointerType OutputImagePointerType;
145  typedef typename Superclass::OutputImageListType OutputImageListType;
148 
149  typedef TFilter FilterType;
150  typedef typename FilterType::Pointer FilterPointerType;
154 
155  itkGetObjectMacro(FilterList, FilterListType);
156 
157  typedef TCost CostType;
158  typedef typename CostType::Pointer CostPointerType;
159  itkGetObjectMacro(Cost, CostType);
160 
162  itkStaticConstMacro(DirectionOfTransformation, DirectionOfTransformationEnumType, Wavelet::FORWARD);
163 
165  const std::vector<bool>& GetWaveletPacketRule() const
166  {
167  return this->m_WaveletPacketRule;
168  }
169 
171  itkGetMacro(NumberOfFilters, unsigned int);
172  itkGetMacro(DepthOfDecomposition, unsigned int);
174 
175  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
176 
185  itkGetMacro(SubsampleImageFactor, unsigned int);
186  itkSetMacro(SubsampleImageFactor, unsigned int);
188 
189 protected:
192 
197  void GenerateData() override;
198 
200  virtual void GenerateData(unsigned int depth, OutputImageType * outputPtr,
201  itk::ProgressAccumulator * accumulator);
202 
203 private:
204  WaveletPacketTransform (const Self &);
205  void operator =(const Self&);
206 
214 
215  // Internal informative data
216  unsigned int m_NumberOfFilters;
218 
221  std::vector<bool> m_WaveletPacketRule;
222 
223 }; // end of class
224 
251 template <class TInputImage, class TOutputImage, class TFilter>
252 class ITK_EXPORT WaveletPacketTransform<TInputImage, TOutputImage, TFilter,
254  : public ImageListToImageFilter<TInputImage, TOutputImage>
255 {
256 public:
262 
264  itkNewMacro(Self);
265 
268 
269  typedef typename Superclass::InputImageType InputImageType;
270  typedef typename InputImageType::Pointer InputImagePointerType;
271  typedef typename InputImageType::ConstPointer InputImageConstPointerType;
272  typedef typename InputImageType::RegionType InputImageRegionType;
273  typedef typename InputImageType::PixelType InputImagePixelType;
276  typedef typename InputImageType::ValueType ValueType;
277 
278  typedef typename Superclass::InputImageListType InputImageListType;
281 
282  typedef typename Superclass::OutputImageType OutputImageType;
283  typedef typename Superclass::OutputImagePointerType OutputImagePointerType;
284  typedef typename OutputImageType::RegionType OutputImageRegionType;
287 
288  typedef TFilter FilterType;
289  typedef typename FilterType::Pointer FilterPointerType;
293 
294  itkGetObjectMacro(FilterList, FilterListType);
295 
297  itkStaticConstMacro(DirectionOfTransformation, DirectionOfTransformationEnumType, Wavelet::INVERSE);
298 
300  const std::vector<bool>& GetWaveletPacketRule() const
301  {
302  return this->m_WaveletPacketRule;
303  }
304  void SetWaveletPacketRule(const std::vector<bool>& rule)
305  {
306  this->m_WaveletPacketRule = rule;
307  this->Modified();
308  }
310 
319  itkGetMacro(SubsampleImageFactor, unsigned int);
320  itkSetMacro(SubsampleImageFactor, unsigned int);
322 
324  itkGetMacro(NumberOfFilters, unsigned int);
325  itkGetMacro(DepthOfDecomposition, unsigned int);
327 
328  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
329 
330 protected:
333 
338  void GenerateOutputInformation() override;
339 
344  void GenerateData() override;
345 
347  virtual unsigned int SetInputFilters(unsigned int& ruleID, InputImageIterator& inputIter,
348  unsigned int filterID);
349 
351  void InterpretRule();
352  void InterpretRule(unsigned int& ruleID, unsigned int curDepth);
354 
355 private:
356  WaveletPacketTransform (const Self &);
357  void operator =(const Self&);
358 
366 
367  // Internal informative data
368  unsigned int m_NumberOfFilters;
370 
372  std::vector<bool> m_WaveletPacketRule;
373 
374 }; // end of class
375 
376 } // end of namespace
377 
378 #ifndef OTB_MANUAL_INSTANTIATION
380 #endif
381 
382 #endif
itk::Size< Monteverdi_DIMENSION > SizeType
Definition: mvdTypes.h:137
Superclass::Iterator Iterator
Definition: otbImageList.h:58
itk::SmartPointer< const Self > ConstPointer
Base class for all the filters taking an images list as input to produce an image.
Cost evaluation to be used into the Wavelet Packet decomposition class.
Iterator of the object list.
itk::Index< Monteverdi_DIMENSION > IndexType
Definition: mvdTypes.h:133
This class is a generic all-purpose wrapping around an std::vector<itk::SmartPointer<ObjectType> >...
Definition: otbObjectList.h:40
itk::ImageSource< TOutputImage > Superclass
Base class for all the filters taking an image input to produce an image list.
Wavelet packet transformation framework.
itk::SmartPointer< Self > Pointer