From bd18e5b768686f3d6dbd57d4c37b8e6d4ecf64a9 Mon Sep 17 00:00:00 2001 From: Alessandra Trapani <55453048+alessandratrapani@users.noreply.github.com> Date: Fri, 5 Jan 2024 16:40:32 +0100 Subject: [PATCH] Extract roi indices from redcell.npy in Suite2pExtractor (#270) * extract roi indices from redcell.npy * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> --- .../extractors/suite2p/suite2psegmentationextractor.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/roiextractors/extractors/suite2p/suite2psegmentationextractor.py b/src/roiextractors/extractors/suite2p/suite2psegmentationextractor.py index 5756a32f..070d132c 100644 --- a/src/roiextractors/extractors/suite2p/suite2psegmentationextractor.py +++ b/src/roiextractors/extractors/suite2p/suite2psegmentationextractor.py @@ -166,7 +166,12 @@ def __init__( self._load_npy(file_name="spks.npy", mmap_mode="r", transpose=True) if channel_name == "chan1" else None ) - self.iscell = self._load_npy("iscell.npy", mmap_mode="r") + # rois segmented from the iamging acquired with second channel (red/anatomical) that match the first channel segmentation + redcell = self._load_npy(file_name="redcell.npy", mmap_mode="r") + if channel_name == "chan2" and redcell is not None: + self.iscell = redcell + else: + self.iscell = self._load_npy("iscell.npy", mmap_mode="r") # The name of the OpticalChannel object is "OpticalChannel" if there is only one channel, otherwise it is # "Chan1" or "Chan2".