OTB  9.0.0
Orfeo Toolbox
otbTextureImageFunction.hxx
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_hxx
22 #define otbTextureImageFunction_hxx
23 
25 
26 namespace otb
27 {
28 
32 template <class TInputImage, class TFunctor, class TCoordRep>
34 {
35  m_Radius.Fill(0);
36  m_Offset.Fill(0);
37 }
39 
43 template <class TInputImage, class TFunctor, class TCoordRep>
44 void TextureImageFunction<TInputImage, TFunctor, TCoordRep>::PrintSelf(std::ostream& os, itk::Indent indent) const
45 {
46  this->Superclass::PrintSelf(os, indent);
47  os << indent << "Radius: " << m_Radius << std::endl;
48  os << indent << "Offset: " << m_Offset << std::endl;
49 }
51 
55 template <class TInputImage, class TFunctor, class TCoordRep>
58 {
59  if (!this->GetInputImage())
60  {
61  return (itk::NumericTraits<RealType>::max());
62  }
63 
64  if (!this->IsInsideBuffer(index))
65  {
66  return (itk::NumericTraits<RealType>::max());
67  }
68 
69  SizeType radiusOff;
70  radiusOff[0] = (m_Radius[0]) + std::abs(m_Offset[0]);
71  radiusOff[1] = (m_Radius[1]) + std::abs(m_Offset[1]);
72  IteratorType itOff(radiusOff, this->GetInputImage(), this->GetInputImage()->GetBufferedRegion());
73  itOff.SetLocation(index);
74 
75  FunctorType funct;
76  funct.SetOffset(m_Offset);
77 
78  return static_cast<RealType>(funct(itOff.GetNeighborhood()));
79 }
80 
81 } // end namespace otb
82 
83 #endif
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
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::TextureImageFunction::PrintSelf
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Definition: otbTextureImageFunction.hxx:44
otbTextureImageFunction.h
otb::TextureImageFunction::FunctorType
TFunctor FunctorType
Definition: otbTextureImageFunction.h:63
otb::TextureImageFunction::TextureImageFunction
TextureImageFunction()
Definition: otbTextureImageFunction.hxx:33
otb::TextureImageFunction::IteratorType
itk::ConstNeighborhoodIterator< InputImageType > IteratorType
Definition: otbTextureImageFunction.h:71
otb::TextureImageFunction::EvaluateAtIndex
RealType EvaluateAtIndex(const IndexType &index) const override
Definition: otbTextureImageFunction.hxx:57