25 #ifndef WTRANSFERFUNCTION_H
26 #define WTRANSFERFUNCTION_H
168 void addColor(
double iso,
const WColor& color );
176 void addAlpha(
double iso,
double alpha );
380 #endif // WTRANSFERFUNCTION_H
A class that stores a 1D transfer function which consists of a linear interpolation of alpha and colo...
bool operator==(const ColorEntry &rhs) const
comparison operator to check for changes
bool operator<=(const Entry &rhs) const
comparison by isovalue
bool operator()(const T &t)
isovalue-based comparison
WTransferFunction()
Default constructor of a meaningless transfer function.
std::vector< ColorEntry > m_colors
Sorted list of colors.
void sample1DTransferFunction(unsigned char *array, int width, double min, double max) const
sample/render the transfer function linearly between min and max in an RGBA texture.
Entry(double iso)
Default constructor.
Color entries are linearly interpolated colors along isovalues.
WColor color
holds the current color at isovalue Entry::iso
~WTransferFunction()
Default destuctor.
bool operator==(const WTransferFunction &rhs) const
Check equivalence of two transfer functions.
size_t numColors() const
Get the number of colors.
double m_isomin
The smallest used iso value.
double getColorIsovalue(size_t i) const
The isovalue of the color at a given index.
Alpha entries represent linearly interpolated transparency values along the isovalue scale...
WTransferFunction(const WTransferFunction &rhs)
Deep copy constructor.
void setHistogram(std::vector< double > &data)
Set the histogram going along with the transfer function.
double iso
the isovalue to compare to
static WTransferFunction createFromRGBA(unsigned char const *const rgba, size_t size)
Try to estimate a transfer function from an RGBA image.
std::vector< AlphaEntry > m_alphas
Sorted list of alpha values.
void removeHistogram()
Clears the histogram data so the gui won't show any.
Templatized comparison predicate for internal searching.
AlphaEntry(double iso, double alpha)
default constructor
double m_isomax
The largest used iso value.
const std::vector< double > & getHistogram() const
Returns the histogram.
bool operator==(const AlphaEntry &rhs) const
comparison operator to check for changes
ColorEntry(double iso, WColor color)
default constructor
std::vector< double > m_histogram
Sores a histogram.
void addAlpha(double iso, double alpha)
Insert a new alpha point.
friend std::ostream & operator<<(std::ostream &out, const WTransferFunction &tf)
Default output operator.
void addColor(double iso, const WColor &color)
Insert a new color point.
double alpha
holds the current alpha at isovalue Entry::iso
bool operator!=(const WTransferFunction &rhs) const
Check equivalence of two transfer functions.
size_t numAlphas() const
Get the number of alphas.
double getAlphaIsovalue(size_t i) const
Get the isovalue at a given index in the alpha values.
const WColor & getColor(size_t i) const
Get color at given index.
double getAlpha(size_t i) const
Get alpha at given index.
WTransferFunction & operator=(const WTransferFunction &rhs)
Deep copy operator.
Prototype for a storage element.
LessPred(double iso)
constructs a predicate that compares for less than iso