Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ophys pipeline (Bruker) #4

Merged
merged 20 commits into from
Nov 21, 2023
Merged

Add ophys pipeline (Bruker) #4

merged 20 commits into from
Nov 21, 2023

Conversation

weiglszonja
Copy link
Collaborator

@weiglszonja weiglszonja commented Aug 8, 2023

  • IntoTheVoidNWBConverter: the converter that automatically adjusts the metadata for the imaging and the segmentation interfaces, and conversion options (through the get_conversion_options method)
  • get_default_imaging_to_segmentation_name_mapping: returns a dictionary that maps each imaging plane name to the segmentation plane name.

This is necessary when there are multiple channels or planes in the imaging data and the segmentation data, as the name
provided in the segmentation interface might not be the same as the name provided in the imaging interface.

Single plane, dual channel example

For example if the imaging data has a single plane with two channels, the default imaging_to_segmentation_plane_map will be defined as follows:

from pinto_lab_to_nwb.into_the_void.into_the_voidnwbconverter import get_default_imaging_to_segmentation_name_mapping

# The folder path that contains the Bruker TIF imaging output (.ome.tif files).
imaging_folder_path = "NCCR62_2023_07_06_IntoTheVoid_t_series_Dual_color-000"
# The folder that contains the Suite2P segmentation output.
segmentation_folder_path =  "NCCR62_2023_07_06_IntoTheVoid_t_series_Dual_color-000/suite2p"

# Provide a mapping between the imaging and segmentation planes
# The default mapping is to rely on the order of the planes in the imaging and segmentation folders
# The keys of the dictionary are the imaging plane names and the values are the segmentation plane names
plane_map = get_default_imaging_to_segmentation_name_mapping(imaging_folder_path, segmentation_folder_path)

which will output:

{'Ch1': 'Chan1Plane0', 'Ch2': 'Chan2Plane0'}

where the keys are the imaging plane names and the values are the segmentation plane names.

This way the converter will automatically set the metadata for the segmentation interfaces to use the same naming convention as the imaging interfaces.
The default mapping can be adjusted by the user as follows:

imaging_to_segmentation_plane_map = {'Ch1': 'Chan2Plane0', 'Ch2': 'Chan1Plane0'}

where "Ch2" will use the first channel provided in the segmentation output from Suite2p, and "Ch1" will use the second channel provided in the segmentation output from Suite2p.

Dual plane, single channel example

For example if the imaging data has two planes with a single channel, the default imaging_to_segmentation_plane_map will be defined as follows:

{'Ch2_000001': 'Chan1Plane0', 'Ch2_000002': 'Chan1Plane1'}

where the keys are the imaging plane names and the values are the segmentation plane names.
If the default mapping has to be adjusted, the user can provide a custom mapping as follows:

imaging_to_segmentation_plane_map = {'Ch1': 'Chan2Plane0', 'Ch2': 'Chan1Plane0'}

where "Ch2" will use the first channel provided in the segmentation output from Suite2p, and "Ch1" will use the second channel provided in the segmentation output from Suite2p.

@weiglszonja weiglszonja marked this pull request as draft August 8, 2023 18:29
@weiglszonja
Copy link
Collaborator Author

@weiglszonja weiglszonja self-assigned this Nov 20, 2023
@weiglszonja weiglszonja marked this pull request as ready for review November 20, 2023 15:54
@CodyCBakerPhD
Copy link
Member

Overall files look great!

One minor, bizarre issue with dual-color

image

Ch1 imaging plane has 2 optic channels? somehow?

@weiglszonja
Copy link
Collaborator Author

Overall files look great!

One minor, bizarre issue with dual-color

image

Ch1 imaging plane has 2 optic channels? somehow?

Ah good catch! They have to use the same optical channels too, as optical channels can be a list in imaging plane, even if I'm using the same imaging plane name, the segmentation metadata adds the default name of optical channel because that link is not updated yet.

@weiglszonja weiglszonja marked this pull request as draft November 20, 2023 19:19
@weiglszonja
Copy link
Collaborator Author

@CodyCBakerPhD making this back a draft until the optical channel link is updated too, I'll let you know when it's fixed.

@weiglszonja
Copy link
Collaborator Author

@CodyCBakerPhD updated the files, they should also include the fix for catalystneuro/roiextractors#263
I noticed that issue while looking at that the files before as they had all NaN values for the mean image, now they should look alright.

@weiglszonja weiglszonja marked this pull request as ready for review November 21, 2023 12:55
@CodyCBakerPhD
Copy link
Member

Those do look better now - I'll go ahead and merge this then and we'll update the pin to ROI extractors after the upstream PR has a test, been merged, and new release cut in a week or so

@CodyCBakerPhD CodyCBakerPhD merged commit acbdca9 into main Nov 21, 2023
1 check passed
@CodyCBakerPhD CodyCBakerPhD deleted the add_two_photon_pipeline branch November 21, 2023 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants