|
MorphoGraphX
2.0-1-227
|
#include <TransferFunction.hpp>
Public Types | |
| enum | Interpolation { RGB, HSV, CYCLIC_HSV } |
| Type of interpolation. More... | |
| typedef Color< float > | Colorf |
| Type of a color. More... | |
| typedef std::vector< std::pair< double, Colorf > > | value_list |
| Type of a list of value/colors. More... | |
| typedef QMap< double, int > | key_map |
| Type of the mapping from the position to the index in the value list. More... | |
Public Member Functions | |
| TransferFunction (Interpolation interpolation=RGB) | |
| Default constructor for a transfer function. More... | |
| TransferFunction (const TransferFunction ©) | |
| Copy constructor. More... | |
| virtual | ~TransferFunction () |
| Virtual destructor. More... | |
Static Public Attributes | |
| static const double | epsilon |
| epsilon used in floating point comparisons More... | |
Predefined transfer functions | |
| Interpolation | _interpolation |
| Current interpolation mode. More... | |
| value_list | values |
| List of values. More... | |
| key_map | keys |
| Mapping of the position to the index in the value list. More... | |
| bool | clamp |
| If true, the colors left and right of the defined points are clamped. More... | |
| Colorf | exteriorColor |
| Color left and right of the control points if not clamped. More... | |
| QString | dump () const |
| Store the transfer function into a string. More... | |
| void | add_rgba_point (double pos, Colorf col) |
| Add a point to the interpolation with the color are RGBA. More... | |
| void | add_hsva_point (double pos, Colorf col) |
| Add a point to the interpolation with the color are HSVA. More... | |
| void | remove_point (double pos) |
| Remove the point at the given position (if any) More... | |
| size_t | size () const |
| Returns the number of points. More... | |
| void | move_point (double old_pos, double new_pos) |
| Move a point (if found) More... | |
| double | next_pos (double old_pos) const |
| Position of the next point, or -1 if none. More... | |
| double | prev_pos (double old_pos) const |
| Position of the previous point, or -1 if none. More... | |
| double | operator[] (int i) const |
| Return the i_th point. More... | |
| Colorf | rgba_point (double position) const |
Return the RGBA point at position. More... | |
| Colorf | hsva_point (double position) const |
Return the RGBA point at position. More... | |
| Colorf | rgba (double position) const |
Returns the color at position in RGBA, linearly interpolating between specified points. More... | |
| Colorf | hsva (double position) const |
Returns the color at position in HSVA, linearly interpolating between specified points. More... | |
| double | alpha (double position) const |
Returns the transparency of the color at position, linearly interpolating between specified points. More... | |
| bool | empty () const |
| Returns true if no points are defined. More... | |
| TransferFunction & | operator= (const TransferFunction &other) |
| Assignement operator for transfer function. More... | |
| bool | operator== (const TransferFunction &other) const |
| Test if two transfer functions are equal. More... | |
| bool | operator!= (const TransferFunction &other) const |
| Test if two transfer functions are different. More... | |
| void | reverse () |
| Reverse the control point. More... | |
| void | clear () |
| Erase all control points. More... | |
| void | adjust (double minValue, double maxValue) |
Adjust the control point to span exactly from minValue to maxValue. More... | |
| Interpolation | interpolation () const |
| Returns the current interpolation mode. More... | |
| void | setInterpolation (Interpolation i) |
| Change the interpolation mode. More... | |
| void | setPointList (const value_list &lst) |
| Change all the control points at once. More... | |
| static TransferFunction | scale (Colorf min, Colorf max, Interpolation interpolation=RGB) |
Predefined transfer-function, scaling from min to \max. More... | |
| static TransferFunction | hue_scale () |
| Scale in hue. More... | |
| static TransferFunction | scale_gray () |
| Scale in gray. More... | |
| static TransferFunction | scale_red () |
| Scale in red. More... | |
| static TransferFunction | scale_green () |
| Scale in green. More... | |
| static TransferFunction | scale_blue () |
| Scale in blue. More... | |
| static TransferFunction | scale_yellow () |
| Scale in yellow. More... | |
| static TransferFunction | scale_cyan () |
| Scale in cyan. More... | |
| static TransferFunction | scale_purple () |
| Scale in purple. More... | |
| static TransferFunction | constant_gray () |
| Scale in transparency. More... | |
| static TransferFunction | constant_red () |
| Scale in transparency. More... | |
| static TransferFunction | constant_green () |
| Scale in transparency. More... | |
| static TransferFunction | constant_blue () |
| Scale in transparency. More... | |
| static TransferFunction | constant_yellow () |
| Scale in transparency. More... | |
| static TransferFunction | constant_cyan () |
| Scale in transparency. More... | |
| static TransferFunction | constant_purple () |
| Scale in transparency. More... | |
| static TransferFunction | jet () |
| Jet color scale. More... | |
| static TransferFunction | french_flag () |
| French flag color scale. More... | |
| static TransferFunction | blackbody () |
| Blackbody colour scale: black - red - yellow - white. More... | |
| static TransferFunction | uniform_jet () |
| A more uniform version of Jet, with smoothly changing luminance and chromaticity. More... | |
| static TransferFunction | helix_warm () |
| A helix through colour space, with warm midtones: black - purple - orange - yellow. More... | |
| static TransferFunction | helix_cool () |
| A helix through colour space, with cool midtones: black - brown - purple - blue. More... | |
| static TransferFunction | helix_full () |
| A helix making a full turn through colour space: black - brown - purple - blue - green - yellow. More... | |
| static TransferFunction | batlow_10 () |
| static TransferFunction | parula () |
| static TransferFunction | load (QString spec) |
| Load a transfer function from a string. More... | |
| Colorf | interpolate (double position, double p1, Colorf col1, double p2, Colorf col2) const |
| Internal function to interpolate color. More... | |
| void | update_keys () |
| Update the key map based on the value list. More... | |
| Colorf | color (double position) const |
Returns the color at position position, using a color mode in accordance with the interpolation mode. More... | |
| void | add_point (double pos, Colorf col) |
| Add a control point with the color using the current color mode. More... | |
Class defining a transfer function as linear interpolation between set values.
Definition at line 34 of file TransferFunction.hpp.
| typedef Color<float> mgx::TransferFunction::Colorf |
Type of a color.
Definition at line 50 of file TransferFunction.hpp.
| typedef QMap<double, int> mgx::TransferFunction::key_map |
Type of the mapping from the position to the index in the value list.
Definition at line 60 of file TransferFunction.hpp.
| typedef std::vector<std::pair<double, Colorf> > mgx::TransferFunction::value_list |
Type of a list of value/colors.
Definition at line 55 of file TransferFunction.hpp.
Type of interpolation.
| Enumerator | |
|---|---|
| RGB | Red-Green-Blue. |
| HSV | Hue-Saturation-Value. |
| CYCLIC_HSV | Like HSV but the hue is cyclic (i.e. to go from 0.9 to 0.1 you go via 0) |
Definition at line 40 of file TransferFunction.hpp.
| mgx::TransferFunction::TransferFunction | ( | Interpolation | interpolation = RGB | ) |
Default constructor for a transfer function.
| interpolation | Type of interpolation |
| mgx::TransferFunction::TransferFunction | ( | const TransferFunction & | copy | ) |
Copy constructor.
|
inlinevirtual |
Virtual destructor.
Definition at line 76 of file TransferFunction.hpp.
| void mgx::TransferFunction::add_hsva_point | ( | double | pos, |
| Colorf | col | ||
| ) |
Add a point to the interpolation with the color are HSVA.
|
protected |
Add a control point with the color using the current color mode.
| pos | Position to add the point to |
| col | Color added |
| void mgx::TransferFunction::add_rgba_point | ( | double | pos, |
| Colorf | col | ||
| ) |
Add a point to the interpolation with the color are RGBA.
| void mgx::TransferFunction::adjust | ( | double | minValue, |
| double | maxValue | ||
| ) |
Adjust the control point to span exactly from minValue to maxValue.
| double mgx::TransferFunction::alpha | ( | double | position | ) | const |
Returns the transparency of the color at position, linearly interpolating between specified points.
|
static |
|
static |
Blackbody colour scale: black - red - yellow - white.
| void mgx::TransferFunction::clear | ( | ) |
Erase all control points.
|
protected |
Returns the color at position position, using a color mode in accordance with the interpolation mode.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
| QString mgx::TransferFunction::dump | ( | ) | const |
Store the transfer function into a string.
|
inline |
Returns true if no points are defined.
Definition at line 291 of file TransferFunction.hpp.
|
static |
French flag color scale.
|
static |
A helix through colour space, with cool midtones: black - brown - purple - blue.
|
static |
A helix making a full turn through colour space: black - brown - purple - blue - green - yellow.
|
static |
A helix through colour space, with warm midtones: black - purple - orange - yellow.
| Colorf mgx::TransferFunction::hsva | ( | double | position | ) | const |
Returns the color at position in HSVA, linearly interpolating between specified points.
| Colorf mgx::TransferFunction::hsva_point | ( | double | position | ) | const |
Return the RGBA point at position.
If the position is not a defined point, it returns Colorf(-1.0f)
|
static |
Scale in hue.
Varies hue and transparency.
|
inline |
Returns the current interpolation mode.
Definition at line 335 of file TransferFunction.hpp.
|
static |
Jet color scale.
|
static |
Load a transfer function from a string.
| void mgx::TransferFunction::move_point | ( | double | old_pos, |
| double | new_pos | ||
| ) |
Move a point (if found)
| double mgx::TransferFunction::next_pos | ( | double | old_pos | ) | const |
Position of the next point, or -1 if none.
| bool mgx::TransferFunction::operator!= | ( | const TransferFunction & | other | ) | const |
Test if two transfer functions are different.
They are equal only if they are defined using the same control points, and use the same interpolation and border conditions.
| TransferFunction& mgx::TransferFunction::operator= | ( | const TransferFunction & | other | ) |
Assignement operator for transfer function.
| bool mgx::TransferFunction::operator== | ( | const TransferFunction & | other | ) | const |
Test if two transfer functions are equal.
They are equal only if they are defined using the same control points, and use the same interpolation and border conditions.
| double mgx::TransferFunction::operator[] | ( | int | i | ) | const |
Return the i_th point.
|
static |
| double mgx::TransferFunction::prev_pos | ( | double | old_pos | ) | const |
Position of the previous point, or -1 if none.
| void mgx::TransferFunction::remove_point | ( | double | pos | ) |
Remove the point at the given position (if any)
| void mgx::TransferFunction::reverse | ( | ) |
Reverse the control point.
Each control point is moved to 1-position.
| Colorf mgx::TransferFunction::rgba | ( | double | position | ) | const |
Returns the color at position in RGBA, linearly interpolating between specified points.
| Colorf mgx::TransferFunction::rgba_point | ( | double | position | ) | const |
Return the RGBA point at position.
If the position is not a defined point, it returns Colorf(-1.0f)
|
static |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Scale in purple.
Varies purple and transparency.
Definition at line 131 of file TransferFunction.hpp.
|
inlinestatic |
|
inlinestatic |
Scale in yellow.
Varies yellow and transparency.
Definition at line 119 of file TransferFunction.hpp.
| void mgx::TransferFunction::setInterpolation | ( | Interpolation | i | ) |
Change the interpolation mode.
| void mgx::TransferFunction::setPointList | ( | const value_list & | lst | ) |
Change all the control points at once.
|
inline |
Returns the number of points.
Definition at line 237 of file TransferFunction.hpp.
|
static |
A more uniform version of Jet, with smoothly changing luminance and chromaticity.
|
protected |
Update the key map based on the value list.
|
protected |
Current interpolation mode.
Definition at line 364 of file TransferFunction.hpp.
|
protected |
If true, the colors left and right of the defined points are clamped.
Otherwise, they are set to the exterior color.
Definition at line 395 of file TransferFunction.hpp.
|
static |
epsilon used in floating point comparisons
Definition at line 47 of file TransferFunction.hpp.
|
protected |
Color left and right of the control points if not clamped.
Definition at line 400 of file TransferFunction.hpp.
|
protected |
Mapping of the position to the index in the value list.
Definition at line 389 of file TransferFunction.hpp.
|
protected |
List of values.
If the mode is HSV or CYCLIC_HSV, the colors are stored in HSVA. Otherwise, the colors are stored in RGBA.
Definition at line 385 of file TransferFunction.hpp.
1.8.17