BIDS-compliant path and filename construction. More...
#include <bids_path.h>
Public Types | |
| using | SPtr = QSharedPointer<BIDSPath> |
| using | ConstSPtr = QSharedPointer<const BIDSPath> |
Public Member Functions | |
| BIDSPath () | |
| BIDSPath (const QString &sRoot, const QString &sSubject, const QString &sSession=QString(), const QString &sTask=QString(), const QString &sDatatype=QString(), const QString &sSuffix=QString(), const QString &sExtension=QString()) | |
| BIDSPath (const BIDSPath &other) | |
| ~BIDSPath () | |
| void | setRoot (const QString &sRoot) |
| void | setSubject (const QString &sSubject) |
| void | setSession (const QString &sSession) |
| void | setTask (const QString &sTask) |
| void | setAcquisition (const QString &sAcquisition) |
| void | setRun (const QString &sRun) |
| void | setProcessing (const QString &sProcessing) |
| void | setSpace (const QString &sSpace) |
| void | setRecording (const QString &sRecording) |
| void | setSplit (const QString &sSplit) |
| void | setDescription (const QString &sDescription) |
| void | setDatatype (const QString &sDatatype) |
| void | setSuffix (const QString &sSuffix) |
| void | setExtension (const QString &sExtension) |
| QString | root () const |
| QString | subject () const |
| QString | session () const |
| QString | task () const |
| QString | acquisition () const |
| QString | run () const |
| QString | processing () const |
| QString | space () const |
| QString | recording () const |
| QString | split () const |
| QString | description () const |
| QString | datatype () const |
| QString | suffix () const |
| QString | extension () const |
| QString | basename () const |
| QString | directory () const |
| QString | filePath () const |
| BIDSPath | withSuffix (const QString &sSuffix, const QString &sExtension) const |
| BIDSPath | channelsTsvPath () const |
| BIDSPath | electrodesTsvPath () const |
| BIDSPath | coordsystemJsonPath () const |
| BIDSPath | eventsTsvPath () const |
| BIDSPath | sidecarJsonPath () const |
| bool | exists () const |
| bool | mkdirs () const |
| QList< BIDSPath > | match () const |
| BIDSPath & | operator= (const BIDSPath &other) |
Static Public Member Functions | |
| static bool | isValidEntityValue (const QString &sValue) |
Friends | |
| bool | operator== (const BIDSPath &a, const BIDSPath &b) |
BIDS-compliant path and filename construction.
Manages BIDS-compliant file paths.
A BIDSPath encodes the BIDS entities (subject, session, task, acquisition, run, etc.) together with a datatype, suffix, extension, and root directory to produce fully qualified file paths that conform to the BIDS specification.
Example usage:
Definition at line 91 of file bids_path.h.
| using BIDSLIB::BIDSPath::ConstSPtr = QSharedPointer<const BIDSPath> |
Const shared pointer type for BIDSPath.
Definition at line 95 of file bids_path.h.
| using BIDSLIB::BIDSPath::SPtr = QSharedPointer<BIDSPath> |
Shared pointer type for BIDSPath.
Definition at line 94 of file bids_path.h.
| BIDSPath::BIDSPath | ( | ) |
Constructs an empty BIDSPath.
Definition at line 60 of file bids_path.cpp.
| BIDSPath::BIDSPath | ( | const QString & | sRoot, |
| const QString & | sSubject, | ||
| const QString & | sSession = QString(), | ||
| const QString & | sTask = QString(), | ||
| const QString & | sDatatype = QString(), | ||
| const QString & | sSuffix = QString(), | ||
| const QString & | sExtension = QString() ) |
Constructs a BIDSPath with the most common entities.
| [in] | sRoot | Root directory of the BIDS dataset. |
| [in] | sSubject | Subject label (without "sub-" prefix). |
| [in] | sSession | Session label (without "ses-" prefix). Can be empty. |
| [in] | sTask | Task label. Can be empty. |
| [in] | sDatatype | BIDS datatype (e.g. "ieeg", "eeg", "meg", "anat"). |
| [in] | sSuffix | Filename suffix (e.g. "ieeg", "channels", "electrodes"). |
| [in] | sExtension | File extension including dot (e.g. ".vhdr", ".tsv", ".json"). |
Definition at line 66 of file bids_path.cpp.
| BIDSPath::BIDSPath | ( | const BIDSPath & | other | ) |
Copy constructor.
Definition at line 85 of file bids_path.cpp.
| BIDSPath::~BIDSPath | ( | ) |
Destructor.
Definition at line 105 of file bids_path.cpp.
| QString BIDSPath::acquisition | ( | ) | const |
Acquisition label.
Definition at line 136 of file bids_path.cpp.
| QString BIDSPath::basename | ( | ) | const |
Constructs the BIDS-compliant filename (without directory).
Format: sub-<label>[ses-<label>][_task-<label>][_acq-<label>][_run-<index>] [_proc-<label>][_space-<label>][_rec-<label>][_split-<index>] [_desc-<label>]<suffix><extension>
Definition at line 151 of file bids_path.cpp.
| BIDSPath BIDSPath::channelsTsvPath | ( | ) | const |
Returns the path for the channels.tsv sidecar.
Definition at line 229 of file bids_path.cpp.
| BIDSPath BIDSPath::coordsystemJsonPath | ( | ) | const |
Returns the path for the coordsystem.json sidecar.
Definition at line 249 of file bids_path.cpp.
| QString BIDSPath::datatype | ( | ) | const |
BIDS datatype string.
Definition at line 143 of file bids_path.cpp.
| QString BIDSPath::description | ( | ) | const |
Description label.
Definition at line 142 of file bids_path.cpp.
| QString BIDSPath::directory | ( | ) | const |
Constructs the directory path for this entity combination.
Format: <root>/sub-<label>[/ses-<label>]/<datatype>/
Definition at line 192 of file bids_path.cpp.
| BIDSPath BIDSPath::electrodesTsvPath | ( | ) | const |
Returns the path for the electrodes.tsv sidecar.
Definition at line 236 of file bids_path.cpp.
| BIDSPath BIDSPath::eventsTsvPath | ( | ) | const |
Returns the path for the events.tsv sidecar.
Definition at line 262 of file bids_path.cpp.
| bool BIDSPath::exists | ( | ) | const |
Checks whether the file at filePath() exists on disk.
Definition at line 277 of file bids_path.cpp.
| QString BIDSPath::extension | ( | ) | const |
File extension.
Definition at line 145 of file bids_path.cpp.
| QString BIDSPath::filePath | ( | ) | const |
Constructs the full file path: directory() + basename().
Definition at line 210 of file bids_path.cpp.
|
static |
Validates entity values (no forbidden characters: -, _, /).
| [in] | sValue | Entity value to validate. |
Definition at line 370 of file bids_path.cpp.
| QList< BIDSPath > BIDSPath::match | ( | ) | const |
Searches the BIDS root for all files matching the current entities. Wildcards are used for unset entities.
Definition at line 294 of file bids_path.cpp.
| bool BIDSPath::mkdirs | ( | ) | const |
Creates the directory structure for this path (mkdir -p).
Definition at line 284 of file bids_path.cpp.
Definition at line 383 of file bids_path.cpp.
| QString BIDSPath::processing | ( | ) | const |
Processing label.
Definition at line 138 of file bids_path.cpp.
| QString BIDSPath::recording | ( | ) | const |
Recording label.
Definition at line 140 of file bids_path.cpp.
| QString BIDSPath::root | ( | ) | const |
BIDS dataset root path.
Definition at line 132 of file bids_path.cpp.
| QString BIDSPath::run | ( | ) | const |
Run index.
Definition at line 137 of file bids_path.cpp.
| QString BIDSPath::session | ( | ) | const |
Session label (without "ses-").
Definition at line 134 of file bids_path.cpp.
| void BIDSPath::setAcquisition | ( | const QString & | sAcquisition | ) |
Set the acquisition label.
Definition at line 117 of file bids_path.cpp.
| void BIDSPath::setDatatype | ( | const QString & | sDatatype | ) |
Set the BIDS datatype (e.g. "ieeg", "eeg", "meg", "anat").
Definition at line 124 of file bids_path.cpp.
| void BIDSPath::setDescription | ( | const QString & | sDescription | ) |
Set the description label.
Definition at line 123 of file bids_path.cpp.
| void BIDSPath::setExtension | ( | const QString & | sExtension | ) |
Set the file extension including dot (e.g. ".vhdr", ".tsv", ".json").
Definition at line 126 of file bids_path.cpp.
| void BIDSPath::setProcessing | ( | const QString & | sProcessing | ) |
Set the processing label.
Definition at line 119 of file bids_path.cpp.
| void BIDSPath::setRecording | ( | const QString & | sRecording | ) |
Set the recording label.
Definition at line 121 of file bids_path.cpp.
| void BIDSPath::setRoot | ( | const QString & | sRoot | ) |
Set the BIDS dataset root directory.
Definition at line 113 of file bids_path.cpp.
| void BIDSPath::setRun | ( | const QString & | sRun | ) |
Set the run index (will be zero-padded to 2 digits).
Definition at line 118 of file bids_path.cpp.
| void BIDSPath::setSession | ( | const QString & | sSession | ) |
Set the session label (without "ses-" prefix).
Definition at line 115 of file bids_path.cpp.
| void BIDSPath::setSpace | ( | const QString & | sSpace | ) |
Set the space label.
Definition at line 120 of file bids_path.cpp.
| void BIDSPath::setSplit | ( | const QString & | sSplit | ) |
Set the split index.
Definition at line 122 of file bids_path.cpp.
| void BIDSPath::setSubject | ( | const QString & | sSubject | ) |
Set the subject label (without "sub-" prefix).
Definition at line 114 of file bids_path.cpp.
| void BIDSPath::setSuffix | ( | const QString & | sSuffix | ) |
Set the filename suffix (e.g. "ieeg", "channels", "electrodes", "coordsystem").
Definition at line 125 of file bids_path.cpp.
| void BIDSPath::setTask | ( | const QString & | sTask | ) |
Set the task label.
Definition at line 116 of file bids_path.cpp.
| BIDSPath BIDSPath::sidecarJsonPath | ( | ) | const |
Returns the path for the sidecar JSON metadata file (e.g. *_ieeg.json, *_eeg.json).
Definition at line 269 of file bids_path.cpp.
| QString BIDSPath::space | ( | ) | const |
Space label.
Definition at line 139 of file bids_path.cpp.
| QString BIDSPath::split | ( | ) | const |
Split index.
Definition at line 141 of file bids_path.cpp.
| QString BIDSPath::subject | ( | ) | const |
Subject label (without "sub-").
Definition at line 133 of file bids_path.cpp.
| QString BIDSPath::suffix | ( | ) | const |
Filename suffix.
Definition at line 144 of file bids_path.cpp.
| QString BIDSPath::task | ( | ) | const |
Task label.
Definition at line 135 of file bids_path.cpp.
| BIDSPath BIDSPath::withSuffix | ( | const QString & | sSuffix, |
| const QString & | sExtension ) const |
Returns a copy of this BIDSPath with updated suffix and extension. Useful for deriving sidecar paths from a data path.
| [in] | sSuffix | New suffix (e.g. "channels", "electrodes", "coordsystem"). |
| [in] | sExtension | New extension (e.g. ".tsv", ".json"). |
Definition at line 219 of file bids_path.cpp.
Definition at line 406 of file bids_path.cpp.