Skip to content

Commit afc439b

Browse files
Refactor ImagingSpace: Remove coordinate system metadata and update attributes
1 parent 485c770 commit afc439b

13 files changed

+68
-189
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
- **Breaking Change**: `OpticalLens`changed in `ObjectiveLens`
55
- **Breaking Change**: `MicroscopyChannel.indicator` changed from a nested group to a link reference
66
- **Breaking Change**: `MicroscopySeries.microscopy_rig` changed from a nested group to a link reference
7+
- **Breaking Change**: Simplified `ImagingSpace` class by removing coordinate system metadata:
8+
- Removed `origin_coordinates` dataset and its `unit` attribute
9+
- Renamed `location` attribute to `anatomical_target` for clearer semantics
10+
- Removed `reference_frame` attribute
11+
- Removed `orientation` attribute
712
- Updated `ndx-ophys-devices` dependency from v0.2.0 to v0.4.0
813

914
## Features

README.md

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -247,17 +247,10 @@ classDiagram
247247
class ImagingSpace {
248248
<<NWBContainer>>
249249
--------------------------------------
250-
datasets
251-
--------------------------------------
252-
**description** : text
253-
origin_coordinates : float64[3], optional
254-
unit : text = "micrometers"
255-
--------------------------------------
256250
attributes
257251
--------------------------------------
258-
location : text, optional
259-
reference_frame : text, optional
260-
orientation : text, optional
252+
**description** : text
253+
**anatomical_target** : text
261254
--------------------------------------
262255
groups
263256
--------------------------------------
@@ -434,17 +427,10 @@ classDiagram
434427
class ImagingSpace {
435428
<<NWBContainer>>
436429
--------------------------------------
437-
datasets
438-
--------------------------------------
439-
**description** : text
440-
origin_coordinates : float64[3], optional
441-
unit : text = "micrometers"
442-
--------------------------------------
443430
attributes
444431
--------------------------------------
445-
location : text, optional
446-
reference_frame : text, optional
447-
orientation : text, optional
432+
**description** : text
433+
**anatomical_target** : text
448434
--------------------------------------
449435
groups
450436
--------------------------------------

docs/source/examples.rst

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,7 @@ Complete example of two-photon calcium imaging with full optical path configurat
214214
description='Layer 2/3 of visual cortex',
215215
pixel_size_in_um=[1.0, 1.0],
216216
dimensions_in_pixels=[height, width],
217-
origin_coordinates=[-1.2, -0.6, -2.0],
218-
location='Visual cortex, layer 2/3',
219-
reference_frame='bregma',
220-
orientation='RAS', # Right-Anterior-Superior
217+
anatomical_target='Visual cortex, layer 2/3',
221218
illumination_pattern=line_scan # Include the illumination pattern
222219
)
223220
@@ -541,10 +538,7 @@ Example of volumetric imaging with 3D ROI segmentation:
541538
description='Visual cortex volume',
542539
voxel_size_in_um=[1.0, 1.0, 2.0], # Higher spacing in z
543540
dimensions_in_voxels=[height, width, depths],
544-
origin_coordinates=[-1.2, -0.6, -2.0],
545-
location='Visual cortex',
546-
reference_frame='bregma',
547-
orientation='RAS', # Right-Anterior-Superior
541+
anatomical_target='Visual cortex, layer 2/3',
548542
illumination_pattern=random_access_scan # Include the illumination pattern
549543
)
550544
@@ -882,10 +876,7 @@ Example of multi-plane imaging with an electrically tunable lens:
882876
description=f'Imaging plane at {depth} µm depth',
883877
pixel_size_in_um=[1.0, 1.0],
884878
dimensions_in_pixels=[height, width],
885-
origin_coordinates=[-1.2, -0.6, depth/1000], # Convert to mm
886-
location='Visual cortex',
887-
reference_frame='bregma',
888-
orientation='RAS',
879+
anatomical_target='Visual cortex',
889880
illumination_pattern=plane_acquisition # Include the illumination pattern
890881
)
891882

docs/source/format.rst

Lines changed: 15 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -360,52 +360,22 @@ Base type for metadata about the region being imaged.
360360
- neurodata_type_def: ImagingSpace
361361
neurodata_type_inc: NWBContainer
362362
doc: Abstract class to contain metadata about the region of physical space that imaging data was recorded from. Extended by PlanarImagingSpace and VolumetricImagingSpace.
363-
datasets:
364-
- name: origin_coordinates
365-
dtype: float64
366-
dims:
367-
- - x, y, z
368-
shape:
369-
- - 3
370-
doc:
371-
Physical location in stereotactic coordinates for the first element of the grid.
372-
See reference_frame to determine what the coordinates are relative to (e.g., bregma).
373-
quantity: "?"
374-
attributes:
375-
- name: unit
376-
dtype: text
377-
default_value: micrometers
378-
doc: Measurement units for origin coordinates. The default value is 'micrometers'.
379363
attributes:
380-
- name: description
381-
dtype: text
382-
doc: Description of the imaging space.
383-
- name: location
384-
dtype: text
385-
doc:
386-
General estimate of location in the brain being subset by this space.
387-
Specify the area, layer, etc.
388-
Use standard atlas names for anatomical regions when possible.
389-
Specify 'whole brain' if the entire brain is strictly contained within the space.
390-
required: false
391-
- name: reference_frame
392-
dtype: text
393-
doc:
394-
The reference frame for the origin coordinates. For example, 'bregma' or 'lambda' for rodent brains.
395-
If the origin coordinates are relative to a specific anatomical landmark, specify that here.
396-
required: false
397-
- name: orientation
398-
doc:
399-
"A 3-letter string. One of A,P,L,R,S,I for each of x, y, and z. For example, the most common
400-
orientation is 'RAS', which means x is right, y is anterior, and z is superior (a.k.a. dorsal).
401-
For dorsal/ventral use 'S/I' (superior/inferior). In the AnatomicalCoordinatesTable, an orientation of
402-
'RAS' corresponds to coordinates in the order of (ML (x), AP (y), DV (z))."
403-
dtype: text
404-
required: false
405-
groups:
406-
- neurodata_type_inc: IlluminationPattern
407-
doc: IlluminationPattern object containing metadata about the method used to acquire this imaging data.
408-
quantity: 1
364+
- name: description
365+
dtype: text
366+
doc: Description of the imaging space.
367+
required: false
368+
- name: anatomical_target
369+
dtype: text
370+
doc:
371+
Name of the targeted anatomical location being subset by this space.
372+
Specify the area, layer, etc. Use standard atlas names for anatomical regions when possible.
373+
Specify 'whole brain' if the entire brain is strictly contained within the space.
374+
required: true
375+
groups:
376+
- neurodata_type_inc: IlluminationPattern
377+
doc: IlluminationPattern object containing metadata about the method used to acquire this imaging data.
378+
quantity: 1
409379
410380
PlanarImagingSpace
411381
^^^^^^^^^^^^^^^

docs/source/getting_started.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ Here's a minimal example showing how to create a basic microscopy dataset:
246246
247247
# Define imaging space with illumination pattern
248248
planar_imaging_space = PlanarImagingSpace(
249-
name='cortex_plane',
250-
description='Layer 2/3 of visual cortex',
249+
name='PlanarImagingSpace',
250+
description='Imaging plane of layer 2/3 of visual cortex',
251251
pixel_size_in_um=[1.0, 1.0],
252252
dimensions_in_pixels=[512, 512],
253-
origin_coordinates=[-1.2, -0.6, -2.0],
253+
anatomical_target='Visual cortex, layer 2/3',
254254
illumination_pattern=line_scan # Include the illumination pattern
255255
)
256256

docs/source/user_guide.rst

Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -283,17 +283,14 @@ Imaging spaces define the physical region being imaged:
283283
)
284284
285285
# Then create the imaging space with the illumination pattern
286-
space_2d = PlanarImagingSpace(
287-
name='cortex_plane',
288-
description='Layer 2/3 of visual cortex',
289-
pixel_size_in_um=[1.0, 1.0], # x, y spacing
290-
dimensions_in_pixels=[512, 512], # width, height in pixels
291-
origin_coordinates=[-1.2, -0.6, -2.0], # relative to bregma
292-
location='Visual cortex',
293-
reference_frame='bregma',
294-
orientation='RAS', # Right-Anterior-Superior
295-
illumination_pattern=line_scan # Include the illumination pattern
296-
)
286+
planar_imaging_space = PlanarImagingSpace(
287+
name='PlanarImagingSpace',
288+
description='Imaging plane of layer 2/3 of visual cortex',
289+
pixel_size_in_um=[1.0, 1.0],
290+
dimensions_in_pixels=[512, 512],
291+
anatomical_target='Visual cortex, layer 2/3',
292+
illumination_pattern=line_scan # Include the illumination pattern
293+
)
297294
298295
2. **VolumetricImagingSpace**: For 3D imaging
299296

@@ -314,10 +311,7 @@ Imaging spaces define the physical region being imaged:
314311
description='Visual cortex volume',
315312
voxel_size_in_um=[1.0, 1.0, 2.0], # x, y, z spacing
316313
dimensions_in_voxels=[512, 512, 100], # width, height, depth in voxels
317-
origin_coordinates=[-1.2, -0.6, -2.0],
318-
location='Visual cortex',
319-
reference_frame='bregma',
320-
orientation='RAS',
314+
anatomical_target='Visual cortex',
321315
illumination_pattern=plane_acquisition
322316
)
323317
@@ -440,15 +434,12 @@ Basic workflow for 2D imaging:
440434
441435
# 6. Set up imaging space with illumination pattern
442436
planar_imaging_space = PlanarImagingSpace(
443-
name='cortex_plane',
444-
description='Layer 2/3 of visual cortex',
445-
pixel_size_in_um=[1.0, 1.0], # x, y spacing
446-
dimensions_in_pixels=[512, 512], # width, height in pixels
447-
origin_coordinates=[-1.2, -0.6, -2.0], # relative to bregma
448-
location='Visual cortex',
449-
reference_frame='bregma',
450-
orientation='RAS', # Right-Anterior-Superior
451-
illumination_pattern=line_scan # Include the illumination pattern
437+
name='PlanarImagingSpace',
438+
description='Imaging plane of layer 2/3 of visual cortex',
439+
pixel_size_in_um=[1.0, 1.0],
440+
dimensions_in_pixels=[512, 512],
441+
anatomical_target='Visual cortex, layer 2/3',
442+
illumination_pattern=line_scan # Include the illumination pattern
452443
)
453444
454445
# 7. Create microscopy channel
@@ -566,15 +557,12 @@ Workflow for one-photon widefield imaging:
566557
567558
# 6. Set up imaging space with illumination pattern
568559
planar_imaging_space = PlanarImagingSpace(
569-
name='hippo_plane',
570-
description='CA1 region of hippocampus',
560+
name='PlanarImagingSpace',
561+
description='Imaging plane of layer 2/3 of visual cortex',
571562
pixel_size_in_um=[1.0, 1.0],
572-
dimensions_in_pixels=[512, 512], # width, height in pixels
573-
origin_coordinates=[-1.8, 2.0, 1.2],
574-
location='Hippocampus, CA1 region',
575-
reference_frame='bregma',
576-
orientation='RAS',
577-
illumination_pattern=plane_acquisition
563+
dimensions_in_pixels=[512, 512],
564+
anatomical_target='Visual cortex, layer 2/3',
565+
illumination_pattern=plane_acquisition # Include the illumination pattern
578566
)
579567
580568
# 7. Create microscopy channel
@@ -697,10 +685,7 @@ Workflow for volumetric imaging with targeted scanning:
697685
description='Visual cortex volume',
698686
voxel_size_in_um=[1.0, 1.0, 2.0], # x, y, z spacing
699687
dimensions_in_voxels=[512, 512, 100], # width, height, depth in voxels
700-
origin_coordinates=[-1.2, -0.6, -2.0],
701-
location='Visual cortex',
702-
reference_frame='bregma',
703-
orientation='RAS',
688+
anatomical_target='Visual cortex',
704689
illumination_pattern=random_access_scan
705690
)
706691

examples/multi_plane_imaging_example.ipynb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,7 @@
348348
" description=f\"Imaging plane at {depth} µm depth\",\n",
349349
" pixel_size_in_um=[1.0, 1.0],\n",
350350
" dimensions_in_pixels=[height, width],\n",
351-
" origin_coordinates=[-1.2, -0.6, depth / 1000], # Convert to mm\n",
352-
" location=\"Visual cortex\",\n",
353-
" reference_frame=\"bregma\",\n",
354-
" orientation=\"RAS\",\n",
351+
" anatomical_target=\"Visual cortex\",\n",
355352
" illumination_pattern=illumination_pattern,\n",
356353
" )\n",
357354
"\n",

examples/one-photon_calcium_imaging_example.ipynb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,7 @@
323323
" description=\"CA1 region of hippocampus\",\n",
324324
" pixel_size_in_um=[1.0, 1.0],\n",
325325
" dimensions_in_pixels=[width, height],\n",
326-
" origin_coordinates=[-1.8, 2.0, 1.2], # Matches the indicator injection coordinates\n",
327-
" location=\"Hippocampus, CA1 region\",\n",
328-
" reference_frame=\"bregma\",\n",
329-
" orientation=\"RAS\", # Right-Anterior-Superior\n",
326+
" anatomical_target=\"Hippocampus, CA1 region\",\n",
330327
" illumination_pattern=illumination_pattern,\n",
331328
")\n",
332329
"\n",

examples/two-photon_calcium_imaging_example.ipynb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,7 @@
326326
" description=\"Layer 2/3 of visual cortex\",\n",
327327
" pixel_size_in_um=[1.0, 1.0],\n",
328328
" dimensions_in_pixels=[height, width],\n",
329-
" origin_coordinates=[-1.2, -0.6, -2.0],\n",
330-
" location=\"Visual cortex, layer 2/3\",\n",
331-
" reference_frame=\"bregma\",\n",
332-
" orientation=\"RAS\", # Right-Anterior-Superior\n",
329+
" anatomical_target=\"Visual cortex, layer 2/3\",\n",
333330
" illumination_pattern=illumination_pattern,\n",
334331
")\n",
335332
"\n",

examples/volumetric_imaging_example.ipynb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,7 @@
332332
" description=\"Visual cortex volume\",\n",
333333
" voxel_size_in_um=[1.0, 1.0, 2.0], # Higher spacing in z\n",
334334
" dimensions_in_voxels=[height, width, depths],\n",
335-
" origin_coordinates=[-1.2, -0.6, -2.0],\n",
336-
" location=\"Visual cortex\",\n",
337-
" reference_frame=\"bregma\",\n",
338-
" orientation=\"RAS\", # Right-Anterior-Superior\n",
335+
" anatomical_target=\"Visual cortex\",\n",
339336
" illumination_pattern=illumination_pattern,\n",
340337
")\n",
341338
"\n",

0 commit comments

Comments
 (0)