catalystneuro / neuroconv

Create NWB files by converting and combining neural data in proprietary formats and adding essential metadata.
https://neuroconv.readthedocs.io
BSD 3-Clause "New" or "Revised" License
50 stars 21 forks source link

Can we write `ImageSeries` in external_mode if the timestamps are well specified #472

Open h-mayorquin opened 1 year ago

h-mayorquin commented 1 year ago

Right now when external mode is chosen we have the starting frames as a requirement:

https://github.com/catalystneuro/neuroconv/blob/2da9f6bef30b46a52b3303d41eb6f80cf8cccffa/src/neuroconv/datainterfaces/behavior/video/videodatainterface.py#L327-L329

That is, for ImageSeries of multiple videos in external mode, we add the requirements of starting_frames. Is this necessary? I can't see any of this specified on pynwb:

https://pynwb.readthedocs.io/en/stable/pynwb.image.html

What is the logic here? My feeling is that if the timestamps are well specfiied then we should be able to write the ImageSeries.

CodyCBakerPhD commented 1 year ago

The timestamps don't tell you the number of frames in each external video file

As far as PyNWB, no I don't think it's a strict requirement, or even technically a best practice just yet, but I think it's a 'highly recommended' strategy

The closest mention we get is in the code https://github.com/NeurodataWithoutBorders/pynwb/blob/a6fa9170f2ad6942d74eaf44c22cedf0b80f0fcd/src/pynwb/image.py#L82-L90

h-mayorquin commented 1 year ago

No, but if you have the timestamps, this should not matter right? As in, you know at what time in your experiment each of the frames in the TimeSeries occured.

CodyCBakerPhD commented 1 year ago

It's not just about the timing of the frames, it's valuable context about how the shape of the total ImageSeries is distributed across the external files

Example: one very short video and one very long one - nearly contiguous but slightly irregular timestamps - timestamps alone do not tell you exactly which frames of the timestamp vector correspond to which video file

h-mayorquin commented 1 year ago

OK, thanks, I undestand that is very important information.

The logic as I understand it now is that: an external file with wihout information would be very incomplete, so we don't let you, even if you could.

CodyCBakerPhD commented 1 year ago

The logic as I understand it now is that: an external file with wihout information would be very incomplete, so we don't let you, even if you could.

As I currently understand it

NWB-schema: this is an optional field PyNWB: we check the field and auto-fill if only a single file - possible plans to warn to specify if using external mode but you can technically skip if you want NeuroConv/GUIDE: not currently required, but it can be easily grabbed from the external files and set automatically for convenience

h-mayorquin commented 1 year ago

Right, I guess we are moving towards there in https://github.com/catalystneuro/neuroconv/pull/464