14#ifndef OSG_TRANSFERFUNCTION
15#define OSG_TRANSFERFUNCTION 1
67 float getMinimum()
const {
return _colorMap.empty() ? 0.0f :
_colorMap.begin()->first; }
82 if (
_image.valid() && i<
static_cast<unsigned int>(
_image->s()))
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
Vec4f Vec4
Definition Vec4:21
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Image class for encapsulating the storage texture image data.
Definition Image:179
Base class/standard interface for objects which require IO support, cloning and reference counting.
Definition Object:61
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
TransferFunction is a class that provide a 1D,2D or 3D colour look up table that can be used on the G...
Definition TransferFunction:31
META_Object(osg, TransferFunction) osg
Get the image that is used for passing the transfer function data to the GPU.
Definition TransferFunction:39
TransferFunction(const TransferFunction &tf, const CopyOp ©op=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
osg::ref_ptr< osg::Image > _image
Definition TransferFunction:51
virtual ~TransferFunction()
const osg::Image * getImage() const
Get the const image that is used for passing the transfer function data to the GPU.
Definition TransferFunction:45
void clear(const osg::Vec4 &color=osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f))
Clear the whole range to just represent a single color.
osg::Vec4 getPixelValue(unsigned int i) const
Get pixel value from the image.
Definition TransferFunction:80
unsigned int getNumberImageCells() const
Get the number of image cells that are assigned to the represent the transfer function when download ...
Definition TransferFunction:93
ColorMap & getColorMap()
Get the color map that stores the mapping between the transfer function value and the colour it maps ...
Definition TransferFunction:111
void setColorMap(const ColorMap &vcm)
set the color map and automatically update the image to make sure they are in sync.
Definition TransferFunction:108
ColorMap _colorMap
Definition TransferFunction:124
const ColorMap & getColorMap() const
Get the const color map that stores the mapping between the transfer function value and the colour it...
Definition TransferFunction:114
void setColor(float v, const osg::Vec4 &color, bool updateImage=true)
Set the color for a specified transfer function value.
std::map< float, osg::Vec4 > ColorMap
Definition TransferFunction:105
osg::Vec4 getColor(float v) const
Get the color for a specified transfer function value, interpolating the value if no exact match is f...
float getMaximum() const
Get the maximum transfer function value.
Definition TransferFunction:70
TransferFunction1D(const TransferFunction1D &tf, const CopyOp ©op=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
void assignToImage(float lower_v, const osg::Vec4 &lower_c, float upper_v, const osg::Vec4 &upper_c)
void updateImage()
Manually update the associate osg::Image to represent the colors assigned in the color map.
META_Object(osg, TransferFunction1D) float getMinimum() const
Get the minimum transfer function value.
Definition TransferFunction:64
void allocate(unsigned int numImageCells)
allocate the osg::Image with specified dimension.
void assign(const ColorMap &vcm)
Assign a color map and automatically update the image to make sure they are in sync.
#define OSG_EXPORT
Definition Export:39