OTB  6.7.0
Orfeo Toolbox
otbBinaryFunctorNeighborhoodImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 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 otbBinaryFunctorNeighborhoodImageFilter_h
22 #define otbBinaryFunctorNeighborhoodImageFilter_h
23 
24 #include "itkImageToImageFilter.h"
27 #include "itkSize.h"
28 
29 namespace otb
30 {
31 
46 template <class TInputImage1, class TInputImage2,
47  class TOutputImage, class TFunction>
48 class ITK_EXPORT BinaryFunctorNeighborhoodImageFilter : public itk::ImageToImageFilter<TInputImage1, TOutputImage>
49 {
50 public:
56 
58  itkNewMacro(Self);
59 
62 
64  typedef TFunction FunctorType;
65  typedef TInputImage1 Input1ImageType;
66  typedef typename Input1ImageType::ConstPointer Input1ImageConstPointer;
67  typedef typename Input1ImageType::Pointer Input1ImagePointer;
68  typedef typename Input1ImageType::RegionType Input1ImageRegionType;
69  typedef typename Input1ImageType::PixelType Input1ImagePixelType;
70  typedef TInputImage2 Input2ImageType;
71  typedef typename Input2ImageType::ConstPointer Input2ImageConstPointer;
72  typedef typename Input2ImageType::Pointer Input2ImagePointer;
73  typedef typename Input2ImageType::RegionType Input2ImageRegionType;
74  typedef typename Input2ImageType::PixelType Input2ImagePixelType;
75  typedef TOutputImage OutputImageType;
76  typedef typename OutputImageType::Pointer OutputImagePointer;
77  typedef typename OutputImageType::RegionType OutputImageRegionType;
78  typedef typename OutputImageType::PixelType OutputImagePixelType;
79 
81 
83  void SetInput1(const TInputImage1 * image1);
84 
86  void SetInput2(const TInputImage2 * image2);
87 
89  const TInputImage1 * GetInput1();
90  const TInputImage2 * GetInput2();
92 
98  {
99  return m_Functor;
100  }
101 
108  void SetFunctor(const FunctorType& functor)
109  {
110  m_Functor = functor;
111  this->Modified();
112  }
114 
119 
122 
124 
125  itkSetMacro(Radius, RadiusSizeType);
126 
128  void SetRadius(unsigned int radius)
129  {
130  m_Radius.Fill(radius);
131  }
132 
133 protected:
136 
147  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
148  itk::ThreadIdType threadId) override;
149 
153  void GenerateInputRequestedRegion(void) override;
154 
156 
157 private:
158  BinaryFunctorNeighborhoodImageFilter(const Self &) = delete;
159  void operator =(const Self&) = delete;
160 
162 };
163 
164 } // end namespace otb
165 
166 #ifndef OTB_MANUAL_INSTANTIATION
168 #endif
169 
170 #endif
itk::ImageToImageFilter< TInputImage1, TOutputImage > Superclass
Superclass::RadiusType RadiusType
itk::ConstNeighborhoodIterator< TInputImage1 > NeighborhoodIteratorType1
Implements neighborhood-wise generic operation of two images.
itk::ConstNeighborhoodIterator< TInputImage2 > NeighborhoodIteratorType2
itk::Size< Input1ImageType::ImageDimension > RadiusSizeType
unsigned int ThreadIdType
Implements pixel-wise generic operation on two images.