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