Developer documentation
Version 3.0.3-105-gd3941f44
colourbars.h
Go to the documentation of this file.
1/* Copyright (c) 2008-2022 the MRtrix3 contributors.
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 *
7 * Covered Software is provided under this License on an "as is"
8 * basis, without warranty of any kind, either expressed, implied, or
9 * statutory, including, without limitation, warranties that the
10 * Covered Software is free of defects, merchantable, fit for a
11 * particular purpose or non-infringing.
12 * See the Mozilla Public License v. 2.0 for more details.
13 *
14 * For more details, see http://www.mrtrix.org/.
15 */
16
17#ifndef __gui_mrview_colourbars_h__
18#define __gui_mrview_colourbars_h__
19
20#include "gui/opengl/gl.h"
21#include "gui/opengl/shader.h"
22#include "colourmap.h"
23
24namespace MR
25{
26 namespace GUI
27 {
28 class Projection;
29
30 namespace MRView
31 {
32 class Displayable;
33
34
35 inline size_t colourmap_index_from_menu (size_t n)
36 {
37 if (ColourMap::maps[n].special)
38 --n;
39 return n;
40 }
41
42
43
44
46 public:
47
48 enum Position {
49 None = 0x00,
50 Top = 0x01,
51 Bottom = 0x02,
52 Left = 0x04,
53 Right = 0x08,
58 };
59
61
62 void begin (Projection* projection,
63 const Position position,
64 const size_t ncolourbars) {
65 current_position = position;
66 current_projection = projection;
67 current_count = ncolourbars;
68 current_colourbar_index = 0;
69 }
70
71 void render (size_t colourmap, bool inverted,
72 float local_min_value, float local_max_value,
73 float global_min_value, float global_range,
74 Eigen::Array3f colour = { NAN, NAN, NAN });
75
76 void render (const Displayable& object, bool inverted);
77
78 void end () {
79 current_position = Position::None;
80 current_projection = nullptr;
81 current_count = 0;
82 current_colourbar_index = 0;
83 }
84
85 protected:
92
93 void setup (size_t index, bool inverted);
94
95 private:
96 static size_t max_n_rows;
97 Position current_position;
98 Projection* current_projection;
99 size_t current_count, current_colourbar_index;
100 };
101
102
103
104 }
105 }
106}
107
108#endif
109
110
111
112
const GLfloat colourbar_padding
Definition: colourbars.h:91
const GLfloat text_offset
Definition: colourbars.h:91
GL::VertexArrayObject VAO
Definition: colourbars.h:87
GL::VertexBuffer VB
Definition: colourbars.h:86
GL::Shader::Program program
Definition: colourbars.h:88
void render(size_t colourmap, bool inverted, float local_min_value, float local_max_value, float global_min_value, float global_range, Eigen::Array3f colour={ NAN, NAN, NAN })
void begin(Projection *projection, const Position position, const size_t ncolourbars)
Definition: colourbars.h:62
GL::Shader::Program frame_program
Definition: colourbars.h:88
void setup(size_t index, bool inverted)
void render(const Displayable &object, bool inverted)
#define NOMEMALIGN
Definition: memory.h:22
const Entry maps[]
size_t colourmap_index_from_menu(size_t n)
Definition: colourbars.h:35
Definition: base.h:24
size_t index