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
Ultrasound S-curve colormap (grayscale and color (with a hint of blue))
static auto Inferno(bool withOpacity = false) -> Colormap
Inferno heatmap (like fire, but with some blue and purple in it)
static auto Fire(bool withOpacity = false) -> Colormap
Fire heatmap (no blue/purple)
static auto CoolWarm() -> Colormap
Cool-Warm (Blue-Red) diverging colormap.

Constructors, destructors, conversion operators

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

Public functions

auto getAsOpenCLBuffer(OpenCLDevice::pointer device, float opacity = 1.0f) const -> cl::Buffer
Create an OpenCL buffer from the colormap data.
auto hasOpacity() const -> bool
Has this colormap opacity defined.
auto isGrayscale() const -> bool
Is this colormap grayscale.
auto isInterpolated() const -> bool
Is this colormap grayscale.
auto isIntensityInvariant() const -> bool
Is this colormap intensity invariant.
auto isDiverging() const -> bool
Is this colormap diverging.
auto getSteps() const -> int
Get nr of steps (defined points) in colormap.
auto getData() const -> std::vector<float>
Get data values of the colormap as a list of floats.

Function documentation

static Colormap fast::Colormap::Ultrasound(bool grayscale = false)

Ultrasound S-curve colormap (grayscale and color (with a hint of blue))

Parameters
grayscale
Returns ultrasound colormap

static Colormap fast::Colormap::Inferno(bool withOpacity = false)

Inferno heatmap (like fire, but with some blue and purple in it)

Parameters
withOpacity Create inferno heatmap with custom opacity. If you will use this heatmap as an overlay you should enable this.
Returns inferno heatmap

static Colormap fast::Colormap::Fire(bool withOpacity = false)

Fire heatmap (no blue/purple)

Parameters
withOpacity Create fire heatmap with custom opacity. If you will use this heatmap as an overlay you should enable this.
Returns fire heatmap

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

Create a grayscale colormap.

Parameters
colormap
interpolate
intensityInvariant
diverging

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

Creates an RGB colormap.

Parameters
colormap
interpolate
intensityInvariant
diverging

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

Creates a colormap directly from a list of floats.

Parameters
values
grayscale
interpolate
intensityInvariant
diverging

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, float opacity = 1.0f) const

Create an OpenCL buffer from the colormap data.

Parameters
device OpenCL device to transfer data to
opacity Opacity to apply to colormap. If lower than 1 opacity will be added to the colormap. If the colormap already has opacity, this opacity will be multiplied with the existing opacity.
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