aqnwb 0.1.0
Loading...
Searching...
No Matches
NWBFile.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <cstdint>
5#include <memory>
6#include <string>
7#include <string_view>
8#include <vector>
9
10#include "Types.hpp"
11#include "Utils.hpp"
12#include "io/BaseIO.hpp"
13#include "io/ReadIO.hpp"
18#include "spec/core.hpp"
19
24namespace AQNWB::NWB
25{
26
31class NWBFile : public Container
32{
33public:
34 // Register the ElectrodesTable as a subclass of Container
36
37
41 NWBFile(std::shared_ptr<IO::BaseIO> io);
42
46 NWBFile(const std::string& path, std::shared_ptr<IO::BaseIO> io);
47
51 NWBFile(const NWBFile&) = delete;
52
56 NWBFile& operator=(const NWBFile&) = delete;
57
61 ~NWBFile();
62
76 Status initialize(const std::string& identifierText,
77 const std::string& description = "a recording session",
78 const std::string& dataCollection = "",
79 const std::string& sessionStartTime = "",
80 const std::string& timestampsReferenceTime = "");
81
89 bool isInitialized() const;
90
95
108 std::vector<Types::ChannelVector> recordingArrays);
109
128 std::vector<Types::ChannelVector> recordingArrays,
129 std::vector<std::string> recordingNames,
130 const IO::BaseDataType& dataType,
131 RecordingContainers* recordingContainers,
132 std::vector<SizeType>& containerIndexes);
133
149 std::vector<Types::ChannelVector> recordingArrays,
150 std::vector<std::string> recordingNames,
151 const IO::BaseDataType& dataType,
152 RecordingContainers* recordingContainers,
153 std::vector<SizeType>& containerIndexes);
154
164 Status createAnnotationSeries(std::vector<std::string> recordingNames,
165 RecordingContainers* recordingContainers,
166 std::vector<SizeType>& containerIndexes);
167
171 "table with the extracellular electrodes")
172
174 std::string,
175 "nwb_version",
176 File version string)
177
180 std::string,
181 "file_create_date",
182 A record of the date the file was created and of
183 subsequent modifications)
184
187 std::string,
188 "identifier",
189 A unique text identifier for the file)
190
193 std::string,
194 "session_description",
195 A description of the experimental session and data in the
196 file)
197
200 std::string,
201 "session_start_time",
202 Date and time of the experiment or session start)
203
206 std::string,
207 "timestamps_reference_time",
208 Date and time corresponding to time zero of all
209 timestamps)
210
211protected:
227 Status createFileStructure(const std::string& identifierText,
228 const std::string& description,
229 const std::string& dataCollection,
230 const std::string& sessionStartTime,
231 const std::string& timestampsReferenceTime);
232
233private:
240 void cacheSpecifications(const Types::NamespaceInfo& namespaceInfo);
241
242 inline const static std::string m_acquisitionPath = "/acquisition";
243
244 inline const static std::string m_specificationsPath = "/specifications";
245
250};
251
252} // namespace AQNWB::NWB
AQNWB::Types::Status Status
Definition BaseIO.hpp:22
#define REGISTER_SUBCLASS(T, NAMESPACE)
Macro to register a subclass with the RegisteredType class registry.
Definition RegisteredType.hpp:410
#define DEFINE_ATTRIBUTE_FIELD(name, default_type, fieldPath, description)
Defines a lazy-loaded attribute field accessor function.
Definition RegisteredType.hpp:443
#define DEFINE_DATASET_FIELD(readName, writeName, default_type, fieldPath, description)
Defines a lazy-loaded dataset field accessor function.
Definition RegisteredType.hpp:475
#define DEFINE_REGISTERED_FIELD(name, registeredType, fieldPath, description)
Defines a lazy-loaded accessor function for reading fields that are RegisteredTypes.
Definition RegisteredType.hpp:528
Represents a base data type.
Definition BaseIO.hpp:43
Container(const std::string &path, std::shared_ptr< IO::BaseIO > io)
Constructor.
Definition Container.cpp:10
Status initialize()
Initialize the container.
Definition Container.cpp:20
Represents a table containing electrode metadata.
Definition ElectrodesTable.hpp:17
static const std::string electrodesTablePath
The path to the ElectrodesTable.
Definition ElectrodesTable.hpp:69
Status createSpikeEventSeries(std::vector< Types::ChannelVector > recordingArrays, std::vector< std::string > recordingNames, const IO::BaseDataType &dataType, RecordingContainers *recordingContainers, std::vector< SizeType > &containerIndexes)
Create SpikeEventSeries objects to record data into. Created objects are stored in recordingContainer...
Definition NWBFile.cpp:268
std::shared_ptr< IO::BaseRecordingData > recordFileCreateDate(bool reset=false)
NWBFile(std::shared_ptr< IO::BaseIO > io)
Constructor for NWBFile class.
Definition NWBFile.cpp:35
Status createElectricalSeries(std::vector< Types::ChannelVector > recordingArrays, std::vector< std::string > recordingNames, const IO::BaseDataType &dataType, RecordingContainers *recordingContainers, std::vector< SizeType > &containerIndexes)
Create ElectricalSeries objects to record data into. Created objects are stored in recordingContainer...
Definition NWBFile.cpp:215
std::shared_ptr< IO::BaseRecordingData > recordTimestampsReferenceTime(bool reset=false)
std::shared_ptr< IO::BaseRecordingData > recordSessionStartTime(bool reset=false)
std::shared_ptr< IO::BaseRecordingData > recordIdentifier(bool reset=false)
NWBFile(const NWBFile &)=delete
Deleted copy constructor to prevent construction-copying.
std::unique_ptr< IO::ReadDataWrapper< DatasetField, VTYPE > > readSessionDescription() const
std::shared_ptr< RTYPE > readElectrodesTable() const
Status createFileStructure(const std::string &identifierText, const std::string &description, const std::string &dataCollection, const std::string &sessionStartTime, const std::string &timestampsReferenceTime)
Creates the default file structure. Note, this function will fail if the file is in a mode where new ...
Definition NWBFile.cpp:128
Status createElectrodesTable(std::vector< Types::ChannelVector > recordingArrays)
Create ElectrodesTable. Note, this function will fail if the file is in a mode where new objects cann...
Definition NWBFile.cpp:178
Status createAnnotationSeries(std::vector< std::string > recordingNames, RecordingContainers *recordingContainers, std::vector< SizeType > &containerIndexes)
Create AnnotationSeries objects to record data into. Created objects are stored in recordingContainer...
Definition NWBFile.cpp:337
NWBFile & operator=(const NWBFile &)=delete
Deleted copy assignment operator to prevent copying.
std::unique_ptr< ElectrodesTable > m_electrodeTable
The ElectrodesTable for the file.
Definition NWBFile.hpp:249
std::shared_ptr< IO::BaseRecordingData > recordSessionDescription(bool reset=false)
std::unique_ptr< IO::ReadDataWrapper< DatasetField, VTYPE > > readTimestampsReferenceTime() const
~NWBFile()
Destructor for NWBFile class.
Definition NWBFile.cpp:46
std::unique_ptr< IO::ReadDataWrapper< DatasetField, VTYPE > > readFileCreateDate() const
std::unique_ptr< IO::ReadDataWrapper< AttributeField, VTYPE > > readNWBVersion() const
void cacheSpecifications(const Types::NamespaceInfo &namespaceInfo)
Saves the specification files for the schema.
Definition NWBFile.cpp:367
bool isInitialized() const
Check if the NWB file is initialized.
Definition NWBFile.cpp:92
std::unique_ptr< IO::ReadDataWrapper< DatasetField, VTYPE > > readIdentifier() const
std::unique_ptr< IO::ReadDataWrapper< DatasetField, VTYPE > > readSessionStartTime() const
static const std::string m_acquisitionPath
Definition NWBFile.hpp:242
Status finalize()
Finalizes the NWB file by closing it.
Definition NWBFile.cpp:123
static const std::string m_specificationsPath
Definition NWBFile.hpp:244
The RecordingContainers class provides an interface for managing and holding groups of Containers acq...
Definition RecordingContainers.hpp:16
Provides definitions for various types used in the project.
Definition Types.hpp:16
Namespace for all classes related to the NWB data standard.
Definition TimeSeries.hpp:13
const std::string namespaceName
Definition core.hpp:21