OTB  9.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-2022 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:
148  FunctionWithNeighborhoodToImageFilter(const Self&) = delete;
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
otb::FunctionWithNeighborhoodToImageFilter::Superclass
itk::InPlaceImageFilter< TInputImage, TOutputImage > Superclass
Definition: otbFunctionWithNeighborhoodToImageFilter.h:56
otb::FunctionWithNeighborhoodToImageFilter::InputImageSizeType
InputImageType::SizeType InputImageSizeType
Definition: otbFunctionWithNeighborhoodToImageFilter.h:74
otbFunctionToImageFilter.h
otb::FunctionWithNeighborhoodToImageFilter::m_Radius
InputImageSizeType m_Radius
Definition: otbFunctionWithNeighborhoodToImageFilter.h:154
otbFunctionWithNeighborhoodToImageFilter.hxx
otb::FunctionWithNeighborhoodToImageFilter::InputImageOffsetType
InputImageType::OffsetType InputImageOffsetType
Definition: otbFunctionWithNeighborhoodToImageFilter.h:75
otb::FunctionWithNeighborhoodToImageFilter::InputImagePixelType
InputImageType::PixelType InputImagePixelType
Definition: otbFunctionWithNeighborhoodToImageFilter.h:73
otb::FunctionWithNeighborhoodToImageFilter::OutputImageRegionType
OutputImageType::RegionType OutputImageRegionType
Definition: otbFunctionWithNeighborhoodToImageFilter.h:78
otb::FunctionWithNeighborhoodToImageFilter::m_Offset
InputImageOffsetType m_Offset
Definition: otbFunctionWithNeighborhoodToImageFilter.h:155
otb::FunctionWithNeighborhoodToImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbFunctionWithNeighborhoodToImageFilter.h:57
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::FunctionWithNeighborhoodToImageFilter
Evaluates a ImageFunction onto a source image.
Definition: otbFunctionWithNeighborhoodToImageFilter.h:51
otb::FunctionWithNeighborhoodToImageFilter::GetFunction
FunctionPointerType GetFunction()
Definition: otbFunctionWithNeighborhoodToImageFilter.h:95
otb::FunctionWithNeighborhoodToImageFilter::OutputImageType
TOutputImage OutputImageType
Definition: otbFunctionWithNeighborhoodToImageFilter.h:76
otb::FunctionWithNeighborhoodToImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbFunctionWithNeighborhoodToImageFilter.h:58
otb::FunctionWithNeighborhoodToImageFilter::m_FunctionList
std::vector< FunctionPointerType > m_FunctionList
Definition: otbFunctionWithNeighborhoodToImageFilter.h:153
otb::FunctionWithNeighborhoodToImageFilter::SetFunction
void SetFunction(FunctionPointerType function)
Definition: otbFunctionWithNeighborhoodToImageFilter.h:90
otb::FunctionWithNeighborhoodToImageFilter::~FunctionWithNeighborhoodToImageFilter
~FunctionWithNeighborhoodToImageFilter() override
Definition: otbFunctionWithNeighborhoodToImageFilter.h:127
otb::FunctionWithNeighborhoodToImageFilter::SetRadius
void SetRadius(InputImageSizeType &rad)
Definition: otbFunctionWithNeighborhoodToImageFilter.h:110
otb::FunctionWithNeighborhoodToImageFilter::Self
FunctionWithNeighborhoodToImageFilter Self
Definition: otbFunctionWithNeighborhoodToImageFilter.h:55
otb::FunctionWithNeighborhoodToImageFilter::FunctionValueType
FunctionType::OutputType FunctionValueType
Definition: otbFunctionWithNeighborhoodToImageFilter.h:84
otb::FunctionWithNeighborhoodToImageFilter::OutputImagePixelType
OutputImageType::PixelType OutputImagePixelType
Definition: otbFunctionWithNeighborhoodToImageFilter.h:79
otb::FunctionWithNeighborhoodToImageFilter::InputImageType
TInputImage InputImageType
Definition: otbFunctionWithNeighborhoodToImageFilter.h:64
otb::FunctionWithNeighborhoodToImageFilter::FunctionPointerType
FunctionType::Pointer FunctionPointerType
Definition: otbFunctionWithNeighborhoodToImageFilter.h:83
otb::FunctionWithNeighborhoodToImageFilter::SetOffset
void SetOffset(InputImageOffsetType &offset)
Definition: otbFunctionWithNeighborhoodToImageFilter.h:117
otb::FunctionWithNeighborhoodToImageFilter::OutputImagePointer
OutputImageType::Pointer OutputImagePointer
Definition: otbFunctionWithNeighborhoodToImageFilter.h:77
otb::FunctionWithNeighborhoodToImageFilter::InputImageRegionType
InputImageType::RegionType InputImageRegionType
Definition: otbFunctionWithNeighborhoodToImageFilter.h:72
otb::FunctionWithNeighborhoodToImageFilter::FunctionType
TFunction FunctionType
Definition: otbFunctionWithNeighborhoodToImageFilter.h:82
otb::FunctionWithNeighborhoodToImageFilter::InputImageConstPointer
InputImageType::ConstPointer InputImageConstPointer
Definition: otbFunctionWithNeighborhoodToImageFilter.h:70
otb::FunctionWithNeighborhoodToImageFilter::FunctionPositionType
FunctionType::InputType FunctionPositionType
Definition: otbFunctionWithNeighborhoodToImageFilter.h:85
otb::FunctionWithNeighborhoodToImageFilter::InputImagePointer
InputImageType::Pointer InputImagePointer
Definition: otbFunctionWithNeighborhoodToImageFilter.h:71
otb::FunctionWithNeighborhoodToImageFilter::m_Function
FunctionPointerType m_Function
Definition: otbFunctionWithNeighborhoodToImageFilter.h:152