1 #ifndef GENESIS_UTILS_TOOLS_COLOR_NORMALIZATION_H_ 2 #define GENESIS_UTILS_TOOLS_COLOR_NORMALIZATION_H_ 121 if( ! std::isfinite( value ) || value == mask_value_ ) {
122 return std::numeric_limits<double>::quiet_NaN();
132 std::vector<double>
operator() ( std::vector<double>
const& values )
const 134 using it_type = std::vector<double>::const_iterator;
135 return operator()<it_type>( values.begin(), values.end() );
143 template <
class ForwardIterator>
144 std::vector<double>
operator()( ForwardIterator first, ForwardIterator last )
const 146 std::vector<double> result;
147 while( first != last ) {
148 result.push_back(
operator()( *first ) );
168 virtual double normalize_(
double value )
const = 0;
181 double mask_value_ = std::numeric_limits<double>::quiet_NaN();
188 #endif // include guard ColorNormalization & operator=(ColorNormalization const &)=default
virtual double normalize_(double value) const =0
Normalization function.
std::vector< double > operator()(ForwardIterator first, ForwardIterator last) const
Return the normalized values for a range of values.
virtual bool is_valid_() const =0
Return whether ranges and other values are correct.
virtual ~ColorNormalization()=default
Container namespace for all symbols of genesis in order to keep them separate when used as a library...
ColorNormalization()=default
double operator()(double value) const
Normalize a value into range [ 0.0, 1.0 ].
ColorNormalization & mask_value(double value)
Mask value that identifies invalid values.
Base class for color normalization.
bool is_valid() const
Return whether ranges and other values are correct.
double mask_value() const
Mask value that identifies invalid values.