def watershed_mask(self, stain_thresh: Number, markers: np.ndarray, disk_size: Optional[int]): """Create a watershed mask that is the union of the spot intensities above stain_thresh and a marker image generated from nuclei Parameters ---------- stain_thresh : Number threshold to apply to the stain image markers : np.ndarray[bool] markers for the stain_image disk_size : Optional[int] if provided, execute a morphological opening operation over the thresholded stain image Returns ------- np.ndarray[bool] : thresholded stain image """ st = self.stain >= stain_thresh watershed_mask: np.ndarray = np.logical_or(st, markers > 0) # dtype bool if disk_size is not None: watershed_mask = bin_open(watershed_mask, disk_size) return watershed_mask
def filter_nuclei(self, nuclei_thresh: float, disk_size: Optional[int]) -> np.ndarray: """Threshold the nuclei image at nuclei_thresh. Parameters ---------- nuclei_thresh : float Threshold the nuclei image at this value disk_size : int if passed, execute a binary opening of the filtered image Returns ------- np.ndarray[bool] : thresholded image """ nuclei_filt = bin_thresh(self.nuclei, nuclei_thresh) if disk_size is not None: nuclei_filt = bin_open(nuclei_filt, disk_size) return nuclei_filt
def watershed_mask(self, stain_thresh, markers, disk_size): st = self.stain >= stain_thresh watershed_mask = np.logical_or(st, markers > 0) if disk_size is not None: watershed_mask = bin_open(watershed_mask, disk_size) return watershed_mask
def filter_dapi(self, dapi_thresh, disk_size): dapi_filt = bin_thresh(self.dapi, dapi_thresh) if disk_size is not None: dapi_filt = bin_open(dapi_filt, disk_size) return dapi_filt