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 support for background components in FrameSliceSegmentationExtractor #378

Merged
merged 4 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### Fixes
* Added specific error message for single-frame scanimage data [PR #360](https://github.com/catalystneuro/roiextractors/pull/360)
* Fixed bug with ScanImage's parse_metadata so that it works properly when hStackManager is disabled [PR #373](https://github.com/catalystneuro/roiextractors/pull/373)
* Add support for background components in FrameSliceSegmentationExtractor [PR #378](https://github.com/catalystneuro/roiextractors/pull/378)

### Improvements
* Removed unnecessary import checks for scipy, h5py, and zarr [PR #364](https://github.com/catalystneuro/roiextractors/pull/364)
Expand Down
9 changes: 9 additions & 0 deletions src/roiextractors/segmentationextractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,9 @@ def __init__(
if hasattr(self._parent_segmentation, "_image_masks"): # otherwise, do not set attribute at all
self._image_masks = self._parent_segmentation._image_masks

if hasattr(self._parent_segmentation, "_background_image_masks"): # otherwise, do not set attribute at all
self._background_image_masks = self._parent_segmentation._background_image_masks

parent_size = self._parent_segmentation.get_num_frames()
if start_frame is None:
start_frame = 0
Expand Down Expand Up @@ -530,6 +533,9 @@ def get_num_frames(self) -> int:
def get_num_rois(self) -> int:
return self._parent_segmentation.get_num_rois()

def get_num_background_components(self) -> int:
return self._parent_segmentation.get_num_background_components()

def get_images_dict(self) -> dict:
return self._parent_segmentation.get_images_dict()

Expand All @@ -550,3 +556,6 @@ def get_num_planes(self) -> int:

def get_roi_pixel_masks(self, roi_ids: Optional[ArrayLike] = None) -> List[np.ndarray]:
return self._parent_segmentation.get_roi_pixel_masks(roi_ids=roi_ids)

def get_background_pixel_masks(self, background_ids: Optional[ArrayLike] = None) -> List[np.ndarray]:
return self._parent_segmentation.get_background_pixel_masks(background_ids=background_ids)
Loading