Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 3, 2023
1 parent 61ee959 commit 39f9084
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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."
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions src/pinto_lab_to_nwb/widefield/widefield_convert_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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).
Expand Down

0 comments on commit 39f9084

Please sign in to comment.