BidsElectrode
Namespace: BIDSLIB · Library: BIDS Library
#include <bids/bids_electrode.h>
struct BIDSLIB::BidsElectrode
Electrode position record corresponding to one row in *_electrodes.tsv.
const BidsDatasetDescription description = BidsDatasetDescription::read(root + "/dataset_description.json");
const QList<BidsChannel> channels = BidsChannel::readTsv(channelsTsv); // one row per channel
const QList<BidsEvent> events = BidsEvent::readTsv(ieeg.eventsTsvPath().filePath()); // onset, duration, sample, value, trial_type
const QList<BidsElectrode> electrodes = BidsElectrode::readTsv(ieeg.electrodesTsvPath().filePath());
const BidsCoordinateSystem coords = BidsCoordinateSystem::readJson(ieeg.coordsystemJsonPath().filePath());
Static Methods
readTsv(sFilePath)
Read a BIDS *_electrodes.tsv file.
Parameters:
- sFilePath : const QString & Path to the electrodes.tsv file.
Returns:
- QList< BidsElectrode > — List of electrode records.
writeTsv(sFilePath, electrodes)
Write a BIDS *_electrodes.tsv file.
Parameters:
-
sFilePath : const QString & Output path.
-
electrodes : const QList< BidsElectrode > & List of electrode records.
Returns:
- bool — true on success.
toFiffDigPoints(electrodes, trans)
Convert a list of BIDS electrodes to a FIFF digitizer point set.
Each electrode with valid numeric x/y/z coordinates is converted to a FiffDigPoint with kind FIFFV_POINT_EEG. Electrodes with "n/a" coordinates are skipped.
If a coordinate transform is supplied, the positions are transformed from the BIDS coordinate frame into the FIFF head frame before insertion, and the points are in its target frame; otherwise their frame is FIFFV_COORD_UNKNOWN.
Parameters:
-
electrodes : const QList< BidsElectrode > & List of BIDS electrode records.
-
trans : const FiffCoordTrans & Optional coordinate transform (BIDS frame → head). Pass a default-constructed FiffCoordTrans to skip.
Returns:
- FiffDigPointSet — FiffDigPointSet with one point per valid electrode.
Example
- Full source:
src/examples/ex_bids/main.cpp - Build target:
ex_bids(runs under CTest)
Used in examples
ex_bids
BIDS library: paths, sidecar TSVs, BrainVision/EDF readers and a raw-data round trip.
const BidsDatasetDescription description = BidsDatasetDescription::read(root + "/dataset_description.json");
const QList<BidsChannel> channels = BidsChannel::readTsv(channelsTsv); // one row per channel
const QList<BidsEvent> events = BidsEvent::readTsv(ieeg.eventsTsvPath().filePath()); // onset, duration, sample, value, trial_type
const QList<BidsElectrode> electrodes = BidsElectrode::readTsv(ieeg.electrodesTsvPath().filePath());
const BidsCoordinateSystem coords = BidsCoordinateSystem::readJson(ieeg.coordsystemJsonPath().filePath());
ok &= expect(description.name == "MNE-CPP Test Dataset" && description.bidsVersion == "1.9.0" && channels.size() == 32 && channels[0].name == "FP1" && channels[0].units == "µV" && events.size() == 4 && events[3].sample == 5250 && events[3].value == 3 && events[3].trialType == "feedback" && electrodes.size() == 10 && electrodes[0].name == "FP1" && electrodes[0].x == "-0.0254" && coords.system == "ACPC" && coords.units == "m",
"dataset_description, channels/events/electrodes.tsv and coordsystem.json read as written");
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>