From 5aefecf433816b36758c32a9aef537d26df4a494 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Fri, 4 Oct 2024 13:43:59 -0700 Subject: [PATCH 01/11] added intrinsic signal imaging --- .../schneider_2024/__init__.py | 1 + .../schneider_2024_convert_session.py | 8 +++ ...2024_intrinsic_signal_imaging_interface.py | 63 +++++++++++++++++++ .../schneider_2024_nwbconverter.py | 6 +- 4 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 src/schneider_lab_to_nwb/schneider_2024/schneider_2024_intrinsic_signal_imaging_interface.py diff --git a/src/schneider_lab_to_nwb/schneider_2024/__init__.py b/src/schneider_lab_to_nwb/schneider_2024/__init__.py index eafd574..8d17765 100644 --- a/src/schneider_lab_to_nwb/schneider_2024/__init__.py +++ b/src/schneider_lab_to_nwb/schneider_2024/__init__.py @@ -1,2 +1,3 @@ from .schneider_2024_behaviorinterface import Schneider2024BehaviorInterface +from .schneider_2024_intrinsic_signal_imaging_interface import Schneider2024IntrinsicSignalOpticalImagingInterface from .schneider_2024_nwbconverter import Schneider2024NWBConverter diff --git a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_convert_session.py b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_convert_session.py index a9aa167..af00e3c 100644 --- a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_convert_session.py +++ b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_convert_session.py @@ -17,6 +17,7 @@ def session_to_nwb( sorting_folder_path: Union[str, Path], behavior_file_path: Union[str, Path], video_folder_path: Union[str, Path], + intrinsic_signal_optical_imaging_folder_path: Union[str, Path], output_dir_path: Union[str, Path], stub_test: bool = False, ): @@ -24,6 +25,7 @@ def session_to_nwb( sorting_folder_path = Path(sorting_folder_path) behavior_file_path = Path(behavior_file_path) video_folder_path = Path(video_folder_path) + intrinsic_signal_optical_imaging_folder_path = Path(intrinsic_signal_optical_imaging_folder_path) output_dir_path = Path(output_dir_path) video_file_paths = [ file_path for file_path in video_folder_path.glob("*.mp4") if not file_path.name.startswith("._") @@ -59,6 +61,10 @@ def session_to_nwb( source_data.update({metadata_key_name: dict(file_paths=[video_file_path], metadata_key_name=metadata_key_name)}) conversion_options.update({metadata_key_name: dict()}) + # Add Intrinsic Signal Optical Imaging + source_data.update(dict(ISOI=dict(folder_path=intrinsic_signal_optical_imaging_folder_path))) + conversion_options.update(dict(ISOI=dict())) + converter = Schneider2024NWBConverter(source_data=source_data) # Add datetime to conversion @@ -115,11 +121,13 @@ def main(): ) behavior_file_path = data_dir_path / "NWB_Share" / "Sample behavior data" / "m74_ephysSample.mat" video_folder_path = data_dir_path / "Schneider sample Data" / "Video" / "m69_231031" + intrinsic_signal_optical_imaging_folder_path = data_dir_path / "NWB_Share" / "Sample Intrinsic imaging data" session_to_nwb( recording_folder_path=recording_folder_path, sorting_folder_path=sorting_folder_path, behavior_file_path=behavior_file_path, video_folder_path=video_folder_path, + intrinsic_signal_optical_imaging_folder_path=intrinsic_signal_optical_imaging_folder_path, output_dir_path=output_dir_path, stub_test=stub_test, ) diff --git a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_intrinsic_signal_imaging_interface.py b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_intrinsic_signal_imaging_interface.py new file mode 100644 index 0000000..c462631 --- /dev/null +++ b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_intrinsic_signal_imaging_interface.py @@ -0,0 +1,63 @@ +"""Primary class for converting intrinsic signal optical imaging.""" +from pynwb.file import NWBFile +from pynwb.base import Images +from pynwb.image import GrayscaleImage, RGBImage +from pydantic import FilePath, DirectoryPath +import numpy as np +from PIL import Image + +from neuroconv.basedatainterface import BaseDataInterface +from neuroconv.utils import DeepDict, get_base_schema +from neuroconv.tools import nwb_helpers + + +class Schneider2024IntrinsicSignalOpticalImagingInterface(BaseDataInterface): + """Intrinsic signal optical imaging interface for schneider_2024 conversion""" + + keywords = ["intrinsic signal optical imaging"] + + def __init__(self, folder_path: DirectoryPath): + super().__init__(folder_path=folder_path) + + def get_metadata(self) -> DeepDict: + # Automatically retrieve as much metadata as possible from the source files available + metadata = super().get_metadata() + + return metadata + + def get_metadata_schema(self) -> dict: + metadata_schema = super().get_metadata_schema() + return metadata_schema + + def add_to_nwbfile(self, nwbfile: NWBFile, metadata: dict): + # Read Data + folder_path = self.source_data["folder_path"] + raw_image_path = folder_path / "BloodvesselPattern.tiff" + processed_image_path = folder_path / "IOS_imageOverlaidFinal.jpg" + with Image.open(raw_image_path) as image: + raw_image_array = np.array(image) + with Image.open(processed_image_path) as image: + processed_image_array = np.array(image) + + # Add Data to NWBFile + isoi_module = nwb_helpers.get_module( + nwbfile=nwbfile, + name="intrinsic_signal_optical_imaging", + description="For precise targeting of auditory cortex, intrinsic optical imaging (IOS) will be performed using a 2-photon microscope (Neurolabware). The skull is first bilaterally thinned over a region of interest (ROI) and made translucent. On experiment day, 680nm red light (ThorLabs) is used to image the ROI. Data is collected via MATLAB running custom suites for online and offline analyses.", + ) + raw_image = GrayscaleImage( + name="raw_image", + data=raw_image_array, + description="Original image capture of ROI for intrinsic imaging.", + ) + processed_image = RGBImage( + name="processed_image", + data=processed_image_array, + description="Original image capture of ROI overlaid with topographic map of processed intrinsic signal.", + ) + images = Images( + name="images", + description="Intrinsic signal optical images.", + images=[raw_image, processed_image], + ) + isoi_module.add(images) diff --git a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_nwbconverter.py b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_nwbconverter.py index 5b1d40e..0f97bf6 100644 --- a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_nwbconverter.py +++ b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_nwbconverter.py @@ -7,7 +7,10 @@ ) from neuroconv.basedatainterface import BaseDataInterface -from schneider_lab_to_nwb.schneider_2024 import Schneider2024BehaviorInterface +from schneider_lab_to_nwb.schneider_2024 import ( + Schneider2024BehaviorInterface, + Schneider2024IntrinsicSignalOpticalImagingInterface, +) class Schneider2024NWBConverter(NWBConverter): @@ -19,4 +22,5 @@ class Schneider2024NWBConverter(NWBConverter): Behavior=Schneider2024BehaviorInterface, VideoCamera1=VideoInterface, VideoCamera2=VideoInterface, + ISOI=Schneider2024IntrinsicSignalOpticalImagingInterface, ) From 9ed01ed9073c062e326022a36ddd574301f800e2 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Fri, 4 Oct 2024 13:56:48 -0700 Subject: [PATCH 02/11] moved metadata to yaml --- ...2024_intrinsic_signal_imaging_interface.py | 44 +++++++++++++++---- .../schneider_2024_metadata.yaml | 14 ++++++ 2 files changed, 50 insertions(+), 8 deletions(-) diff --git a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_intrinsic_signal_imaging_interface.py b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_intrinsic_signal_imaging_interface.py index c462631..cc90b86 100644 --- a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_intrinsic_signal_imaging_interface.py +++ b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_intrinsic_signal_imaging_interface.py @@ -27,6 +27,33 @@ def get_metadata(self) -> DeepDict: def get_metadata_schema(self) -> dict: metadata_schema = super().get_metadata_schema() + metadata_schema["properties"]["IntrinsicSignalOpticalImaging"] = dict() + metadata_schema["properties"]["IntrinsicSignalOpticalImaging"]["properties"] = { + "Module": { + "properties": { + "name": {"type": "string"}, + "description": {"type": "string"}, + }, + }, + "Images": { + "properties": { + "name": {"type": "string"}, + "description": {"type": "string"}, + }, + }, + "RawImage": { + "properties": { + "name": {"type": "string"}, + "description": {"type": "string"}, + }, + }, + "ProcessedImage": { + "properties": { + "name": {"type": "string"}, + "description": {"type": "string"}, + }, + }, + } return metadata_schema def add_to_nwbfile(self, nwbfile: NWBFile, metadata: dict): @@ -40,24 +67,25 @@ def add_to_nwbfile(self, nwbfile: NWBFile, metadata: dict): processed_image_array = np.array(image) # Add Data to NWBFile + isoi_metadata = metadata["IntrinsicSignalOpticalImaging"] isoi_module = nwb_helpers.get_module( nwbfile=nwbfile, - name="intrinsic_signal_optical_imaging", - description="For precise targeting of auditory cortex, intrinsic optical imaging (IOS) will be performed using a 2-photon microscope (Neurolabware). The skull is first bilaterally thinned over a region of interest (ROI) and made translucent. On experiment day, 680nm red light (ThorLabs) is used to image the ROI. Data is collected via MATLAB running custom suites for online and offline analyses.", + name=isoi_metadata["Module"]["name"], + description=isoi_metadata["Module"]["description"], ) raw_image = GrayscaleImage( - name="raw_image", + name=isoi_metadata["RawImage"]["name"], data=raw_image_array, - description="Original image capture of ROI for intrinsic imaging.", + description=isoi_metadata["RawImage"]["description"], ) processed_image = RGBImage( - name="processed_image", + name=isoi_metadata["ProcessedImage"]["name"], data=processed_image_array, - description="Original image capture of ROI overlaid with topographic map of processed intrinsic signal.", + description=isoi_metadata["ProcessedImage"]["description"], ) images = Images( - name="images", - description="Intrinsic signal optical images.", + name=isoi_metadata["Images"]["name"], + description=isoi_metadata["Images"]["description"], images=[raw_image, processed_image], ) isoi_module.add(images) diff --git a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_metadata.yaml b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_metadata.yaml index 24d1541..15d9264 100644 --- a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_metadata.yaml +++ b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_metadata.yaml @@ -87,3 +87,17 @@ Behavior: Sorting: units_description: Neural spikes will be sorted offline using Kilosort 2.5 and Phy2 software and manually curated to ensure precise spike time acquisition. + +IntrinsicSignalOpticalImaging: + Module: + name: intrinsic_signal_optical_imaging + description: For precise targeting of auditory cortex, intrinsic optical imaging (IOS) will be performed using a 2-photon microscope (Neurolabware). The skull is first bilaterally thinned over a region of interest (ROI) and made translucent. On experiment day, 680nm red light (ThorLabs) is used to image the ROI. Data is collected via MATLAB running custom suites for online and offline analyses. + Images: + name: images + description: Intrinsic signal optical images. + RawImage: + name: raw_image + description: Original image capture of ROI for intrinsic imaging. + ProcessedImage: + name: processed_image + description: Original image capture of ROI overlaid with topographic map of processed intrinsic signal. From 7e1e93051bf26acac00b5f93bcf85aa4f525fb17 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Fri, 4 Oct 2024 13:57:59 -0700 Subject: [PATCH 03/11] removed unused imports --- .../schneider_2024_intrinsic_signal_imaging_interface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_intrinsic_signal_imaging_interface.py b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_intrinsic_signal_imaging_interface.py index cc90b86..ded3838 100644 --- a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_intrinsic_signal_imaging_interface.py +++ b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_intrinsic_signal_imaging_interface.py @@ -2,12 +2,12 @@ from pynwb.file import NWBFile from pynwb.base import Images from pynwb.image import GrayscaleImage, RGBImage -from pydantic import FilePath, DirectoryPath +from pydantic import DirectoryPath import numpy as np from PIL import Image from neuroconv.basedatainterface import BaseDataInterface -from neuroconv.utils import DeepDict, get_base_schema +from neuroconv.utils import DeepDict from neuroconv.tools import nwb_helpers From 0668da5290a3a3715d131060fa4a6cdf7dfd3e6e Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Fri, 4 Oct 2024 14:12:22 -0700 Subject: [PATCH 04/11] added notes --- .../schneider_2024/schneider_2024_notes.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_notes.md b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_notes.md index 54ac346..520db97 100644 --- a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_notes.md +++ b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_notes.md @@ -4,6 +4,11 @@ ## Video +## Intrinsic Signal Optical Imaging +- Just including raw blood vessel image and processed overlay + pixel locations bc including the isoi roi response series would really require an extension for context, but seems like it has limited reuse potential. +- Need more detailed description of topographic lines in overlay image. +- Need pixel locs for ephys + ## Data Requests - Mice sexes - Remaining data for Grant's project From 7cc37d1f2275699caf1270cd52fab6eec067f7c4 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Fri, 4 Oct 2024 15:43:44 -0700 Subject: [PATCH 05/11] updated description from paper --- .../schneider_2024/schneider_2024_metadata.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_metadata.yaml b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_metadata.yaml index 15d9264..5997bf7 100644 --- a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_metadata.yaml +++ b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_metadata.yaml @@ -97,7 +97,7 @@ IntrinsicSignalOpticalImaging: description: Intrinsic signal optical images. RawImage: name: raw_image - description: Original image capture of ROI for intrinsic imaging. + description: Original image capture of ROI (blood vessel pattern) for intrinsic imaging. ProcessedImage: name: processed_image - description: Original image capture of ROI overlaid with topographic map of processed intrinsic signal. + description: The primary auditory cortex was identified through tonotopic mapping using a temporally periodic acoustic stimulation consisting of sequences of single pure tones of ascending or descending frequencies (20 tones per sequence, 2 to 40kHz exponentially separated, 75dB SPL, 50ms tone duration, 500ms onset-to-onset interval). Tone sequences were delivered from a free-field speaker 10cm above the mouse and repeated 40-60 times (0.1Hz). To compute tonotopic maps, the time course of each pixel was first highpass filtered using a moving average (10s window). Next, a Fourier transform was computed to extract the phase and the power of the frequency component at the frequency of acoustic stimulation (0.1 Hz). The phase indicates the sound frequency driving the response of a pixel, and the power indicates the strength of its response. To account for the hemodynamic delay and compute maps of absolute tonotopy, the response time to ascending sequence of tones was subtracted from the response time to the descending sequence. From these maps of absolute tonotopy, equally spaced iso-frequency contour lines were extracted, color-coded for sound frequency, and overlaid on top of the image of the blood vessel pattern. From 1d50bcd61185944259080610c14aa132813c062b Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Fri, 4 Oct 2024 15:44:41 -0700 Subject: [PATCH 06/11] updated notes --- src/schneider_lab_to_nwb/schneider_2024/schneider_2024_notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_notes.md b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_notes.md index 520db97..917cc00 100644 --- a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_notes.md +++ b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_notes.md @@ -6,7 +6,7 @@ ## Intrinsic Signal Optical Imaging - Just including raw blood vessel image and processed overlay + pixel locations bc including the isoi roi response series would really require an extension for context, but seems like it has limited reuse potential. -- Need more detailed description of topographic lines in overlay image. +- Used the Audette paper for description of overlay image. - Need pixel locs for ephys ## Data Requests From c1bc18ff243fc5338e9cb7b1d6cb0ca5bfa2adff Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Wed, 9 Oct 2024 08:53:18 -0700 Subject: [PATCH 07/11] Union[str, Path] --> str | Path --- .../schneider_2024_convert_all_sessions.py | 27 +++++++++---------- .../schneider_2024_convert_session.py | 13 +++++---- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_convert_all_sessions.py b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_convert_all_sessions.py index 0d59044..8cb5833 100644 --- a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_convert_all_sessions.py +++ b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_convert_all_sessions.py @@ -1,6 +1,5 @@ """Primary script to run to convert all sessions in a dataset using session_to_nwb.""" from pathlib import Path -from typing import Union from concurrent.futures import ProcessPoolExecutor, as_completed from pprint import pformat import traceback @@ -11,8 +10,8 @@ def dataset_to_nwb( *, - data_dir_path: Union[str, Path], - output_dir_path: Union[str, Path], + data_dir_path: str | Path, + output_dir_path: str | Path, max_workers: int = 1, verbose: bool = True, ): @@ -20,9 +19,9 @@ def dataset_to_nwb( Parameters ---------- - data_dir_path : Union[str, Path] + data_dir_path : str | Path The path to the directory containing the raw data. - output_dir_path : Union[str, Path] + output_dir_path : str | Path The path to the directory where the NWB files will be saved. max_workers : int, optional The number of workers to use for parallel processing, by default 1 @@ -39,7 +38,7 @@ def dataset_to_nwb( for session_to_nwb_kwargs in session_to_nwb_kwargs_per_session: session_to_nwb_kwargs["output_dir_path"] = output_dir_path session_to_nwb_kwargs["verbose"] = verbose - exception_file_path = data_dir_path / f"ERROR_.txt" # Add error file path here + exception_file_path = data_dir_path / f"ERROR_.txt" # Add error file path here futures.append( executor.submit( safe_session_to_nwb, @@ -51,7 +50,7 @@ def dataset_to_nwb( pass -def safe_session_to_nwb(*, session_to_nwb_kwargs: dict, exception_file_path: Union[Path, str]): +def safe_session_to_nwb(*, session_to_nwb_kwargs: dict, exception_file_path: str | Path): """Convert a session to NWB while handling any errors by recording error messages to the exception_file_path. Parameters @@ -72,13 +71,13 @@ def safe_session_to_nwb(*, session_to_nwb_kwargs: dict, exception_file_path: Uni def get_session_to_nwb_kwargs_per_session( *, - data_dir_path: Union[str, Path], + data_dir_path: str | Path, ): """Get the kwargs for session_to_nwb for each session in the dataset. Parameters ---------- - data_dir_path : Union[str, Path] + data_dir_path : str | Path The path to the directory containing the raw data. Returns @@ -86,11 +85,11 @@ def get_session_to_nwb_kwargs_per_session( list[dict[str, Any]] A list of dictionaries containing the kwargs for session_to_nwb for each session. """ - ##### - # # Implement this function to return the kwargs for session_to_nwb for each session - # This can be a specific list with hard-coded sessions, a path expansion or any conversion specific logic that you might need - ##### - raise NotImplementedError + ##### + # # Implement this function to return the kwargs for session_to_nwb for each session + # This can be a specific list with hard-coded sessions, a path expansion or any conversion specific logic that you might need + ##### + raise NotImplementedError if __name__ == "__main__": diff --git a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_convert_session.py b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_convert_session.py index af00e3c..8c1792a 100644 --- a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_convert_session.py +++ b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_convert_session.py @@ -1,6 +1,5 @@ """Primary script to run to convert an entire session for of data using the NWBConverter.""" from pathlib import Path -from typing import Union import datetime import pytz from zoneinfo import ZoneInfo @@ -13,12 +12,12 @@ def session_to_nwb( - recording_folder_path: Union[str, Path], - sorting_folder_path: Union[str, Path], - behavior_file_path: Union[str, Path], - video_folder_path: Union[str, Path], - intrinsic_signal_optical_imaging_folder_path: Union[str, Path], - output_dir_path: Union[str, Path], + recording_folder_path: str | Path, + sorting_folder_path: str | Path, + behavior_file_path: str | Path, + video_folder_path: str | Path, + intrinsic_signal_optical_imaging_folder_path: str | Path, + output_dir_path: str | Path, stub_test: bool = False, ): recording_folder_path = Path(recording_folder_path) From b0b1d10beeae9b9a1d1112f64ccf33398d3991ce Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Wed, 9 Oct 2024 14:37:12 -0700 Subject: [PATCH 08/11] keywords --> tuple --- .../schneider_2024/schneider_2024_behaviorinterface.py | 2 +- .../schneider_2024_intrinsic_signal_imaging_interface.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_behaviorinterface.py b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_behaviorinterface.py index 6d2b818..63b7b97 100644 --- a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_behaviorinterface.py +++ b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_behaviorinterface.py @@ -16,7 +16,7 @@ class Schneider2024BehaviorInterface(BaseDataInterface): """Behavior interface for schneider_2024 conversion""" - keywords = ["behavior"] + keywords = ("behavior",) def __init__(self, file_path: FilePath): super().__init__(file_path=file_path) diff --git a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_intrinsic_signal_imaging_interface.py b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_intrinsic_signal_imaging_interface.py index ded3838..d45ba74 100644 --- a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_intrinsic_signal_imaging_interface.py +++ b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_intrinsic_signal_imaging_interface.py @@ -14,7 +14,7 @@ class Schneider2024IntrinsicSignalOpticalImagingInterface(BaseDataInterface): """Intrinsic signal optical imaging interface for schneider_2024 conversion""" - keywords = ["intrinsic signal optical imaging"] + keywords = ("intrinsic signal optical imaging",) def __init__(self, folder_path: DirectoryPath): super().__init__(folder_path=folder_path) From e082c7a79d0e80b8496b5ce17e03b6a042e5f630 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Wed, 9 Oct 2024 14:40:57 -0700 Subject: [PATCH 09/11] added note for isoi devices --- src/schneider_lab_to_nwb/schneider_2024/schneider_2024_notes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_notes.md b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_notes.md index 917cc00..9fa76de 100644 --- a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_notes.md +++ b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_notes.md @@ -8,6 +8,7 @@ - Just including raw blood vessel image and processed overlay + pixel locations bc including the isoi roi response series would really require an extension for context, but seems like it has limited reuse potential. - Used the Audette paper for description of overlay image. - Need pixel locs for ephys +- Need device info for 2p microscope and red light laser ## Data Requests - Mice sexes From 04df5d52590127a57f512ead97c445e160134d46 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Wed, 9 Oct 2024 14:52:20 -0700 Subject: [PATCH 10/11] added placeholders for isoi 2p microscope and stim laser --- .../schneider_2024_intrinsic_signal_imaging_interface.py | 6 ++++++ .../schneider_2024/schneider_2024_metadata.yaml | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_intrinsic_signal_imaging_interface.py b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_intrinsic_signal_imaging_interface.py index d45ba74..ee6341f 100644 --- a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_intrinsic_signal_imaging_interface.py +++ b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_intrinsic_signal_imaging_interface.py @@ -2,6 +2,7 @@ from pynwb.file import NWBFile from pynwb.base import Images from pynwb.image import GrayscaleImage, RGBImage +from pynwb.device import Device from pydantic import DirectoryPath import numpy as np from PIL import Image @@ -89,3 +90,8 @@ def add_to_nwbfile(self, nwbfile: NWBFile, metadata: dict): images=[raw_image, processed_image], ) isoi_module.add(images) + + # Add Devices + for device_kwargs in isoi_metadata["Devices"]: + device = Device(**device_kwargs) + nwbfile.add_device(device) diff --git a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_metadata.yaml b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_metadata.yaml index 5997bf7..0f19a86 100644 --- a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_metadata.yaml +++ b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_metadata.yaml @@ -101,3 +101,10 @@ IntrinsicSignalOpticalImaging: ProcessedImage: name: processed_image description: The primary auditory cortex was identified through tonotopic mapping using a temporally periodic acoustic stimulation consisting of sequences of single pure tones of ascending or descending frequencies (20 tones per sequence, 2 to 40kHz exponentially separated, 75dB SPL, 50ms tone duration, 500ms onset-to-onset interval). Tone sequences were delivered from a free-field speaker 10cm above the mouse and repeated 40-60 times (0.1Hz). To compute tonotopic maps, the time course of each pixel was first highpass filtered using a moving average (10s window). Next, a Fourier transform was computed to extract the phase and the power of the frequency component at the frequency of acoustic stimulation (0.1 Hz). The phase indicates the sound frequency driving the response of a pixel, and the power indicates the strength of its response. To account for the hemodynamic delay and compute maps of absolute tonotopy, the response time to ascending sequence of tones was subtracted from the response time to the descending sequence. From these maps of absolute tonotopy, equally spaced iso-frequency contour lines were extracted, color-coded for sound frequency, and overlaid on top of the image of the blood vessel pattern. + Devices: + - name: two_photon_microscope + description: (Neurolabware) + manufacturer: Neurolabware + - name: intrinsic_signal_optical_imaging_laser + description: (ThorLabs) + manufacturer: ThorLabs From 8e38b2b73f07a2100b5e67f03fccd3fb3a422543 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Wed, 9 Oct 2024 15:22:56 -0700 Subject: [PATCH 11/11] added q about overlaid image flipped left/right --- src/schneider_lab_to_nwb/schneider_2024/schneider_2024_notes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_notes.md b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_notes.md index 9fa76de..3190d87 100644 --- a/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_notes.md +++ b/src/schneider_lab_to_nwb/schneider_2024/schneider_2024_notes.md @@ -9,6 +9,7 @@ - Used the Audette paper for description of overlay image. - Need pixel locs for ephys - Need device info for 2p microscope and red light laser +- Why is the overlaid image flipped left/right compared to the original? ## Data Requests - Mice sexes