Skip to content

Commit

Permalink
Add to_nwbfile to methods in roi extractors (#1027)
Browse files Browse the repository at this point in the history
  • Loading branch information
h-mayorquin authored Aug 25, 2024
1 parent bd1493c commit 727228c
Show file tree
Hide file tree
Showing 7 changed files with 645 additions and 235 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* Deprecated use of `compression` and `compression_options` in `VideoInterface` [PR #1005](https://github.com/catalystneuro/neuroconv/pull/1005)
* `get_schema_from_method_signature` has been deprecated; please use `get_json_schema_from_method_signature` instead. [PR #1016](https://github.com/catalystneuro/neuroconv/pull/1016)
* `neuroconv.utils.FilePathType` and `neuroconv.utils.FolderPathType` have been deprecated; please use `pydantic.FilePath` and `pydantic.DirectoryPath` instead. [PR #1017](https://github.com/catalystneuro/neuroconv/pull/1017)
* Changed the roiextractors.tool function (e.g. `add_imaging` and `add_segmentation`) to have the `_to_nwbfile` suffix [PR #1027][PR #1017](https://github.com/catalystneuro/neuroconv/pull/1027)


### Features
* Added MedPCInterface for operant behavioral output files. [PR #883](https://github.com/catalystneuro/neuroconv/pull/883)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ def add_to_nwbfile(
stub_test: bool = False,
stub_frames: int = 100,
):
from ...tools.roiextractors import add_imaging
from ...tools.roiextractors import add_imaging_to_nwbfile

if stub_test:
stub_frames = min([stub_frames, self.imaging_extractor.get_num_frames()])
imaging_extractor = self.imaging_extractor.frame_slice(start_frame=0, end_frame=stub_frames)
else:
imaging_extractor = self.imaging_extractor

add_imaging(
add_imaging_to_nwbfile(
imaging=imaging_extractor,
nwbfile=nwbfile,
metadata=metadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,15 @@ def add_to_nwbfile(
-------
"""
from ...tools.roiextractors import add_segmentation
from ...tools.roiextractors import add_segmentation_to_nwbfile

if stub_test:
stub_frames = min([stub_frames, self.segmentation_extractor.get_num_frames()])
segmentation_extractor = self.segmentation_extractor.frame_slice(start_frame=0, end_frame=stub_frames)
else:
segmentation_extractor = self.segmentation_extractor

add_segmentation(
add_segmentation_to_nwbfile(
segmentation_extractor=segmentation_extractor,
nwbfile=nwbfile,
metadata=metadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def add_to_nwbfile(
):
from ndx_miniscope.utils import add_miniscope_device

from ....tools.roiextractors import add_photon_series
from ....tools.roiextractors import add_photon_series_to_nwbfile

miniscope_timestamps = self.get_original_timestamps()
imaging_extractor = self.imaging_extractor
Expand All @@ -108,7 +108,7 @@ def add_to_nwbfile(
device_metadata = metadata["Ophys"]["Device"][0]
add_miniscope_device(nwbfile=nwbfile, device_metadata=device_metadata)

add_photon_series(
add_photon_series_to_nwbfile(
imaging=imaging_extractor,
nwbfile=nwbfile,
metadata=metadata,
Expand Down
17 changes: 14 additions & 3 deletions src/neuroconv/tools/roiextractors/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
from .roiextractors import (
check_if_imaging_fits_into_memory,
get_nwb_imaging_metadata,
get_nwb_segmentation_metadata,
add_background_fluorescence_traces,
add_background_plane_segmentation,
add_devices_to_nwbfile,
add_fluorescence_traces_to_nwbfile,
add_image_segmentation_to_nwbfile,
add_imaging_to_nwbfile,
add_imaging_plane_to_nwbfile,
add_photon_series_to_nwbfile,
add_plane_segmentation_to_nwbfile,
add_segmentation_to_nwbfile,
add_summary_images_to_nwbfile,
write_imaging_to_nwbfile,
write_segmentation_to_nwbfile,
add_devices,
add_fluorescence_traces,
add_image_segmentation,
Expand All @@ -10,9 +24,6 @@
add_plane_segmentation,
add_segmentation,
add_summary_images,
check_if_imaging_fits_into_memory,
get_nwb_imaging_metadata,
get_nwb_segmentation_metadata,
write_imaging,
write_segmentation,
)
Loading

0 comments on commit 727228c

Please sign in to comment.