MouseLand / suite2p

cell detection in calcium imaging recordings
http://www.suite2p.org
GNU General Public License v3.0
335 stars 239 forks source link

Link NWB data when using NWB on input & output #746

Open chrisroat opened 2 years ago

chrisroat commented 2 years ago

Currently, the NWB output by Suite2p has dummy information, which could be filled in with actual information from incoming data if it is also NWB format. The pieces that need to be addressed that I see, though there could be more:

carsen-stringer commented 2 years ago

happy to accept a pull request that implements this! currently the github version can accept NWB files, I've told someone at NWB about this but it hasn't been tested yet since I don't have any NWB files to test

chrisroat commented 2 years ago

OK, I can look into this. It will be little bit hacky, as there are pieces of both Suite2p and NWB that I generally work around (e.g., in Suite2p, I have to set a "data_path" while using NWB input).

See the following example I made, which creates some fake data from a 2p dataset and runs suite2p with NWB input and output. I'll work from this to get a PR put together. https://github.com/deisseroth-lab/data-sharing-examples/tree/master/dandi/ophys

carsen-stringer commented 2 years ago

Oh that's awesome! Haha nice data_path input, where does it error if you don't give it a data_path? I tried to take care of that here: https://github.com/MouseLand/suite2p/blob/9473e9ae0d587132308bb1e7b6c174f5af939844/suite2p/run_s2p.py#L363

carsen-stringer commented 2 years ago

cc @jmdelahanty Chris's code above might help you out

jmdelahanty commented 2 years ago

Thank you!

chrisroat commented 2 years ago

From https://github.com/NeurodataWithoutBorders/pynwb/issues/1416, it seems like the idea of having a separate NWB file for output will be problematic.

Would it be acceptable to write the Suite2p output back into the original NWB file when save_NWB is set? This would avoid the need to create ImagingPlane, OpticalChannel, etc.

kir0ul commented 2 years ago

Maybe all this metadata could be (somehow) added from the interface before running the analysis?

carsen-stringer commented 1 year ago

cc @rly