Developer documentation
Version 3.0.3-105-gd3941f44
roi.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_tool_roi_editor_roi_h__
18#define __gui_mrview_tool_roi_editor_roi_h__
19
20#include "memory.h"
21#include "transform.h"
22#include "types.h"
23
27#include "gui/color_button.h"
29
33
34
35namespace MR
36{
37
38 class Header;
39
40 namespace GUI
41 {
42 namespace MRView
43 {
44 namespace Tool
45 {
46
47
48 class ROI : public Base
49 { MEMALIGN(ROI)
50 Q_OBJECT
51
52 public:
53 ROI (Dock* parent);
54 ~ROI();
55
56 void draw (const Projection& projection, bool is_3D, int axis, int slice) override;
57
58 static void add_commandline_options (MR::App::OptionList& options);
59 virtual bool process_commandline_option (const MR::App::ParsedOption& opt) override;
60
61 virtual bool mouse_press_event () override;
62 virtual bool mouse_move_event () override;
63 virtual bool mouse_release_event () override;
64 virtual QCursor* get_cursor () override;
65
66 private slots:
67 void new_slot ();
68 void open_slot ();
69 void save_slot ();
70 void close_slot ();
71 void draw_slot ();
72 void undo_slot ();
73 void redo_slot ();
74 void hide_all_slot ();
75 void slice_copy_slot (QAction*);
76 void select_edit_mode (QAction*);
77 void toggle_shown_slot (const QModelIndex&, const QModelIndex&);
78 void update_selection ();
79 void update_slot ();
80 void colour_changed ();
81 void opacity_changed (int unused);
82 void model_rows_changed ();
83
84 protected:
91 QListView* list_view;
97 Eigen::Vector3f current_origin, prev_pos;
99
100 Mode::Slice::Shader shader;
101
103 void updateGL() {
104 window().get_current_mode()->update_overlays = true;
105 window().updateGL();
106 }
107
108 void load (vector<std::unique_ptr<MR::Header>>& list);
109 void save (ROI_Item*);
110
111 int normal2axis (const Eigen::Vector3f&, const ROI_Item&) const;
112
113 void dropEvent (QDropEvent* event) override;
114 };
115
116
117 }
118 }
119 }
120}
121
122#endif
123
124
125
a class to hold the list of option groups
Definition: app.h:139
object storing information about option parsed from command-line
Definition: app.h:286
Window & window() const
Definition: base.h:87
Eigen::Vector3f current_origin
Definition: roi.h:97
QPushButton * hide_all_button
Definition: roi.h:85
QToolButton * brush_button
Definition: roi.h:87
QToolButton * fill_button
Definition: roi.h:87
QToolButton * copy_from_above_button
Definition: roi.h:88
QPushButton * close_button
Definition: roi.h:85
QPushButton * save_button
Definition: roi.h:85
QToolButton * draw_button
Definition: roi.h:86
QActionGroup * edit_mode_group
Definition: roi.h:89
AdjustButton * brush_size_button
Definition: roi.h:94
QToolButton * copy_from_below_button
Definition: roi.h:88
Mode::Slice::Shader shader
Definition: roi.h:100
void load(vector< std::unique_ptr< MR::Header > > &list)
QToolButton * rectangle_button
Definition: roi.h:87
QListView * list_view
Definition: roi.h:91
QSlider * opacity_slider
Definition: roi.h:93
QActionGroup * slice_copy_group
Definition: roi.h:89
void dropEvent(QDropEvent *event) override
ROI_Model * list_model
Definition: roi.h:90
int normal2axis(const Eigen::Vector3f &, const ROI_Item &) const
QToolButton * undo_button
Definition: roi.h:86
Eigen::Vector3f prev_pos
Definition: roi.h:97
QColorButton * colour_button
Definition: roi.h:92
QToolButton * redo_button
Definition: roi.h:86
Mode::Base * get_current_mode() const
Definition: window.h:111
Definition: base.h:24
int axis
#define MEMALIGN(...)
Definition: types.h:185