Skip to main content

BidsCoordinateSystem

Namespace: BIDSLIB  ·  Library: BIDS Library

#include <bids/bids_coordinate_system.h>

struct BIDSLIB::BidsCoordinateSystem

Coordinate system metadata from *_coordsystem.json.

Describes the spatial reference frame used for electrode positions.

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());

Public Methods​

toFiffCoordTrans(fromFrame, toFrame)​

Convert parsed transform to a FiffCoordTrans.

Parameters:

  • fromFrame : int Source coordinate frame (default FIFFV_COORD_MRI = 5).

  • toFrame : int Destination coordinate frame (default FIFFV_COORD_HEAD = 4).

Returns:

  • FiffCoordTrans — FiffCoordTrans populated with the parsed 4x4 matrix.

Static Methods​

readJson(sFilePath)​

Read a BIDS *_coordsystem.json file.

Parameters:

  • sFilePath : const QString & Path to the coordsystem.json file.

Returns:


writeJson(sFilePath, cs)​

Write a BIDS *_coordsystem.json file.

Parameters:

  • sFilePath : const QString & Output path.

  • cs : const BidsCoordinateSystem & Coordinate system metadata.

Returns:

  • bool — true on success.

Example​

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 110
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​