Created
August 4, 2018 18:47
-
-
Save jayrbolton/682c984f3f55255d11115f91fde37486 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
from pynwb import NWBFile, NWBHDF5IO | |
from pynwb.ophys import ImageSegmentation, TwoPhotonSeries, OpticalChannel | |
nwbfile = NWBFile('a', 'b', 'c', datetime.now()) | |
mod = nwbfile.create_processing_module('a', 'b', 'c') | |
optical_channel = OpticalChannel('a', 'b', 'c', 500.) | |
imaging_plane = nwbfile.create_imaging_plane('a', 'b', optical_channel, 'c', 'd', 600., '2.718', 'GFP', 'd', [], 4.0, 'e', 'f') | |
image_series = TwoPhotonSeries( | |
name='a', | |
source='b', | |
dimension=[2], | |
external_file=['images.tiff'], | |
imaging_plane=imaging_plane, | |
starting_frame=[0], | |
format='tiff', | |
timestamps=list()) | |
nwbfile.add_acquisition(image_series) | |
mod = nwbfile.create_processing_module('my_ca_imaging_module', 'b', 'c') | |
img_seg = ImageSegmentation('desc') | |
mod.add_data_interface(img_seg) | |
ps = img_seg.create_plane_segmentation('b', 'c', imaging_plane, 'my_planeseg', image_series) | |
# 3d pix_mask format: [(x, y, z, val)] | |
pix_mask1 = [(1, 2, 3, 1.1)] | |
img_mask1 = [[1.1, 0.0, 0.0]] | |
ps.add_roi('1234', pix_mask1, img_mask1) | |
io = NWBHDF5IO('example.nwb', 'w') | |
io.write(nwbfile) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment