Developer documentation
Version 3.0.3-105-gd3941f44
lightbox.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_mode_lightbox_h__
18#define __gui_mrview_mode_lightbox_h__
19
21
22namespace MR
23{
24 namespace GUI
25 {
26 namespace MRView
27 {
28 namespace Mode
29 {
30 class LightBox : public Slice
31 { MEMALIGN(LightBox)
32 Q_OBJECT
33 using proj_focusdelta = std::pair<Projection,float>;
34 public:
36
37 void paint (Projection& with_projection) override;
38 void set_focus_event() override;
39 void slice_move_event (float x) override;
40 void pan_event () override;
41 void panthrough_event () override;
42 void tilt_event () override;
43 void rotate_event () override;
44 void image_changed_event() override;
45 void reset_windowing () override;
46
47 void request_update_mode_gui(ModeGuiVisitor& visitor) const override {
48 visitor.update_lightbox_mode_gui(*this); }
49
50 static size_t get_rows() { return n_rows; }
51 static size_t get_cols() { return n_cols; }
52 static size_t get_volume_increment() { return volume_increment; }
53 static float get_slice_increment() { return slice_focus_increment; }
54 static float get_slice_inc_adjust_rate() { return slice_focus_inc_adjust_rate; }
55 static bool get_show_grid() { return show_grid_lines; }
56 static bool get_show_volumes() { return show_volumes; }
57
58 void set_rows(size_t rows);
59 void set_cols(size_t cols);
60 void set_volume_increment(size_t vol_inc);
61 void set_slice_increment(float inc);
62 void set_show_grid(bool show_grid);
63 void set_show_volumes(bool show_vol);
64
65 public slots:
66 void nrows_slot(int value) { set_rows(static_cast<size_t>(value)); }
67 void ncolumns_slot(int value) { set_cols(static_cast<size_t>(value));}
72 void image_volume_changed_slot() { updateGL(); }
73
74 protected:
75 void draw_plane_primitive(int axis, Displayable::Shader& shader_program,
76 Projection& with_projection) override;
77
78 private:
79 void draw_grid();
80 bool render_volumes();
81
82 // Want layout state to persist even after instance is destroyed
83 static bool show_grid_lines, show_volumes;
84 static std::string prev_image_name;
85 static ssize_t n_rows, n_cols, volume_increment;
86 static float slice_focus_increment;
87 static float slice_focus_inc_adjust_rate;
88 static ssize_t current_slice_index;
89
90 ModelViewProjection get_projection_at (int row, int col) const;
91
92 GL::VertexBuffer frame_VB;
93 GL::VertexArrayObject frame_VAO;
94 GL::Shader::Program frame_program;
95 bool frames_dirty;
96 signals:
98 };
99
100 }
101 }
102 }
103}
104
105
106#endif
void request_update_mode_gui(ModeGuiVisitor &visitor) const override
Definition: lightbox.h:47
void set_volume_increment(size_t vol_inc)
void show_volumes_slot(bool value)
Definition: lightbox.h:71
void set_slice_increment(float inc)
static size_t get_cols()
Definition: lightbox.h:51
void nrows_slot(int value)
Definition: lightbox.h:66
void slice_inc_slot(float value)
Definition: lightbox.h:68
static float get_slice_inc_adjust_rate()
Definition: lightbox.h:54
static float get_slice_increment()
Definition: lightbox.h:53
void set_show_volumes(bool show_vol)
void draw_plane_primitive(int axis, Displayable::Shader &shader_program, Projection &with_projection) override
void show_grid_slot(bool value)
Definition: lightbox.h:70
void volume_inc_slot(int value)
Definition: lightbox.h:69
void set_show_grid(bool show_grid)
void ncolumns_slot(int value)
Definition: lightbox.h:67
void image_changed_event() override
void slice_move_event(float x) override
static size_t get_rows()
Definition: lightbox.h:50
void paint(Projection &with_projection) override
static bool get_show_volumes()
Definition: lightbox.h:56
static size_t get_volume_increment()
Definition: lightbox.h:52
VectorType::Scalar value(const VectorType &coefs, typename VectorType::Scalar cos_elevation, typename VectorType::Scalar cos_azimuth, typename VectorType::Scalar sin_azimuth, int lmax)
Definition: SH.h:233
Definition: base.h:24
int axis