70 return QStringLiteral(
"custom");
75static MnaDataKind dataKindFromString(
const QString& str)
102 return QStringLiteral(
"input");
107static MnaPortDir portDirFromString(
const QString& str)
119 QJsonObject json =
extras;
120 json[QLatin1String(
"name")] =
name;
121 json[QLatin1String(
"data_kind")] = dataKindToString(
dataKind);
122 json[QLatin1String(
"direction")] = portDirToString(
direction);
148 port.
name = json[QLatin1String(
"name")].toString();
149 port.
dataKind = dataKindFromString(json[QLatin1String(
"data_kind")].toString());
150 port.
direction = portDirFromString(json[QLatin1String(
"direction")].toString());
151 port.
sourceNodeId = json[QLatin1String(
"source_node")].toString();
152 port.
sourcePortName = json[QLatin1String(
"source_port")].toString();
153 port.
streamProtocol = json[QLatin1String(
"stream_protocol")].toString();
154 port.
streamEndpoint = json[QLatin1String(
"stream_endpoint")].toString();
155 port.
streamBufferMs = json[QLatin1String(
"stream_buffer_ms")].toInt(0);
157 port.
cachedResultHash = json[QLatin1String(
"cached_result_hash")].toString();
159 static const QSet<QString> knownKeys = {
160 QStringLiteral(
"name"), QStringLiteral(
"data_kind"),
161 QStringLiteral(
"direction"), QStringLiteral(
"source_node"),
162 QStringLiteral(
"source_port"), QStringLiteral(
"stream_protocol"),
163 QStringLiteral(
"stream_endpoint"), QStringLiteral(
"stream_buffer_ms"),
164 QStringLiteral(
"cached_result"), QStringLiteral(
"cached_result_hash")
166 for (
auto it = json.constBegin(); it != json.constEnd(); ++it) {
167 if (!knownKeys.contains(it.key()))
168 port.
extras.insert(it.key(), it.value());
178 QCborMap cbor = QCborMap::fromJsonObject(
extras);
179 cbor[QLatin1String(
"name")] =
name;
180 cbor[QLatin1String(
"data_kind")] = dataKindToString(
dataKind);
181 cbor[QLatin1String(
"direction")] = portDirToString(
direction);
205 port.
name = cbor[QLatin1String(
"name")].toString();
206 port.
dataKind = dataKindFromString(cbor[QLatin1String(
"data_kind")].toString());
207 port.
direction = portDirFromString(cbor[QLatin1String(
"direction")].toString());
208 port.
sourceNodeId = cbor[QLatin1String(
"source_node")].toString();
209 port.
sourcePortName = cbor[QLatin1String(
"source_port")].toString();
210 port.
streamProtocol = cbor[QLatin1String(
"stream_protocol")].toString();
211 port.
streamEndpoint = cbor[QLatin1String(
"stream_endpoint")].toString();
212 port.
streamBufferMs = cbor[QLatin1String(
"stream_buffer_ms")].toInteger();
214 port.
cachedResultHash = cbor[QLatin1String(
"cached_result_hash")].toString();
216 static const QSet<QString> knownKeys = {
217 QStringLiteral(
"name"), QStringLiteral(
"data_kind"),
218 QStringLiteral(
"direction"), QStringLiteral(
"source_node"),
219 QStringLiteral(
"source_port"), QStringLiteral(
"stream_protocol"),
220 QStringLiteral(
"stream_endpoint"), QStringLiteral(
"stream_buffer_ms"),
221 QStringLiteral(
"cached_result"), QStringLiteral(
"cached_result_hash")
223 QJsonObject cborJson = cbor.toJsonObject();
224 for (
auto it = cborJson.constBegin(); it != cborJson.constEnd(); ++it) {
225 if (!knownKeys.contains(it.key()))
226 port.
extras.insert(it.key(), it.value());
MnaPort struct declaration — typed input/output slot on a graph node.
MNE Analysis Container Format (mna/mnx).
@ FiffRaw
Raw MEG/EEG data (FIFF format).
@ Annotation
FreeSurfer annotation / parcellation.
@ Forward
Forward solution.
@ SourceEstimate
Source-level time series.
@ Custom
User-defined data kind.
@ Inverse
Inverse operator.
@ Surface
Surface mesh (FreeSurfer).
@ Covariance
Noise or data covariance matrix.
@ RealTimeStream
Live data channel (MNE Scan / LSL / FIFF-RT).
@ Evoked
Averaged evoked response.
@ Matrix
Generic Eigen matrix (for intermediate results).
QString cachedResultHash
SHA-256 for invalidation.
QString name
Port name (unique within a node).
QJsonObject toJson() const
QString sourcePortName
Which output port on that node?
MnaDataKind dataKind
Data kind flowing through this port.
MnaPortDir direction
Input or Output.
QString cachedResultPath
Relative path to cached result.
int streamBufferMs
Ring-buffer length in ms (0 = unbounded).
QString streamEndpoint
Protocol-specific address (e.g. "localhost:4218" for fiff-rt).
QJsonObject extras
Unknown keys preserved for lossless round-trip.
static MnaPort fromJson(const QJsonObject &json)
QString sourceNodeId
Which node produces this input? (empty → graph-level input).
static MnaPort fromCbor(const QCborMap &cbor)
QString streamProtocol
"fiff-rt", "lsl", "ftbuffer", "shm", "" = internal signal/slot