ODIN
miviewview.h
1 /***************************************************************************
2  miviewview.h - description
3  -------------------
4  begin : Thu Jun 20 19:02:26 CEST 2002
5  copyright : (C) 2000-2021 by Thies H. Jochimsen
6  email : thies@jochimsen.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef MIVIEWVIEW_H
19 #define MIVIEWVIEW_H
20 
21 #include <odinqt/ldrwidget.h>
22 
23 
24 #include <odinpara/odinpara.h>
25 #include <odinpara/ldrnumbers.h>
26 #include <odinpara/ldrarrays.h>
27 #include <odinpara/ldrblock.h>
28 
29 // miview modules
30 #include "miview_fmri.h"
31 #include "miview_rois.h"
32 
33 
34 class Protocol; // forward declaration
35 struct FileData; // forward declaration
36 struct SelectionData; // forward declaration
37 
39 
40 // for debugging MiView component
41 class MiViewComp {
42  public:
43  static const char* get_compName();
44 };
45 
47 
48 struct MiViewOpts : LDRblock {
49 
50  LDRbool color;
51  LDRfloat contrast;
52  LDRfloat brightness;
53  LDRstring valfile;
54  LDRstring recfile;
55  LDRint blowup;
56  LDRstring low;
57  LDRstring upp;
58  LDRstring dump;
59  LDRstring mapfile;
60  LDRfloat maplow;
61  LDRfloat mapupp;
62  LDRfloat maprect;
63  LDRstring legendexport;
64  LDRstring maplegendexport;
65  LDRbool noscale;
66 
67  MiViewOpts();
68 };
69 
71 
72 class MiViewView : public QWidget {
73  Q_OBJECT
74 
75  public:
76  MiViewView(QWidget *parent);
77  ~MiViewView();
78 
79 
80  static void set_defaults(Protocol& prot);
81  static void usage();
82 
83  bool is_image_display() const {return (get_nx()*get_ny())>1;}
84  bool has_timecourse() const {return get_nrep()>1;}
85  bool has_fmri() const {return fmri.is_valid();}
86  bool has_rois() const {return rois.is_valid();}
87  bool has_overlay() const {return has_olm;}
88 
89  signals:
90 
91  void setMessage(const char* text);
92 
93 
94  public slots:
95 
96  void writeData();
97  void writeImage();
98  void writeROIs();
99  void writeFmriClusters();
100  void writeProfile();
101  void writeTimecourse();
102  void writeLegend();
103  void writeMapLegend();
104 
105  void selectVoxel();
106  void showProfile();
107  void showTimecourse();
108  void showProtocol();
109 
110 
111  private slots:
112 
113  void update();
114 
115  void slotClicked(int x, int y, int z);
116  void slotNewProfile(const float *data, int npts, bool horizontal, int position);
117  void slotNewMask(const float *data, int slice);
118 
119 
120  private:
121 
122  int get_nx() const;
123  int get_ny() const;
124  int get_nz() const;
125  int get_nrep() const;
126 
127  void filedata2displaydata();
128 
129  STD_string check_and_get_format(const STD_string& fname, const svector& possible_formats, bool show_error_msg=true);
130 
131  void export_legend(const STD_string& filename);
132  void export_map_legend(const STD_string& filename);
133 
134  void val2file(int rep, int z, int y, int x, float val) const;
135 
136 
137  MiViewOpts mopts;
138 
139  bool has_bounds; // true if set manually
140  float lowbound;
141  float uppbound;
142 
143 
144  FileData* file; // holding the data of the file
145 
146  LDRfloatArr displaydata;
147  GuiProps guiprops_cache;
148  LDRblock settings;
149  LDRint repetition;
150  LDRfloatArr timecourse;
151 
152  bool has_olm;
153 
154 
155  SelectionData* selection; // holding data of user selections
156 
157  GuiGridLayout* grid;
158  LDRwidget* displaywidget;
159  LDRwidget* settingswidget;
160  LDRwidget* tcoursewidget;
161  LDRwidget* fmriwidget;
162  LDRwidget* roiswidget;
163 
164  STD_string data_fname_cache;
165  STD_string image_fname_cache;
166  STD_string rois_fname_cache;
167  STD_string clusters_fname_cache;
168  STD_string profile_fname_cache;
169  STD_string tcourse_fname_cache;
170 
171  LDRint pos_cache[n_directions];
172 
173 
174  // miview modules
175  MiViewFmri fmri;
176  MiViewRois rois;
177 
178 
179 };
180 
181 
182 #endif
Protocol proxy.
Definition: protocol.h:33