21 #ifndef otbWrapperNumericalParameter_h
22 #define otbWrapperNumericalParameter_h
26 #include "itkNumericTraits.h"
27 #include <boost/optional.hpp>
54 m_Value = m_DefaultValue;
60 m_Value =
otb::clamp(value, m_MinimumValue, m_MaximumValue);
63 if (!GetAutomaticValue())
79 itkGenericExceptionMacro(<<
"Parameter " << this->GetKey() <<
" has no value yet.");
86 return m_Value != boost::none;
117 itkExceptionMacro(
"Cannot convert parameter " << GetKey() <<
" to int (no value).");
119 return static_cast<int>(*m_Value);
126 itkExceptionMacro(
"Cannot convert parameter " << GetKey() <<
" to float (no value).");
128 return static_cast<float>(*m_Value);
135 itkExceptionMacro(
"Cannot convert parameter " << GetKey() <<
" to double (no value).");
137 return static_cast<double>(*m_Value);
152 std::ostringstream oss;
153 oss << this->GetValue();
160 : m_DefaultValue(
itk::NumericTraits<T>::Zero), m_MinimumValue(
itk::NumericTraits<T>::NonpositiveMin()), m_MaximumValue(
itk::NumericTraits<T>::max())
271 this->SetName(
"RAM");
272 this->SetDescription(
"Set the maximum of available memory for the pipeline execution in mega bytes (optional, 256 by default).");
277 this->SetMinimumValue(1);
304 this->SetName(
"Radius");
306 this->SetDescription(
"Radius in pixels");
void FromDouble(double value) override
itk::SmartPointer< Self > Pointer
ParameterType GetType() const override
itk::SmartPointer< const Self > ConstPointer
itk::SmartPointer< Self > Pointer
void FromFloat(float value) override
ParameterType GetType() const override
itk::SmartPointer< const Self > ConstPointer
ParameterType GetType() const override
itk::SmartPointer< Self > Pointer
itk::SmartPointer< const Self > ConstPointer
This class represents a numerical parameter.
NumericalParameter(const Parameter &)=delete
~NumericalParameter() override
void SetValue(const std::string &valueStr)
ScalarType m_MinimumValue
boost::optional< T > m_Value
void ClearValue() override
bool HasValue() const override
void SetValue(ScalarType value)
double ToDouble() const override
ScalarType GetValue() const
float ToFloat() const override
void FromString(const std::string &value) override
std::string ToString() const override
void operator=(const Parameter &)=delete
itk::SmartPointer< Self > Pointer
ScalarType m_MaximumValue
ScalarType m_DefaultValue
void FromInt(int value) override
itk::SmartPointer< const Self > ConstPointer
int ToInt() const override
This class represent a parameter for the wrapper framework This class is a high level class represent...
ParameterType GetType() const override
itk::SmartPointer< const Self > ConstPointer
itk::SmartPointer< Self > Pointer
bool HasValue() const override
itk::SmartPointer< const Self > ConstPointer
ParameterType GetType() const override
itk::SmartPointer< Self > Pointer
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
constexpr T const & clamp(T const &v, T const &lo, T const &hi) noexcept