LibCarna Version 3.4.0
Loading...
Searching...
No Matches
ColorMap.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010 - 2016 Leonid Kostrykin
3 *
4 * Chair of Medical Engineering (mediTEC)
5 * RWTH Aachen University
6 * Pauwelsstr. 20
7 * 52074 Aachen
8 * Germany
9 *
10 *
11 * Copyright (C) 2021 - 2025 Leonid Kostrykin
12 *
13 */
14
15#ifndef COLORMAP_H_6014714286
16#define COLORMAP_H_6014714286
17
18#include <LibCarna/LibCarna.hpp>
20#include <memory>
21
27namespace LibCarna
28{
29
30namespace base
31{
32
33
34
35// ----------------------------------------------------------------------------------
36// ColorMap
37// ----------------------------------------------------------------------------------
38
44class LIBCARNA ColorMap
45{
46
48
49 struct Details;
50 const std::unique_ptr< Details > pimpl;
51
52public:
53
57 const static unsigned int DEFAULT_RESOLUTION = ( 1 << 16 );
58
59 const static float DEFAULT_MINIMUM_INTENSITY;
60
61 const static float DEFAULT_MAXIMUM_INTENSITY;
62
70 explicit ColorMap( unsigned int resolution = DEFAULT_RESOLUTION );
71
76
81 void clear();
82
96
100
106 ColorMap& writeLinearSpline( const std::vector< base::Color >& colors );
107
111 const std::vector< base::Color >& getColorList() const;
112
116 void bind( int unit ) const;
117
122
131 void setMinimumIntensity( float minimumIntensity );
132
136 float minimumIntensity() const;
137
146 void setMaximumIntensity( float maximumIntensity );
147
151 float maximumIntensity() const;
152
153}; // base :: ColorMap
154
155
156
157} // namespace LibCarna :: base
158
159} // namespace LibCarna
160
161#endif // COLORMAP_H_6014714286
Contains forward-declarations.
Represents an association.
Represents a mapping of intensity values to RGBA colors, that can be queried in a shader.
Definition ColorMap.hpp:45
ColorMap & writeLinearSegment(float intensityFirst, float intensityLast, const base::Color &colorFirst, const base::Color &colorLast)
void bind(int unit) const
Binds this texture and the corresponding sampler to unit.
void setMinimumIntensity(float minimumIntensity)
Sets the minimum intensity value. Intensity values below this value are treated as 0.
~ColorMap()
Deletes the maintained OpenGL texture and sampler objects.
ColorMap(unsigned int resolution=DEFAULT_RESOLUTION)
Instantiates.
const std::vector< base::Color > & getColorList() const
Returns the list of colors stored in the color map.
void setMaximumIntensity(float maximumIntensity)
Sets the maximum intensity value. Intensity values above this value are treated as 1.
ColorMap & writeLinearSpline(const std::vector< base::Color > &colors)
Writes a linear segment with writeLinearSegment for each subsequent pair of colors....
float minimumIntensity() const
Returns the minimum intensity value. Intensity values below this value are treated as 0.
void clear()
Clears the color map. All intensity values are mapped to base::Color::BLACK_NO_ALPHA after calling th...
ColorMap & operator=(const ColorMap &other)
Writes the content the other color map into this.
ColorMap & writeLinearSegment(const base::math::Span< float > &intensityRange, const base::math::Span< base::Color > colorRange)
Linearly maps all intensity values from intensityRange to colorRange.
float maximumIntensity() const
Returns the maximum intensity value. Intensity values above this value are treated as 1.
static const float DEFAULT_MINIMUM_INTENSITY
Holds the default value for minimumIntensity.
Definition ColorMap.hpp:59
static const float DEFAULT_MAXIMUM_INTENSITY
Holds the default value for maximumIntensity.
Definition ColorMap.hpp:61
Represents a color. Objects from this class are copyable and assignable.
Definition Color.hpp:45
Defines an interval with T.
Definition Span.hpp:47
Defines LibCarna::base::noncopyable and NON_COPYABLE.
#define NON_COPYABLE
Marks the class that it is placed in as non-copyable.