Color normalization that maps to discrete intervals.
The normalization takes a set of boundaries, which define the edges of intervals. Values falling within an interval are mapped to a value within [ 0.0, 1.0 ]
that corresponds to the index of the interval. For example, with boundaries 3.0, 4.0, 5.0, 6.0
, we get three intervals. Valus outside of these boundaries are mapped to -1.0
or 2.0
. Hence, values are mapped as follows:
< 3.0 : -1.0
[ 3.0, 4.0 ) : 0.0
[ 4.0, 5.0 ) : 0.5
[ 5.0, 6.0 ] : 1.0
> 6.0 : 2.0
Thus, this normalization can immediately be used with a ColorMap. Furthermore, the function interval() offers to retrieve the interval index for a given value. For the example above, these would be values between 0 and 2 for valid values.
Definition at line 75 of file norm_boundary.hpp.
|
| ColorNormalizationBoundary ()=default |
|
| ColorNormalizationBoundary (ColorNormalizationBoundary &&)=default |
|
| ColorNormalizationBoundary (ColorNormalizationBoundary const &)=default |
|
| ColorNormalizationBoundary (double min, double max, size_t intervals) |
|
| ColorNormalizationBoundary (std::vector< double > const &boundaries) |
|
virtual | ~ColorNormalizationBoundary () override=default |
|
template<class ForwardIterator > |
ColorNormalizationBoundary & | autoscale (ForwardIterator first, ForwardIterator last, size_t intervals) |
| Set the boundaries similar to scale(), but use the given range to determine min and max first. More...
|
|
ColorNormalizationBoundary & | autoscale (std::vector< double > const &values, size_t intervals) |
| Set the boundaries similar to scale(), but use the given vector of values to determine min and max first. More...
|
|
std::vector< double > const & | boundaries () const |
| Return the boundaries currently set. More...
|
|
ColorNormalizationBoundary & | boundaries (std::vector< double > const &values) |
| Explicitly set the boundaries to the given values . Have to be sorted. More...
|
|
long | interval (double value) const |
| Return the interval index of a value. More...
|
|
ColorNormalizationBoundary & | operator= (ColorNormalizationBoundary &&)=default |
|
ColorNormalizationBoundary & | operator= (ColorNormalizationBoundary const &)=default |
|
ColorNormalizationBoundary & | scale (double min, double max, size_t intervals) |
| Set the boundaries to equal-sizes intervals between min and max , using intervals many steps. More...
|
|
| 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...
|
|
ColorNormalization & | mask_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...
|
|
ColorNormalization & | operator= (ColorNormalization &&)=default |
|
ColorNormalization & | operator= (ColorNormalization const &)=default |
|