def run(self, stack: ImageStack, in_place: bool = True, verbose: bool = True, n_processes: Optional[int] = None) -> ImageStack: """Perform filtering of an image stack Parameters ---------- stack : ImageStack Stack to be filtered. in_place : bool if True, process ImageStack in-place, otherwise return a new stack verbose : bool if True, report on filtering progress (default = False) Returns ------- ImageStack : if in-place is False, return the results of filter as a new stack """ group_by = determine_axes_to_group_by(self.is_volume) apply_filtering: Callable = partial(self._gaussian_laplace, sigma=self.sigma) return stack.apply( apply_filtering, group_by=group_by, verbose=verbose, in_place=in_place, n_processes=n_processes, )
def run(self, stack: ImageStack, in_place: bool = False, verbose: bool = True, n_processes: Optional[int] = None) -> ImageStack: """Perform filtering of an image stack Parameters ---------- stack : ImageStack Stack to be filtered. in_place : bool if True, process ImageStack in-place, otherwise return a new stack verbose : bool if True, report on filtering progress (default = False) n_processes : Optional[int] Number of parallel processes to devote to calculating the filter Returns ------- ImageStack : If in-place is False, return the results of filter as a new stack. Otherwise return the original stack. """ group_by = determine_axes_to_group_by(self.is_volume) high_pass: Callable = partial(self._high_pass, sigma=self.sigma) result = stack.apply(high_pass, group_by=group_by, verbose=verbose, in_place=in_place, n_processes=n_processes) return result
def run(self, stack: ImageStack, in_place: bool = False, verbose: bool = False, n_processes: Optional[int] = None) -> ImageStack: """Perform filtering of an image stack Parameters ---------- stack : ImageStack Stack to be filtered. in_place : bool if True, process ImageStack in-place, otherwise return a new stack verbose : bool If True, report on the percentage completed (default = False) during processing n_processes : Optional[int] Number of parallel processes to devote to calculating the filter Returns ------- ImageStack : If in-place is False, return the results of filter as a new stack. Otherwise return the original stack. """ group_by = determine_axes_to_group_by(self.is_volume) clip = partial(self._clip, p_min=self.p_min, p_max=self.p_max) result = stack.apply(clip, group_by=group_by, verbose=verbose, in_place=in_place, n_processes=n_processes) return result
def run(self, stack: ImageStack, in_place: bool = False, verbose: bool = False, n_processes: Optional[int] = None) -> ImageStack: """Perform filtering of an image stack Parameters ---------- stack : ImageStack Stack to be filtered. in_place : bool if True, process ImageStack in-place, otherwise return a new stack verbose : bool If True, report on the percentage completed (default = False) during processing n_processes : Optional[int] Number of parallel processes to devote to calculating the filter Returns ------- ImageStack : If in-place is False, return the results of filter as a new stack. Otherwise return the original stack. """ group_by = {Axes.ROUND, Axes.ZPLANE} unmix = partial(self._unmix, coeff_mat=self.coeff_mat) result = stack.apply(unmix, group_by=group_by, verbose=verbose, in_place=in_place, n_processes=n_processes) return result
def run( self, stack: ImageStack, in_place: bool=False, verbose=False, n_processes: Optional[int]=None ) -> ImageStack: """Perform filtering of an image stack Parameters ---------- stack : ImageStack Stack to be filtered. in_place : bool if True, process ImageStack in-place, otherwise return a new stack verbose : bool if True, report on the percentage completed during processing (default = False) n_processes : Optional[int] Number of parallel processes to devote to calculating the filter Returns ------- ImageStack : If in-place is False, return the results of filter as a new stack. Otherwise return the original stack. """ func = partial( self._richardson_lucy_deconv, iterations=self.num_iter, psf=self.psf, clip=self.clip ) result = stack.apply( func, in_place=in_place, verbose=verbose, n_processes=n_processes ) return result
def run( self, stack: ImageStack, in_place: bool = False, verbose: bool = False, n_processes: Optional[int] = None, *args, ) -> ImageStack: """Perform filtering of an image stack Parameters ---------- stack : ImageStack Stack to be filtered. in_place : bool if True, process ImageStack in-place, otherwise return a new stack verbose : bool if True, report on filtering progress (default = False) n_processes : Optional[int] Number of parallel processes to devote to calculating the filter Returns ------- ImageStack : If in-place is False, return the results of filter as a new stack. Otherwise return the original stack. """ bandpass_ = partial(self._bandpass, lshort=self.lshort, llong=self.llong, threshold=self.threshold, truncate=self.truncate) group_by = determine_axes_to_group_by(self.is_volume) result = stack.apply( bandpass_, group_by=group_by, in_place=in_place, n_processes=n_processes, clip_method=self.clip_method, ) return result
def run( self, stack: ImageStack, in_place: bool = False, verbose: bool = False, n_processes: Optional[int] = None, *args, ) -> ImageStack: """Perform filtering of an image stack Parameters ---------- stack : ImageStack Stack to be filtered. in_place : bool if True, process ImageStack in-place, otherwise return a new stack verbose : bool if True, report on filtering progress (default = False) n_processes : Optional[int] Number of parallel processes to devote to calculating the filter Returns ------- ImageStack : If in-place is False, return the results of filter as a new stack. Otherwise return the original stack. """ if verbose: print("Calculating reference distribution...") reference_image = self._compute_reference_distribution(stack) apply_function = partial(self._match_histograms, reference=reference_image) result = stack.apply(apply_function, group_by=self.group_by, verbose=verbose, in_place=in_place, n_processes=n_processes) return result
def run(self, stack: ImageStack, in_place: bool = False, verbose: bool = False, n_processes: Optional[int] = None) -> ImageStack: """Perform filtering of an image stack Parameters ---------- stack : ImageStack Stack to be filtered. in_place : bool if True, process ImageStack in-place, otherwise return a new stack verbose : bool if True, report the filtering progress across the tiles or volumes of the ImageStack n_processes : Optional[int] Number of parallel processes to devote to calculating the filter Returns ------- ImageStack : If in-place is False, return the results of filter as a new stack. Otherwise return the original stack. """ bandpass_ = partial(self._bandpass, lshort=self.lshort, llong=self.llong, threshold=self.threshold, truncate=self.truncate) result = stack.apply(bandpass_, verbose=verbose, in_place=in_place, is_volume=self.is_volume, n_processes=n_processes) return result