Token vocabulary and structures for foundation-model tokenization of InvSourceEstimate. More...
#include <cstdint>#include <vector>

Go to the source code of this file.
Classes | |
| struct | INVLIB::InvToken |
| One element of a tokenised neural-source representation. More... | |
| struct | INVLIB::InvTokenizeOptions |
| Tokenization options controlling layer inclusion and sub-sampling. More... | |
Namespaces | |
| namespace | INVLIB |
| Inverse source estimation (MNE, dSPM, sLORETA, dipole fitting). | |
Functions | |
| std::vector< int32_t > | INVLIB::tokenIds (const std::vector< InvToken > &tokens) |
| std::vector< float > | INVLIB::tokenValues (const std::vector< InvToken > &tokens) |
Token vocabulary and structures for foundation-model tokenization of InvSourceEstimate.
Copyright (C) 2026, Christoph Dinh. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The token vocabulary defines a self-describing sequence format for serializing multimodal neural source representations into a flat token stream that transformers and other foundation models can process.
Each token carries an integer vocabulary ID and an optional continuous floating-point value. Structural tokens (section delimiters, metadata labels) use only the ID; value-carrier tokens (amplitudes, positions, times, indices) pair the ID with the continuous quantity. This hybrid design supports both:
A typical token sequence for a surface MNE estimate has the form:
[BOS] [META_BEGIN] [METHOD_MNE] [SPACE_SURFACE] [ORIENT_FIXED] [META_END] [GRID_BEGIN] [N_SOURCES val] [N_TIMES val] [T_MIN val] [T_STEP val] [VERTEX val] ... [VERTEX val] [GRID_ROW] [AMP val] ... [AMP val] ... [GRID_END] [EOS]
Dense data layers (grid amplitudes, connectivity matrices) can be optionally omitted via InvTokenizeOptions, producing a compact metadata-only sequence suitable for context-limited attention windows.
Definition in file inv_token.h.