v2.0.0
Loading...
Searching...
No Matches
bids_raw_data.h
Go to the documentation of this file.
1//=============================================================================================================
35
36#ifndef BIDS_RAW_DATA_H
37#define BIDS_RAW_DATA_H
38
39//=============================================================================================================
40// INCLUDES
41//=============================================================================================================
42
43#include "bids_global.h"
44#include "bids_event.h"
45#include "bids_electrode.h"
47#include "bids_path.h"
49
50#include <fiff/fiff_raw_data.h>
51
52//=============================================================================================================
53// QT INCLUDES
54//=============================================================================================================
55
56#include <QSharedPointer>
57#include <QString>
58#include <QList>
59#include <QMap>
60
61//=============================================================================================================
62// DEFINE NAMESPACE BIDSLIB
63//=============================================================================================================
64
65namespace BIDSLIB
66{
67
68//=============================================================================================================
99{
100public:
101 using SPtr = QSharedPointer<BidsRawData>;
102 using ConstSPtr = QSharedPointer<const BidsRawData>;
103
104 //=========================================================================================================
109 {
110 bool overwrite{false};
111 bool copyData{true};
113 QString datasetName;
114 };
115
116 //=========================================================================================================
120 BidsRawData() = default;
121
122 //=========================================================================================================
126 ~BidsRawData() = default;
127
128 // Move-only: the reader holds exclusive ownership of the open file.
129 BidsRawData(BidsRawData&& other) noexcept;
130 BidsRawData& operator=(BidsRawData&& other) noexcept;
131 BidsRawData(const BidsRawData&) = delete;
133
134 //=========================================================================================================
135 // I/O — read
136 //=========================================================================================================
137
154 static BidsRawData read(const BIDSPath& bidsPath);
155
156 //=========================================================================================================
157 // I/O — write
158 //=========================================================================================================
159
179 BIDSPath write(const BIDSPath& bidsPath,
180 const QString& sourcePath,
181 const WriteOptions& options) const;
182
186 inline BIDSPath write(const BIDSPath& bidsPath,
187 const QString& sourcePath = QString()) const
188 {
189 return write(bidsPath, sourcePath, WriteOptions());
190 }
191
192 //=========================================================================================================
193 // Query
194 //=========================================================================================================
195
199 bool isValid() const { return m_bIsValid; }
200
204 void setValid(bool bValid) { m_bIsValid = bValid; }
205
209 void clear();
210
211 //=========================================================================================================
212 // Static helpers
213 //=========================================================================================================
214
222 static AbstractFormatReader::UPtr createReader(const QString& sExtension);
223
224 //=========================================================================================================
225 // Core data members (public, following mne-cpp convention)
226 //=========================================================================================================
227
229 QList<BidsEvent> events;
230 QMap<QString, int> eventIdMap;
231 QList<BidsElectrode> electrodes;
234
235 //=========================================================================================================
236 // iEEG sidecar metadata (integrated from *_{datatype}.json)
237 // Fields derivable from FiffInfo (sfreq, channel counts) are omitted —
238 // they are computed on write and applied on read.
239 //=========================================================================================================
240
243 QString manufacturer;
247
248private:
249 bool m_bIsValid{false};
250};
251
252} // namespace BIDSLIB
253
254#endif // BIDS_RAW_DATA_H
FiffRawData class declaration.
Contains the declaration of the AbstractFormatReader class.
BidsCoordinateSystem struct — iEEG coordinate system from *_coordsystem.json.
BIDSPath class declaration — BIDS-compliant path construction and entity management.
BidsElectrode struct — electrode position from *_electrodes.tsv.
bids library export/import macros.
#define BIDSSHARED_EXPORT
Definition bids_global.h:55
BidsEvent struct declaration — a single BIDS event annotation.
BIDS dataset reading, writing, path construction, and sidecar metadata handling for iEEG/EEG/MEG.
Coordinate system metadata from *_coordsystem.json.
BIDS-compliant path and filename construction.
Definition bids_path.h:92
static BidsRawData read(const BIDSPath &bidsPath)
Read a BIDS dataset from disk.
BIDSPath write(const BIDSPath &bidsPath, const QString &sourcePath=QString()) const
Convenience overload — write with default options.
bool isValid() const
Returns true if the data was loaded successfully.
FIFFLIB::FiffRawData raw
AbstractFormatReader::UPtr reader
BidsRawData(const BidsRawData &)=delete
QSharedPointer< BidsRawData > SPtr
QMap< QString, int > eventIdMap
BidsRawData & operator=(const BidsRawData &)=delete
void setValid(bool bValid)
Marks the data as valid or invalid.
QList< BidsElectrode > electrodes
QSharedPointer< const BidsRawData > ConstSPtr
BidsRawData & operator=(BidsRawData &&other) noexcept
QList< BidsEvent > events
BidsCoordinateSystem coordinateSystem
BIDSPath write(const BIDSPath &bidsPath, const QString &sourcePath, const WriteOptions &options) const
Write this dataset to a BIDS-compliant directory.
Options controlling how write() operates.
std::unique_ptr< AbstractFormatReader > UPtr
FIFF raw measurement data.