-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathColorMap.h
56 lines (42 loc) · 1.07 KB
/
ColorMap.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#include <vtkColorSeries.h>
#include <vtkSmartPointer.h>
#include <QColor>
#include <QStringList>
#include <vector>
namespace shapeworks {
class ColorMap {
public:
QString name_;
vtkSmartPointer<vtkColorSeries> color_series_;
void construct_lookup_table(vtkSmartPointer<vtkLookupTable> lut);
static vtkColor3ub convert(QColor color);
void set_discrete_mode(bool discrete_mode) { discrete_mode_ = discrete_mode; }
void set_reverse_mode(bool reverse_mode) { reverse_mode_ = reverse_mode; }
private:
bool discrete_mode_ = false;
bool reverse_mode_ = false;
};
class ColorMaps : public std::vector<ColorMap> {
public:
ColorMaps();
vtkSmartPointer<vtkColorSeries> get_color_series(int index) {
if (index < 0) {
index = 0;
}
if (index > size() - 1) {
index = size() - 1;
}
return (*this)[index].color_series_;
}
ColorMap get_color_map(int index) {
if (index < 0) {
index = 0;
}
if (index > size() - 1) {
index = size() - 1;
}
return (*this)[index];
}
};
} // namespace shapeworks