58 return QStringLiteral(
"custom");
63static MnaDataKind dataKindFromString(
const QString& str)
90 return QStringLiteral(
"input");
95static MnaPortDir portDirFromString(
const QString& str)
107 QJsonObject json =
extras;
108 json[QLatin1String(
"name")] =
name;
109 json[QLatin1String(
"data_kind")] = dataKindToString(
dataKind);
110 json[QLatin1String(
"direction")] = portDirToString(
direction);
136 port.
name = json[QLatin1String(
"name")].toString();
137 port.
dataKind = dataKindFromString(json[QLatin1String(
"data_kind")].toString());
138 port.
direction = portDirFromString(json[QLatin1String(
"direction")].toString());
139 port.
sourceNodeId = json[QLatin1String(
"source_node")].toString();
140 port.
sourcePortName = json[QLatin1String(
"source_port")].toString();
141 port.
streamProtocol = json[QLatin1String(
"stream_protocol")].toString();
142 port.
streamEndpoint = json[QLatin1String(
"stream_endpoint")].toString();
143 port.
streamBufferMs = json[QLatin1String(
"stream_buffer_ms")].toInt(0);
145 port.
cachedResultHash = json[QLatin1String(
"cached_result_hash")].toString();
147 static const QSet<QString> knownKeys = {
148 QStringLiteral(
"name"), QStringLiteral(
"data_kind"),
149 QStringLiteral(
"direction"), QStringLiteral(
"source_node"),
150 QStringLiteral(
"source_port"), QStringLiteral(
"stream_protocol"),
151 QStringLiteral(
"stream_endpoint"), QStringLiteral(
"stream_buffer_ms"),
152 QStringLiteral(
"cached_result"), QStringLiteral(
"cached_result_hash")
154 for (
auto it = json.constBegin(); it != json.constEnd(); ++it) {
155 if (!knownKeys.contains(it.key()))
156 port.
extras.insert(it.key(), it.value());
166 QCborMap cbor = QCborMap::fromJsonObject(
extras);
167 cbor[QLatin1String(
"name")] =
name;
168 cbor[QLatin1String(
"data_kind")] = dataKindToString(
dataKind);
169 cbor[QLatin1String(
"direction")] = portDirToString(
direction);
193 port.
name = cbor[QLatin1String(
"name")].toString();
194 port.
dataKind = dataKindFromString(cbor[QLatin1String(
"data_kind")].toString());
195 port.
direction = portDirFromString(cbor[QLatin1String(
"direction")].toString());
196 port.
sourceNodeId = cbor[QLatin1String(
"source_node")].toString();
197 port.
sourcePortName = cbor[QLatin1String(
"source_port")].toString();
198 port.
streamProtocol = cbor[QLatin1String(
"stream_protocol")].toString();
199 port.
streamEndpoint = cbor[QLatin1String(
"stream_endpoint")].toString();
200 port.
streamBufferMs = cbor[QLatin1String(
"stream_buffer_ms")].toInteger();
202 port.
cachedResultHash = cbor[QLatin1String(
"cached_result_hash")].toString();
204 static const QSet<QString> knownKeys = {
205 QStringLiteral(
"name"), QStringLiteral(
"data_kind"),
206 QStringLiteral(
"direction"), QStringLiteral(
"source_node"),
207 QStringLiteral(
"source_port"), QStringLiteral(
"stream_protocol"),
208 QStringLiteral(
"stream_endpoint"), QStringLiteral(
"stream_buffer_ms"),
209 QStringLiteral(
"cached_result"), QStringLiteral(
"cached_result_hash")
211 QJsonObject cborJson = cbor.toJsonObject();
212 for (
auto it = cborJson.constBegin(); it != cborJson.constEnd(); ++it) {
213 if (!knownKeys.contains(it.key()))
214 port.
extras.insert(it.key(), it.value());
Typed input or output slot on a graph node — carries an MnaDataKind, an upstream link,...
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).
Named, typed port on an MNA graph node with upstream link and optional real-time stream binding.
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