OTB  10.0.0
Orfeo Toolbox
otbBinaryFunctorNeighborhoodVectorImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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 otbBinaryFunctorNeighborhoodVectorImageFilter_h
22 #define otbBinaryFunctorNeighborhoodVectorImageFilter_h
23 
24 #include "itkInPlaceImageFilter.h"
25 #include "itkImageRegionIteratorWithIndex.h"
26 #include "itkConstNeighborhoodIterator.h"
27 
28 namespace otb
29 {
41 template <class TInputImage1, class TInputImage2, class TOutputImage, class TFunction>
42 class ITK_EXPORT BinaryFunctorNeighborhoodVectorImageFilter : public itk::InPlaceImageFilter<TInputImage1, TOutputImage>
43 {
44 public:
47  typedef itk::InPlaceImageFilter<TInputImage1, TOutputImage> Superclass;
48  typedef itk::SmartPointer<Self> Pointer;
49  typedef itk::SmartPointer<const Self> ConstPointer;
50 
52  itkNewMacro(Self);
53 
55  itkTypeMacro(BinaryFunctorNeighborhoodVectorImageFilter, InPlaceImageFilter);
56 
58  typedef TFunction FunctorType;
59  typedef TInputImage1 Input1ImageType;
60  typedef typename Input1ImageType::ConstPointer Input1ImagePointer;
61  typedef typename Input1ImageType::RegionType Input1ImageRegionType;
62  typedef typename Input1ImageType::PixelType Input1ImagePixelType;
63  typedef TInputImage2 Input2ImageType;
64  typedef typename Input2ImageType::ConstPointer Input2ImagePointer;
65  typedef typename Input2ImageType::RegionType Input2ImageRegionType;
66  typedef typename Input2ImageType::PixelType Input2ImagePixelType;
67  typedef TOutputImage OutputImageType;
68  typedef typename OutputImageType::Pointer OutputImagePointer;
69  typedef typename OutputImageType::RegionType OutputImageRegionType;
70  typedef typename OutputImageType::PixelType OutputImagePixelType;
71 
72  typedef itk::ProcessObject ProcessObjectType;
73 
75  void SetInput1(const TInputImage1* image1);
76 
78  void SetInput2(const TInputImage2* image2);
79 
83  void SetRadius(const unsigned char& min, const unsigned char& max);
84 
90  {
91  return m_Functor;
92  }
93 
100  void SetFunctor(const FunctorType& functor)
101  {
102  m_Functor = functor;
103  this->Modified();
104  }
106 
107  typedef itk::ConstNeighborhoodIterator<TInputImage1> NeighborhoodIteratorType1;
108  typedef itk::ConstNeighborhoodIterator<TInputImage2> NeighborhoodIteratorType2;
109 
110  typedef typename NeighborhoodIteratorType1::RadiusType RadiusType1;
111  typedef typename NeighborhoodIteratorType2::RadiusType RadiusType2;
112 
113  typedef unsigned char RadiusSizeType;
114 
115  itkSetMacro(Radius, RadiusSizeType);
116 
117 protected:
120  {
121  }
122 
133  void DynamicThreadedGenerateData(const OutputImageRegionType& outputRegionForThread) override;
134 
139  void GenerateOutputInformation(void) override;
140 
142 
143 private:
145  void operator=(const Self&) = delete;
146 
148 };
149 } // namespace otb
150 
151 #ifndef OTB_MANUAL_INSTANTIATION
153 #endif
154 
155 #endif
Implements neighborhood-wise generic operation of two images being vector images.
itk::ConstNeighborhoodIterator< TInputImage1 > NeighborhoodIteratorType1
itk::ConstNeighborhoodIterator< TInputImage2 > NeighborhoodIteratorType2
BinaryFunctorNeighborhoodVectorImageFilter(const Self &)=delete
itk::InPlaceImageFilter< TInputImage1, TOutputImage > Superclass
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.