OTB  9.0.0
Orfeo Toolbox
otbTextureImageFunction.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 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
otb::TextureImageFunction::m_Offset
OffsetType m_Offset
Definition: otbTextureImageFunction.h:134
otb::TextureImageFunction::OutputType
Superclass::OutputType OutputType
Definition: otbTextureImageFunction.h:67
otb::TextureImageFunction::m_Radius
SizeType m_Radius
Definition: otbTextureImageFunction.h:133
otb::TextureImageFunction::NeighborhoodType
IteratorType::NeighborhoodType NeighborhoodType
Definition: otbTextureImageFunction.h:72
otb::TextureImageFunction::RealType
itk::NumericTraits< typename InputImageType::PixelType >::RealType RealType
Definition: otbTextureImageFunction.h:73
otb::TextureImageFunction::SizeType
InputImageType::SizeType SizeType
Definition: otbTextureImageFunction.h:65
otb::TextureImageFunction::IndexType
Superclass::IndexType IndexType
Definition: otbTextureImageFunction.h:68
otb::TextureImageFunction::Self
TextureImageFunction Self
Definition: otbTextureImageFunction.h:50
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::TextureImageFunction::SetOffset
void SetOffset(OffsetType &off)
Definition: otbTextureImageFunction.h:105
otb::TextureImageFunction
Calculate a texture over an image.
Definition: otbTextureImageFunction.h:44
otb::TextureImageFunction::ContinuousIndexType
Superclass::ContinuousIndexType ContinuousIndexType
Definition: otbTextureImageFunction.h:69
otb::TextureImageFunction::OffsetType
InputImageType::OffsetType OffsetType
Definition: otbTextureImageFunction.h:64
otb::TextureImageFunction::FunctorType
TFunctor FunctorType
Definition: otbTextureImageFunction.h:63
otb::TextureImageFunction::GetName
virtual std::string GetName() const
Definition: otbTextureImageFunction.h:115
otb::TextureImageFunction::InputImageType
TInputImage InputImageType
Definition: otbTextureImageFunction.h:59
otb::TextureImageFunction::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbTextureImageFunction.h:52
otb::TextureImageFunction::~TextureImageFunction
~TextureImageFunction() override
Definition: otbTextureImageFunction.h:124
otb::TextureImageFunction::PointType
Superclass::PointType PointType
Definition: otbTextureImageFunction.h:70
otb::TextureImageFunction::Superclass
itk::ImageFunction< TInputImage, typename itk::NumericTraits< typename TInputImage::PixelType >::RealType, TCoordRep > Superclass
Definition: otbTextureImageFunction.h:51
otbTextureImageFunction.hxx
otb::TextureImageFunction::PixelType
InputImageType::PixelType PixelType
Definition: otbTextureImageFunction.h:66
otb::TextureImageFunction::Evaluate
RealType Evaluate(const PointType &point) const override
Definition: otbTextureImageFunction.h:82
otb::TextureImageFunction::SetRadius
void SetRadius(SizeType &rad)
Definition: otbTextureImageFunction.h:98
otb::TextureImageFunction::IteratorType
itk::ConstNeighborhoodIterator< InputImageType > IteratorType
Definition: otbTextureImageFunction.h:71
otb::TextureImageFunction::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbTextureImageFunction.h:53
otb::TextureImageFunction::EvaluateAtContinuousIndex
RealType EvaluateAtContinuousIndex(const ContinuousIndexType &cindex) const override
Definition: otbTextureImageFunction.h:88