Skip to content

Commit d77ab12

Browse files
User/wmerynda/video container (#485)
1 parent 8ad9a3e commit d77ab12

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

rec_to_nwb/processing/builder/originators/video_files_originator.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ def __init__(self, raw_data_path, video_directory, video_files_metadata):
1111

1212
def make(self, nwb_content):
1313
fl_video_files = self.fl_video_files_manager.get_video_files()
14-
for fl_video_file in fl_video_files:
15-
image_series = VideoFilesCreator.create(fl_video_file, self.video_directory, nwb_content)
16-
VideoFilesInjector.inject(nwb_content, image_series)
14+
image_series_list = [
15+
VideoFilesCreator.create(fl_video_file, self.video_directory, nwb_content)
16+
for fl_video_file in fl_video_files
17+
]
18+
VideoFilesInjector.inject_all(nwb_content, image_series_list)
19+
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from pynwb import NWBFile
2-
from pynwb.image import ImageSeries
2+
from pynwb.behavior import BehavioralEvents
33

44
from rec_to_nwb.processing.tools.beartype.beartype import beartype
55

@@ -8,5 +8,13 @@ class VideoFilesInjector:
88

99
@staticmethod
1010
@beartype
11-
def inject(nwb_content: NWBFile, image_series: ImageSeries):
12-
nwb_content.add_stimulus(image_series)
11+
def inject_all(nwb_content: NWBFile, image_series_list: list):
12+
video = BehavioralEvents(name='video')
13+
for image_series in image_series_list:
14+
VideoFilesInjector.__add_single_image_series(video, image_series)
15+
nwb_content.processing['behavior'].add(video)
16+
17+
@staticmethod
18+
def __add_single_image_series(video, image_series):
19+
video.add_timeseries(image_series)
20+
return video

0 commit comments

Comments
 (0)