Skip to content

Commit

Permalink
Update ElectrodeTable to use m_ member names
Browse files Browse the repository at this point in the history
  • Loading branch information
oruebel committed Sep 23, 2024
1 parent 3affcca commit 30e1226
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 35 deletions.
40 changes: 20 additions & 20 deletions src/nwb/file/ElectrodeTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ ElectrodeTable::ElectrodeTable(std::shared_ptr<IO::BaseIO> io)
: DynamicTable(electrodeTablePath, // use the electrodeTablePath
io,
{"group", "group_name", "location"})
, electrodeDataset(std::make_unique<ElementIdentifiers>(
, m_electrodeDataset(std::make_unique<ElementIdentifiers>(
AQNWB::mergePaths(electrodeTablePath, "id"), io))
, groupNamesDataset(std::make_unique<VectorData>(
, m_groupNamesDataset(std::make_unique<VectorData>(
AQNWB::mergePaths(electrodeTablePath, "group_name"), io))
, locationsDataset(std::make_unique<VectorData>(
, m_locationsDataset(std::make_unique<VectorData>(
AQNWB::mergePaths(electrodeTablePath, "location"), io))
{
}
Expand All @@ -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<ElementIdentifiers>(
, m_electrodeDataset(std::make_unique<ElementIdentifiers>(
AQNWB::mergePaths(electrodeTablePath, "id"), io))
, groupNamesDataset(std::make_unique<VectorData>(
, m_groupNamesDataset(std::make_unique<VectorData>(
AQNWB::mergePaths(electrodeTablePath, "group_name"), io))
, locationsDataset(std::make_unique<VectorData>(
, m_locationsDataset(std::make_unique<VectorData>(
AQNWB::mergePaths(electrodeTablePath, "location"), io))
{
std::cerr << "ElectrodeTable object is required to appear at "
Expand All @@ -49,17 +49,17 @@ void ElectrodeTable::initialize(const std::string& description)
// create group
DynamicTable::initialize(description);

electrodeDataset->setDataset(std::unique_ptr<IO::BaseRecordingData>(
m_electrodeDataset->setDataset(std::unique_ptr<IO::BaseRecordingData>(
m_io->createArrayDataSet(IO::BaseDataType::I32,
SizeArray {1},
SizeArray {1},
AQNWB::mergePaths(m_path, "id"))));
groupNamesDataset->setDataset(std::unique_ptr<IO::BaseRecordingData>(
m_groupNamesDataset->setDataset(std::unique_ptr<IO::BaseRecordingData>(
m_io->createArrayDataSet(IO::BaseDataType::STR(250),
SizeArray {0},
SizeArray {1},
AQNWB::mergePaths(m_path, "group_name"))));
locationsDataset->setDataset(std::unique_ptr<IO::BaseRecordingData>(
m_locationsDataset->setDataset(std::unique_ptr<IO::BaseRecordingData>(
m_io->createArrayDataSet(IO::BaseDataType::STR(250),
SizeArray {0},
SizeArray {1},
Expand All @@ -70,26 +70,26 @@ void ElectrodeTable::addElectrodes(std::vector<Channel> 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);
}
37 changes: 22 additions & 15 deletions src/nwb/file/ElectrodeTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

/**
Expand All @@ -75,45 +75,52 @@ class ElectrodeTable : public DynamicTable
*/
void setGroupPath(const std::string& groupPath);

std::unique_ptr<ElementIdentifiers> electrodeDataset;
std::unique_ptr<VectorData> groupNamesDataset;
std::unique_ptr<VectorData> locationsDataset;

/**
* @brief The path to the ElectrodeTable.
*/
inline const static std::string electrodeTablePath =
"/general/extracellular_ephys/electrodes";

private:
/**
* @brief The channel information from the acquisition system.
*/
std::vector<Channel> channels;

/**
* @brief The global indices for each electrode.
*/
std::vector<int> electrodeNumbers;
std::vector<int> m_electrodeNumbers;

/**
* @brief The names of the ElectrodeGroup object for each electrode.
*/
std::vector<std::string> groupNames;
std::vector<std::string> m_groupNames;

/**
* @brief The location names for each electrode.
*/
std::vector<std::string> locationNames;
std::vector<std::string> m_locationNames;

/**
* @brief The references to the ElectrodeGroup object for each electrode.
*/
std::vector<std::string> groupReferences;
std::vector<std::string> 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<ElementIdentifiers> m_electrodeDataset;

/**
* @brief The group names column for write
*/
std::unique_ptr<VectorData> m_groupNamesDataset;

/**
* @brief The locations column for write
*/
std::unique_ptr<VectorData> m_locationsDataset;
};
} // namespace AQNWB::NWB

0 comments on commit 30e1226

Please sign in to comment.