Convert data to nwb
Project description
# nwbext_ecog: An NWB extension for ECoG data
Author: Ben Dichter
There are three data types, `Surface`, `CorticalSurfaces`, and `ECoGSubject`. `CorticalSurfaces` is simply a group (like a folder) to put `Surface` objects into. `Surface` holds surface mesh data (vertices and triangular faces) for sections of cortex. `ECoGSubject` is an extension of `Subject` that allows you to add the `CorticalSurfaces` object to `/general/subject`.
## Usage
### python
install:
```bash
pip install git+https://github.com/bendichter/nwbext_ecog.git
```
write:
```python
import pynwb
from nwbext_ecog import CorticalSurfaces, ECoGSubject
nwbfile = pynwb.NWBFile(...)
...
cortical_surfaces = CorticalSurfaces()
## loop me
cortical_surfaces.create_surface(name=name, faces=faces, vertices=veritices)
##
nwbfile.subject = ECoGSubject(cortical_surfaces=cortical_surfaces)
```
You can optionally attach images of the subject's brain:
```python
from pynwb.base import Images
from pynwb.image import GrayscaleImage
subject.images = Images(name='subject images', images=[GrayscaleImage('image1', data=image_data)])
```
read:
```python
import nwbext_ecog
from pynwb import NWBHDF5IO
io = NWBHDF5IO('path_to_file.nwb','r')
nwb = io.read()
nwb.subject.cortical_surfaces
```
### MATLAB
install:
```matlab
generateExtension('/path/to/nwbext_ecog/nwbext_ecog/ecog.namespace.yaml');
```
write:
```matlab
cortical_surfaces = types.ecog.CorticalSurfaces;
%%% loop me
surf = types.ecog.Surface('faces', faces, 'vertices', vertices);
cortical_surfaces.surface.set(surface_name, surf);
%%%
file.subject = types.ecog.ECoGSubject(name, cortical_surfaces);
```
Author: Ben Dichter
There are three data types, `Surface`, `CorticalSurfaces`, and `ECoGSubject`. `CorticalSurfaces` is simply a group (like a folder) to put `Surface` objects into. `Surface` holds surface mesh data (vertices and triangular faces) for sections of cortex. `ECoGSubject` is an extension of `Subject` that allows you to add the `CorticalSurfaces` object to `/general/subject`.
## Usage
### python
install:
```bash
pip install git+https://github.com/bendichter/nwbext_ecog.git
```
write:
```python
import pynwb
from nwbext_ecog import CorticalSurfaces, ECoGSubject
nwbfile = pynwb.NWBFile(...)
...
cortical_surfaces = CorticalSurfaces()
## loop me
cortical_surfaces.create_surface(name=name, faces=faces, vertices=veritices)
##
nwbfile.subject = ECoGSubject(cortical_surfaces=cortical_surfaces)
```
You can optionally attach images of the subject's brain:
```python
from pynwb.base import Images
from pynwb.image import GrayscaleImage
subject.images = Images(name='subject images', images=[GrayscaleImage('image1', data=image_data)])
```
read:
```python
import nwbext_ecog
from pynwb import NWBHDF5IO
io = NWBHDF5IO('path_to_file.nwb','r')
nwb = io.read()
nwb.subject.cortical_surfaces
```
### MATLAB
install:
```matlab
generateExtension('/path/to/nwbext_ecog/nwbext_ecog/ecog.namespace.yaml');
```
write:
```matlab
cortical_surfaces = types.ecog.CorticalSurfaces;
%%% loop me
surf = types.ecog.Surface('faces', faces, 'vertices', vertices);
cortical_surfaces.surface.set(surface_name, surf);
%%%
file.subject = types.ecog.ECoGSubject(name, cortical_surfaces);
```
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nwbext_ecog-0.6.0.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for nwbext_ecog-0.6.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aeb4f4501682e36b839f783c8282415fa9a0f6c8917f7c3ed058edeb93162647 |
|
MD5 | 8bd00ed816797b637ed11e4cc6a10be1 |
|
BLAKE2b-256 | c41ac12851e1f06978b2e92360423e0069187c72dd17e35bc5e347d7ad8b3e6c |