Commit 188778da authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[DOC]

parent d3a682b8
......@@ -30,132 +30,23 @@
#include "WColor.h"
/**
* A cass that stores a 1D transfer function which consits
* of a linear interpolation of alpha and color values
* A class that stores a 1D transfer function which consists
* of a linear interpolation of alpha and color values.
*/
class WTransferFunction // NOLINT problem with macro
{
private:
/**
* Prototype for a storage element
*/
struct Entry
{
/**
* Default constructor
* \param iso the iso value
*/
explicit Entry( double iso ) : iso( iso )
{
}
/**
* comparison by isovalue
* \param rhs entry to compare t
* \returns true if this->iso <= rhs.iso
*/
bool operator <= ( const Entry &rhs ) const
{
return iso <= rhs.iso;
}
/** the isovalue */
double iso;
};
/**
* Color entries are linearly interpolated colors along isovalues
*/
struct ColorEntry : public Entry
{
/** default constructor
* \param iso the isovalue
* \param color the color at the isovalue
*/
ColorEntry( double iso, WColor color ) : Entry( iso ), color( color )
{
}
/**
* comparison operator to check for changes
* \param rhs ColorEntry to compare to
* \returns true if rhs equals this
*/
bool operator==( const ColorEntry& rhs ) const
{
return iso == rhs.iso && color == rhs.color;
}
/** holds the current color at isovalue Entry::iso */
WColor color;
};
/**
* Alpha entries represent linearly interpolated transparency values
* along the isovalue scale. Alpha is in the range [ 0...1 ] where
* 1 signifies entirely opaque ( which makes it more an opacity value instead
* of alpha, but I use the commonly used language here )
*/
struct AlphaEntry : public Entry
{
/** default constructor
* \param iso the isovalue
* \param alpha the alpha at the isovalue in the range from 0 = transparent to 1 = opaque
*/
AlphaEntry( double iso, double alpha ) : Entry( iso ), alpha( alpha )
{
}
/**
* comparison operator to check for changes
* \param rhs AlphaEntry to compare to
* \returns true if rhs is equal to this
*/
bool operator==( const AlphaEntry& rhs ) const
{
return iso == rhs.iso && alpha == rhs.alpha;
}
/** holds the current alpha at isovalue Entry::iso */
double alpha;
};
public:
/**
* Templatized comparison predicate for internal searching
* Default constructor of a meaningless transfer function
*/
template<typename T>
struct LessPred
{
/** constructs a predicate that compares for less than iso
* \param iso: used iso value
*/
explicit LessPred( double iso ) : iso( iso )
{
}
/** isovalue-based comparison
* \param t the object to compare to
* \returns true if iso is less than t.iso
*/
bool operator()( const T& t )
{
return iso < t.iso;
}
/** the isovalue to compare to */
double iso;
};
public:
/** default constructor of a meaningless transfer function */
WTransferFunction() : isomin( 0. ), isomax( 0. )
{
}
/** deep copy constructor
/**
* Deep copy constructor.
*
* \param rhs the value to histogram
*/
WTransferFunction( const WTransferFunction &rhs )
......@@ -163,7 +54,9 @@ public:
{
}
/** deep copy operator
/**
* Deep copy operator
*
* \param rhs the value to copy
* \returns reference to current object
* \returns reference to current object
......@@ -179,6 +72,8 @@ public:
}
/**
* Check equivalence of two transfer functions.
*
* \returns true if this object contains exactly the same
* data as rhs
* \param rhs object to compare with
......@@ -186,17 +81,23 @@ public:
bool operator==( const WTransferFunction &rhs ) const;
/**
* Check equivalence of two transfer functions.
*
* \returns negated result of operator==
* \param rhs the value to compare with
*/
bool operator!=( const WTransferFunction &rhs ) const;
/** default destuctor */
/**
* Default destuctor.
*/
~WTransferFunction()
{
}
/**
* Get the number of alphas
*
* \returns the number of alpha points
*/
size_t numAlphas() const
......@@ -205,6 +106,8 @@ public:
}
/**
* Get the number of colors.
*
* \returns the number of color points
*/
size_t numColors() const
......@@ -213,6 +116,8 @@ public:
}
/**
* Get the isovalue at a given index in the alpha values.
*
* \param i the index of the point to query
* \returns the alpha values position/isovalue at index i
*/
......@@ -221,9 +126,10 @@ public:
return alphas.at( i ).iso;
}
/**
* \param i the index of the point to query
* The isovalue of the color at a given index.
*
* \param i the index of the point to query.
* \returns the color values position/isovalue at index i
*/
double getColorIsovalue( size_t i ) const
......@@ -232,6 +138,8 @@ public:
}
/**
* Get alpha at given index.
*
* \param i the index to query
* \returns the alpha value at index i
*/
......@@ -241,6 +149,8 @@ public:
}
/**
* Get color at given index.
*
* \param i the index to query
* \returns the color at index i
*/
......@@ -250,21 +160,23 @@ public:
}
/**
* insert a new color point
* Insert a new color point.
*
* \param iso the new iso value
* \param color the new color at the given iso value
*/
void addColor( double iso, const WColor& color );
/**
* insert a new alpha point
* Insert a new alpha point.
*
* \param iso the new iso value
* \param alpha the new alpha value at the given iso value
*/
void addAlpha( double iso, double alpha );
/**
* set the histogram going along with the transfer function
* Set the histogram going along with the transfer function
*
* This should be changed in the future to be handled in a different
* way. A good option would be to introduce an object encapsulating
......@@ -278,7 +190,7 @@ public:
}
/**
* clears the histogram data so the gui won't show any
* Clears the histogram data so the gui won't show any
*/
void removeHistogram()
{
......@@ -286,7 +198,8 @@ public:
}
/**
* returns the histogram
* Returns the histogram.
*
* \returns a reference to the internal representation of the histogram
*/
const std::vector< double >& getHistogram() const
......@@ -307,24 +220,145 @@ public:
/**
* Try to estimate a transfer function from an RGBA image.
*
* \param rgba: values between 0 and 255 representing the red, green, and blue channel
* \param size: number of color entries in rgba
* \returns approximated transfer function
*/
static WTransferFunction createFromRGBA( unsigned char const * const rgba, size_t size );
private:
/** sorted list of colors */
/**
* Prototype for a storage element
*/
struct Entry
{
/**
* Default constructor
* \param iso the iso value
*/
explicit Entry( double iso ) : iso( iso )
{
}
/**
* comparison by isovalue
* \param rhs entry to compare t
* \returns true if this->iso <= rhs.iso
*/
bool operator <= ( const Entry &rhs ) const
{
return iso <= rhs.iso;
}
/** the isovalue */
double iso;
};
/**
* Color entries are linearly interpolated colors along isovalues
*/
struct ColorEntry : public Entry
{
/** default constructor
* \param iso the isovalue
* \param color the color at the isovalue
*/
ColorEntry( double iso, WColor color ) : Entry( iso ), color( color )
{
}
/**
* comparison operator to check for changes
* \param rhs ColorEntry to compare to
* \returns true if rhs equals this
*/
bool operator==( const ColorEntry& rhs ) const
{
return iso == rhs.iso && color == rhs.color;
}
/** holds the current color at isovalue Entry::iso */
WColor color;
};
/**
* Alpha entries represent linearly interpolated transparency values
* along the isovalue scale. Alpha is in the range [ 0...1 ] where
* 1 signifies entirely opaque ( which makes it more an opacity value instead
* of alpha, but I use the commonly used language here )
*/
struct AlphaEntry : public Entry
{
/** default constructor
* \param iso the isovalue
* \param alpha the alpha at the isovalue in the range from 0 = transparent to 1 = opaque
*/
AlphaEntry( double iso, double alpha ) : Entry( iso ), alpha( alpha )
{
}
/**
* comparison operator to check for changes
* \param rhs AlphaEntry to compare to
* \returns true if rhs is equal to this
*/
bool operator==( const AlphaEntry& rhs ) const
{
return iso == rhs.iso && alpha == rhs.alpha;
}
/** holds the current alpha at isovalue Entry::iso */
double alpha;
};
/**
* Templatized comparison predicate for internal searching
*/
template<typename T>
struct LessPred
{
/** constructs a predicate that compares for less than iso
* \param iso: used iso value
*/
explicit LessPred( double iso ) : iso( iso )
{
}
/** isovalue-based comparison
* \param t the object to compare to
* \returns true if iso is less than t.iso
*/
bool operator()( const T& t )
{
return iso < t.iso;
}
/** the isovalue to compare to */
double iso;
};
/**
* Sorted list of colors
*/
std::vector<ColorEntry> colors;
/** sorted list of alpha values */
/**
* Sorted list of alpha values.
*/
std::vector<AlphaEntry> alphas;
/** the smallest used iso value */
/**
* The smallest used iso value.
*/
double isomin;
/** the largest used iso value */
/**
* The largest used iso value.
*/
double isomax;
/** stores a histogram. This is used for property-handling only
/**
* Sores a histogram. This is used for property-handling only
* and does not change the transfer function at all.
*/
std::vector< double > histogram;
......@@ -334,9 +368,11 @@ private:
/**
* Default output operator. Currently stores values the same way as it is done in the properties.
* This code should only be used for debugging and you should not realy on the interface.
* This code should only be used for debugging and you should not rely on the interface.
*
* \param tf The transfer function to output
* \param out The stream to which we write
*
* \returns reference to out
*/
std::ostream& operator << ( std::ostream& out, const WTransferFunction& tf );
......
......@@ -63,6 +63,8 @@ class WMatrixFixedTest;
* A data store with the specified dimensions and type. The possibilities are endless. This way, you can optimize data storage for certain kinds
* of matrices, like sparse or symmetric ones. It even allows the definition of a whole data block containing many matrices.
*
* \note storage is done row-major
*
* \tparam ValueT the integral type
* \tparam Rows the number of rows
* \tparam Cols the number of cols
......
......@@ -33,7 +33,7 @@
#include "core/kernel/WModuleInputData.h"
#include "core/kernel/WModuleOutputData.h"
/**
/**
* A module to provide 1D transfer functions, e.g., for volume rendering.
*
* \ingroup modules
......@@ -122,8 +122,8 @@ nnectors must not be handled by the module.
WPropInt m_binSize;
/**
* the transfer function property
*/
* the transfer function property
*/
WPropTransferFunction m_transferFunction;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment