fast::Colormap class

Colormap data structure.

The colormap can be both in grayscale and in RGB color. The colormap can be linearly interpolated between points or just use nearest neighbor interpolation.

Public static functions

static auto Ultrasound(bool grayscale = false) -> Colormap

Constructors, destructors, conversion operators

Colormap()
Create empty uninitialized colormap.
Colormap(const std::map<float, float>& colormap, bool interpolate = true) explicit
Create a grayscale colormap.
Colormap(const std::map<float, Color>& colormap, bool interpolate = true) explicit
Creates an RGB colormap.
Colormap(std::vector<float> values, bool grayscale, bool interpolate = true)
Creates a colormap directly from a list of floats.

Public functions

auto getAsOpenCLBuffer(OpenCLDevice::pointer device) const -> cl::Buffer
Create an OpenCL buffer from the colormap data.
auto isGrayscale() const -> bool
auto isInterpolated() const -> bool
auto getSteps() const -> int
auto getData() const -> std::vector<float>
Get data values of the colormap as a list of floats.

Function documentation

fast::Colormap::Colormap(const std::map<float, float>& colormap, bool interpolate = true) explicit

Create a grayscale colormap.

Parameters
colormap
interpolate

fast::Colormap::Colormap(const std::map<float, Color>& colormap, bool interpolate = true) explicit

Creates an RGB colormap.

Parameters
colormap
interpolate

fast::Colormap::Colormap(std::vector<float> values, bool grayscale, bool interpolate = true)

Creates a colormap directly from a list of floats.

Parameters
values
grayscale
interpolate

The floats must be intensity_source1, intensity_output1, intensity_source2, intensity_output2, ... N if you have a grayscale colormap. If you have a RGB colormap it should be: intensity_source1, red1, green1, blue1, intensity_source2, red2, green2, blue2, .... N

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

Create an OpenCL buffer from the colormap data.

Parameters
device OpenCL device to transfer data to
Returns OpenCL buffer

std::vector<float> fast::Colormap::getData() const

Get data values of the colormap as a list of floats.

Returns list of floats