v2.0.0
Loading...
Searching...
No Matches
mne_msh_display_surface.h
Go to the documentation of this file.
1//=============================================================================================================
18
19#ifndef MNEMSHDISPLAYSURFACE_H
20#define MNEMSHDISPLAYSURFACE_H
21
22//=============================================================================================================
23// INCLUDES
24//=============================================================================================================
25
26#include "mne_global.h"
27#include "mne_types.h"
28#include "mne_surface.h"
29
30//=============================================================================================================
31// EIGEN INCLUDES
32//=============================================================================================================
33
34#include <Eigen/Core>
35
36//=============================================================================================================
37// QT INCLUDES
38//=============================================================================================================
39
40#include <QSharedPointer>
41#include <QString>
42
43//=============================================================================================================
44// STL INCLUDES
45//=============================================================================================================
46
47#include <memory>
48#include <vector>
49
50//=============================================================================================================
51// DEFINE NAMESPACE MNELIB
52//=============================================================================================================
53
54namespace MNELIB
55{
56
57//=============================================================================================================
58// FORWARD DECLARATIONS
59//=============================================================================================================
60
61class MNEMorphMap;
62class MNEMshPicked;
64
65} // NAMESPACE MNELIB
66
67namespace FIFFLIB { class FiffDigitizerData; }
68
69namespace MNELIB
70{
71
72//=============================================================================================================
79{
80public:
81 typedef QSharedPointer<MNEMshDisplaySurface> SPtr;
82 typedef QSharedPointer<const MNEMshDisplaySurface> ConstSPtr;
83
84 //=========================================================================================================
89
90 //=========================================================================================================
95
96public:
97 QString filename;
98 time_t time_loaded = 0;
99 QString subj;
100 QString surf_name;
101 Eigen::Vector3f eye{1.0f, 0.0f, 0.0f};
102 Eigen::Vector3f up{0.0f, 0.0f, 1.0f};
103 Eigen::Vector3f rot = Eigen::Vector3f::Zero();
104 Eigen::Vector3f move = Eigen::Vector3f::Zero();
105
106 float fov = 2.0f;
107 float fov_scale = 1.0f;
108 Eigen::Vector3f minv = Eigen::Vector3f::Constant(-1.0f);
109 Eigen::Vector3f maxv = Eigen::Vector3f::Constant(1.0f);
110 Eigen::Matrix4f trans = Eigen::Matrix4f::Identity();
111 bool sketch = false;
112
113 std::vector<std::unique_ptr<MNELIB::MNEMorphMap>> maps;
114
115 int overlay_type = 0;
116 Eigen::VectorXf overlay_values;
118 Eigen::VectorXf alt_overlay_values;
119 Eigen::VectorXf marker_values;
120
121 Eigen::VectorXf vertex_colors;
122 std::unique_ptr<MNELIB::MNEMshColorScaleDef> color_scale;
124 Eigen::Vector4f even_vertex_color = Eigen::Vector4f::Zero();
125
126 Eigen::VectorXf marker_colors;
128 Eigen::MatrixXi marker_tri;
129 Eigen::VectorXi marker_tri_no;
130 int nmarker_tri = 0;
131 Eigen::Vector4f marker_color = Eigen::Vector4f::Zero();
133
135 bool transparent = false;
136
137 bool show_aux_data = false;
138
139 std::vector<MNELIB::MNEMshPicked> picked;
140
141 void *user_data = nullptr;
143
144 //=========================================================================================================
145 // Alignment functions (moved from MNESurfaceOrVolume)
146 //=========================================================================================================
147
162 const FIFFLIB::FiffDigitizerData& mri_dig,
163 int niter,
164 int scale_head,
165 float omit_dist,
166 Eigen::Vector3f& scales);
167
172 const Eigen::Matrix<float, 3, 3, Eigen::RowMajor>& mri_fid,
173 Eigen::Vector3f& scales);
174
179 float maxdist) const;
180
185 bool do_all, bool do_approx) const;
186
191 int nasion_weight,
192 const std::optional<Eigen::Vector3f>& nasion_mri,
193 int last_step) const;
194
199
203 void scale(const Eigen::Vector3f& scales);
204
211 void decide_surface_extent(const QString& tag);
212
219 void decide_curv_display(const QString& name);
220
226
227// ### OLD STRUCT ###
228// typedef struct { /* Display surface properties */
229// char *filename; /* Where did this surface come from? */
230// time_t time_loaded; /* When was the surface loaded */
231// char *subj; /* The name of the subject in SUBJECTS_DIR */
232// char *surf_name; /* The name of the surface */
233// MNELIB::MNESurface* s; /* This is the surface */
234// float eye[3]; /* Eye position for viewing */
235// float up[3]; /* Up vector for viewing */
236// float rot[3]; /* Rotation angles of the MRI (in radians) */
237// float move[3]; /* Possibly move the origin, too */
238
239// float fov; /* Field of view (extent of the surface) */
240// float fov_scale; /* How much space to leave */
241// float minv[3]; /* Minimum values along the three coordinate axes */
242// float maxv[3]; /* Maximum values along the three coordinate axes */
243// float *trans; /* Extra transformation for this surface */
244// int sketch; /* Use sketch mode if decimated triangulation is available? */
245
246// morphMap *maps; /* Morphing maps from other surfaces to this */
247// int nmap; /* Normally just one */
248
249// int overlay_type; /* What are the overlay values? */
250// float *overlay_values; /* Overlay value array */
251// int alt_overlay_type; /* A second choice for overlay */
252// float *alt_overlay_values;
253// float *marker_values; /* Marker values (will be shown in shades of marker color) */
254
255// float *vertex_colors; /* Vertex color array */
256// mshColorScaleDef* color_scale; /* Color scale used to define these colors */
257// int nvertex_colors; /* How many components? */
258// float even_vertex_color[4]; /* This is going to be employed in case of uniform coloring */
259
260// float *marker_colors; /* Vertex color array (for the markers) */
261// int nmarker_colors; /* How many components? */
262// int **marker_tri; /* Triangles containing markers */
263// int *marker_tri_no; /* Numbers of the marker triangles */
264// int nmarker_tri; /* How many */
265// float marker_color[4]; /* Marker color */
266// int curvature_color_mode; /* How to show curvature */
267
268// int overlay_color_mode; /* How to show overlay data */
269// int transparent; /* Is this surface going to be transparent? */
270
271// int show_aux_data; /* Show auxilliary data related to this surface */
272
273// mshPicked* picked; /* Picked locations in world coordinates */
274// int npicked; /* How many */
275
276// void *user_data; /* Can be used to store whatever */
277// mneUserFreeFunc* user_data_free; /* Function to free the above */
278// } *mshDisplaySurface,mshDisplaySurfaceRec;
279};
280
281//=============================================================================================================
282// INLINE DEFINITIONS
283//=============================================================================================================
284} // NAMESPACE MNELIB
285
286#endif // MNEMSHDISPLAYSURFACE_H
Lightweight triangulated surface (vertices, triangles, normals) used by surface-based routines.
MNELIB shared-library export/import macros and library build metadata.
#define MNESHARED_EXPORT
Definition mne_global.h:40
Legacy MNE-C constants and shared typedefs used across MNELIB structures.
Core MNE data structures (source spaces, source estimates, hemispheres).
void(* mneUserFreeFunc)(void *)
Generic destructor callback for user-attached data.
Definition mne_types.h:68
FIFF file I/O, in-memory data structures and high-level readers/writers.
Registration-ready digitization data: dig points, device→head transform and HPI fit metadata.
Vertex-to-vertex mapping between two FreeSurfer surface meshes for morphing source estimates.
Color scale definition with value range and color mapping for surface visualization.
void get_head_scale(FIFFLIB::FiffDigitizerData &dig, const Eigen::Matrix< float, 3, 3, Eigen::RowMajor > &mri_fid, Eigen::Vector3f &scales)
float rms_digitizer_distance(FIFFLIB::FiffDigitizerData &dig) const
void decide_surface_extent(const QString &tag)
void scale(const Eigen::Vector3f &scales)
std::unique_ptr< MNELIB::MNEMshColorScaleDef > color_scale
void calculate_digitizer_distances(FIFFLIB::FiffDigitizerData &dig, bool do_all, bool do_approx) const
std::vector< MNELIB::MNEMshPicked > picked
QSharedPointer< const MNEMshDisplaySurface > ConstSPtr
QSharedPointer< MNEMshDisplaySurface > SPtr
int align_fiducials(FIFFLIB::FiffDigitizerData &head_dig, const FIFFLIB::FiffDigitizerData &mri_dig, int niter, int scale_head, float omit_dist, Eigen::Vector3f &scales)
int discard_outlier_digitizer_points(FIFFLIB::FiffDigitizerData &d, float maxdist) const
std::vector< std::unique_ptr< MNELIB::MNEMorphMap > > maps
int iterate_alignment_once(FIFFLIB::FiffDigitizerData &dig, int nasion_weight, const std::optional< Eigen::Vector3f > &nasion_mri, int last_step) const
void decide_curv_display(const QString &name)
Picked point on a displayed surface storing vertex index, coordinates, and source value.