Skip to content

Commit 9e591cd

Browse files
Add illumination patterns and refine imaging modality examples in Jupyter notebooks
1 parent f32c159 commit 9e591cd

File tree

4 files changed

+51
-26
lines changed

4 files changed

+51
-26
lines changed

examples/multi_plane_imaging_example.ipynb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"\n",
3434
"from ndx_microscopy import (\n",
3535
" Microscope,\n",
36+
" LineScan,\n",
3637
" ExcitationLightPath,\n",
3738
" EmissionLightPath,\n",
3839
" PlanarImagingSpace,\n",
@@ -104,7 +105,8 @@
104105
" name='etl-scope',\n",
105106
" description='Two-photon microscope with electrically tunable lens',\n",
106107
" manufacturer='Custom Build',\n",
107-
" model='ETL-Special'\n",
108+
" model='ETL-Special',\n",
109+
" technique='XY raster scanning combined with electrically tunable lens to control Z direction', \n",
108110
")\n",
109111
"nwbfile.add_device(microscope)\n",
110112
"\n",
@@ -261,6 +263,14 @@
261263
"response_series_list = []\n",
262264
"depths = [-100, -50, 0, 50, 100] # Depths in µm\n",
263265
"\n",
266+
"illumination_pattern = LineScan(\n",
267+
" name=\"line_scanning\",\n",
268+
" description=\"Line scanning two-photon microscopy\",\n",
269+
" scan_direction=\"horizontal\",\n",
270+
" line_rate_in_Hz=1000.0,\n",
271+
" dwell_time_in_s=1.0e-6,\n",
272+
")\n",
273+
"\n",
264274
"for depth in depths:\n",
265275
" # Create imaging space for this depth\n",
266276
" plane_space = PlanarImagingSpace(\n",
@@ -270,7 +280,8 @@
270280
" origin_coordinates=[-1.2, -0.6, depth/1000], # Convert to mm\n",
271281
" location='Visual cortex',\n",
272282
" reference_frame='bregma',\n",
273-
" orientation='RAS'\n",
283+
" orientation='RAS',\n",
284+
" illumination_pattern=illumination_pattern\n",
274285
" )\n",
275286
"\n",
276287
" # Create example data for this plane\n",

examples/one-photon_calcium_imaging_example.ipynb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"\n",
3333
"from ndx_microscopy import (\n",
3434
" Microscope, \n",
35-
" ImagingModality,\n",
35+
" PlaneAcquisition,\n",
3636
" ExcitationLightPath,\n",
3737
" EmissionLightPath,\n",
3838
" PlanarImagingSpace,\n",
@@ -98,7 +98,8 @@
9898
" name='1p-scope',\n",
9999
" description='Custom one-photon microscope for calcium imaging',\n",
100100
" manufacturer='Custom Build',\n",
101-
" model='1P-Special'\n",
101+
" model='1P-Special',\n",
102+
" technique='widefield',\n",
102103
")\n",
103104
"nwbfile.add_device(microscope)\n",
104105
"\n",
@@ -236,9 +237,10 @@
236237
"outputs": [],
237238
"source": [
238239
"# Define imaging space\n",
239-
"imaging_modality = ImagingModality(\n",
240-
" name=\"widefield\",\n",
240+
"illumination_pattern = PlaneAcquisition(\n",
241+
" name=\"plane_acquisition\",\n",
241242
" description=\"Widefield fluorescence imaging\",\n",
243+
" plane_thickness_in_um=5.0,\n",
242244
")\n",
243245
"imaging_space = PlanarImagingSpace(\n",
244246
" name=\"hippo_plane1\",\n",
@@ -248,7 +250,7 @@
248250
" location=\"Hippocampus, CA1 region\",\n",
249251
" reference_frame=\"bregma\",\n",
250252
" orientation=\"RAS\", # Right-Anterior-Superior\n",
251-
" imaging_modality=imaging_modality,\n",
253+
" illumination_pattern=illumination_pattern,\n",
252254
")\n",
253255
"\n",
254256
"# Create example imaging data\n",

examples/two-photon_calcium_imaging_example.ipynb

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
" Microscope, \n",
3535
" ExcitationLightPath,\n",
3636
" EmissionLightPath,\n",
37-
" LineScanning,\n",
37+
" LineScan,\n",
3838
" PlanarImagingSpace,\n",
3939
" PlanarMicroscopySeries,\n",
4040
" Segmentation2D,\n",
@@ -104,7 +104,8 @@
104104
" name='2p-scope',\n",
105105
" description='Custom two-photon microscope for calcium imaging',\n",
106106
" manufacturer='Custom Build',\n",
107-
" model='2P-Special'\n",
107+
" model='2P-Special',\n",
108+
" technique='mirror scanning',\n",
108109
")\n",
109110
"nwbfile.add_device(microscope)\n",
110111
"\n",
@@ -245,22 +246,22 @@
245246
"outputs": [],
246247
"source": [
247248
"# Define imaging space\n",
248-
"imaging_modality = LineScanning(\n",
249-
" name='line_scanning',\n",
250-
" description='Line scanning two-photon microscopy',\n",
251-
" scan_direction='horizontal',\n",
249+
"illumination_pattern = LineScan(\n",
250+
" name=\"line_scanning\",\n",
251+
" description=\"Line scanning two-photon microscopy\",\n",
252+
" scan_direction=\"horizontal\",\n",
252253
" line_rate_in_Hz=1000.0,\n",
253254
" dwell_time_in_s=1.0e-6,\n",
254255
")\n",
255256
"imaging_space = PlanarImagingSpace(\n",
256-
" name='cortex_plane1',\n",
257-
" description='Layer 2/3 of visual cortex',\n",
257+
" name=\"cortex_plane1\",\n",
258+
" description=\"Layer 2/3 of visual cortex\",\n",
258259
" grid_spacing_in_um=[1.0, 1.0],\n",
259260
" origin_coordinates=[-1.2, -0.6, -2.0],\n",
260-
" location='Visual cortex, layer 2/3',\n",
261-
" reference_frame='bregma',\n",
262-
" orientation='RAS', # Right-Anterior-Superior\n",
263-
" imaging_modality=imaging_modality\n",
261+
" location=\"Visual cortex, layer 2/3\",\n",
262+
" reference_frame=\"bregma\",\n",
263+
" orientation=\"RAS\", # Right-Anterior-Superior\n",
264+
" illumination_pattern=illumination_pattern,\n",
264265
")\n",
265266
"\n",
266267
"# Create example imaging data\n",

examples/volumetric_imaging_example.ipynb

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"\n",
3636
"from ndx_microscopy import (\n",
3737
" Microscope,\n",
38+
" LineScan,\n",
3839
" ExcitationLightPath,\n",
3940
" EmissionLightPath,\n",
4041
" VolumetricImagingSpace,\n",
@@ -101,10 +102,11 @@
101102
"source": [
102103
"# Set up microscope\n",
103104
"microscope = Microscope(\n",
104-
" name='volume-scope',\n",
105-
" description='Custom volumetric imaging microscope',\n",
106-
" manufacturer='Custom Build',\n",
107-
" model='Volume-Special'\n",
105+
" name=\"volume-scope\",\n",
106+
" description=\"Custom volumetric imaging microscope\",\n",
107+
" manufacturer=\"Custom Build\",\n",
108+
" model=\"Volume-Special\",\n",
109+
" technique=\"XY raster scanning combined with acousto-optic deflectors (AODs)\",\n",
108110
")\n",
109111
"nwbfile.add_device(microscope)\n",
110112
"\n",
@@ -246,14 +248,22 @@
246248
"outputs": [],
247249
"source": [
248250
"# Define volumetric imaging space\n",
251+
"illumination_pattern = LineScan(\n",
252+
" name=\"line_scanning\",\n",
253+
" description=\"Line scanning two-photon microscopy\",\n",
254+
" scan_direction=\"horizontal\",\n",
255+
" line_rate_in_Hz=1000.0,\n",
256+
" dwell_time_in_s=1.0e-6,\n",
257+
")\n",
249258
"volume_space = VolumetricImagingSpace(\n",
250259
" name='cortex_volume',\n",
251260
" description='Visual cortex volume',\n",
252261
" grid_spacing_in_um=[1.0, 1.0, 2.0], # Higher spacing in z\n",
253262
" origin_coordinates=[-1.2, -0.6, -2.0],\n",
254263
" location='Visual cortex',\n",
255264
" reference_frame='bregma',\n",
256-
" orientation='RAS' # Right-Anterior-Superior\n",
265+
" orientation='RAS', # Right-Anterior-Superior\n",
266+
" illumination_pattern=illumination_pattern,\n",
257267
")\n",
258268
"\n",
259269
"# Create example volumetric data\n",
@@ -276,6 +286,7 @@
276286
" rate=5.0, # Lower rate for volumetric imaging\n",
277287
" starting_time=0.0\n",
278288
")\n",
289+
"\n",
279290
"nwbfile.add_acquisition(volume_series)"
280291
]
281292
},
@@ -412,7 +423,7 @@
412423
],
413424
"metadata": {
414425
"kernelspec": {
415-
"display_name": "Python 3",
426+
"display_name": "ndx-microscopy-env",
416427
"language": "python",
417428
"name": "python3"
418429
},
@@ -426,7 +437,7 @@
426437
"name": "python",
427438
"nbconvert_exporter": "python",
428439
"pygments_lexer": "ipython3",
429-
"version": "3.8.0"
440+
"version": "3.11.10"
430441
}
431442
},
432443
"nbformat": 4,

0 commit comments

Comments
 (0)