From 30e12265b840aaa5d51e3c30ff5b3d75ef5e39c5 Mon Sep 17 00:00:00 2001 From: Oliver Ruebel Date: Mon, 23 Sep 2024 00:09:55 -0700 Subject: [PATCH] Update ElectrodeTable to use m_ member names --- src/nwb/file/ElectrodeTable.cpp | 40 ++++++++++++++++----------------- src/nwb/file/ElectrodeTable.hpp | 37 +++++++++++++++++------------- 2 files changed, 42 insertions(+), 35 deletions(-) diff --git a/src/nwb/file/ElectrodeTable.cpp b/src/nwb/file/ElectrodeTable.cpp index 67bb8f4..16c7fe6 100644 --- a/src/nwb/file/ElectrodeTable.cpp +++ b/src/nwb/file/ElectrodeTable.cpp @@ -14,11 +14,11 @@ ElectrodeTable::ElectrodeTable(std::shared_ptr io) : DynamicTable(electrodeTablePath, // use the electrodeTablePath io, {"group", "group_name", "location"}) - , electrodeDataset(std::make_unique( + , m_electrodeDataset(std::make_unique( AQNWB::mergePaths(electrodeTablePath, "id"), io)) - , groupNamesDataset(std::make_unique( + , m_groupNamesDataset(std::make_unique( AQNWB::mergePaths(electrodeTablePath, "group_name"), io)) - , locationsDataset(std::make_unique( + , m_locationsDataset(std::make_unique( AQNWB::mergePaths(electrodeTablePath, "location"), io)) { } @@ -28,11 +28,11 @@ ElectrodeTable::ElectrodeTable(const std::string& path, : DynamicTable( electrodeTablePath, // use the electrodeTablePath io) // TODO May need to initialize the colNames in DynamicTable - , electrodeDataset(std::make_unique( + , m_electrodeDataset(std::make_unique( AQNWB::mergePaths(electrodeTablePath, "id"), io)) - , groupNamesDataset(std::make_unique( + , m_groupNamesDataset(std::make_unique( AQNWB::mergePaths(electrodeTablePath, "group_name"), io)) - , locationsDataset(std::make_unique( + , m_locationsDataset(std::make_unique( AQNWB::mergePaths(electrodeTablePath, "location"), io)) { std::cerr << "ElectrodeTable object is required to appear at " @@ -49,17 +49,17 @@ void ElectrodeTable::initialize(const std::string& description) // create group DynamicTable::initialize(description); - electrodeDataset->setDataset(std::unique_ptr( + m_electrodeDataset->setDataset(std::unique_ptr( m_io->createArrayDataSet(IO::BaseDataType::I32, SizeArray {1}, SizeArray {1}, AQNWB::mergePaths(m_path, "id")))); - groupNamesDataset->setDataset(std::unique_ptr( + m_groupNamesDataset->setDataset(std::unique_ptr( m_io->createArrayDataSet(IO::BaseDataType::STR(250), SizeArray {0}, SizeArray {1}, AQNWB::mergePaths(m_path, "group_name")))); - locationsDataset->setDataset(std::unique_ptr( + m_locationsDataset->setDataset(std::unique_ptr( m_io->createArrayDataSet(IO::BaseDataType::STR(250), SizeArray {0}, SizeArray {1}, @@ -70,26 +70,26 @@ void ElectrodeTable::addElectrodes(std::vector channels) { // create datasets for (const auto& ch : channels) { - groupReferences.push_back( - AQNWB::mergePaths(groupPathBase, ch.getGroupName())); - groupNames.push_back(ch.getGroupName()); - electrodeNumbers.push_back(ch.getGlobalIndex()); - locationNames.push_back("unknown"); + m_groupReferences.push_back( + AQNWB::mergePaths(m_groupPathBase, ch.getGroupName())); + m_groupNames.push_back(ch.getGroupName()); + m_electrodeNumbers.push_back(ch.getGlobalIndex()); + m_locationNames.push_back("unknown"); } } void ElectrodeTable::finalize() { - setRowIDs(electrodeDataset, electrodeNumbers); + setRowIDs(m_electrodeDataset, m_electrodeNumbers); addColumn("group_name", "the name of the ElectrodeGroup this electrode is a part of", - groupNamesDataset, - groupNames); + m_groupNamesDataset, + m_groupNames); addColumn("location", "the location of channel within the subject e.g. brain region", - locationsDataset, - locationNames); + m_locationsDataset, + m_locationNames); addColumn("group", "a reference to the ElectrodeGroup this electrode is a part of", - groupReferences); + m_groupReferences); } diff --git a/src/nwb/file/ElectrodeTable.hpp b/src/nwb/file/ElectrodeTable.hpp index b73265c..d68b3ec 100644 --- a/src/nwb/file/ElectrodeTable.hpp +++ b/src/nwb/file/ElectrodeTable.hpp @@ -66,7 +66,7 @@ class ElectrodeTable : public DynamicTable inline std::string getGroupPath() const { // all channels in ChannelVector should have the same groupName - return groupReferences[0]; + return m_groupReferences[0]; } /** @@ -75,10 +75,6 @@ class ElectrodeTable : public DynamicTable */ void setGroupPath(const std::string& groupPath); - std::unique_ptr electrodeDataset; - std::unique_ptr groupNamesDataset; - std::unique_ptr locationsDataset; - /** * @brief The path to the ElectrodeTable. */ @@ -86,34 +82,45 @@ class ElectrodeTable : public DynamicTable "/general/extracellular_ephys/electrodes"; private: - /** - * @brief The channel information from the acquisition system. - */ - std::vector channels; - /** * @brief The global indices for each electrode. */ - std::vector electrodeNumbers; + std::vector m_electrodeNumbers; /** * @brief The names of the ElectrodeGroup object for each electrode. */ - std::vector groupNames; + std::vector m_groupNames; /** * @brief The location names for each electrode. */ - std::vector locationNames; + std::vector m_locationNames; /** * @brief The references to the ElectrodeGroup object for each electrode. */ - std::vector groupReferences; + std::vector m_groupReferences; /** * @brief The references path to the ElectrodeGroup */ - std::string groupPathBase = "/general/extracellular_ephys"; + inline const static std::string m_groupPathBase = + "/general/extracellular_ephys"; + + /** + * @brief The row ids data object for write + */ + std::unique_ptr m_electrodeDataset; + + /** + * @brief The group names column for write + */ + std::unique_ptr m_groupNamesDataset; + + /** + * @brief The locations column for write + */ + std::unique_ptr m_locationsDataset; }; } // namespace AQNWB::NWB