/usr/include/OTB-6.4/otbStandardDSCostFunction.h is in libotb-dev 6.4.0+dfsg-1.
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 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | /*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef otbStandardDSCostFunction_h
#define otbStandardDSCostFunction_h
#include "itkSingleValuedCostFunction.h"
#include "otbVectorDataToDSValidatedVectorDataFilter.h"
namespace otb
{
/** \class StandardDSCostFunction
* \brief Standard Cost Function used to estimate the fuzzy model parameters
* in the Dempster-Shafer framework
*
* This class has been developed to estimate, with the help of the Amoeba
* optimizer, the fuzzy model parameters to be used in the class
* otb::VectorDataToDSValidatedVectorDataFilter. The cost value compute the
* cost according to:
* - an enriched ground truth vector data (using VectorDataToRoadDescription)
* - an enriched negative sample VectorData or at least random samples
* - an hypothesis (the same as the considered DSValidationFilter)
* (by default (NONDVI, ROADSA, NOBUIL))
* - a weight between 0 and 1 (0.5 by default) corresponding to the situation
* policy regarding under detection/false detection (1 no under detection
* 0 no false detection)
* For now the cost function use the NONDVI Feature, ROADSA Feature and and
* the NOBUIL Feature.
* For each evolution of the VectorDataToDSValidatedVectorDataFilter,
* this cost function must be adapted.
*
* \ingroup CostFunction
* \sa VectorDataToDSValidatedVectorDataFilter
* \sa AmoebaOptimizer
*
* \ingroup OTBDempsterShafer
*/
template <class TDSValidationFilter>
class ITK_EXPORT StandardDSCostFunction :
public itk::SingleValuedCostFunction
{
public:
/** Standard class typedefs. */
typedef StandardDSCostFunction Self;
typedef itk::SingleValuedCostFunction Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(StandardDSCostFunction, itk::SingleValuedCostFunction);
typedef Superclass::MeasureType MeasureType; //double
typedef Superclass::DerivativeType DerivativeType; //Array<double>
typedef Superclass::ParametersType ParametersType; //Array<double>
typedef TDSValidationFilter DSValidationFilterType;
typedef typename DSValidationFilterType::VectorDataType
VectorDataType;
typedef typename DSValidationFilterType::TreeIteratorType
TreeIteratorType;
typedef typename DSValidationFilterType::LabelSetType
LabelSetType;
typedef FuzzyDescriptorsModelManager FuzzyDescriptorsModelManagerType;
typedef FuzzyDescriptorsModelManager::DescriptorListType
DescriptorListType;
typedef FuzzyDescriptorsModelManager::DescriptorsModelType
DescriptorsModelType;
typedef FuzzyDescriptorsModelManager::PairType PairType;
typedef Parser ParserType;
/** This method returns the value of the cost function corresponding
* to the specified parameters. */
MeasureType GetValue( const ParametersType & parameters ) const ITK_OVERRIDE;
/** This method returns the derivative of the cost function corresponding
* to the specified parameters. */
void GetDerivative( const ParametersType & parameters,
DerivativeType & derivative ) const ITK_OVERRIDE;
unsigned int GetNumberOfParameters(void) const ITK_OVERRIDE;
itkSetMacro(Weight, double);
itkGetConstMacro(Weight, double);
itkSetMacro(CriterionFormula, std::string);
itkGetConstMacro(CriterionFormula, std::string);
void SetDescriptorList(DescriptorListType list)
{
m_DescriptorList = list;
}
DescriptorListType GetDescriptorList()
{
return m_DescriptorList;
}
itkSetObjectMacro(GTVectorData, VectorDataType);
itkGetConstObjectMacro(GTVectorData, VectorDataType);
itkSetObjectMacro(NSVectorData, VectorDataType);
itkGetConstObjectMacro(NSVectorData, VectorDataType);
LabelSetType GetBeliefHypothesis()
{
return m_BeliefHypothesis;
}
void SetBeliefHypothesis(LabelSetType hypothesis)
{
m_BeliefHypothesis = hypothesis;
}
LabelSetType GetPlausibilityHypothesis()
{
return m_PlausibilityHypothesis;
}
void SetPlausibilityHypothesis(LabelSetType hypothesis)
{
m_PlausibilityHypothesis = hypothesis;
}
protected:
/** Constructor */
StandardDSCostFunction();
/** Destructor */
~StandardDSCostFunction() ITK_OVERRIDE {}
/**PrintSelf method */
void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE;
private:
StandardDSCostFunction(const Self &); //purposely not implemented
void operator =(const Self&); //purposely not implemented
typename VectorDataType::Pointer m_GTVectorData; //Ground Truth
typename VectorDataType::Pointer m_NSVectorData; //Negative Samples
typename ParserType::Pointer m_Parser;
std::string m_CriterionFormula;
double m_Weight; //range ]0; 1[
LabelSetType m_BeliefHypothesis;
LabelSetType m_PlausibilityHypothesis;
DescriptorListType m_DescriptorList;
};
} // end namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbStandardDSCostFunction.txx"
#endif
#endif
|