|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_UTILS_COLOR_NORMALIZATION_H_
2 #define GENESIS_UTILS_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()=default
double operator()(double value) const
Normalize a value into range [ 0.0, 1.0 ].
virtual ~ColorNormalization()=default
Base class for color normalization.
double mask_value() const
Mask value that identifies invalid values.
virtual double normalize_(double value) const =0
Normalization function.
bool is_valid() const
Return whether ranges and other values are correct.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
std::vector< double > operator()(ForwardIterator first, ForwardIterator last) const
Return the normalized values for a range of values.
ColorNormalization & operator=(ColorNormalization const &)=default
ColorNormalization & mask_value(double value)
Mask value that identifies invalid values.
virtual bool is_valid_() const =0
Return whether ranges and other values are correct.