BidsDatasetDescription
Namespace: BIDSLIB · Library: BIDS Library
#include <bids/bids_dataset_description.h>
struct BIDSLIB::BidsDatasetDescription
Dataset-level metadata from dataset_description.json.
Every BIDS dataset must contain a dataset_description.json at its root. This struct captures the required and recommended fields.
src/examples/ex_bids/main.cpp
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
read(sFilePath)
Read a dataset_description.json file.
Parameters:
- sFilePath : const QString & Path to dataset_description.json.
Returns:
- BidsDatasetDescription — Populated description, or default if file cannot be read.
write(sFilePath, desc)
Write a dataset_description.json file.
Parameters:
-
sFilePath : const QString & Output path.
-
desc : const BidsDatasetDescription & Dataset description to write.
Returns:
- bool — true on success.
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.
src/examples/ex_bids/main.cpp, line 109
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>