Skip to content

Commit

Permalink
switch from dorsal/ventral to superior/inferior
Browse files Browse the repository at this point in the history
  • Loading branch information
bendichter committed Jul 11, 2024
1 parent d1e3124 commit 6aeb180
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
10 changes: 5 additions & 5 deletions spec/ndx-anatomical-localization.extensions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ groups:
dtype: text
required: true
- name: x
doc: "One of: APLRDV, communicating the axis and direction of the x coordinate"
doc: "One of: APLRSI, communicating the axis and direction of the x coordinate. For dorsal/ventral use 'S/I' (superior/inferior)."
dtype: text
required: true
- name: y
doc: "One of: APLRDV, communicating the axis and direction of the y coordinate"
- name: "y"
doc: "One of: APLRSI, communicating the axis and direction of the y coordinate. For dorsal/ventral use 'S/I' (superior/inferior)."
dtype: text
required: true
- name: z
doc: "One of: APLRDV, communicating the axis and direction of the z coordinate"
doc: "One of: APLRSI, communicating the axis and direction of the z coordinate. For dorsal/ventral use 'S/I' (superior/inferior)."
dtype: text
required: true
- neurodata_type_def: AnatonicalCoordinatesTable
Expand All @@ -45,7 +45,7 @@ groups:
neurodata_type_inc: VectorData
doc: "The x coordinate"
quantity: 1
- name: y
- name: "y"
neurodata_type_inc: VectorData
doc: "The y coordinate"
quantity: 1
Expand Down
32 changes: 22 additions & 10 deletions src/pynwb/ndx_anatomical_localization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,43 @@
TempAnatonicalCoordinatesTable = get_class("AnatonicalCoordinatesTable", "ndx-anatomical-localization")





@register_class("Space", "ndx-anatomical-localization")
class Space(TempSpace):
def __init__(self, name, space_name, origin, units, x, y, z):
valid_values = ["A", "P", "L", "R", "D", "V"]
assert x in valid_values, "x must be one of 'A', 'P', 'L', 'R', 'D', 'V'"
assert y in valid_values, "y must be one of 'A', 'P', 'L', 'R', 'D', 'V'"
assert z in valid_values, "z must be one of 'A', 'P', 'L', 'R', 'D', 'V'"
valid_values = ["A", "P", "L", "R", "S", "I"]
assert x in valid_values, "x must be one of 'A', 'P', 'L', 'R', 'S', 'I'"
assert y in valid_values, "y must be one of 'A', 'P', 'L', 'R', 'S', 'I'"
assert z in valid_values, "z must be one of 'A', 'P', 'L', 'R', 'S', 'I'"

map = dict(A="AP", P="AP", L="LR", R="LR", D="DV", V="DV")
new_var = [map[var] for var in (x,y,z)]
assert len(set(new_var)) == 3, "x, y, and z must be unique dimensions (AP, LR, DV)"
map = {"A": "AP", "P": "AP", "L": "LR", "R": "LR", "S": "SI", "I": "SI"}
new_var = [map[var] for var in (x, y, z)]
assert len(set(new_var)) == 3, "x, y, and z must be unique dimensions (AP, LR, SI)"

super().__init__(name=name, space_name=space_name, origin=origin, units=units, x=x, y=y, z=z)


@classmethod
def get_predefined_space(cls, space_name):
if space_name == "CCFv3":
return Space(
name="space",
space_name="CCFv3",
origin="In the middle of the anterior commissure",
units="um",
x="R",
y="A",
z="S"
)


@register_class("AnatonicalCoordinatesTable", "ndx-anatomical-localization")
class AnatonicalCoordinatesTable(TempAnatonicalCoordinatesTable):
def __init__(self, name, target, description, space, method):
super().__init__(name=name, description=description, space=space, method=method)
self.target_object.table = target



# NOTE: `widgets/tetrode_series_widget.py` adds a "widget"
# attribute to the TetrodeSeries class. This attribute is used by NWBWidgets.
# Delete the `widgets` subpackage or the `tetrode_series_widget.py` module
Expand Down
3 changes: 2 additions & 1 deletion src/pynwb/tests/test_anatomical_coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def test_create_anatonical_coordinates_table():

electrodes_table = mock_ElectrodeTable()

space = Space(name="space", space_name="CCF", origin="origin", units="um", x="A", y="D", z="L")
#space = Space(name="space", space_name="CCF", origin="origin", units="um", x="A", y="S", z="L")
space = Space.get_predefined_space("CCFv3")

table = AnatonicalCoordinatesTable(
name="MyAnatonicalLocalization",
Expand Down

0 comments on commit 6aeb180

Please sign in to comment.