OTB  6.7.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-2019 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>
52  public itk::InPlaceImageFilter<TInputImage, TOutputImage>
53 {
54 public:
60 
62  itkNewMacro(Self);
63 
66 
70  typedef TInputImage InputImageType;
71  typedef typename InputImageType::ConstPointer InputImageConstPointer;
72  typedef typename InputImageType::Pointer InputImagePointer;
73  typedef typename InputImageType::RegionType InputImageRegionType;
74  typedef typename InputImageType::PixelType InputImagePixelType;
76  typedef typename InputImageType::OffsetType InputImageOffsetType;
77  typedef TOutputImage OutputImageType;
78  typedef typename OutputImageType::Pointer OutputImagePointer;
79  typedef typename OutputImageType::RegionType OutputImageRegionType;
80  typedef typename OutputImageType::PixelType OutputImagePixelType;
81 
83  typedef TFunction FunctionType;
84  typedef typename FunctionType::Pointer FunctionPointerType;
85  typedef typename FunctionType::OutputType FunctionValueType;
86  typedef typename FunctionType::InputType FunctionPositionType;
87 
88 // itkGetObjectMacro(Function, FunctionType);
89 
92  {
93  m_Function = function;
94  this->Modified();
95  }
97  {
98  return m_Function;
99  }
101 
102 
104  itkStaticConstMacro(InputImageDimension, unsigned int,
105  TInputImage::ImageDimension);
106  itkStaticConstMacro(OutputImageDimension, unsigned int,
107  TOutputImage::ImageDimension);
109 
110 
112  itkGetMacro(Radius, InputImageSizeType);
114  {
115  m_Radius = rad;
116  m_Function->SetRadius(rad);
117  this->Modified();
118  }
119  itkGetMacro(Offset, InputImageOffsetType);
121  {
122  m_Offset = offset;
123  m_Function->SetOffset(offset);
124  this->Modified();
125  }
127 
128 protected:
131 
132  void BeforeThreadedGenerateData() override;
133 
134  void GenerateInputRequestedRegion() override;
135 
146  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
147  itk::ThreadIdType threadId) override;
148 
149 private:
150  FunctionWithNeighborhoodToImageFilter(const Self &) = delete;
151  void operator =(const Self&) = delete;
152 
153  //FunctionPointerType m_Function;
155  std::vector<FunctionPointerType> m_FunctionList;
158 };
159 
160 } // end namespace otb
161 
162 #ifndef OTB_MANUAL_INSTANTIATION
164 #endif
165 
166 #endif
itk::Size< Monteverdi_DIMENSION > SizeType
Definition: mvdTypes.h:137
itk::InPlaceImageFilter< TInputImage, TOutputImage > Superclass
unsigned int ThreadIdType
Evaluates a ImageFunction onto a source image.