From 39f9084e15cdb53aca1f8e190f0a10b4b3b8a6af Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 3 Dec 2023 14:33:03 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- ...defield_processed_segmentationinterface.py | 13 ++++++----- ..._segmentation_images_blue_datainterface.py | 22 ++++++++++++------- ...egmentation_images_violet_datainterface.py | 4 +++- .../widefield/widefield_convert_session.py | 8 +++---- 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/src/pinto_lab_to_nwb/widefield/interfaces/widefield_processed_segmentationinterface.py b/src/pinto_lab_to_nwb/widefield/interfaces/widefield_processed_segmentationinterface.py index e27da11..bda40b0 100644 --- a/src/pinto_lab_to_nwb/widefield/interfaces/widefield_processed_segmentationinterface.py +++ b/src/pinto_lab_to_nwb/widefield/interfaces/widefield_processed_segmentationinterface.py @@ -16,12 +16,13 @@ class WidefieldProcessedSegmentationinterface(BaseSegmentationExtractorInterface Extractor = WidefieldProcessedSegmentationExtractor def __init__( - self, - info_mat_file_path: FilePathType, - roi_from_ref_mat_file_path: FilePathType, - vasculature_mask_file_path: FilePathType, - blue_pca_mask_file_path: FilePathType, - verbose: bool = True): + self, + info_mat_file_path: FilePathType, + roi_from_ref_mat_file_path: FilePathType, + vasculature_mask_file_path: FilePathType, + blue_pca_mask_file_path: FilePathType, + verbose: bool = True, + ): """ Parameters diff --git a/src/pinto_lab_to_nwb/widefield/interfaces/widefield_segmentation_images_blue_datainterface.py b/src/pinto_lab_to_nwb/widefield/interfaces/widefield_segmentation_images_blue_datainterface.py index 376eae9..1469f41 100644 --- a/src/pinto_lab_to_nwb/widefield/interfaces/widefield_segmentation_images_blue_datainterface.py +++ b/src/pinto_lab_to_nwb/widefield/interfaces/widefield_segmentation_images_blue_datainterface.py @@ -14,11 +14,11 @@ class WidefieldSegmentationImagesBlueInterface(BaseDataInterface): """The custom interface to add the blue channel manual and vasculature mask to the NWBFile.""" def __init__( - self, - vasculature_mask_file_path: FilePathType, - manual_mask_file_path: FilePathType, - manual_mask_struct_name: str, - verbose: bool = True, + self, + vasculature_mask_file_path: FilePathType, + manual_mask_file_path: FilePathType, + manual_mask_struct_name: str, + verbose: bool = True, ): """ The interface to add the summary images to the NWBFile. @@ -35,7 +35,9 @@ def __init__( """ super().__init__(vasculature_mask_file_path=vasculature_mask_file_path) self.vasculature_mask_file_path = Path(vasculature_mask_file_path) - assert self.vasculature_mask_file_path.exists(), f"The vasculature mask file '{vasculature_mask_file_path}' does not exist." + assert ( + self.vasculature_mask_file_path.exists() + ), f"The vasculature mask file '{vasculature_mask_file_path}' does not exist." self.manual_mask_file_path = Path(manual_mask_file_path) assert self.manual_mask_file_path.exists(), f"The manual mask file '{manual_mask_file_path}' does not exist." @@ -49,14 +51,18 @@ def __init__( def _load_vasculature_mask(self) -> np.ndarray: vasculature_mask_mat = read_mat(str(self.vasculature_mask_file_path)) - assert "mask" in vasculature_mask_mat, f"The vasculature mask is missing from {self.vasculature_mask_file_path}." + assert ( + "mask" in vasculature_mask_mat + ), f"The vasculature mask is missing from {self.vasculature_mask_file_path}." vasculature_mask = vasculature_mask_mat["mask"] return vasculature_mask def _load_manual_mask(self): manual_mask_mat = read_mat(self.manual_mask_file_path) - assert self.manual_mask_struct_name in manual_mask_mat, f"The manual mask is missing from {self.manual_mask_file_path}." + assert ( + self.manual_mask_struct_name in manual_mask_mat + ), f"The manual mask is missing from {self.manual_mask_file_path}." manual_mask = manual_mask_mat[self.manual_mask_struct_name] return manual_mask diff --git a/src/pinto_lab_to_nwb/widefield/interfaces/widefield_segmentation_images_violet_datainterface.py b/src/pinto_lab_to_nwb/widefield/interfaces/widefield_segmentation_images_violet_datainterface.py index dc48d37..7c2d0c8 100644 --- a/src/pinto_lab_to_nwb/widefield/interfaces/widefield_segmentation_images_violet_datainterface.py +++ b/src/pinto_lab_to_nwb/widefield/interfaces/widefield_segmentation_images_violet_datainterface.py @@ -25,7 +25,9 @@ def __init__(self, violet_pca_mask_file_path: FilePathType, verbose: bool = True """ super().__init__(violet_pca_mask_file_path=violet_pca_mask_file_path) self.violet_pca_mask_file_path = Path(violet_pca_mask_file_path) - assert self.violet_pca_mask_file_path.exists(), f"The violet channel PCA mask file '{violet_pca_mask_file_path}' does not exist." + assert ( + self.violet_pca_mask_file_path.exists() + ), f"The violet channel PCA mask file '{violet_pca_mask_file_path}' does not exist." self.verbose = verbose self._image_pca_violet = self._load_pca_mask() diff --git a/src/pinto_lab_to_nwb/widefield/widefield_convert_session.py b/src/pinto_lab_to_nwb/widefield/widefield_convert_session.py index 3e17acd..a261d2c 100644 --- a/src/pinto_lab_to_nwb/widefield/widefield_convert_session.py +++ b/src/pinto_lab_to_nwb/widefield/widefield_convert_session.py @@ -182,7 +182,7 @@ def session_to_nwb( # Parameters for conversion # The folder path that contains the raw imaging data in Micro-Manager OME-TIF format (.ome.tif files). - #imaging_folder_path = Path("/Users/weian/data/Cherry/20230802/Cherry_20230802_20hz_1") + # imaging_folder_path = Path("/Users/weian/data/Cherry/20230802/Cherry_20230802_20hz_1") imaging_folder_path = Path("/Volumes/t7-ssd/Pinto/DrChicken_20230419_20hz") # The file path to the strobe sequence file. strobe_sequence_file_path = imaging_folder_path / "strobe_seq_1_2.mat" @@ -196,14 +196,14 @@ def session_to_nwb( vasculature_mask_file_path = imaging_folder_path / "vasculature_mask_2.mat" # The file path that contains the manual mask on the full size session image (blue channel). - #manual_mask_file_path = imaging_folder_path / "reg_manual_mask_jlt6316_Cherry_20230802_1_1_1.mat" + # manual_mask_file_path = imaging_folder_path / "reg_manual_mask_jlt6316_Cherry_20230802_1_1_1.mat" manual_mask_file_path = imaging_folder_path / "regManualMask.mat" # The name of the struct in the manual mask file that contains the manual mask (e.g. "regMask" or "reg_manual_mask"). - #manual_mask_struct_name = "reg_manual_mask" + # manual_mask_struct_name = "reg_manual_mask" manual_mask_struct_name = "regMask" # The file path that contains the Allen area label of each pixel mapped onto the reference image of the mouse and registered to the session. - #roi_from_ref_mat_file_path = imaging_folder_path / "ROIfromRef_1.mat" + # roi_from_ref_mat_file_path = imaging_folder_path / "ROIfromRef_1.mat" roi_from_ref_mat_file_path = imaging_folder_path / "ROIfromRef.mat" # The file path that contains the contrast based vasculature mask on the downsampled (binned) session image (blue channel).