Skip to content

Commit 1af0529

Browse files
oruebelstephprince
andauthored
Update ElectrodesTable type (#214)
* Update ElectrodesTable type * Rename ElectrodeTable to ElectrodesTable * Fix linter * Update docs/pages/devdocs/registered_types.dox --------- Co-authored-by: Steph Prince <[email protected]>
1 parent 25ca46b commit 1af0529

19 files changed

+87
-89
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ add_library(
3333
src/nwb/ecephys/ElectricalSeries.cpp
3434
src/nwb/ecephys/SpikeEventSeries.cpp
3535
src/nwb/file/ElectrodeGroup.cpp
36-
src/nwb/file/ElectrodeTable.cpp
36+
src/nwb/file/ElectrodesTable.cpp
3737
src/nwb/misc/AnnotationSeries.cpp
3838
src/nwb/hdmf/base/Container.cpp
3939
src/nwb/hdmf/base/Data.cpp

docs/pages/devdocs/read_design.dox

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,12 @@
327327
* via the \ref AQNWB::NWB::VectorData::readData "VectorData::readData" method for reading.
328328
*
329329
* In some cases, the data type for `VectorData` may be predetermined in the schema. For example, the `location` column
330-
* of the \ref AQNWB::NWB::ElectrodeTable "ElectrodeTable" requires string data. To simplify reading in such cases where
330+
* of the \ref AQNWB::NWB::ElectrodesTable "ElectrodesTable" requires string data. To simplify reading in such cases where
331331
* the data type is fixed, AqNWB defines \ref AQNWB::NWB::VectorDataTyped "VectorDataTyped<DTYPE>", which inherits from
332332
* \ref AQNWB::NWB::VectorData "VectorData". This class allows the data type to be specified at compile time via the class
333333
* template, enabling \ref AQNWB::NWB::VectorDataTyped "VectorDataTyped<DTYPE>::readData" to expose the data with the type
334334
* already set at compile time. When used in combination with the \ref DEFINE_REGISTERED_FIELD macro, this approach allows
335-
* \ref AQNWB::NWB::ElectrodeTable::readLocationColumn "ElectrodeTable::readLocationColumn" to return the data to the user
335+
* \ref AQNWB::NWB::ElectrodesTable::readLocationColumn "ElectrodesTable::readLocationColumn" to return the data to the user
336336
* with the type already set. The same approach is also applied in the case of \ref AQNWB::NWB::Data "Data" and its derived
337337
* class \ref AQNWB::NWB::DataTyped "DataTyped".
338338
*

docs/pages/devdocs/registered_types.dox

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
*
9292
* 6. Similarly, we use the \ref DEFINE_REGISTERED_FIELD macro to define getter methods for other
9393
* \ref AQNWB::NWB::RegisteredType "RegisteredType" objects that we own, such as a
94-
* \ref AQNWB::NWB::ElectrodeTable "ElectrodeTable" that owns
94+
* \ref AQNWB::NWB::ElectrodesTable "ElectrodesTable" that owns
9595
* predefined \ref AQNWB::NWB::VectorData "VectorData" columns:
9696
* @code
9797
* DEFINE_REGISTERED_FIELD(readGroupNameColumn, VectorData<std::string>, "group_name", "the name of the ElectrodeGroup")
@@ -273,7 +273,7 @@
273273
* the same as the `neurodata_type`. However, in some cases this may not be possible.
274274
* In this case, we need to use \ref REGISTER_SUBCLASS_WITH_TYPENAME macro instead of
275275
* \ref REGISTER_SUBCLASS. E.g. using
276-
* ``REGISTER_SUBCLASS_WITH_TYPENAME(ElectrodeTable, "core", "DynamicTable")``,
276+
* ``REGISTER_SUBCLASS_WITH_TYPENAME(ElectrodesTable, "core", "DynamicTable")``,
277277
* the class will be registered in the registry, under the ``core::ElectrodesTable`` key,
278278
* but with "DynamicTable" as the typename value and the `ElectrodesTable.getTypeName`
279279
* automatic override returning the indicated typename instead of the classname.
@@ -284,12 +284,12 @@
284284
* An example is \ref AQNWB::NWB::VectorData "VectorData" which uses a template parameter to define the
285285
* data type of data that is manages.
286286
* 2. A class for a modified type that does not have its own `neurodata_type`
287-
* in the NWB schema. An example is `ElectrodesTable` in NWB <v2.7, which
287+
* in the NWB schema. An example is `ElectrodesTable` in NWB <v2.9, which
288288
* did not have an assigned `neurodata_type`, but was implemented as a regular
289-
* `DynamicTable`. To allow us to define a class `ElectrodeTable` to help with writing the table
290-
* we can then use ``REGISTER_SUBCLASS_WITH_TYPENAME(ElectrodeTable, "core", "DynamicTable")``
291-
* in the \ref AQNWB::NWB::ElectrodeTable "ElectrodeTable" class. This ensures that the `neurodata_type` attribute is set
292-
* correctly to `DynamicTable` on write instead of `ElectrodeTable`.
289+
* `DynamicTable`. To allow us to define a class `ElectrodesTable` to help with writing the table
290+
* we can then use ``REGISTER_SUBCLASS_WITH_TYPENAME(ElectrodesTable, "core", "DynamicTable")``
291+
* in the \ref AQNWB::NWB::ElectrodesTable "ElectrodesTable" class. This ensures that the `neurodata_type` attribute is set
292+
* correctly to `DynamicTable` on write instead of `ElectrodesTable`.
293293
*
294294
* \subsection implement_templated_registered_type Templated RegisteredType Classes
295295
*
@@ -387,21 +387,21 @@
387387
*
388388
* The main limitaton of the \ref REGISTER_SUBCLASS_WITH_TYPENAME approach is that on read, AqNWB
389389
* will use the default class associated with the `neurodata_type`. E.g., in the case of
390-
* the \ref AQNWB::NWB::ElectrodeTable "ElectrodeTable" class, by default the regular
390+
* the \ref AQNWB::NWB::ElectrodesTable "ElectrodesTable" class, by default the regular
391391
* \ref AQNWB::NWB::DynamicTable "DynamicTable" class will be used since that is what
392392
* the schema is indicating to use. Similarly, for \ref AQNWB::NWB::VectorData "VectorData"
393393
* the default `VectorData<std::any>` will be used on read. To support reading using the
394394
* more specific types, we can use the \ref DEFINE_REGISTERED_FIELD macro to define
395395
* read methods that will return the approbriate type, e.g.:
396396
*
397397
* \code
398-
* DEFINE_REGISTERED_FIELD(readElectrodeTable,
399-
* ElectrodeTable,
400-
* ElectrodeTable::electrodeTablePath,
398+
* DEFINE_REGISTERED_FIELD(readElectrodesTable,
399+
* ElectrodesTable,
400+
* ElectrodesTable::electrodeTablePath,
401401
* "table with the extracellular electrodes")
402402
* \endcode
403403
*
404-
* in \ref AQNWB::NWB::NWBFile "NWBFile" to read the \ref AQNWB::NWB::ElectrodeTable "ElectrodeTable",
404+
* in \ref AQNWB::NWB::NWBFile "NWBFile" to read the \ref AQNWB::NWB::ElectrodesTable "ElectrodesTable",
405405
* or
406406
*
407407
* \code
@@ -412,7 +412,7 @@
412412
* "the name of the ElectrodeGroup this electrode is a part of")
413413
* \endcode
414414
*
415-
* in the \ref AQNWB::NWB::ElectrodeTable "ElectrodeTable" to read the `group_name` column
415+
* in the \ref AQNWB::NWB::ElectrodesTable "ElectrodesTable" to read the `group_name` column
416416
* as `VectorData<std::string>` with the data type already specified as `std::string` at compile time.
417417
*
418418
* \section using_schematype_to_aqnwb Using the schematype_to_aqnwb.py Utility

docs/pages/userdocs/read.dox

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
* When the path and type of objects is fixed in the schema (or we know them based on other conventions),
3333
* then we can read the types directly from the file. E.g., here we first read the
3434
* \ref AQNWB::NWB::NWBFile "NWBFile" directly, which we know exists at the root "/"
35-
* of the file. We then read the \ref AQNWB::NWB::ElectrodeTable "ElectrodeTable"
36-
* via the predefined \ref AQNWB::NWB::NWBFile::readElectrodeTable "NWBFile::readElectrodeTable"
35+
* of the file. We then read the \ref AQNWB::NWB::ElectrodesTable "ElectrodesTable"
36+
* via the predefined \ref AQNWB::NWB::NWBFile::readElectrodesTable "NWBFile::readElectrodesTable"
3737
* method. The advantage of this approach is that we do not need to manually specify paths
3838
* or object types. Similarly, when we read the `locations` columns, we do not need to
3939
* specify the name or the data type to use.

docs/pages/userdocs/workflow.dox

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* 3. Create the \ref AQNWB::NWB::NWBFile "NWBFile" object used for managing and creating NWB
1616
* file contents.
1717
* 4. Create the recording metadata stored in ``/general`` in NWB, e.g., the
18-
* \ref AQNWB::NWB::ElectrodeTable "ElectrodeTable" object used for
18+
* \ref AQNWB::NWB::ElectrodesTable "ElectrodesTable" object used for
1919
* saving electrodes information.
2020
* 5. Create the \ref AQNWB::NWB::Container "Container" objects (e.g.,
2121
* \ref AQNWB::NWB::ElectricalSeries "ElectricalSeries") used for recording and add them
@@ -59,7 +59,7 @@
5959
*
6060
* \subsection create_recmeta 4. Create the recording metadata
6161
* \subsubsection create_recmeta_ecephys Create the extracellular recording metadata
62-
* Next, construct the \ref AQNWB::NWB::ElectrodeTable "ElectrodeTable" object,
62+
* Next, construct the \ref AQNWB::NWB::ElectrodesTable "ElectrodesTable" object,
6363
* using the `recordingArrays` as an input. Note that in many cases, you will be recording from
6464
* all electrodes detected by the device and this `recordingArrays` structure will be the same as
6565
* is used to create the \ref AQNWB::NWB::ElectricalSeries "ElectricalSeries". However in some cases

src/nwb/NWBFile.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ Status NWBFile::createFileStructure(const std::string& identifierText,
178178
Status NWBFile::createElectrodesTable(
179179
std::vector<Types::ChannelVector> recordingArrays)
180180
{
181-
std::unique_ptr<NWB::ElectrodeTable> electrodeTable =
182-
std::make_unique<NWB::ElectrodeTable>(m_io);
181+
std::unique_ptr<NWB::ElectrodesTable> electrodeTable =
182+
std::make_unique<NWB::ElectrodesTable>(m_io);
183183
electrodeTable->initialize();
184184
for (const auto& channelVector : recordingArrays) {
185185
electrodeTable->addElectrodes(channelVector);
@@ -229,7 +229,7 @@ Status NWBFile::createElectricalSeries(
229229

230230
// Setup electrode table if it was not yet created
231231
bool electrodeTableCreated =
232-
m_io->objectExists(ElectrodeTable::electrodeTablePath);
232+
m_io->objectExists(ElectrodesTable::electrodeTablePath);
233233
if (!electrodeTableCreated) {
234234
std::cerr << "NWBFile::createElectricalSeries requires an electrodes table "
235235
"to be present"
@@ -282,7 +282,7 @@ Status NWBFile::createSpikeEventSeries(
282282

283283
// Setup electrode table if it was not yet created
284284
bool electrodeTableCreated =
285-
m_io->objectExists(ElectrodeTable::electrodeTablePath);
285+
m_io->objectExists(ElectrodesTable::electrodeTablePath);
286286
if (!electrodeTableCreated) {
287287
std::cerr << "NWBFile::createElectricalSeries requires an electrodes table "
288288
"to be present"

src/nwb/NWBFile.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "io/ReadIO.hpp"
1414
#include "nwb/RecordingContainers.hpp"
1515
#include "nwb/base/TimeSeries.hpp"
16-
#include "nwb/file/ElectrodeTable.hpp"
16+
#include "nwb/file/ElectrodesTable.hpp"
1717
#include "nwb/hdmf/base/Container.hpp"
1818
#include "spec/core.hpp"
1919

@@ -31,7 +31,7 @@ namespace AQNWB::NWB
3131
class NWBFile : public Container
3232
{
3333
public:
34-
// Register the ElectrodeTable as a subclass of Container
34+
// Register the ElectrodesTable as a subclass of Container
3535
REGISTER_SUBCLASS(NWBFile, AQNWB::SPEC::CORE::namespaceName)
3636

3737
/**
@@ -165,9 +165,9 @@ class NWBFile : public Container
165165
RecordingContainers* recordingContainers,
166166
std::vector<SizeType>& containerIndexes);
167167

168-
DEFINE_REGISTERED_FIELD(readElectrodeTable,
169-
ElectrodeTable,
170-
ElectrodeTable::electrodeTablePath,
168+
DEFINE_REGISTERED_FIELD(readElectrodesTable,
169+
ElectrodesTable,
170+
ElectrodesTable::electrodeTablePath,
171171
"table with the extracellular electrodes")
172172

173173
DEFINE_ATTRIBUTE_FIELD(readNWBVersion,
@@ -244,9 +244,9 @@ class NWBFile : public Container
244244
inline const static std::string m_specificationsPath = "/specifications";
245245

246246
/**
247-
* @brief The ElectrodeTable for the file
247+
* @brief The ElectrodesTable for the file
248248
*/
249-
std::unique_ptr<ElectrodeTable> m_electrodeTable;
249+
std::unique_ptr<ElectrodesTable> m_electrodeTable;
250250
};
251251

252252
} // namespace AQNWB::NWB

src/nwb/ecephys/ElectricalSeries.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "nwb/ecephys/ElectricalSeries.hpp"
22

33
#include "Utils.hpp"
4-
#include "nwb/file/ElectrodeTable.hpp"
4+
#include "nwb/file/ElectrodesTable.hpp"
55

66
using namespace AQNWB::NWB;
77

@@ -39,7 +39,7 @@ Status ElectricalSeries::initialize(const IO::ArrayDataSetConfig& dataConfig,
3939

4040
// get the number of electrodes from the electrode table
4141
std::string idPath =
42-
AQNWB::mergePaths(ElectrodeTable::electrodeTablePath, "id");
42+
AQNWB::mergePaths(ElectrodesTable::electrodeTablePath, "id");
4343
std::vector<SizeType> elecTableDsetSize = m_io->getStorageObjectShape(idPath);
4444
SizeType numElectrodes = elecTableDsetSize[0];
4545

@@ -94,7 +94,7 @@ Status ElectricalSeries::initialize(const IO::ArrayDataSetConfig& dataConfig,
9494
m_io->createAttribute("the electrodes that generated this electrical series",
9595
electrodesPath,
9696
"description");
97-
m_io->createReferenceAttribute(ElectrodeTable::electrodeTablePath,
97+
m_io->createReferenceAttribute(ElectrodesTable::electrodeTablePath,
9898
AQNWB::mergePaths(getPath(), "electrodes"),
9999
"table");
100100

src/nwb/ecephys/ElectricalSeries.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "io/BaseIO.hpp"
88
#include "io/ReadIO.hpp"
99
#include "nwb/base/TimeSeries.hpp"
10-
#include "nwb/file/ElectrodeTable.hpp"
10+
#include "nwb/file/ElectrodesTable.hpp"
1111
#include "spec/core.hpp"
1212

1313
namespace AQNWB::NWB
@@ -112,7 +112,7 @@ class ElectricalSeries : public TimeSeries
112112

113113
DEFINE_REFERENCED_REGISTERED_FIELD(
114114
readElectrodesTable,
115-
ElectrodeTable,
115+
ElectrodesTable,
116116
"electrodes/table",
117117
The electrodes table retrieved from the object referenced in the
118118
`electrodes / table` attribute.)

src/nwb/file/ElectrodeTable.cpp renamed to src/nwb/file/ElectrodesTable.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
#include "nwb/file/ElectrodeTable.hpp"
1+
#include "nwb/file/ElectrodesTable.hpp"
22

33
#include "Channel.hpp"
44
#include "Utils.hpp"
55

66
using namespace AQNWB::NWB;
77

8-
// ElectrodeTable
8+
// ElectrodesTable
99
// Initialize the static registered_ member to trigger registration
10-
REGISTER_SUBCLASS_IMPL(ElectrodeTable)
10+
REGISTER_SUBCLASS_IMPL(ElectrodesTable)
1111

1212
/** Constructor */
13-
ElectrodeTable::ElectrodeTable(std::shared_ptr<IO::BaseIO> io)
13+
ElectrodesTable::ElectrodesTable(std::shared_ptr<IO::BaseIO> io)
1414
: DynamicTable(electrodeTablePath, // use the electrodeTablePath
1515
io)
1616
, m_electrodeDataset(std::make_unique<ElementIdentifiers>(
@@ -22,8 +22,8 @@ ElectrodeTable::ElectrodeTable(std::shared_ptr<IO::BaseIO> io)
2222
{
2323
}
2424

25-
ElectrodeTable::ElectrodeTable(const std::string& path,
26-
std::shared_ptr<IO::BaseIO> io)
25+
ElectrodesTable::ElectrodesTable(const std::string& path,
26+
std::shared_ptr<IO::BaseIO> io)
2727
: DynamicTable(electrodeTablePath, io)
2828
, m_electrodeDataset(std::make_unique<ElementIdentifiers>(
2929
AQNWB::mergePaths(electrodeTablePath, "id"), io))
@@ -32,14 +32,14 @@ ElectrodeTable::ElectrodeTable(const std::string& path,
3232
, m_locationsDataset(std::make_unique<VectorData>(
3333
AQNWB::mergePaths(electrodeTablePath, "location"), io))
3434
{
35-
assert(path == this->electrodeTablePath && "ElectrodeTable object is required to appear at /general/extracellular_ephys/electrodes");
35+
assert(path == this->electrodeTablePath && "ElectrodesTable object is required to appear at /general/extracellular_ephys/electrodes");
3636
}
3737

3838
/** Destructor */
39-
ElectrodeTable::~ElectrodeTable() {}
39+
ElectrodesTable::~ElectrodesTable() {}
4040

4141
/** Initialization function*/
42-
Status ElectrodeTable::initialize(const std::string& description)
42+
Status ElectrodesTable::initialize(const std::string& description)
4343
{
4444
// create group
4545
DynamicTable::initialize(description);
@@ -64,7 +64,7 @@ Status ElectrodeTable::initialize(const std::string& description)
6464
return electrodeStatus && groupNameStatus && locationStatus;
6565
}
6666

67-
void ElectrodeTable::addElectrodes(std::vector<Channel> channelsInput)
67+
void ElectrodesTable::addElectrodes(std::vector<Channel> channelsInput)
6868
{
6969
// create datasets
7070
for (const auto& ch : channelsInput) {
@@ -76,7 +76,7 @@ void ElectrodeTable::addElectrodes(std::vector<Channel> channelsInput)
7676
}
7777
}
7878

79-
Status ElectrodeTable::finalize()
79+
Status ElectrodesTable::finalize()
8080
{
8181
Status rowIdStatus = setRowIDs(m_electrodeDataset, m_electrodeNumbers);
8282
Status locationColStatus = addColumn(m_locationsDataset, m_locationNames);

0 commit comments

Comments
 (0)