OTB  6.7.0
Orfeo Toolbox
otbUnaryFunctorNeighborhoodImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbUnaryFunctorNeighborhoodImageFilter_h
22 #define otbUnaryFunctorNeighborhoodImageFilter_h
23 
24 #include "itkImageToImageFilter.h"
27 #include "itkProcessObject.h"
28 
29 namespace otb
30 {
42 template <class TInputImage, class TOutputImage, class TFunction>
44  : public itk::ImageToImageFilter<TInputImage, TOutputImage>
45 {
46 public:
52 
54  itkNewMacro(Self);
55 
57  itkTypeMacro(UnaryFunctorNeighborhoodImageFilter, ImageToImageFilter);
58 
60  typedef TFunction FunctorType;
61  typedef typename Superclass::InputImageType InputImageType;
62  typedef typename InputImageType::ConstPointer InputImagePointer;
63  typedef typename InputImageType::RegionType InputImageRegionType;
64  typedef typename InputImageType::PixelType InputImagePixelType;
66  typedef typename Superclass::OutputImageType OutputImageType;
67  typedef typename OutputImageType::Pointer OutputImagePointer;
68  typedef typename OutputImageType::RegionType OutputImageRegionType;
69  typedef typename OutputImageType::PixelType OutputImagePixelType;
70 
72 
74  itkSetMacro(Radius, InputImageSizeType);
75  itkGetMacro(Radius, InputImageSizeType);
77 
79  void SetRadius(unsigned int radius)
80  {
81  m_Radius.Fill(radius);
82  }
83 
89  {
90  this->Modified();
91  return m_Functor;
92  }
94 
99  const FunctorType& GetFunctor() const
100  {
101  return m_Functor;
102  }
103 
110  void SetFunctor(const FunctorType& functor)
111  {
112  m_Functor = functor;
113  this->Modified();
114  }
116 
119  typedef unsigned char RadiusSizeType;
120 
121 protected:
126 
131 
142  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
143 
147  void GenerateInputRequestedRegion(void) override;
148 
149 private:
150  UnaryFunctorNeighborhoodImageFilter(const Self &) = delete;
151  void operator =(const Self&) = delete;
152 
155 };
156 
157 } // namespace otb
158 
159 #ifndef OTB_MANUAL_INSTANTIATION
161 #endif
162 
163 #endif
itk::Size< Monteverdi_DIMENSION > SizeType
Definition: mvdTypes.h:137
Implements neighborhood-wise generic operation on image.
Superclass::RadiusType RadiusType
itk::ConstNeighborhoodIterator< TInputImage > NeighborhoodIteratorType
unsigned int ThreadIdType
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass