OTB  10.0.0
Orfeo Toolbox
otbWaveletTransform.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 otbWaveletTransform_h
24 #define otbWaveletTransform_h
25 
28 #include "otbObjectList.h"
29 #include "otbWaveletGenerator.h"
30 #include "otbWaveletOperatorBase.h"
31 
32 namespace otb
33 {
34 
57 template <class TInputImage, class TOutputImage, class TFilter, Wavelet::WaveletDirection TDirectionOfTransformation>
58 class ITK_EXPORT WaveletTransform : public itk::ImageSource<TOutputImage>
59 {
60 public:
63  typedef itk::ImageSource<TOutputImage> Superclass;
64  typedef itk::SmartPointer<Self> Pointer;
65  typedef itk::SmartPointer<const Self> ConstPointer;
66 
68  itkNewMacro(Self);
69 
71  itkTypeMacro(WaveletTransform, ImageSource);
72 
73 protected:
76  virtual ~WaveletTransform();
78 
79 private:
81  void operator=(const Self&);
82 };
83 
108 template <class TInputImage, class TOutputImage, class TFilter>
109 class ITK_EXPORT WaveletTransform<TInputImage, TOutputImage, TFilter, Wavelet::FORWARD> : public ImageToImageListFilter<TInputImage, TOutputImage>
110 {
111 public:
115  typedef itk::SmartPointer<Self> Pointer;
116  typedef itk::SmartPointer<const Self> ConstPointer;
117 
119  itkNewMacro(Self);
120 
123 
124  typedef TInputImage InputImageType;
125  typedef typename InputImageType::Pointer InputImagePointerType;
126  typedef typename InputImageType::ConstPointer InputImageConstPointerType;
127  typedef typename InputImageType::RegionType InputImageRegionType;
128  typedef typename InputImageType::PixelType InputImagePixelType;
129  typedef typename InputImageType::SizeType SizeType;
130  typedef typename InputImageType::ValueType ValueType;
131 
132  typedef typename Superclass::OutputImageType OutputImageType;
133  typedef typename Superclass::OutputImagePointerType OutputImagePointerType;
134  typedef typename Superclass::OutputImageListType OutputImageListType;
137 
138  typedef TFilter FilterType;
139  typedef typename FilterType::Pointer FilterPointerType;
143 
145  FilterType* GetNthFilter(unsigned int idx) const
146  {
147  if (idx >= m_NumberOfDecompositions)
148  {
149  itkExceptionMacro(<< "Impossible to GetNthFilter with the index element " << idx << "; this element don't exist, the size of the filter list is "
150  << m_FilterList->Size() << ".");
151  }
152  return static_cast<FilterType*>(m_FilterList->GetNthElement(idx));
153  }
154 
156  itkStaticConstMacro(DirectionOfTransformation, DirectionOfTransformationEnumType, Wavelet::FORWARD);
157 
158  itkGetMacro(NumberOfDecompositions, unsigned int);
159  itkSetMacro(NumberOfDecompositions, unsigned int);
160 
161  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
162 
171  itkGetMacro(SubsampleImageFactor, unsigned int);
172  itkSetMacro(SubsampleImageFactor, unsigned int);
174 
175 protected:
177  ~WaveletTransform() override
178  {
179  }
180 
182  void GenerateData() override;
183 
184 private:
186  void operator=(const Self&);
187 
192 
200 
205 }; // end of Forward class
206 
235 template <class TInputImage, class TOutputImage, class TFilter>
236 class ITK_EXPORT WaveletTransform<TInputImage, TOutputImage, TFilter, Wavelet::INVERSE> : public ImageListToImageFilter<TInputImage, TOutputImage>
237 {
238 public:
242  typedef itk::SmartPointer<Self> Pointer;
243  typedef itk::SmartPointer<const Self> ConstPointer;
244 
246  itkNewMacro(Self);
247 
250 
251  typedef TInputImage InputImageType;
252  typedef typename InputImageType::Pointer InputImagePointerType;
253  typedef typename InputImageType::ConstPointer InputImageConstPointerType;
254  typedef typename InputImageType::RegionType InputImageRegionType;
255  typedef typename InputImageType::PixelType InputImagePixelType;
256  typedef typename InputImageType::SizeType SizeType;
257  typedef typename InputImageType::IndexType IndexType;
258  typedef typename InputImageType::ValueType ValueType;
259 
260  typedef typename Superclass::InputImageListType InputImageListType;
263 
264  typedef typename Superclass::OutputImageType OutputImageType;
265  typedef typename OutputImageType::Pointer OutputImagePointerType;
266  typedef typename OutputImageType::RegionType OutputImageRegionType;
267  typedef typename OutputImageType::SizeType OutputImageSizeType;
268  typedef typename OutputImageType::IndexType OutputImageIndexType;
269  typedef typename OutputImageType::ValueType OutputValueType;
270 
271  typedef TFilter FilterType;
272  typedef typename FilterType::Pointer FilterPointerType;
276 
278  FilterType* GetNthFilter(unsigned int idx) const
279  {
280  if (idx >= m_NumberOfDecompositions)
281  {
282  itkExceptionMacro(<< "Impossible to GetNthFilter with the index element " << idx << "; this element don't exist, the size of the filter list is "
283  << m_FilterList->Size() << ".");
284  }
285  return static_cast<FilterType*>(m_FilterList->GetNthElement(idx));
286  }
287 
289  itkStaticConstMacro(DirectionOfTransformation, DirectionOfTransformationEnumType, Wavelet::INVERSE);
290 
291  itkGetMacro(NumberOfDecompositions, unsigned int);
292 
293  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
294 
303  itkGetMacro(SubsampleImageFactor, unsigned int);
304  itkSetMacro(SubsampleImageFactor, unsigned int);
306 
307 protected:
309  ~WaveletTransform() override
310  {
311  }
312 
317  void GenerateOutputInformation() override;
318 
320  void GenerateData() override;
321 
322 private:
324  void operator=(const Self&);
325 
330 
338 
343 }; // end of inverse class
344 
345 } // end of namespace
346 
347 #ifndef OTB_MANUAL_INSTANTIATION
348 #include "otbWaveletTransform.hxx"
349 #endif
350 
351 #endif
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 transformation framework.
itk::SmartPointer< Self > Pointer
itk::SmartPointer< const Self > ConstPointer
virtual ~WaveletTransform()
WaveletTransform(const Self &)
void operator=(const Self &)
itk::ImageSource< TOutputImage > Superclass
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.