OTB  9.0.0
Orfeo Toolbox
otbHuMomentsImageFunction.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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 otbHuMomentsImageFunction_h
22 #define otbHuMomentsImageFunction_h
23 
24 #include "itkImageFunction.h"
25 #include "itkFixedArray.h"
26 
27 namespace otb
28 {
29 
65 
66 template <class TInputImage, class TCoordRep = double>
67 class ITK_EXPORT HuMomentsImageFunction
68  : public itk::ImageFunction<TInputImage, itk::FixedArray<typename itk::NumericTraits<typename TInputImage::PixelType>::RealType, 7>, TCoordRep>
69 {
70 public:
73  typedef itk::ImageFunction<TInputImage, itk::FixedArray<typename itk::NumericTraits<typename TInputImage::PixelType>::RealType, 7>, TCoordRep> Superclass;
74  typedef itk::SmartPointer<Self> Pointer;
75  typedef itk::SmartPointer<const Self> ConstPointer;
76 
78  itkTypeMacro(HuMomentsImageFunction, ImageFunction);
79 
81  itkNewMacro(Self);
82 
84  typedef TInputImage InputImageType;
85  typedef typename Superclass::IndexType IndexType;
86  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
87  typedef typename Superclass::PointType PointType;
88 
89  typedef typename Superclass::OutputType OutputType;
90  typedef typename OutputType::ValueType ScalarRealType;
91 
92  typedef TCoordRep CoordRepType;
93 
95  itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension);
96 
98  OutputType EvaluateAtIndex(const IndexType& index) const override;
99 
101  OutputType Evaluate(const PointType& point) const override
102  {
103  IndexType index;
104  this->ConvertPointToNearestIndex(point, index);
105  return this->EvaluateAtIndex(index);
106  }
108  {
109  IndexType index;
110  this->ConvertContinuousIndexToNearestIndex(cindex, index);
111  return this->EvaluateAtIndex(index);
112  }
114 
118  itkSetMacro(NeighborhoodRadius, unsigned int);
119  itkGetConstReferenceMacro(NeighborhoodRadius, unsigned int);
121 
122 protected:
125  {
126  }
127  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
128 
129 private:
130  HuMomentsImageFunction(const Self&) = delete;
131  void operator=(const Self&) = delete;
132 
133  unsigned int m_NeighborhoodRadius;
134 };
135 
136 } // namespace otb
137 
138 #ifndef OTB_MANUAL_INSTANTIATION
140 #endif
141 
142 #endif
otb::HuMomentsImageFunction::PointType
Superclass::PointType PointType
Definition: otbHuMomentsImageFunction.h:87
otb::HuMomentsImageFunction
Calculate the Hu's invariant parameters.
Definition: otbHuMomentsImageFunction.h:67
otb::HuMomentsImageFunction::OutputType
Superclass::OutputType OutputType
Definition: otbHuMomentsImageFunction.h:89
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::HuMomentsImageFunction::Self
HuMomentsImageFunction Self
Definition: otbHuMomentsImageFunction.h:72
otb::HuMomentsImageFunction::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbHuMomentsImageFunction.h:75
otb::HuMomentsImageFunction::InputImageType
TInputImage InputImageType
Definition: otbHuMomentsImageFunction.h:81
otb::HuMomentsImageFunction::Superclass
itk::ImageFunction< TInputImage, itk::FixedArray< typename itk::NumericTraits< typename TInputImage::PixelType >::RealType, 7 >, TCoordRep > Superclass
Definition: otbHuMomentsImageFunction.h:73
otb::HuMomentsImageFunction::ScalarRealType
OutputType::ValueType ScalarRealType
Definition: otbHuMomentsImageFunction.h:90
otb::HuMomentsImageFunction::CoordRepType
TCoordRep CoordRepType
Definition: otbHuMomentsImageFunction.h:92
otb::HuMomentsImageFunction::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbHuMomentsImageFunction.h:74
otb::HuMomentsImageFunction::Evaluate
OutputType Evaluate(const PointType &point) const override
Definition: otbHuMomentsImageFunction.h:101
otb::HuMomentsImageFunction::m_NeighborhoodRadius
unsigned int m_NeighborhoodRadius
Definition: otbHuMomentsImageFunction.h:133
otbHuMomentsImageFunction.hxx
otb::HuMomentsImageFunction::ContinuousIndexType
Superclass::ContinuousIndexType ContinuousIndexType
Definition: otbHuMomentsImageFunction.h:86
otb::HuMomentsImageFunction::EvaluateAtContinuousIndex
OutputType EvaluateAtContinuousIndex(const ContinuousIndexType &cindex) const override
Definition: otbHuMomentsImageFunction.h:107
otb::HuMomentsImageFunction::IndexType
Superclass::IndexType IndexType
Definition: otbHuMomentsImageFunction.h:85
otb::HuMomentsImageFunction::~HuMomentsImageFunction
~HuMomentsImageFunction() override
Definition: otbHuMomentsImageFunction.h:124