v2.0.0
Loading...
Searching...
No Matches
inv_token.h
Go to the documentation of this file.
1//=============================================================================================================
60
61#ifndef INV_TOKEN_H
62#define INV_TOKEN_H
63
64//=============================================================================================================
65// INCLUDES
66//=============================================================================================================
67
68#include <cstdint>
69#include <vector>
70
71//=============================================================================================================
72// DEFINE NAMESPACE INVLIB
73//=============================================================================================================
74
75namespace INVLIB
76{
77
78//=============================================================================================================
99enum class InvTokenId : int32_t
100{
101 // --- Special tokens ---
102 Pad = 0,
103 Bos = 1,
104 Eos = 2,
105 Sep = 3,
106
107 // --- Section markers (paired begin / end) ---
110
113 GridRow = 22,
114
119
124
129
131 PosEnd = 61,
132
133 // --- Method labels (one-hot from InvEstimateMethod) ---
147
148 // --- Source-space labels (one-hot from InvSourceSpaceType) ---
154
155 // --- Orientation labels (one-hot from InvOrientationType) ---
160
161 // --- Value-carrier tokens (paired with float in InvToken::value) ---
162 Amplitude = 200,
163 Vertex = 201,
164 TimeVal = 202,
165 FreqVal = 203,
166 PosX = 204,
167 PosY = 205,
168 PosZ = 206,
169 MomX = 207,
170 MomY = 208,
171 MomZ = 209,
172 Goodness = 210,
175 ConnValue = 213,
176 GridIndex = 214,
177
178 // --- Boolean tokens ---
183
184 // --- Dimension tokens (carry size as int-in-float) ---
185 NSources = 280,
186 NTimes = 281,
187 NGroups = 282,
188 NDipoles = 283,
189 NMeasures = 284,
190 NIndices = 285,
191 NFreeDof = 286,
192 TStep = 287,
193
194 // --- Connectivity-measure name tokens ---
195 MeasCoh = 300,
197 MeasPlv = 302,
198 MeasPli = 303,
199 MeasWpli = 304,
201 MeasPdc = 306,
202 MeasDtf = 307,
205 MeasOther = 310,
206
207 // --- Quantization bin base (for fully discrete tokenisation) ---
209};
210
211//=============================================================================================================
224{
226 float value;
227
229 explicit InvToken(InvTokenId _id) : id(_id), value(0.0f) {}
230 InvToken(InvTokenId _id, float _val) : id(_id), value(_val) {}
231};
232
233//=============================================================================================================
243{
244 bool includeGridData = true;
245 bool includeCouplings = true;
248 bool includePositions = true;
249 int maxSources = -1;
250 int maxTimePoints = -1;
251};
252
253//=============================================================================================================
261inline std::vector<int32_t> tokenIds(const std::vector<InvToken>& tokens)
262{
263 std::vector<int32_t> ids(tokens.size());
264 for (size_t i = 0; i < tokens.size(); ++i)
265 ids[i] = static_cast<int32_t>(tokens[i].id);
266 return ids;
267}
268
269//=============================================================================================================
277inline std::vector<float> tokenValues(const std::vector<InvToken>& tokens)
278{
279 std::vector<float> vals(tokens.size());
280 for (size_t i = 0; i < tokens.size(); ++i)
281 vals[i] = tokens[i].value;
282 return vals;
283}
284
285} // NAMESPACE INVLIB
286
287#endif // INV_TOKEN_H
Inverse source estimation (MNE, dSPM, sLORETA, dipole fitting).
std::vector< float > tokenValues(const std::vector< InvToken > &tokens)
Definition inv_token.h:277
std::vector< int32_t > tokenIds(const std::vector< InvToken > &tokens)
Definition inv_token.h:261
InvToken(InvTokenId _id, float _val)
Definition inv_token.h:230
InvTokenId id
Definition inv_token.h:225
InvToken(InvTokenId _id)
Definition inv_token.h:229
Tokenization options controlling layer inclusion and sub-sampling.
Definition inv_token.h:243