MNE-CPP 0.1.9
A Framework for Electrophysiology
Loading...
Searching...
No Matches
fiff_coord_trans_old.h
Go to the documentation of this file.
1//=============================================================================================================
37#ifndef FIFFCOORDTRANSOLD_H
38#define FIFFCOORDTRANSOLD_H
39
40//=============================================================================================================
41// INCLUDES
42//=============================================================================================================
43
44#include "../fiff_global.h"
45
46#include "../fiff_types.h"
47#include "../fiff_stream.h"
48#include "../fiff_dir_node.h"
49
50//=============================================================================================================
51// EIGEN INCLUDES
52//=============================================================================================================
53
54#include <Eigen/Core>
55
56//=============================================================================================================
57// QT INCLUDES
58//=============================================================================================================
59
60#include <QSharedPointer>
61
62namespace FIFFLIB
63{
64class FiffTag;
65}
66
67//=============================================================================================================
68// DEFINE NAMESPACE FIFFLIB
69//=============================================================================================================
70
71namespace FIFFLIB
72{
73
74//=============================================================================================================
81{
82public:
83 typedef QSharedPointer<FiffCoordTransOld> SPtr;
84 typedef QSharedPointer<const FiffCoordTransOld> ConstSPtr;
86 //=========================================================================================================
91
92 //=========================================================================================================
99 FiffCoordTransOld(const FiffCoordTransOld& p_FiffCoordTransOld);
100
101 static FiffCoordTransOld* catenate(FiffCoordTransOld* t1,FiffCoordTransOld* t2);
102
103 //=========================================================================================================
109 FiffCoordTransOld(int from,int to,float rot[3][3],float move[3]);
110
111 //=========================================================================================================
117
118 //=========================================================================================================
119 /*
120 * Transform Old coord transformation to new class.
121 */
122 FiffCoordTrans toNew();
123
124 //============================= make_volume_source_space.c =============================
125
126 /*
127 * Add inverse transform to an existing one
128 */
129 static int add_inverse(FiffCoordTransOld* t);
130
131 //============================= fiff_trans.c =============================
132 FiffCoordTransOld* fiff_invert_transform () const;
133
134 static void fiff_coord_trans (float r[3], const FiffCoordTransOld* t,int do_move);
135
136 static FiffCoordTransOld* fiff_combine_transforms (int from,int to,FiffCoordTransOld* t1,FiffCoordTransOld* t2);
137
138 static void fiff_coord_trans_inv (float r[3],FiffCoordTransOld* t,int do_move);
139
140 //============================= mne_coord_transforms.c =============================
141
142 static const char *mne_coord_frame_name(int frame);
143
144 static void mne_print_coord_transform_label(FILE *log,char *label, FiffCoordTransOld* t);
145
146 static void mne_print_coord_transform(FILE *log, FiffCoordTransOld* t);
147
148 static FiffCoordTransOld* mne_read_transform(const QString& name,int from, int to);
149
150 static FiffCoordTransOld* mne_read_transform_from_node(//fiffFile in,
152 const FIFFLIB::FiffDirNode::SPtr& node,
153 int from, int to);
154
155 static FiffCoordTransOld* mne_read_mri_transform(const QString& name);
156
157 static FiffCoordTransOld* mne_read_meas_transform(const QString& name);
158
159 static FiffCoordTransOld* mne_read_transform_ascii(char *name, int from, int to);
160
161 static FiffCoordTransOld* mne_read_FShead2mri_transform(char *name);
162
163 static FiffCoordTransOld* mne_identity_transform(int from, int to);
164
165 static FiffCoordTransOld * fiff_make_transform_card (int from,int to,
166 float *rL,
167 float *rN,
168 float *rR);
169
170 //============================= digitizer.c =============================
171
172 static FiffCoordTransOld* procrustes_align(int from_frame, /* The coordinate frames */
173 int to_frame,
174 float **fromp, /* Point locations in these two coordinate frames */
175 float **top,
176 float *w, /* Optional weights */
177 int np, /* How many points */
178 float max_diff); /* Maximum allowed difference */
179
180 //=============================================================================================================
181 //TODO: remove later on
182 static FiffCoordTransOld* read_helper( QSharedPointer<FIFFLIB::FiffTag>& tag );
183
184 //========================================================================================================
192 friend bool operator== (const FiffCoordTransOld &a, const FiffCoordTransOld &b);
193
194public:
195 FIFFLIB::fiff_int_t from;
196 FIFFLIB::fiff_int_t to;
197 Eigen::Matrix3f rot;
198 Eigen::Vector3f move;
199 Eigen::Matrix3f invrot;
200 Eigen::Vector3f invmove;
202 // ### OLD STRUCT ###
203 //typedef struct _fiffCoordTransRec {
204 // fiff_int_t from; /**< Source coordinate system. */
205 // fiff_int_t to; /**< Destination coordinate system. */
206 // fiff_float_t rot[3][3]; /**< The forward transform (rotation part). */
207 // fiff_float_t move[3]; /**< The forward transform (translation part). */
208 // fiff_float_t invrot[3][3]; /**< The inverse transform (rotation part). */
209 // fiff_float_t invmove[3]; /**< The inverse transform (translation part). */
210 //} *fiffCoordTrans, fiffCoordTransRec; /**< Coordinate transformation descriptor. */
211};
212
213//=============================================================================================================
214// INLINE DEFINITIONS
215//=============================================================================================================
216
217inline bool operator== (const FiffCoordTransOld &a, const FiffCoordTransOld &b)
218{
219 return (a.from == b.from &&
220 a.to == b.to &&
221 a.rot.isApprox(b.rot, 0.0001f) &&
222 a.move.isApprox(b.move, 0.0001f) &&
223 a.invrot.isApprox(b.invrot, 0.0001f) &&
224 a.invmove.isApprox(b.invmove, 0.0001f));
225}
226} // NAMESPACE FIFFLIB
227
228#endif // FIFFCOORDTRANSOLD_H
#define FIFFSHARED_EXPORT
Definition fiff_global.h:56
Coordinate transformation descriptor.
QSharedPointer< const FiffCoordTransOld > ConstSPtr
QSharedPointer< FiffCoordTransOld > SPtr
Coordinate transformation description.
QSharedPointer< FiffDirNode > SPtr
QSharedPointer< FiffStream > SPtr