diff --git a/CHANGELOG.md b/CHANGELOG.md index e53e78c5..8ed444e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/src/roiextractors/segmentationextractor.py b/src/roiextractors/segmentationextractor.py index 3c2881c1..7694f478 100644 --- a/src/roiextractors/segmentationextractor.py +++ b/src/roiextractors/segmentationextractor.py @@ -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 @@ -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() @@ -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)