A library for working with phylogenetic and population genetic data.
v0.27.0
ColorNormalization Class Referenceabstract

#include <genesis/utils/tools/color/normalization.hpp>

Inherited by ColorNormalizationBoundary, and ColorNormalizationLinear.

Detailed Description

Base class for color normalization.

Definition at line 52 of file normalization.hpp.

Public Member Functions

 ColorNormalization ()=default
 
 ColorNormalization (ColorNormalization &&)=default
 
 ColorNormalization (ColorNormalization const &)=default
 
virtual ~ColorNormalization ()=default
 
bool is_valid () const
 Return whether ranges and other values are correct. More...
 
double mask_value () const
 Mask value that identifies invalid values. More...
 
ColorNormalizationmask_value (double value)
 Mask value that identifies invalid values. More...
 
double operator() (double value) const
 Normalize a value into range [ 0.0, 1.0 ]. More...
 
template<class ForwardIterator >
std::vector< double > operator() (ForwardIterator first, ForwardIterator last) const
 Return the normalized values for a range of values. More...
 
std::vector< double > operator() (std::vector< double > const &values) const
 Return the normalized values for a vector of values. More...
 
ColorNormalizationoperator= (ColorNormalization &&)=default
 
ColorNormalizationoperator= (ColorNormalization const &)=default
 

Protected Member Functions

virtual bool is_valid_ () const =0
 Return whether ranges and other values are correct. More...
 
virtual double normalize_ (double value) const =0
 Normalization function. More...
 

Constructor & Destructor Documentation

◆ ColorNormalization() [1/3]

ColorNormalization ( )
default

◆ ~ColorNormalization()

virtual ~ColorNormalization ( )
virtualdefault

◆ ColorNormalization() [2/3]

ColorNormalization ( ColorNormalization const &  )
default

◆ ColorNormalization() [3/3]

Member Function Documentation

◆ is_valid()

bool is_valid ( ) const
inline

Return whether ranges and other values are correct.

Definition at line 91 of file normalization.hpp.

◆ is_valid_()

virtual bool is_valid_ ( ) const
protectedpure virtual

Return whether ranges and other values are correct.

Implemented in ColorNormalizationLinear, ColorNormalizationBoundary, ColorNormalizationDiverging, and ColorNormalizationLogarithmic.

◆ mask_value() [1/2]

double mask_value ( ) const
inline

Mask value that identifies invalid values.

When querying a value that compares equal to the mask value, the color functions return mask_color() instead of a Color from the palette. This is meant as a simple means of filtering and visualizing invalid values.

The mask value is initialized to quiet_NaN, so that it never compares equal to anything. Thus, it is not used by default has to be explicitly set to a different value.

Definition at line 83 of file normalization.hpp.

◆ mask_value() [2/2]

ColorNormalization& mask_value ( double  value)
inline

Mask value that identifies invalid values.

When querying a value that compares equal to the mask value, the color functions return mask_color() instead of a Color from the palette. This is meant as a simple means of filtering and visualizing invalid values.

The mask value is initialized to quiet_NaN, so that it never compares equal to anything. Thus, it is not used by default has to be explicitly set to a different value.

Definition at line 103 of file normalization.hpp.

◆ normalize_()

virtual double normalize_ ( double  value) const
protectedpure virtual

Normalization function.

Return a value in range [ 0.0, 1.0 ] for valid values, or outside of this for clipping values. Derived classes need to override this to provide their specific normalization.

By having this function separated from the operator(), we implement a non-virtual interface.

Implemented in ColorNormalizationLinear, ColorNormalizationBoundary, ColorNormalizationDiverging, and ColorNormalizationLogarithmic.

◆ operator()() [1/3]

double operator() ( double  value) const
inline

Normalize a value into range [ 0.0, 1.0 ].

The function first checks whether the value is finite or mask_value(), and returns quiet_NaN if so. If not, the normalization is applied.

Definition at line 119 of file normalization.hpp.

◆ operator()() [2/3]

std::vector<double> operator() ( ForwardIterator  first,
ForwardIterator  last 
) const
inline

Return the normalized values for a range of values.

Simply applies operator() ( double value ) to all values.

Definition at line 144 of file normalization.hpp.

◆ operator()() [3/3]

std::vector<double> operator() ( std::vector< double > const &  values) const
inline

Return the normalized values for a vector of values.

Simply applies operator() ( double value ) to all values.

Definition at line 132 of file normalization.hpp.

◆ operator=() [1/2]

ColorNormalization& operator= ( ColorNormalization &&  )
default

◆ operator=() [2/2]

ColorNormalization& operator= ( ColorNormalization const &  )
default

The documentation for this class was generated from the following file: