@@ -7,6 +7,57 @@ This extension allows for the storage of configuration options used by the [EXTR
7
7
8
8
## Usage
9
9
10
+
11
+ ### Python
12
+ Install the extension from [ PyPI] ( https://pypi.org/project/ndx-extract/ )
13
+ ``` shell
14
+ pip install ndx-extract
15
+ ```
16
+ Usage:
17
+ ``` python
18
+ from datetime import datetime
19
+ from ndx_extract import EXTRACTSegmentation
20
+ from pynwb import NWBFile, NWBHDF5IO
21
+
22
+ # Create the NWBfile
23
+ nwbfile = NWBFile(
24
+ session_description = " The mouse in open exploration." ,
25
+ identifier = " Mouse5_Day3" ,
26
+ session_start_time = datetime.now().astimezone(),
27
+ )
28
+ # Create the processing module
29
+ ophys_module = nwbfile.create_processing_module(
30
+ name = " ophys" ,
31
+ description = " optical physiology processed data" ,
32
+ )
33
+ # Create the segmentation object and define the configuration properties
34
+ # The properties that can be defined are listed at spec/ndx-EXTRACT.extensions.yaml
35
+ image_segmentation = EXTRACTSegmentation(
36
+ name = " ImageSegmentation" ,
37
+ version = " 1.1.0" ,
38
+ preprocess = True ,
39
+ trace_output_option = " nonneg" ,
40
+ )
41
+ # Add this image segmentation to the processing module
42
+ ophys_module.add(image_segmentation)
43
+
44
+ # Writing the NWB file
45
+ with NWBHDF5IO(" image_segmentation.nwb" , mode = " w" ) as io:
46
+ io.write(nwbfile)
47
+
48
+ # Reading the NWB file and accessing the segmentation parameters
49
+ with NWBHDF5IO(" image_segmentation.nwb" , mode = " r" ) as io:
50
+ nwbfile_in = io.read()
51
+ nwbfile_in.processing[" ophys" ].data_interfaces[" ImageSegmentation" ].version
52
+ nwbfile_in.processing[" ophys" ].data_interfaces[" ImageSegmentation" ].preprocess
53
+ nwbfile_in.processing[" ophys" ].data_interfaces[" ImageSegmentation" ].trace_output_option
54
+ ```
55
+
56
+ Running the tests:
57
+ ``` shell
58
+ python -m unittest src/pynwb/tests/test_extract.py
59
+ ```
60
+
10
61
### MATLAB
11
62
install:
12
63
``` matlab
0 commit comments