This file is indexed.

/usr/include/OTB-5.8/otbMRFOptimizerMetropolis.h is in libotb-dev 5.8.0+dfsg-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*=========================================================================

  Program:   ORFEO Toolbox
  Language:  C++
  Date:      $Date$
  Version:   $Revision$


  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
  See OTBCopyright.txt for details.


     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/
#ifndef otbMRFOptimizerMetropolis_h
#define otbMRFOptimizerMetropolis_h

#include "otbMRFOptimizer.h"
#include "otbMath.h"
#include "itkNumericTraits.h"
#include "itkMersenneTwisterRandomVariateGenerator.h"

namespace otb
{
/**
 * \class MRFOptimizerMetropolis
 * \brief This is the optimizer class implementing the Metropolis algorithm
 *
 * This is one optimizer to be used in the MRF framework. This optimizer
 * follows the metropolis algorithm to accept of reject the value proposed by the sampler.
 *
 * The MRFOptimizerMetropolis has one parameter corresponding to the temperature T used
 * to accept or reject proposed values. The proposed value is accepted with a probability:
 *
 *  \f[ e^{\frac{-\Delta E}{T}} \f]
 *
 *
 * This class is meant to be used in the MRF framework with the otb::MarkovRandomFieldFilter
 *
 * \ingroup Markov
 *
 * \ingroup OTBMarkov
 */

class ITK_EXPORT MRFOptimizerMetropolis : public MRFOptimizer
{
public:

  typedef MRFOptimizerMetropolis        Self;
  typedef MRFOptimizer                  Superclass;
  typedef itk::SmartPointer<Self>       Pointer;
  typedef itk::SmartPointer<const Self> ConstPointer;
  typedef Superclass::ParametersType    ParametersType;

  typedef itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType;

  itkNewMacro(Self);

  itkTypeMacro(MRFOptimizerMetropolis, MRFOptimizer);

  /** Set parameter to a one array filled with paramVal.*/
  void SetSingleParameter(double parameterVal)
  {
    this->m_Parameters.SetSize(1);
    this->m_Parameters.Fill(parameterVal);
    this->Modified();
  }

  inline bool Compute(double deltaEnergy) ITK_OVERRIDE
  {
    if (deltaEnergy < 0)
      {
      return true;
      }
    if (deltaEnergy == 0)
      {
      return false;
      }
    else
      {
      double proba = vcl_exp(-(deltaEnergy) / this->m_Parameters[0]);
      if ((m_Generator->GetIntegerVariate() % 10000) < proba * 10000)
        {
        return true;
        }
      }
    return false;
  }

  /** Methods to cancel random effects.*/
  void InitializeSeed(int seed)
  {
    m_Generator->SetSeed(seed);
  }
  void InitializeSeed()
  {
    m_Generator->SetSeed();
  }

protected:
  MRFOptimizerMetropolis()
    {
    this->m_NumberOfParameters = 1;
    this->m_Parameters.SetSize(1);
    this->m_Parameters[0] = 1.0;
    m_Generator = RandomGeneratorType::GetInstance();
    m_Generator->SetSeed();
    }
  ~MRFOptimizerMetropolis() ITK_OVERRIDE {}
  RandomGeneratorType::Pointer m_Generator;
};

}

#endif