OTB  10.0.0
Orfeo Toolbox
otbWaveletPacketTransform.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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 {
36 
62 template <class TInputImage, class TOutputImage, class TFilter, Wavelet::WaveletDirection TDirectionOfTransformation,
63  class TCost = FullyDecomposedWaveletPacketCost<TInputImage>>
64 class ITK_EXPORT WaveletPacketTransform : public itk::ImageSource<TOutputImage>
65 {
66 public:
69  typedef itk::ImageSource<TOutputImage> Superclass;
70  typedef itk::SmartPointer<Self> Pointer;
71  typedef itk::SmartPointer<const Self> ConstPointer;
72 
74  itkNewMacro(Self);
75 
77  itkTypeMacro(WaveletPacketTransform, ImageSource);
78 
79 protected:
84 
85 private:
87  void operator=(const Self&);
88 };
89 
117 template <class TInputImage, class TOutputImage, class TFilter, class TCost>
118 class ITK_EXPORT WaveletPacketTransform<TInputImage, TOutputImage, TFilter, Wavelet::FORWARD, TCost> : public ImageToImageListFilter<TInputImage, TOutputImage>
119 {
120 public:
124  typedef itk::SmartPointer<Self> Pointer;
125  typedef itk::SmartPointer<const Self> ConstPointer;
126 
128  itkNewMacro(Self);
129 
132 
133  typedef TInputImage InputImageType;
134  typedef typename InputImageType::Pointer InputImagePointerType;
135  typedef typename InputImageType::ConstPointer InputImageConstPointerType;
136  typedef typename InputImageType::RegionType InputImageRegionType;
137  typedef typename InputImageType::PixelType InputImagePixelType;
138  typedef typename InputImageType::SizeType SizeType;
139  typedef typename InputImageType::ValueType ValueType;
140 
141  typedef typename Superclass::OutputImageType OutputImageType;
142  typedef typename Superclass::OutputImagePointerType OutputImagePointerType;
143  typedef typename Superclass::OutputImageListType OutputImageListType;
146 
147  typedef TFilter FilterType;
148  typedef typename FilterType::Pointer FilterPointerType;
152 
154 
155  typedef TCost CostType;
156  typedef typename CostType::Pointer CostPointerType;
158 
160  itkStaticConstMacro(DirectionOfTransformation, DirectionOfTransformationEnumType, Wavelet::FORWARD);
161 
163  const std::vector<bool>& GetWaveletPacketRule() const
164  {
165  return this->m_WaveletPacketRule;
166  }
167 
169  itkGetMacro(NumberOfFilters, unsigned int);
170  itkGetMacro(DepthOfDecomposition, unsigned int);
172 
173  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
174 
183  itkGetMacro(SubsampleImageFactor, unsigned int);
184  itkSetMacro(SubsampleImageFactor, unsigned int);
186 
187 protected:
190  {
191  }
192 
197  void GenerateData() override;
198 
200  virtual void GenerateData(unsigned int depth, OutputImageType* outputPtr, itk::ProgressAccumulator* accumulator);
201 
202 private:
204  void operator=(const Self&);
205 
213 
214  // Internal informative data
215  unsigned int m_NumberOfFilters;
217 
220  std::vector<bool> m_WaveletPacketRule;
221 
222 }; // end of class
223 
250 template <class TInputImage, class TOutputImage, class TFilter>
251 class ITK_EXPORT WaveletPacketTransform<TInputImage, TOutputImage, TFilter, Wavelet::INVERSE, FullyDecomposedWaveletPacketCost<TInputImage>>
252  : public ImageListToImageFilter<TInputImage, TOutputImage>
253 {
254 public:
258  typedef itk::SmartPointer<Self> Pointer;
259  typedef itk::SmartPointer<const Self> ConstPointer;
260 
262  itkNewMacro(Self);
263 
266 
267  typedef typename Superclass::InputImageType InputImageType;
268  typedef typename InputImageType::Pointer InputImagePointerType;
269  typedef typename InputImageType::ConstPointer InputImageConstPointerType;
270  typedef typename InputImageType::RegionType InputImageRegionType;
271  typedef typename InputImageType::PixelType InputImagePixelType;
272  typedef typename InputImageType::SizeType SizeType;
273  typedef typename InputImageType::IndexType IndexType;
274  typedef typename InputImageType::ValueType ValueType;
275 
276  typedef typename Superclass::InputImageListType InputImageListType;
279 
280  typedef typename Superclass::OutputImageType OutputImageType;
281  typedef typename Superclass::OutputImagePointerType OutputImagePointerType;
282  typedef typename OutputImageType::RegionType OutputImageRegionType;
283  typedef typename OutputImageType::SizeType OutputImageSizeType;
284  typedef typename OutputImageType::IndexType OutputImageIndexType;
285 
286  typedef TFilter FilterType;
287  typedef typename FilterType::Pointer FilterPointerType;
291 
293 
295  itkStaticConstMacro(DirectionOfTransformation, DirectionOfTransformationEnumType, Wavelet::INVERSE);
296 
298  const std::vector<bool>& GetWaveletPacketRule() const
299  {
300  return this->m_WaveletPacketRule;
301  }
302  void SetWaveletPacketRule(const std::vector<bool>& rule)
303  {
304  this->m_WaveletPacketRule = rule;
305  this->Modified();
306  }
308 
317  itkGetMacro(SubsampleImageFactor, unsigned int);
318  itkSetMacro(SubsampleImageFactor, unsigned int);
320 
322  itkGetMacro(NumberOfFilters, unsigned int);
323  itkGetMacro(DepthOfDecomposition, unsigned int);
325 
326  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
327 
328 protected:
331  {
332  }
333 
338  void GenerateOutputInformation() override;
339 
344  void GenerateData() override;
345 
347  virtual unsigned int SetInputFilters(unsigned int& ruleID, InputImageIterator& inputIter, unsigned int filterID);
348 
350  void InterpretRule();
351  void InterpretRule(unsigned int& ruleID, unsigned int curDepth);
353 
354 private:
356  void operator=(const Self&);
357 
365 
366  // Internal informative data
367  unsigned int m_NumberOfFilters;
369 
371  std::vector<bool> m_WaveletPacketRule;
372 
373 }; // end of class
374 
375 } // end of namespace
376 
377 #ifndef OTB_MANUAL_INSTANTIATION
379 #endif
380 
381 #endif
Cost evaluation to be used into the Wavelet Packet decomposition class.
Base class for all the filters producing an otbImageList.
Base class for all the filters taking an images list as input to produce an image.
itk::SmartPointer< Self > Pointer
Definition: otbImageList.h:45
Superclass::Iterator Iterator
Definition: otbImageList.h:57
Base class for all the filters taking an image input to produce an image list.
Iterator of the object list.
This class is a generic all-purpose wrapping around an std::vector<itk::SmartPointer<ObjectType> >.
Definition: otbObjectList.h:41
itk::SmartPointer< Self > Pointer
Definition: otbObjectList.h:46
Wavelet packet transformation framework.
itk::SmartPointer< const Self > ConstPointer
itk::ImageSource< TOutputImage > Superclass
WaveletPacketTransform(const Self &)
itk::SmartPointer< Self > Pointer
void operator=(const Self &)
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.