OTB  9.0.0
Orfeo Toolbox
otbCzihoSOMNeighborhoodBehaviorFunctor.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
3  * Copyright (C) 2007-2012 Institut Mines Telecom / Telecom Bretagne
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 
23 #ifndef otbCzihoSOMNeighborhoodBehaviorFunctor_h
24 #define otbCzihoSOMNeighborhoodBehaviorFunctor_h
25 
26 #include "itkSize.h"
27 #include "itkMath.h"
28 
29 namespace otb
30 {
31 
32 namespace Functor
33 {
34 
57 {
58 public:
61  {
62  }
64  {
65  }
67 
69  template <unsigned int VDimension>
70  itk::Size<VDimension> operator()(unsigned int currentIteration, unsigned int numberOfIterations, const itk::Size<VDimension>& sizeInit) const
71  {
72  itk::Size<VDimension> theSize;
73  double weightening = ::std::pow(1.0 - static_cast<double>(currentIteration) / static_cast<double>(numberOfIterations), 2.0);
74  for (unsigned int i = 0; i < VDimension; ++i)
75  {
76  theSize[i] = static_cast<typename itk::Size<VDimension>::SizeValueType>(static_cast<double>(sizeInit[i]) * weightening);
77  }
79 
80  return theSize;
81  }
82 
83 }; // end of class CzihoSOMNeighborhoodBehaviorFunctor
84 
85 } // end namespace Functor
86 
87 } // end namespace otb
88 
89 #endif
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Functor::CzihoSOMNeighborhoodBehaviorFunctor::~CzihoSOMNeighborhoodBehaviorFunctor
virtual ~CzihoSOMNeighborhoodBehaviorFunctor()
Definition: otbCzihoSOMNeighborhoodBehaviorFunctor.h:63
otb::Functor::CzihoSOMNeighborhoodBehaviorFunctor::operator()
itk::Size< VDimension > operator()(unsigned int currentIteration, unsigned int numberOfIterations, const itk::Size< VDimension > &sizeInit) const
Definition: otbCzihoSOMNeighborhoodBehaviorFunctor.h:70
otb::Functor::CzihoSOMNeighborhoodBehaviorFunctor
Neighborhood size behavior over SOM training phase.
Definition: otbCzihoSOMNeighborhoodBehaviorFunctor.h:56
otb::Functor::CzihoSOMNeighborhoodBehaviorFunctor::CzihoSOMNeighborhoodBehaviorFunctor
CzihoSOMNeighborhoodBehaviorFunctor()
Definition: otbCzihoSOMNeighborhoodBehaviorFunctor.h:60