OTB  6.7.0
Orfeo Toolbox
otbWaveletTransform.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 otbWaveletTransform_h
24 #define otbWaveletTransform_h
25 
28 #include "otbObjectList.h"
29 #include "otbWaveletGenerator.h"
30 #include "otbWaveletOperatorBase.h"
31 
32 namespace otb {
33 
56 template <class TInputImage, class TOutputImage, class TFilter,
57  Wavelet::WaveletDirection TDirectionOfTransformation>
58 class ITK_EXPORT WaveletTransform
59  : public itk::ImageSource<TOutputImage>
60 {
61 public:
67 
69  itkNewMacro(Self);
70 
72  itkTypeMacro(WaveletTransform, ImageSource);
73 
74 protected:
77  virtual ~WaveletTransform();
79 
80 private:
81  WaveletTransform (const Self &);
82  void operator =(const Self&);
83 };
84 
109 template <class TInputImage, class TOutputImage, class TFilter>
110 class ITK_EXPORT WaveletTransform<TInputImage, TOutputImage, TFilter, Wavelet::FORWARD>
111  : public ImageToImageListFilter<TInputImage, TOutputImage>
112 {
113 public:
119 
121  itkNewMacro(Self);
122 
125 
126  typedef TInputImage InputImageType;
127  typedef typename InputImageType::Pointer InputImagePointerType;
128  typedef typename InputImageType::ConstPointer InputImageConstPointerType;
129  typedef typename InputImageType::RegionType InputImageRegionType;
130  typedef typename InputImageType::PixelType InputImagePixelType;
132  typedef typename InputImageType::ValueType ValueType;
133 
134  typedef typename Superclass::OutputImageType OutputImageType;
135  typedef typename Superclass::OutputImagePointerType OutputImagePointerType;
136  typedef typename Superclass::OutputImageListType OutputImageListType;
139 
140  typedef TFilter FilterType;
141  typedef typename FilterType::Pointer FilterPointerType;
145 
146  itkGetObjectMacro(FilterList, FilterListType);
147  FilterType * GetNthFilter(unsigned int idx) const
148  {
149  if (idx >= m_NumberOfDecompositions)
150  {
151  itkExceptionMacro(<< "Impossible to GetNthFilter with the index element "
152  << idx << "; this element don't exist, the size of the filter list is "
153  << m_FilterList->Size() << ".");
154  }
155  return static_cast<FilterType*>(m_FilterList->GetNthElement(idx));
156  }
157 
159  itkStaticConstMacro(DirectionOfTransformation, DirectionOfTransformationEnumType, Wavelet::FORWARD);
160 
161  itkGetMacro(NumberOfDecompositions, unsigned int);
162  itkSetMacro(NumberOfDecompositions, unsigned int);
163 
164  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
165 
174  itkGetMacro(SubsampleImageFactor, unsigned int);
175  itkSetMacro(SubsampleImageFactor, unsigned int);
177 
178 protected:
180  ~WaveletTransform() override {}
181 
183  void GenerateData() override;
184 
185 private:
186  WaveletTransform (const Self &);
187  void operator =(const Self&);
188 
193 
201 
206 }; // end of Forward class
207 
236 template <class TInputImage, class TOutputImage, class TFilter>
237 class ITK_EXPORT WaveletTransform<TInputImage, TOutputImage, TFilter, Wavelet::INVERSE>
238  : public ImageListToImageFilter<TInputImage, TOutputImage>
239 {
240 public:
246 
248  itkNewMacro(Self);
249 
252 
253  typedef TInputImage InputImageType;
254  typedef typename InputImageType::Pointer InputImagePointerType;
255  typedef typename InputImageType::ConstPointer InputImageConstPointerType;
256  typedef typename InputImageType::RegionType InputImageRegionType;
257  typedef typename InputImageType::PixelType InputImagePixelType;
260  typedef typename InputImageType::ValueType ValueType;
261 
262  typedef typename Superclass::InputImageListType InputImageListType;
265 
266  typedef typename Superclass::OutputImageType OutputImageType;
267  typedef typename OutputImageType::Pointer OutputImagePointerType;
268  typedef typename OutputImageType::RegionType OutputImageRegionType;
271  typedef typename OutputImageType::ValueType OutputValueType;
272 
273  typedef TFilter FilterType;
274  typedef typename FilterType::Pointer FilterPointerType;
278 
279  itkGetObjectMacro(FilterList, FilterListType);
280  FilterType * GetNthFilter(unsigned int idx) const
281  {
282  if (idx >= m_NumberOfDecompositions)
283  {
284  itkExceptionMacro(<< "Impossible to GetNthFilter with the index element "
285  << idx << "; this element don't exist, the size of the filter list is "
286  << m_FilterList->Size() << ".");
287  }
288  return static_cast<FilterType*>(m_FilterList->GetNthElement(idx));
289  }
290 
292  itkStaticConstMacro(DirectionOfTransformation, DirectionOfTransformationEnumType, Wavelet::INVERSE);
293 
294  itkGetMacro(NumberOfDecompositions, unsigned int);
295 
296  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
297 
306  itkGetMacro(SubsampleImageFactor, unsigned int);
307  itkSetMacro(SubsampleImageFactor, unsigned int);
309 
310 protected:
312  ~WaveletTransform() override {}
313 
318  void GenerateOutputInformation() override;
319 
321  void GenerateData() override;
322 
323 private:
324  WaveletTransform (const Self &);
325  void operator =(const Self&);
326 
331 
339 
344 }; // end of inverse class
345 
346 } // end of namespace
347 
348 #ifndef OTB_MANUAL_INSTANTIATION
349 #include "otbWaveletTransform.hxx"
350 #endif
351 
352 #endif
itk::Size< Monteverdi_DIMENSION > SizeType
Definition: mvdTypes.h:137
Superclass::Iterator Iterator
Definition: otbImageList.h:58
Base class for all the filters taking an images list as input to produce an image.
Iterator of the object list.
itk::SmartPointer< const Self > ConstPointer
itk::Index< Monteverdi_DIMENSION > IndexType
Definition: mvdTypes.h:133
Wavelet transformation framework.
This class is a generic all-purpose wrapping around an std::vector<itk::SmartPointer<ObjectType> >...
Definition: otbObjectList.h:40
itk::SmartPointer< Self > Pointer
Base class for all the filters taking an image input to produce an image list.
itk::ImageSource< TOutputImage > Superclass