v2.0.0
Loading...
Searching...
No Matches
bids_path.h
Go to the documentation of this file.
1//=============================================================================================================
35
36#ifndef BIDS_PATH_H
37#define BIDS_PATH_H
38
39//=============================================================================================================
40// INCLUDES
41//=============================================================================================================
42
43#include "bids_global.h"
44
45//=============================================================================================================
46// QT INCLUDES
47//=============================================================================================================
48
49#include <QSharedPointer>
50#include <QString>
51#include <QMap>
52#include <QDir>
53
54//=============================================================================================================
55// DEFINE NAMESPACE BIDSLIB
56//=============================================================================================================
57
58namespace BIDSLIB
59{
60
61//=============================================================================================================
74{
75public:
76 using SPtr = QSharedPointer<BIDSPath>;
77 using ConstSPtr = QSharedPointer<const BIDSPath>;
78
79 //=========================================================================================================
83 BIDSPath();
84
85 //=========================================================================================================
97 BIDSPath(const QString& sRoot,
98 const QString& sSubject,
99 const QString& sSession = QString(),
100 const QString& sTask = QString(),
101 const QString& sDatatype = QString(),
102 const QString& sSuffix = QString(),
103 const QString& sExtension = QString());
104
105 //=========================================================================================================
111 BIDSPath(const BIDSPath& other);
112
113 //=========================================================================================================
117 ~BIDSPath();
118
119 //=========================================================================================================
120 // Entity setters
121 //=========================================================================================================
122
128 void setRoot(const QString& sRoot);
129
135 void setSubject(const QString& sSubject);
136
142 void setSession(const QString& sSession);
143
149 void setTask(const QString& sTask);
150
156 void setAcquisition(const QString& sAcquisition);
157
163 void setRun(const QString& sRun);
164
170 void setProcessing(const QString& sProcessing);
171
177 void setSpace(const QString& sSpace);
178
184 void setRecording(const QString& sRecording);
185
191 void setSplit(const QString& sSplit);
192
198 void setDescription(const QString& sDescription);
199
205 void setDatatype(const QString& sDatatype);
206
212 void setSuffix(const QString& sSuffix);
213
219 void setExtension(const QString& sExtension);
220
221 //=========================================================================================================
222 // Entity getters
223 //=========================================================================================================
224
226 QString root() const;
228 QString subject() const;
230 QString session() const;
232 QString task() const;
234 QString acquisition() const;
236 QString run() const;
238 QString processing() const;
240 QString space() const;
242 QString recording() const;
244 QString split() const;
246 QString description() const;
248 QString datatype() const;
250 QString suffix() const;
252 QString extension() const;
253
254 //=========================================================================================================
255 // Path construction
256 //=========================================================================================================
257
267 QString basename() const;
268
276 QString directory() const;
277
283 QString filePath() const;
284
285 //=========================================================================================================
286 // Convenience methods
287 //=========================================================================================================
288
297 BIDSPath withSuffix(const QString& sSuffix, const QString& sExtension) const;
298
304
310
316
321 BIDSPath eventsTsvPath() const;
322
329
334 bool exists() const;
335
340 bool mkdirs() const;
341
348 QList<BIDSPath> match() const;
349
350 //=========================================================================================================
351 // Validation
352 //=========================================================================================================
353
359 static bool isValidEntityValue(const QString& sValue);
360
361 //=========================================================================================================
362 // Operators
363 //=========================================================================================================
364
365 BIDSPath& operator=(const BIDSPath& other);
366 friend bool operator==(const BIDSPath& a, const BIDSPath& b);
367
368private:
369 QString m_sRoot;
370 QString m_sSubject;
371 QString m_sSession;
372 QString m_sTask;
373 QString m_sAcquisition;
374 QString m_sRun;
375 QString m_sProcessing;
376 QString m_sSpace;
377 QString m_sRecording;
378 QString m_sSplit;
379 QString m_sDescription;
380 QString m_sDatatype;
381 QString m_sSuffix;
382 QString m_sExtension;
383
387 static QString zeroPad(const QString& sValue);
388};
389
390//=============================================================================================================
391
392inline bool operator==(const BIDSPath& a, const BIDSPath& b)
393{
394 return a.root() == b.root() &&
395 a.subject() == b.subject() &&
396 a.session() == b.session() &&
397 a.task() == b.task() &&
398 a.acquisition() == b.acquisition() &&
399 a.run() == b.run() &&
400 a.processing() == b.processing() &&
401 a.space() == b.space() &&
402 a.recording() == b.recording() &&
403 a.split() == b.split() &&
404 a.description() == b.description() &&
405 a.datatype() == b.datatype() &&
406 a.suffix() == b.suffix() &&
407 a.extension() == b.extension();
408}
409
410} // namespace BIDSLIB
411
412#endif // BIDS_PATH_H
MNE-CPP BIDS library entry point: Qt symbol-visibility plumbing and the BIDSLIB namespace documentati...
#define BIDSSHARED_EXPORT
Definition bids_global.h:43
BIDS dataset reading, writing, path construction, and sidecar metadata handling for iEEG/EEG/MEG.
bool operator==(const BIDSPath &a, const BIDSPath &b)
Definition bids_path.h:392
QString subject() const
void setSession(const QString &sSession)
void setSpace(const QString &sSpace)
QString filePath() const
QString session() const
void setRecording(const QString &sRecording)
void setSubject(const QString &sSubject)
Definition bids_path.cpp:97
QString split() const
friend bool operator==(const BIDSPath &a, const BIDSPath &b)
Definition bids_path.h:392
void setDatatype(const QString &sDatatype)
QString description() const
BIDSPath electrodesTsvPath() const
bool exists() const
QString run() const
void setDescription(const QString &sDescription)
void setRun(const QString &sRun)
void setAcquisition(const QString &sAcquisition)
QString root() const
void setSplit(const QString &sSplit)
QSharedPointer< BIDSPath > SPtr
Definition bids_path.h:76
BIDSPath channelsTsvPath() const
static bool isValidEntityValue(const QString &sValue)
QString directory() const
QString acquisition() const
void setTask(const QString &sTask)
BIDSPath & operator=(const BIDSPath &other)
QString extension() const
void setProcessing(const QString &sProcessing)
void setRoot(const QString &sRoot)
Definition bids_path.cpp:93
QString space() const
QString suffix() const
QString basename() const
void setSuffix(const QString &sSuffix)
QString processing() const
QString recording() const
BIDSPath coordsystemJsonPath() const
QList< BIDSPath > match() const
QString task() const
BIDSPath withSuffix(const QString &sSuffix, const QString &sExtension) const
BIDSPath eventsTsvPath() const
void setExtension(const QString &sExtension)
bool mkdirs() const
QString datatype() const
QSharedPointer< const BIDSPath > ConstSPtr
Definition bids_path.h:77
BIDSPath sidecarJsonPath() const