data structure for holding 1D transfer function data More...
#include <transferfunction.h>
Public Member Functions | |
TransferFunction (const std::vector< TFPrimitiveData > &values) | |
TransferFunction (const std::vector< TFPrimitiveData > &values, TFPrimitiveSetType type) | |
TransferFunction (const TransferFunction &rhs)=default | |
TransferFunction (TransferFunction &&rhs) noexcept=default | |
TransferFunction & | operator= (const TransferFunction &rhs)=default |
TransferFunction & | operator= (TransferFunction &&rhs) noexcept=default |
void | setMask (dvec2 mask) |
dvec2 | getMask () const |
void | setMaskMin (double maskMin) |
double | getMaskMin () const |
void | setMaskMax (double maskMax) |
double | getMaskMax () const |
void | clearMask () |
virtual void | serialize (Serializer &s) const override |
virtual void | deserialize (Deserializer &d) override |
vec4 | sample (double v) const |
vec4 | sample (float v) const |
virtual void | interpolateAndStoreColors (std::span< vec4 > data) const override |
![]() | |
TFPrimitiveSet (const std::vector< TFPrimitiveData > &values={}, TFPrimitiveSetType type=TFPrimitiveSetType::Relative) | |
TFPrimitiveSet (const TFPrimitiveSet &rhs) | |
TFPrimitiveSet (TFPrimitiveSet &&rhs) noexcept=default | |
TFPrimitiveSet & | operator= (const TFPrimitiveSet &rhs) |
TFPrimitiveSet & | operator= (TFPrimitiveSet &&rhs) noexcept |
void | setType (TFPrimitiveSetType type) |
TFPrimitiveSetType | getType () const |
dvec2 | getRange () const |
size_t | size () const |
bool | empty () const |
TFPrimitive & | operator[] (size_t i) |
const TFPrimitive & | operator[] (size_t i) const |
TFPrimitive & | get (size_t i) |
const TFPrimitive & | get (size_t i) const |
TFPrimitive & | front () |
const TFPrimitive & | front () const |
TFPrimitive & | back () |
const TFPrimitive & | back () const |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
const_iterator | cbegin () const |
const_iterator | cend () const |
std::vector< TFPrimitiveData > | get () const |
std::vector< TFPrimitiveData > | getUnsorted () const |
void | set (std::span< const TFPrimitiveData >) |
void | set (const_iterator begin, const_iterator end) |
std::pair< std::vector< double >, std::vector< vec4 > > | getVectors () const |
std::pair< std::vector< float >, std::vector< vec4 > > | getVectorsf () const |
std::vector< double > | getPositions () const |
std::vector< float > | getPositionsf () const |
std::vector< vec4 > | getColors () const |
TFPrimitive & | add (const TFPrimitive &primitive) |
TFPrimitive & | add (double pos, const vec4 &color) |
TFPrimitive & | add (double pos, double alpha) |
TFPrimitive & | add (const dvec2 &pos) |
TFPrimitive & | add (const TFPrimitiveData &data) |
void | add (const std::vector< TFPrimitiveData > &primitives) |
bool | remove (const TFPrimitive &primitive) |
void | clear () |
void | setPosition (std::span< TFPrimitive * > primitives, double pos) |
virtual void | onTFPrimitiveChange (const TFPrimitive &p) override |
bool | operator== (const std::vector< TFPrimitiveData > &rhs) const |
bool | contains (const TFPrimitive *primitive) const |
![]() | |
Observable (const Observable< TFPrimitiveSetObserver > &other) | |
Observable (Observable< TFPrimitiveSetObserver > &&other) noexcept | |
Observable< TFPrimitiveSetObserver > & | operator= (const Observable< TFPrimitiveSetObserver > &other) |
Observable< TFPrimitiveSetObserver > & | operator= (Observable< TFPrimitiveSetObserver > &&other) noexcept |
void | addObserver (TFPrimitiveSetObserver *observer) |
void | removeObserver (TFPrimitiveSetObserver *observer) |
virtual void | startBlockingNotifications () override final |
virtual void | stopBlockingNotifications () override final |
![]() | |
Observer (const Observer &other) | |
Observer (Observer &&other) | |
Observer & | operator= (Observer &&other) |
Observer & | operator= (const Observer &other) |
virtual | ~Observer () |
void | removeObservation (ObservableInterface *observable) |
void | removeObservations () |
Static Public Member Functions | |
static std::vector< TFPrimitiveData > | simplify (const std::vector< TFPrimitiveData > &points, double delta=0.01) |
static TransferFunction | load (const std::filesystem::path &path) |
static void | save (const TransferFunction &tf, const std::filesystem::path &path) |
Protected Member Functions | |
virtual std::string_view | serializationKey () const override |
virtual std::string_view | serializationItemKey () const override |
![]() | |
TFPrimitive & | add (std::unique_ptr< TFPrimitive > primitive) |
bool | remove (std::vector< std::unique_ptr< TFPrimitive > >::iterator it) |
void | sort () |
vec4 | interpolateColor (double t) const |
![]() | |
void | notifyTFPrimitiveAdded (const TFPrimitiveSet &set, TFPrimitive &p) |
void | notifyTFPrimitiveRemoved (const TFPrimitiveSet &set, TFPrimitive &p) |
void | notifyTFPrimitiveChanged (const TFPrimitiveSet &set, const TFPrimitive &p) |
void | notifyTFTypeChanged (const TFPrimitiveSet &set, TFPrimitiveSetType type) |
void | notifyTFMaskChanged (const TFPrimitiveSet &set, dvec2 mask) |
![]() | |
void | forEachObserver (C callback) |
![]() | |
void | addObservationHelper (Observer *observer) |
void | removeObservationHelper (Observer *observer) |
![]() | |
void | addObservation (ObservableInterface *observable) |
Friends | |
IVW_CORE_API bool | operator== (const TransferFunction &lhs, const TransferFunction &rhs) |
IVW_CORE_API bool | operator!= (const TransferFunction &lhs, const TransferFunction &rhs) |
Additional Inherited Members | |
![]() | |
using | transform_t = TFPrimitive& (*)(TFPrimitive*) |
using | const_transform_t = const TFPrimitive& (*)(const TFPrimitive*) |
using | iterator |
using | const_iterator |
![]() | |
std::vector< std::unique_ptr< TFPrimitive > > | values_ |
std::vector< TFPrimitive * > | sorted_ |
![]() | |
std::unordered_set< ObservableInterface * > | observables_ |
data structure for holding 1D transfer function data
|
overridevirtual |
Reimplemented from inviwo::TFPrimitiveSet.
|
overridevirtual |
Interpolate the color between all neighboring pairs of TFPrimitives and write the result to dataArray. The range of all TFPrimitives is [0,1] when TF type is relative
data | write interpolated colors into data |
Reimplemented from inviwo::TFPrimitiveSet.
vec4 inviwo::TransferFunction::sample | ( | double | v | ) | const |
Sample the transfer function at position v and return the respective color and opacity (rgba). The range of the transfer function is [0,1].
v | sampling position, if v is outside the range [0,1] it is clamped to [0,1] |
vec4 inviwo::TransferFunction::sample | ( | float | v | ) | const |
Sample the transfer function at position v and return the respective color and opacity (rgba). The range of the transfer function is [0,1].
v | sampling position, if v is outside the range [0,1] it is clamped to [0,1] |
|
overrideprotectedvirtual |
Reimplemented from inviwo::TFPrimitiveSet.
|
overrideprotectedvirtual |
Reimplemented from inviwo::TFPrimitiveSet.
|
overridevirtual |
Reimplemented from inviwo::TFPrimitiveSet.
|
static |
Simplify a vector of TF points by removing points that can be replaced by interpolating between the previous and the next point, as long as the resulting error is less then delta. the error is the absolute maximal component wise error at the point to be removed.