v2.0.0
Loading...
Searching...
No Matches
bids_path.h File Reference

Programmatic construction and matching of BIDS-compliant directories, filenames and sidecar paths. More...

#include "bids_global.h"
#include <QSharedPointer>
#include <QString>
#include <QMap>
#include <QDir>
Include dependency graph for bids_path.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  BIDSLIB::BIDSPath
 BIDS-compliant path and filename construction. More...

Namespaces

namespace  BIDSLIB
 BIDS dataset reading, writing, path construction, and sidecar metadata handling for iEEG/EEG/MEG.

Detailed Description

Programmatic construction and matching of BIDS-compliant directories, filenames and sidecar paths.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.1.0
Date
March 2026

The BIDS specification fixes both the directory layout (root/sub-XX/[ses-YY/]<datatype>/) and the <entity>-

ordering of the basename (sub, ses, task, acq, run, proc, space, rec, split, desc, then a _<suffix> and a .<ext>). BIDSPath is the value object that encodes those entities and emits canonical paths via BIDSPath::basename, BIDSPath::directory and BIDSPath::filePath, mirroring the API of mne_bids.BIDSPath in mne-python so call sites can be ported with minimal cognitive overhead.

Beyond serialisation, BIDSPath provides three orthogonal conveniences: BIDSPath::withSuffix and the dedicated channelsTsvPath / electrodesTsvPath / coordsystemJsonPath / eventsTsvPath / sidecarJsonPath helpers so a single BIDSPath instance can spawn every sidecar derived from a raw-data BIDSPath; BIDSPath::mkdirs to materialise the directory hierarchy lazily on write; and BIDSPath::match to enumerate actual on-disk files whose entity values complete the unset slots of the current path. Entity-value validation rejects the three characters BIDS forbids inside a label (-, _, /).

Spec: https://bids-specification.readthedocs.io/en/stable/common-principles.html#file-name-structure

Definition in file bids_path.h.