fast::TransferFunction class

A class for defining a transfer function used in volume rendering.

This used in the AlphaBlendingVolumeRenderer. The transfer function contains a set of 5-tuple points (intensity, red, green, blue, alpha).

Public static functions

static auto CT_Blood_And_Bone() -> TransferFunction
static auto CT_Bone() -> TransferFunction
static auto CT_Blood() -> TransferFunction
static auto Ultrasound() -> TransferFunction

Constructors, destructors, conversion operators

TransferFunction()
TransferFunction(std::initializer_list<float> values)
TransferFunction(std::vector<float> values)

Public functions

auto addPoint(float intensity, Vector4f color) -> int
void removePoint(int i)
void clear()
auto getSize() const -> int
auto getPoint(int i) const -> std::tuple<float, Vector4f>
auto getAsOpenCLBuffer(OpenCLDevice::pointer device) const -> cl::Buffer

Protected functions

void checkData() const

Protected variables

std::vector<float> m_data

Function documentation

fast::TransferFunction::TransferFunction()

Creates an empty transfer function

fast::TransferFunction::TransferFunction(std::initializer_list<float> values)

Parameters
values

Initialize the transfer function. The input values have to be a multiple of 5. Thus a set of 5-tuples (intensity, red, green, blue, alpha)

fast::TransferFunction::TransferFunction(std::vector<float> values)

Parameters
values

Initialize the transfer function. The input values have to be a multiple of 5. Thus a set of 5-tuples (intensity, red, green, blue, alpha)

int fast::TransferFunction::addPoint(float intensity, Vector4f color)

Parameters
intensity
color (red, green, blue, alpha)
Returns index

Add a point to the transfer function. Intensity must be larger than previous point. I.e. the transfer function has to be sorted on increasing intensity

void fast::TransferFunction::removePoint(int i)

Parameters
i index

Remove transfer function point at index i

void fast::TransferFunction::clear()

Remove all points in the transfer function.

int fast::TransferFunction::getSize() const

Returns number of points in the transfer function

std::tuple<float, Vector4f> fast::TransferFunction::getPoint(int i) const

Parameters
i index
Returns 2-tuple of intensity and color(red, green, blue, alpha)

Get intensity and color at index i

cl::Buffer fast::TransferFunction::getAsOpenCLBuffer(OpenCLDevice::pointer device) const

Parameters
device OpenCL device to transfer data to
Returns OpenCL buffer

Create an OpenCL buffer from the transfer function data.

void fast::TransferFunction::checkData() const protected

Validate the internal data structure of TransferFunction. Throws exception if invalid.