OTB  10.0.0
Orfeo Toolbox
otbFunctionWithNeighborhoodToImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1999-2011 Insight Software Consortium
3  * Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
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 #ifndef otbFunctionWithNeighborhoodToImageFilter_h
23 #define otbFunctionWithNeighborhoodToImageFilter_h
24 
26 
27 namespace otb
28 {
29 
50 template <class TInputImage, class TOutputImage, class TFunction>
51 class ITK_EXPORT FunctionWithNeighborhoodToImageFilter : public itk::InPlaceImageFilter<TInputImage, TOutputImage>
52 {
53 public:
56  typedef itk::InPlaceImageFilter<TInputImage, TOutputImage> Superclass;
57  typedef itk::SmartPointer<Self> Pointer;
58  typedef itk::SmartPointer<const Self> ConstPointer;
59 
61  itkNewMacro(Self);
62 
64  itkTypeMacro(FunctionWithNeighborhoodToImageFilter, itk::InPlaceImageFilter);
65 
69  typedef TInputImage InputImageType;
70  typedef typename InputImageType::ConstPointer InputImageConstPointer;
71  typedef typename InputImageType::Pointer InputImagePointer;
72  typedef typename InputImageType::RegionType InputImageRegionType;
73  typedef typename InputImageType::PixelType InputImagePixelType;
74  typedef typename InputImageType::SizeType InputImageSizeType;
75  typedef typename InputImageType::OffsetType InputImageOffsetType;
76  typedef TOutputImage OutputImageType;
77  typedef typename OutputImageType::Pointer OutputImagePointer;
78  typedef typename OutputImageType::RegionType OutputImageRegionType;
79  typedef typename OutputImageType::PixelType OutputImagePixelType;
80 
82  typedef TFunction FunctionType;
83  typedef typename FunctionType::Pointer FunctionPointerType;
84  typedef typename FunctionType::OutputType FunctionValueType;
85  typedef typename FunctionType::InputType FunctionPositionType;
86 
87  // itkGetObjectMacro(Function, FunctionType);
88 
91  {
92  m_Function = function;
93  this->Modified();
94  }
96  {
97  return m_Function;
98  }
100 
101 
103  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
104  itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
106 
107 
109  itkGetMacro(Radius, InputImageSizeType);
111  {
112  m_Radius = rad;
113  m_Function->SetRadius(rad);
114  this->Modified();
115  }
116  itkGetMacro(Offset, InputImageOffsetType);
118  {
119  m_Offset = offset;
120  m_Function->SetOffset(offset);
121  this->Modified();
122  }
124 
125 protected:
128  {
129  }
130 
131  void BeforeThreadedGenerateData() override;
132 
133  void GenerateInputRequestedRegion() override;
134 
145  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
146 
147 private:
149  void operator=(const Self&) = delete;
150 
151  // FunctionPointerType m_Function;
153  std::vector<FunctionPointerType> m_FunctionList;
156 };
157 
158 } // end namespace otb
159 
160 #ifndef OTB_MANUAL_INSTANTIATION
162 #endif
163 
164 #endif
Evaluates a ImageFunction onto a source image.
itk::InPlaceImageFilter< TInputImage, TOutputImage > Superclass
FunctionWithNeighborhoodToImageFilter(const Self &)=delete
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.