Skip to content

Commit

Permalink
allow for incomplete data ingestion, fix ypix bug, add mean image to …
Browse files Browse the repository at this point in the history
…caiman seg class (#227)

* added new args to allow for incomplete data import and fixed potential bug with ypix

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* make method: caiman seg class retrieve mean image

* Update src/roiextractors/extractors/suite2p/suite2psegmentationextractor.py

naming of _load_npy

Co-authored-by: Cody Baker <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update src/roiextractors/extractors/suite2p/suite2psegmentationextractor.py

remove search_plane_subdirectory

Co-authored-by: Cody Baker <[email protected]>

* update changelog

* fix bug and remove remaining references to search_plane_subdirectory

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* bug fix on function name passing tests now

* Revert suite2p to main version

* add docstrings

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Cody Baker <[email protected]>
Co-authored-by: Paul Adkisson <[email protected]>
  • Loading branch information
4 people authored Mar 4, 2024
1 parent 0f46b2c commit 7aa2a63
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@

* Added support for Miniscope AVI files with the `MiniscopeImagingExtractor`. [PR #225](https://github.com/catalystneuro/roiextractors/pull/225)

* Added support for incomplete file ingestion for the `Suite2pSegmentationExtractor`. [PR #227](https://github.com/catalystneuro/roiextractors/pull/227)

* Bug fix for the `CaimanSegmentationExtractor`: Change reshaping from 'C' to 'F' (Fortran). [PR #227](https://github.com/catalystneuro/roiextractors/pull/227)

* Bug fix for the `CaimanSegmentationExtractor`: Added importing of `self._image_correlation` and changed how `self._image_mean` to import the background component image. [PR #227](https://github.com/catalystneuro/roiextractors/pull/227)


# v0.5.2
Expand Down
14 changes: 11 additions & 3 deletions src/roiextractors/extractors/caiman/caimansegmentationextractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def __init__(self, file_path: PathType):
self._roi_response_dff = self._trace_extractor_read("F_dff")
self._roi_response_neuropil = self._trace_extractor_read("C")
self._roi_response_deconvolved = self._trace_extractor_read("S")
self._image_correlation = self._summary_image_read()
self._image_correlation = self._correlation_image_read()
self._image_mean = self._summary_image_read()
self._sampling_frequency = self._dataset_file["params"]["data"]["fr"][()]
self._image_masks = self._image_mask_sparse_read()

Expand Down Expand Up @@ -112,11 +113,18 @@ def _trace_extractor_read(self, field):
if field in self._dataset_file["estimates"]:
return lazy_ops.DatasetView(self._dataset_file["estimates"][field]).lazy_transpose()

def _summary_image_read(self):
"""Read the summary image (Cn) from the estimates dataset of the h5py file."""
def _correlation_image_read(self):
"""Read correlation image Cn."""
if self._dataset_file["estimates"].get("Cn"):
return np.array(self._dataset_file["estimates"]["Cn"])

def _summary_image_read(self):
"""Read summary image mean."""
if self._dataset_file["estimates"].get("b"):
FOV_shape = self._dataset_file["params"]["data"]["dims"][()]
b_sum = self._dataset_file["estimates"]["b"][:].sum(axis=1)
return np.array(b_sum).reshape(FOV_shape, order="F")

def get_accepted_list(self):
accepted = self._dataset_file["estimates"]["idx_components"]
if len(accepted.shape) == 0:
Expand Down

0 comments on commit 7aa2a63

Please sign in to comment.