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

allow for incomplete data ingestion, fix ypix bug, add mean image to caiman seg class #227

Merged
merged 17 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved

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