OTB  10.0.0
Orfeo Toolbox
otbTextureImageFunction.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 otbTextureImageFunction_h
22 #define otbTextureImageFunction_h
23 
24 #include "itkImageFunction.h"
25 #include "itkConstNeighborhoodIterator.h"
26 #include "itkVariableLengthVector.h"
27 
28 namespace otb
29 {
30 
43 template <class TInputImage, class TFunctor, class TCoordRep = float>
44 class ITK_EXPORT TextureImageFunction
45  : public itk::ImageFunction<TInputImage, typename itk::NumericTraits<typename TInputImage::PixelType>::RealType, TCoordRep>
46 {
47 public:
48 
51  typedef itk::ImageFunction<TInputImage, typename itk::NumericTraits<typename TInputImage::PixelType>::RealType, TCoordRep> Superclass;
52  typedef itk::SmartPointer<Self> Pointer;
53  typedef itk::SmartPointer<const Self> ConstPointer;
54 
56  itkTypeMacro(TextureImageFunction, itk::ImageFunction);
57 
59  itkNewMacro(Self);
60 
62  typedef TInputImage InputImageType;
63  typedef TFunctor FunctorType;
64  typedef typename InputImageType::OffsetType OffsetType;
65  typedef typename InputImageType::SizeType SizeType;
66  typedef typename InputImageType::PixelType PixelType;
67  typedef typename Superclass::OutputType OutputType;
68  typedef typename Superclass::IndexType IndexType;
69  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
70  typedef typename Superclass::PointType PointType;
71  typedef itk::ConstNeighborhoodIterator<InputImageType> IteratorType;
72  typedef typename IteratorType::NeighborhoodType NeighborhoodType;
73  typedef typename itk::NumericTraits<typename InputImageType::PixelType>::RealType RealType;
74 
76  itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension);
77 
79  RealType EvaluateAtIndex(const IndexType& index) const override;
80 
82  RealType Evaluate(const PointType& point) const override
83  {
84  IndexType index;
85  this->ConvertPointToNearestIndex(point, index);
86  return this->EvaluateAtIndex(index);
87  }
89  {
90  IndexType index;
91  this->ConvertContinuousIndexToNearestIndex(cindex, index);
92  return this->EvaluateAtIndex(index);
93  }
95 
98  void SetRadius(SizeType& rad)
99  {
100  m_Radius = rad;
101  this->Modified();
102  }
104 
106  {
107  m_Offset = off;
108  this->Modified();
109  }
110 
111  itkGetMacro(Radius, SizeType);
112  itkGetMacro(Offset, OffsetType);
113 
115  virtual std::string GetName() const
116  {
117  FunctorType funct;
118  return funct.GetName();
119  }
121 
122 protected:
125  {
126  }
127  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
128 
129 private:
130  TextureImageFunction(const Self&) = delete;
131  void operator=(const Self&) = delete;
132 
135 };
136 
137 } // end namespace otb
138 
139 #ifndef OTB_MANUAL_INSTANTIATION
141 #endif
142 
143 #endif
Calculate a texture over an image.
RealType Evaluate(const PointType &point) const override
Superclass::OutputType OutputType
Superclass::PointType PointType
void operator=(const Self &)=delete
itk::SmartPointer< Self > Pointer
itk::ConstNeighborhoodIterator< InputImageType > IteratorType
Superclass::ContinuousIndexType ContinuousIndexType
itk::SmartPointer< const Self > ConstPointer
IteratorType::NeighborhoodType NeighborhoodType
itk::ImageFunction< TInputImage, typename itk::NumericTraits< typename TInputImage::PixelType >::RealType, TCoordRep > Superclass
virtual std::string GetName() const
TextureImageFunction(const Self &)=delete
InputImageType::PixelType PixelType
itk::NumericTraits< typename InputImageType::PixelType >::RealType RealType
InputImageType::OffsetType OffsetType
InputImageType::SizeType SizeType
RealType EvaluateAtContinuousIndex(const ContinuousIndexType &cindex) const override
Superclass::IndexType IndexType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.