Developer documentation
Version 3.0.3-105-gd3941f44
gui_image.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_image_h__
18#define __gui_mrview_image_h__
19
20#include "image.h"
21#include "types.h"
22#include "gui/opengl/gl.h"
23#include "gui/mrview/volume.h"
24#include "interp/linear.h"
25#include "interp/nearest.h"
26#include <unordered_map>
27
28
29namespace MR
30{
31 namespace GUI
32 {
33
34 class Projection;
35
36 namespace MRView
37 {
38
39 class Window;
40
41 namespace Tool
42 {
43 class ODF;
44 }
45
46
47
48
49
50 class ImageBase : public Volume
52 public:
54 virtual ~ImageBase();
55
56 void render2D (Displayable::Shader& shader_program, const Projection& projection, const int plane, const int slice);
57 void render3D (Displayable::Shader& shader_program, const Projection& projection, const float depth);
58
59 virtual void update_texture2D (const int plane, const int slice) = 0;
60 virtual void update_texture3D() = 0;
61
62 void get_axes (const int plane, int& x, int& y) const;
63
64 protected:
67
68 };
69
70
71
72
73
74
75 class Image : public ImageBase
77 public:
78 Image (MR::Header&&);
79
80 void update_texture2D (const int plane, const int slice) override;
81 void update_texture3D() override;
82
83 void request_render_colourbar (DisplayableVisitor& visitor) override
84 { if (show_colour_bar) visitor.render_image_colourbar (*this); }
85
87
88 cfloat trilinear_value (const Eigen::Vector3f&) const;
89 cfloat nearest_neighbour_value (const Eigen::Vector3f&) const;
90
91 const transform_type& transform() const { return image.transform(); }
92 const vector<std::string>& comments() const { return _comments; }
93
94 void reset_windowing (const int, const bool);
95
96 protected:
97
101 };
102
103 std::array<float, 3> slice_min, slice_max;
104 std::unordered_map<size_t, CachedTexture> tex_4d_cache;
105
106 private:
107 bool volume_unchanged ();
108 bool format_unchanged ();
109 size_t guess_colourmap () const;
110
111 template <typename T> void copy_texture_3D ();
112 void copy_texture_3D_complex ();
113 void lookup_texture_4D_cache ();
114 void update_texture_4D_cache ();
115
116 vector<std::string> _comments;
117
118 };
119
120
121 }
122 }
123}
124
125#endif
126
virtual void render_image_colourbar(const Image &)
Definition: displayable.h:57
GL::Texture texture2D[3]
Definition: gui_image.h:65
vector< ssize_t > tex_positions
Definition: gui_image.h:66
std::array< float, 3 > slice_max
Definition: gui_image.h:103
std::array< float, 3 > slice_min
Definition: gui_image.h:103
std::unordered_map< size_t, CachedTexture > tex_4d_cache
Definition: gui_image.h:104
Eigen::Vector3f tex[4]
Definition: volume.h:144
const transform_type & transform() const
Definition: image.h:63
Definition: base.h:24
std::complex< float > cfloat
Definition: types.h:218
Eigen::Transform< default_type, 3, Eigen::AffineCompact > transform_type
the type for the affine transform of an image:
Definition: types.h:234
#define MEMALIGN(...)
Definition: types.h:185
MEMALIGN(CachedTexture) GL float value_min
Definition: gui_image.h:98
MEMALIGN(CachedTexture) GL float value_max
Definition: gui_image.h:100