From 2d73a4a1c9d6f68f933b7d250b1243ff37ff1160 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 17:51:18 +0000 Subject: [PATCH 1/2] ci(pre-commit.ci): auto update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.6.0 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.6.0...v5.0.0) - [github.com/psf/black: 24.8.0 → 24.10.0](https://github.com/psf/black/compare/24.8.0...24.10.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b1f72f8c..17f331f1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ default_install_hook_types: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-toml - id: check-yaml @@ -26,7 +26,7 @@ repos: # black - code formatting - repo: https://github.com/psf/black - rev: 24.8.0 + rev: 24.10.0 hooks: - id: black From 144af27fc60c89b81415e6c660eda6a488abef9b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 17:51:37 +0000 Subject: [PATCH 2/2] style(pre-commit.ci): auto fixes --- pyclesperanto/_array.py | 2 +- pyclesperanto/_bia_bob_plugins.py | 177 ++- pyclesperanto/_functionalities.py | 4 +- pyclesperanto/_operators.py | 7 +- pyclesperanto/_tier1.py | 1692 +++++++++++++--------- pyclesperanto/_tier2.py | 711 +++++---- pyclesperanto/_tier3.py | 217 +-- pyclesperanto/_tier4.py | 166 ++- pyclesperanto/_tier5.py | 92 +- pyclesperanto/_tier6.py | 107 +- pyclesperanto/_tier7.py | 205 ++- pyclesperanto/_tier8.py | 22 +- src/wrapper/tier1_.cpp | 4 +- src/wrapper/tier2_.cpp | 4 +- src/wrapper/tier3_.cpp | 4 +- src/wrapper/tier4_.cpp | 4 +- src/wrapper/tier5_.cpp | 4 +- src/wrapper/tier6_.cpp | 4 +- src/wrapper/tier7_.cpp | 4 +- src/wrapper/tier8_.cpp | 4 +- tests/test_extension_ratio_map.py | 3 +- tests/test_filter_labels_by_size.py | 3 +- tests/test_label_pixelcount_map.py | 3 +- tests/test_reduce_labels_to_centroids.py | 3 +- tests/test_threshold_otsu.py | 15 +- 25 files changed, 2071 insertions(+), 1390 deletions(-) diff --git a/pyclesperanto/_array.py b/pyclesperanto/_array.py index 0fa77752..4302cf72 100644 --- a/pyclesperanto/_array.py +++ b/pyclesperanto/_array.py @@ -344,6 +344,6 @@ def is_image(object): "", "", "", - "" + "", ] ) diff --git a/pyclesperanto/_bia_bob_plugins.py b/pyclesperanto/_bia_bob_plugins.py index 5d9c6964..94e89d9a 100644 --- a/pyclesperanto/_bia_bob_plugins.py +++ b/pyclesperanto/_bia_bob_plugins.py @@ -1,270 +1,269 @@ - def list_bia_bob_plugins(): """List of function hints for bia_bob""" return """ ## pyclesperanto - pyclesperanto is a Python library for GPU-accelerated image processing and analysis. + pyclesperanto is a Python library for GPU-accelerated image processing and analysis. To use it, you need to import it: ``` import pyclesperanto as cle ``` - + * Compute the absolute value of each pixel in an input image, optionally specifying an output image and device for processing. cle.absolute(input_image: ndarray) -> ndarray - + * Calculate the pixel-by-pixel absolute difference between two images, optionally storing the result in an output image and selecting a device for operation. cle.absolute_difference(input_image0: ndarray, input_image1: ndarray) -> ndarray - + * Generate a binary image by applying the binary AND operator to corresponding pixels of two input images, considering all non-zero pixels as 1. cle.binary_and(input_image0: ndarray, input_image1: ndarray) -> ndarray - + * Identify and highlight edge pixels of binary objects, setting them to 1 in the output image on a specified device. cle.binary_edge_detection(input_image: ndarray) -> ndarray - + * Convert an image to a binary image by negating all non-zero pixels using the binary NOT operator. cle.binary_not(input_image: ndarray) -> ndarray - + * Combine two images pixel-wise using the binary OR operator, interpreting any non-zero pixel values as 1, with optional specification of output image and device. cle.binary_or(input_image0: ndarray, input_image1: ndarray) -> ndarray - + * Subtract one binary image from another, optionally specifying an output image and device. cle.binary_subtract(input_image0: ndarray, input_image1: ndarray) -> ndarray - + * Generate a binary image by applying the XOR operation on two input images, interpreting all non-zero pixels as 1. cle.binary_xor(input_image0: ndarray, input_image1: ndarray) -> ndarray - + * Perform background subtraction using a bottomhat filter on an image with customizable region radii, connectivity, and processing device options. cle.bottom_hat(input_image: ndarray, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1, connectivity: str = 'box') -> ndarray - + * Perform background subtraction on an input image using a bottomhat filter with customizable radius parameters for X, Y, and Z dimensions. cle.bottom_hat_sphere(input_image: ndarray, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1) -> ndarray - + * calculate the centroids of all labels in a 3D label image and output the coordinates as a point list image, with optional control over background inclusion and device execution. cle.centroids_of_labels(input_image: ndarray, withBG: bool = False) -> ndarray - + * Apply spherical morphological closing to intensity or binary images with customizable radii and connectivity options, optionally specifying an output image and device. cle.closing(input_image: ndarray, radius_x: int = 1, radius_y: int = 1, radius_z: int = 0, connectivity: str = 'box') -> ndarray - + * Perform a morphological closing operation on a label image using an octagonal structuring element with optional radius and device specifications. cle.closing_labels(input_image: ndarray, radius: int = 0) -> ndarray - + * Apply morphological closing to images using a spherical footprint, adjustable by x, y, z radii and optional output and device specifications. cle.closing_sphere(input_image: ndarray, radius_x: int = 1, radius_y: int = 1, radius_z: int = 0) -> ndarray - + * Combine two label images by overwriting and sequentially relabeling, allowing specification of input images, output image, and device. cle.combine_labels(input_image0: ndarray, input_image1: ndarray) -> ndarray - + * Concatenate two images or image stacks along the X axis, with optional output image and device specifications. cle.concatenate_along_x(input_image0: ndarray, input_image1: ndarray) -> ndarray - + * Concatenate two images or stacks along the Y axis, specifying optional output and device parameters. cle.concatenate_along_y(input_image0: ndarray, input_image1: ndarray) -> ndarray - + * Concatenate two images or stacks along the Z axis to produce a combined output image, optionally specifying a device for the operation. cle.concatenate_along_z(input_image0: ndarray, input_image1: ndarray) -> ndarray - + * Generate a label map by performing connected components analysis on a binary image, considering either 'box' or 'sphere' pixel neighborhoods, with optional output image and device specification. cle.connected_component_labeling(input_image: ndarray, connectivity: str = 'box') -> ndarray - + * Analyze and label connected components in a binary image using specified neighborhood connectivity, with support for device-specific execution. cle.connected_components_labeling(input_image: ndarray, connectivity: str = 'box') -> ndarray - + * compute a vector indicating the number of touching neighbors for each label in a touch matrix, optionally ignoring background touches. cle.count_touching_neighbors(input_image: ndarray, ignore_background: bool = True) -> ndarray - + * Generate an image with pixel values of 1 on label edges and 0 elsewhere from an input labelmap. cle.detect_label_edges(input_image: ndarray) -> ndarray - + * Perform a Difference of Gaussian operation on a 3D image by applying two Gaussian blurs with specified sigmas and subtracting the results, suitable for 32-bit Float images. cle.difference_of_gaussian(input_image: ndarray, sigma1_x: float = 2, sigma1_y: float = 2, sigma1_z: float = 2, sigma2_x: float = 2, sigma2_y: float = 2, sigma2_z: float = 2) -> ndarray - + * Generate a binary image using dilation based on the specified 'box' or 'sphere' connectivity from an input image, with non-zero pixels treated as ones. cle.dilate(input_image: ndarray, connectivity: str = 'box') -> ndarray - + * Enlarge labels in an isotropic input image without overlap, optionally specifying output image, dilation radius, and device. cle.dilate_labels(input_image: ndarray, radius: int = 2) -> ndarray - + * Generate a binary image with pixel values 0 and 1 by applying binary dilation on the input image considering the von Neumann neighborhood. cle.dilate_sphere(input_image: ndarray) -> ndarray - + * apply Gaussian blur to an image, divide the original by the result, and optionally choose sigma values and device settings cle.divide_by_gaussian_background(input_image: ndarray, sigma_x: float = 2, sigma_y: float = 2, sigma_z: float = 2) -> ndarray - + * perform binary erosion on an input image using either 'box' or 'sphere' connectivity, with pixel interpretation for non-zero values as 1. cle.erode(input_image: ndarray, connectivity: str = 'box') -> ndarray - + * Perform binary erosion on an input image using the von Neumann neighborhood, outputting a binary image with pixel values 0 and 1. cle.erode_sphere(input_image: ndarray) -> ndarray - + * segment and label an image using blurring, thresholding, erosion, and masked Voronoi-labeling, suitable for dense objects but may remove small objects. cle.eroded_otsu_labeling(input_image: ndarray, number_of_erosions: int = 5, outline_sigma: float = 2) -> ndarray - + * Remove edge-touching labels from an image and renumber remaining labels, with options to exclude edges along x, y, z axes and specify a computing device. cle.exclude_labels_on_edges(input_image: ndarray, exclude_x: bool = True, exclude_y: bool = True, exclude_z: bool = True) -> ndarray - + * Filter a label image to remove labels smaller than a specified minimum size, optionally specifying an output image and processing device. cle.exclude_large_labels(input_image: ndarray, min_size: float = 100) -> ndarray - + * Filter out labels in an image that exceed a specified maximum size. cle.exclude_small_labels(input_image: ndarray, max_size: float = 100) -> ndarray - + * Dilate regions in a label map image using an octagon shape until they touch, with results output to a specified device or image. cle.extend_labeling_via_voronoi(input_image: ndarray) -> ndarray - + * Label objects in grey-value images using Gaussian blur, Otsu-thresholding, and connected component labeling, with adjustable segmentation via outline_sigma. cle.gauss_otsu_labeling(input_image0: ndarray, outline_sigma: float = 0) -> ndarray - + * Apply a Gaussian blur to an image with specified sigma values for the X, Y, and Z axes, allowing for non-isotropic filtering and skipping blur in any direction with a zero sigma. cle.gaussian_blur(input_image: ndarray, sigma_x: float = 0, sigma_y: float = 0, sigma_z: float = 0) -> ndarray - + * Calculate a matrix representing the distances between points from two n-dimensional pointlists extracted from input images, with the resulting matrix size being (n+1) x (m+1). cle.generate_distance_matrix(input_image0: ndarray, input_image1: ndarray) -> ndarray - + * generate a matrix representing label adjacency by marking touching labels in an input image, while utilizing an optional output image and device parameter. cle.generate_touch_matrix(input_image: ndarray) -> ndarray - + * Convert a binary image with single pixels set to 1 into a labeled spots image, where each detected spot is assigned a unique number. cle.label_spots(input_image: ndarray) -> ndarray - + * Generate a list of coordinates for labelled points in an image based on a labelmap resulting from connected components analysis. cle.labelled_spots_to_pointlist(input_image: ndarray) -> ndarray - + * Apply the Laplace operator using 'box' or 'sphere' connectivity to process an input image, optionally specifying an output image and device. cle.laplace(input_image: ndarray, connectivity: str = 'box') -> ndarray - + * Apply the Laplace operator using a Box neighborhood to process an input image, with options to specify an output image and the device for computation. cle.laplace_box(input_image: ndarray) -> ndarray - + * Apply the Laplace operator using a Diamond neighborhood to process an input image, optionally specifying an output image and device. cle.laplace_diamond(input_image: ndarray) -> ndarray - + * Apply a binary mask to an image, copying pixels from the input image to the output where the mask is non-zero, resulting in a masked image. cle.mask(input_image: ndarray, mask: ndarray) -> ndarray - + * Generate a masked image by copying pixels from an intensity image where corresponding pixels in a label image match a specified label value, with optional output image and device parameters. cle.mask_label(input_image0: ndarray, input_image1: ndarray, label: float = 1) -> ndarray - + * Label connected components and dilate them using an octagon shape within a masked area to produce an output label map, with optional device specification. cle.masked_voronoi_labeling(input_image: ndarray, mask: ndarray) -> ndarray - + * Compare each pixel value in an image with a constant scalar and output the maximum between them. cle.maximum_image_and_scalar(input_image: ndarray, scalar: float = 0) -> ndarray - + * Determine the maximum pixel value between two images, optionally storing the result in a specified output and selecting the device for computation. cle.maximum_images(input_image0: ndarray, input_image1: ndarray) -> ndarray - + * Calculate the local maximum within a spherical neighborhood for each pixel in an image, with customizable radii along the x, y, and z axes, and optionally specify an output image and device for processing. cle.maximum_sphere(input_image: ndarray, radius_x: float = 1, radius_y: float = 1, radius_z: float = 0) -> ndarray - + * calculate the maximum intensity projection of an image along the Z-axis, optionally specifying an output image and a processing device. cle.maximum_z_projection(input_image: ndarray) -> ndarray - + * Calculate the local mean average of pixels within a specified neighborhood shape (box or sphere) in an image, with adjustable radius for each dimension. cle.mean(input_image: ndarray, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, connectivity: str = 'box') -> ndarray - + * Calculate the local mean average of pixels within a spherical neighborhood defined by specified radii in an image. cle.mean_sphere(input_image: ndarray, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1) -> ndarray - + * Calculate and store the mean squared error (MSE) between two images in the ImageJs Results table. cle.mean_squared_error(input_image0: ndarray, input_image1: ndarray) -> float - + * compute the mean average intensity projection of an image along the Z-axis, with optional output image and device specifications cle.mean_z_projection(input_image: ndarray) -> ndarray - + * Determine the local minimum in a spherical neighborhood of each pixel with specified radii in the x, y, and z axes on a selected device. cle.minimum_sphere(input_image: ndarray, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1) -> ndarray - + * Compute the minimum intensity projection of an image along the Z-axis, specifying optional output and device parameters. cle.minimum_z_projection(input_image: ndarray) -> ndarray - + * compute the local mode of a pixel's neighborhood in an image with specified radius and shape, using values from 0 to 255. cle.mode(input_image: ndarray, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, connectivity: str = 'box') -> ndarray - + * calculate the local mode of pixel intensities within a spherical neighborhood for semantic segmentation correction, with intensity values ranging from 0 to 255, using specified radii and device options. cle.mode_sphere(input_image: ndarray, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1) -> ndarray - + * Compute the remainder of division for corresponding pixel values between two images, optionally specifying an output image and device. cle.modulo_images(input_image0: ndarray, input_image1: ndarray) -> ndarray - + * Apply morphological opening to intensity or binary images using a spherical or box-shaped footprint with configurable radii and device options. cle.opening(input_image: ndarray, radius_x: float = 1, radius_y: float = 1, radius_z: float = 0, connectivity: str = 'box') -> ndarray - + * Perform a morphological opening on a label image using an octagonal structuring element, with optional output image and device specification. cle.opening_labels(input_image: ndarray, radius: int = 0) -> ndarray - + * Apply morphological opening to intensity or binary images using a spherical footprint, specifying radii along x, y, and z axes, with optional output and device parameters. cle.opening_sphere(input_image: ndarray, radius_x: float = 1, radius_y: float = 1, radius_z: float = 0) -> ndarray - + * extract pixel intensities from specified (x,y,z) coordinates in an image and store them in a vector cle.read_values_from_positions(input_image: ndarray, list: ndarray) -> ndarray - + * Reduce a label map to its centroids in an optional output image using a specified device. cle.reduce_labels_to_centroids(input_image: ndarray) -> ndarray - + * Extracts label edges from a label map, preserving label IDs and setting the background to zero, with optional device specification for processing. cle.reduce_labels_to_label_edges(input_image: ndarray) -> ndarray - + * Renumber labels in an image to eliminate gaps, ensuring the number of labels equals the maximum label index, primarily processed on the CPU. cle.relabel_sequential(input_image: ndarray, blocksize: int = 4096) -> ndarray - + * Remove labels from the edges of an image and renumber remaining elements, with options to exclude specific axes and specify a device for operation. cle.remove_labels_on_edges(input_image: ndarray, exclude_x: bool = True, exclude_y: bool = True, exclude_z: bool = True) -> ndarray - + * Filter out objects larger than a specified size from a label map image. cle.remove_large_labels(input_image: ndarray, max_size: float = 100) -> ndarray - + * Remove labelled objects smaller than a specified pixel size from a label map image, with optional output image specification and device selection. cle.remove_small_labels(input_image: ndarray, min_size: float = 100) -> ndarray - + * Replace the intensities of an input image based on a vector mapping old to new intensity values, with optional specification of the output image and device for processing. cle.replace_intensities(input_image0: ndarray, input_image1: ndarray) -> ndarray - + * Replace pixel intensities in an image using a vector where the index corresponds to old intensities and the value to new ones, with optional output image and device specification. cle.replace_values(input_image0: ndarray, input_image1: ndarray) -> ndarray - + * Translate and rotate an image by specified vectors and angles (in degrees) optionally with interpolation and resizing, supporting operation on specified devices. cle.rigid_transform(input_image: ndarray, translate_x: float = 0, translate_y: float = 0, translate_z: float = 0, angle_x: float = 0, angle_y: float = 0, angle_z: float = 0, centered: bool = True, interpolate: bool = False, resize: bool = False) -> ndarray - + * Perform a morphological opening on a label image, fill gaps using Voronoi labeling, and retain the background, suitable for isotropic images. cle.smooth_labels(input_image: ndarray, radius: int = 0) -> ndarray - + * Apply the Sobel kernel to an input image for edge detection with optional device specification and output. cle.sobel(input_image: ndarray) -> ndarray - + * Calculate the squared pixel-by-pixel difference between two images, optionally specifying an output image and a device for processing. cle.squared_difference(input_image0: ndarray, input_image1: ndarray) -> ndarray - + * Calculate the local standard deviation of an image's pixel neighborhood with specified radii and optional output image, using either a box or sphere connectivity shape. cle.standard_deviation(input_image: ndarray, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, connectivity: str = 'box') -> ndarray - + * Calculate the local standard deviation in a pixel's spherical neighborhood based on specified radii along the x, y, and (optionally) z axes for either 2D or 3D images, with an optional device specification for processing. cle.standard_deviation_sphere(input_image: ndarray, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1) -> ndarray - + * compute the standard deviation intensity projection of an image stack along the Z-axis, with optional specification of output image and device. cle.std_z_projection(input_image: ndarray) -> ndarray - + * Subtracts a Gaussian-blurred version of an image from the original, with configurable blur radii and optional output image and device specification. cle.subtract_gaussian_background(input_image: ndarray, sigma_x: float = 2, sigma_y: float = 2, sigma_z: float = 2) -> ndarray - + * Calculate the sum intensity projection of an image along the Z-axis, optionally specifying an output image and device. cle.sum_z_projection(input_image: ndarray) -> ndarray - + * Convert an image to binary using Otsu's thresholding via a GPU-accelerated histogram. cle.threshold_otsu(input_image: ndarray) -> ndarray - + * perform background subtraction on an image using a tophat filter with customizable radii and connectivity options cle.top_hat(input_image: ndarray, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1, connectivity: str = 'box') -> ndarray - + * Subtract the background from an input image using a tophat filter with customizable radii and device options. cle.top_hat_sphere(input_image: ndarray, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1) -> ndarray - + * Calculate the local variance of a pixel's spherical neighborhood in an image, considering specified radii for each axis and optionally designating output and processing device. cle.variance_sphere(input_image: ndarray, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1) -> ndarray - + * Label connected components in a binary image and dilate regions using an octagon shape until they touch, returning the resulting label map. cle.voronoi_labeling(input_image: ndarray) -> ndarray - + * Label objects in isotropic greyvalue images by applying Gaussian blurs, spot detection, Otsu thresholding, and Voronoi labeling with parameters for segmentation precision and cell proximity control. cle.voronoi_otsu_labeling(input_image: ndarray, spot_sigma: float = 2, outline_sigma: float = 2) -> ndarray - + """ diff --git a/pyclesperanto/_functionalities.py b/pyclesperanto/_functionalities.py index 826b1f40..c925c75d 100644 --- a/pyclesperanto/_functionalities.py +++ b/pyclesperanto/_functionalities.py @@ -1,7 +1,7 @@ +from inspect import getmembers, isfunction from os import path from pathlib import Path -from typing import Optional, Union, Callable -from inspect import getmembers, isfunction +from typing import Callable, Optional, Union import numpy as np from matplotlib.colors import ListedColormap diff --git a/pyclesperanto/_operators.py b/pyclesperanto/_operators.py index cb1b9ee2..8a92def9 100644 --- a/pyclesperanto/_operators.py +++ b/pyclesperanto/_operators.py @@ -644,7 +644,12 @@ def __repr_html__(self): num_bins = 32 h = np.asarray( - histogram(self, num_bins=num_bins, minimum_intensity=self.min(), maximum_intensity=self.max()) + histogram( + self, + num_bins=num_bins, + minimum_intensity=self.min(), + maximum_intensity=self.max(), + ) ) plt.figure(figsize=(1.8, 1.2)) plt.bar(range(0, len(h)), h) diff --git a/pyclesperanto/_tier1.py b/pyclesperanto/_tier1.py index 90621bc0..ddab42e1 100644 --- a/pyclesperanto/_tier1.py +++ b/pyclesperanto/_tier1.py @@ -12,20 +12,21 @@ from ._core import Device from ._decorators import plugin_function -clic = importlib.import_module('._pyclesperanto', package='pyclesperanto') +clic = importlib.import_module("._pyclesperanto", package="pyclesperanto") + @plugin_function(categories=["filter", "in assistant"]) def absolute( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Computes the absolute value of every individual pixel x in a given image.
f(x) = |x| 
Parameters ---------- - input_image: Image + input_image: Image The input image to be processed. output_image: Optional[Image] (= None) The output image where results are written into. @@ -42,23 +43,24 @@ def absolute( """ return clic._absolute(device, input_image, output_image) + @plugin_function(categories=["combine", "in assistant"]) def add_images_weighted( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - factor1: float =1, - factor2: float =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + factor1: float = 1, + factor2: float = 1, + device: Optional[Device] = None, ) -> Image: """Calculates the sum of pairs of pixels x and y from images X and Y weighted with factors a and b.
f(x, y, a, b) = x * a + y * b
Parameters ---------- - input_image0: Image + input_image0: Image The first input image to added. - input_image1: Image + input_image1: Image The second image to be added. output_image: Optional[Image] (= None) The output image where results are written into. @@ -77,21 +79,24 @@ def add_images_weighted( ---------- [1] https://clij.github.io/clij2-docs/reference_addImagesWeighted """ - return clic._add_images_weighted(device, input_image0, input_image1, output_image, float(factor1), float(factor2)) + return clic._add_images_weighted( + device, input_image0, input_image1, output_image, float(factor1), float(factor2) + ) + @plugin_function(categories=["filter", "in assistant"]) def add_image_and_scalar( input_image: Image, - output_image: Optional[Image] =None, - scalar: float =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + scalar: float = 1, + device: Optional[Device] = None, ) -> Image: """Adds a scalar value s to all pixels x of a given image X.
f(x, s) = x +
     s
Parameters ---------- - input_image: Image + input_image: Image The input image where scalare should be added. output_image: Optional[Image] (= None) The output image where results are written into. @@ -110,12 +115,21 @@ def add_image_and_scalar( """ return clic._add_image_and_scalar(device, input_image, output_image, float(scalar)) -@plugin_function(categories=["combine", "binary processing", "in assistant", "combine labels", "label processing"]) + +@plugin_function( + categories=[ + "combine", + "binary processing", + "in assistant", + "combine labels", + "label processing", + ] +) def binary_and( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Computes a binary image (containing pixel values 0 and 1) from two images X and Y by connecting pairs of pixels x and y with the binary AND operator &. All @@ -124,9 +138,9 @@ def binary_and( Parameters ---------- - input_image0: Image + input_image0: Image The first binary input image to be processed. - input_image1: Image + input_image1: Image The second binary input image to be processed. output_image: Optional[Image] (= None) The output image where results are written into. @@ -143,18 +157,26 @@ def binary_and( """ return clic._binary_and(device, input_image0, input_image1, output_image) -@plugin_function(categories=["binary processing", "label processing", "in assistant", "bia-bob-suggestion"]) + +@plugin_function( + categories=[ + "binary processing", + "label processing", + "in assistant", + "bia-bob-suggestion", + ] +) def binary_edge_detection( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines pixels/voxels which are on the surface of binary objects and sets only them to 1 in the destination image. All other pixels are set to 0. Parameters ---------- - input_image: Image + input_image: Image The binary input image where edges will be searched. output_image: Optional[Image] (= None) The output image where edge pixels will be 1. @@ -171,11 +193,20 @@ def binary_edge_detection( """ return clic._binary_edge_detection(device, input_image, output_image) -@plugin_function(categories=["binary processing", "filter", "label processing", "in assistant", "bia-bob-suggestion"]) + +@plugin_function( + categories=[ + "binary processing", + "filter", + "label processing", + "in assistant", + "bia-bob-suggestion", + ] +) def binary_not( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Computes a binary image (containing pixel values 0 and 1) from an image X by negating its pixel values x using the binary NOT operator ! All pixel values @@ -183,7 +214,7 @@ def binary_not( Parameters ---------- - input_image: Image + input_image: Image The binary input image to be inverted. output_image: Optional[Image] (= None) The output image where results are written into. @@ -200,12 +231,21 @@ def binary_not( """ return clic._binary_not(device, input_image, output_image) -@plugin_function(categories=["combine", "binary processing", "in assistant", "combine labels", "label processing"]) + +@plugin_function( + categories=[ + "combine", + "binary processing", + "in assistant", + "combine labels", + "label processing", + ] +) def binary_or( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Computes a binary image (containing pixel values 0 and 1) from two images X and Y by connecting pairs of pixels x and y with the binary OR operator |. All pixel @@ -214,9 +254,9 @@ def binary_or( Parameters ---------- - input_image0: Image + input_image0: Image The first binary input image to be processed. - input_image1: Image + input_image1: Image The second binary input image to be processed. output_image: Optional[Image] (= None) The output image where results are written into. @@ -233,20 +273,29 @@ def binary_or( """ return clic._binary_or(device, input_image0, input_image1, output_image) -@plugin_function(categories=["combine", "binary processing", "in assistant", "combine labels", "label processing"]) + +@plugin_function( + categories=[ + "combine", + "binary processing", + "in assistant", + "combine labels", + "label processing", + ] +) def binary_subtract( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Subtracts one binary image from another. Parameters ---------- - input_image0: Image + input_image0: Image The first binary input image to be processed. - input_image1: Image + input_image1: Image The second binary input image to be subtracted from the first. output_image: Optional[Image] (= None) The output image where results are written into. @@ -263,12 +312,21 @@ def binary_subtract( """ return clic._binary_subtract(device, input_image0, input_image1, output_image) -@plugin_function(categories=["combine", "binary processing", "in assistant", "combine labels", "label processing"]) + +@plugin_function( + categories=[ + "combine", + "binary processing", + "in assistant", + "combine labels", + "label processing", + ] +) def binary_xor( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Computes a binary image (containing pixel values 0 and 1) from two images X and Y by connecting pairs of pixels x and y with the binary operators AND &, OR | @@ -277,9 +335,9 @@ def binary_xor( Parameters ---------- - input_image0: Image + input_image0: Image The first binary input image to be processed. - input_image1: Image + input_image1: Image The second binary input image to be processed. output_image: Optional[Image] (= None) The output image where results are written into. @@ -296,18 +354,19 @@ def binary_xor( """ return clic._binary_xor(device, input_image0, input_image1, output_image) + @plugin_function(categories=["filter", "binary processing"]) def binary_supinf( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Compute the maximum of the erosion with plannar structuring elements. Warning: This operation is only supported BINARY data type images. Parameters ---------- - input_image: Image + input_image: Image The binary input image to be processed. output_image: Optional[Image] (= None) The output image where results are written into. @@ -320,18 +379,19 @@ def binary_supinf( """ return clic._binary_supinf(device, input_image, output_image) + @plugin_function(categories=["filter", "binary processing"]) def binary_infsup( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Compute the minimum of the dilation with plannar structuring elements. Warning: This operation is only supported BINARY data type images. Parameters ---------- - input_image: Image + input_image: Image The binary input image to be processed. output_image: Optional[Image] (= None) The output image where results are written into. @@ -344,13 +404,14 @@ def binary_infsup( """ return clic._binary_infsup(device, input_image, output_image) + @plugin_function def block_enumerate( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - blocksize: int =256, - device: Optional[Device] =None + output_image: Optional[Image] = None, + blocksize: int = 256, + device: Optional[Device] = None, ) -> Image: """Enumerates pixels with value 1 in a onedimensional image For example handing over the image [0, 1, 1, 0, 1, 0, 1, 1] would be processed to an image [0, 1, 2, @@ -362,14 +423,14 @@ def block_enumerate( Parameters ---------- - input_image0: Image + input_image0: Image input binary vector image - input_image1: Image + input_image1: Image precomputed sums of blocks output_image: Optional[Image] (= None) output enumerated vector image blocksize: int (= 256) - + device: Optional[Device] (= None) Device to perform the operation on. @@ -377,23 +438,26 @@ def block_enumerate( ------- Image """ - return clic._block_enumerate(device, input_image0, input_image1, output_image, int(blocksize)) + return clic._block_enumerate( + device, input_image0, input_image1, output_image, int(blocksize) + ) + @plugin_function(categories=["filter", "combine", "in assistant"]) def convolve( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Convolve the image with a given kernel image. It is recommended that the kernel image has an odd size in X, Y and Z. Parameters ---------- - input_image0: Image + input_image0: Image First input image to process. - input_image1: Image + input_image1: Image Second input image to process. output_image: Optional[Image] (= None) Output result image. @@ -410,17 +474,18 @@ def convolve( """ return clic._convolve(device, input_image0, input_image1, output_image) + @plugin_function def copy( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Copies an image.
f(x) = x
Parameters ---------- - input_image: Image + input_image: Image Input image to copy. output_image: Optional[Image] (= None) Output copy image. @@ -437,12 +502,13 @@ def copy( """ return clic._copy(device, input_image, output_image) + @plugin_function def copy_slice( input_image: Image, - output_image: Optional[Image] =None, - slice_index: int =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + slice_index: int = 0, + device: Optional[Device] = None, ) -> Image: """This method has two purposes: It copies a 2D image to a given slice_index z position in a 3D image stack or It copies a given slice_index at position z in @@ -453,12 +519,12 @@ def copy_slice( Parameters ---------- - input_image: Image + input_image: Image Input image to copy from. output_image: Optional[Image] (= None) Output copy image slice_index. slice_index: int (= 0) - + device: Optional[Device] (= None) Device to perform the operation on. @@ -472,12 +538,13 @@ def copy_slice( """ return clic._copy_slice(device, input_image, output_image, int(slice_index)) + @plugin_function def copy_horizontal_slice( input_image: Image, - output_image: Optional[Image] =None, - slice_index: int =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + slice_index: int = 0, + device: Optional[Device] = None, ) -> Image: """This method has two purposes: It copies a 2D image to a given slice_index y position in a 3D image stack or It copies a given slice_index at position y in @@ -485,12 +552,12 @@ def copy_horizontal_slice( Parameters ---------- - input_image: Image + input_image: Image Input image to copy from. output_image: Optional[Image] (= None) Output copy image slice_index. slice_index: int (= 0) - + device: Optional[Device] (= None) Device to perform the operation on. @@ -502,14 +569,17 @@ def copy_horizontal_slice( ---------- [1] https://clij.github.io/clij2-docs/reference_copySlice """ - return clic._copy_horizontal_slice(device, input_image, output_image, int(slice_index)) + return clic._copy_horizontal_slice( + device, input_image, output_image, int(slice_index) + ) + @plugin_function def copy_vertical_slice( input_image: Image, - output_image: Optional[Image] =None, - slice_index: int =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + slice_index: int = 0, + device: Optional[Device] = None, ) -> Image: """This method has two purposes: It copies a 2D image to a given slice_index x position in a 3D image stack or It copies a given slice_index at position x in @@ -517,12 +587,12 @@ def copy_vertical_slice( Parameters ---------- - input_image: Image + input_image: Image Input image to copy from. output_image: Optional[Image] (= None) Output copy image slice_index. slice_index: int (= 0) - + device: Optional[Device] (= None) Device to perform the operation on. @@ -534,26 +604,29 @@ def copy_vertical_slice( ---------- [1] https://clij.github.io/clij2-docs/reference_copySlice """ - return clic._copy_vertical_slice(device, input_image, output_image, int(slice_index)) + return clic._copy_vertical_slice( + device, input_image, output_image, int(slice_index) + ) + @plugin_function def crop( input_image: Image, - output_image: Optional[Image] =None, - start_x: int =0, - start_y: int =0, - start_z: int =0, - width: int =1, - height: int =1, - depth: int =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + start_x: int = 0, + start_y: int = 0, + start_z: int = 0, + width: int = 1, + height: int = 1, + depth: int = 1, + device: Optional[Device] = None, ) -> Image: """Crops a given substack out of a given image stack. Note: If the destination image preexists already, it will be overwritten and keep it's dimensions. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -580,19 +653,30 @@ def crop( ---------- [1] https://clij.github.io/clij2-docs/reference_crop3D """ - return clic._crop(device, input_image, output_image, int(start_x), int(start_y), int(start_z), int(width), int(height), int(depth)) + return clic._crop( + device, + input_image, + output_image, + int(start_x), + int(start_y), + int(start_z), + int(width), + int(height), + int(depth), + ) + @plugin_function(categories=["filter", "in assistant"]) def cubic_root( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Computes the cubic root of each pixel. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -605,18 +689,21 @@ def cubic_root( """ return clic._cubic_root(device, input_image, output_image) -@plugin_function(categories=["binarize", "label processing", "in assistant", "bia-bob-suggestion"]) + +@plugin_function( + categories=["binarize", "label processing", "in assistant", "bia-bob-suggestion"] +) def detect_label_edges( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Takes a labelmap and returns an image where all pixels on label edges are set to 1 and all other pixels to 0. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -633,11 +720,12 @@ def detect_label_edges( """ return clic._detect_label_edges(device, input_image, output_image) + @plugin_function(categories=["binary processing"]) def dilate_box( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Computes a binary image with pixel values 0 and 1 containing the binary dilation of a given input image. The dilation takes the Mooreneighborhood (8 pixels in 2D @@ -648,7 +736,7 @@ def dilate_box( Parameters ---------- - input_image: Image + input_image: Image Input image to process. Input image to process. output_image: Optional[Image] (= None) Output result image. Output result image. @@ -665,11 +753,12 @@ def dilate_box( """ return clic._dilate_box(device, input_image, output_image) + @plugin_function(categories=["binary processing"]) def dilate_sphere( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Computes a binary image with pixel values 0 and 1 containing the binary dilation of a given input image. The dilation takes the vonNeumannneighborhood (4 pixels @@ -678,7 +767,7 @@ def dilate_sphere( Parameters ---------- - input_image: Image + input_image: Image Input image to process. Input image to process. output_image: Optional[Image] (= None) Output result image. Output result image. @@ -695,12 +784,13 @@ def dilate_sphere( """ return clic._dilate_sphere(device, input_image, output_image) + @plugin_function(categories=["binary processing"]) def dilate( input_image: Image, - output_image: Optional[Image] =None, - connectivity: str ="box", - device: Optional[Device] =None + output_image: Optional[Image] = None, + connectivity: str = "box", + device: Optional[Device] = None, ) -> Image: """Computes a binary image with pixel values 0 and 1 containing the binary dilation of a given input image. The dilation apply the Mooreneighborhood (8 pixels in 2D @@ -710,7 +800,7 @@ def dilate( Parameters ---------- - input_image: Image + input_image: Image Input image to process. Input image to process. output_image: Optional[Image] (= None) Output result image. Output result image. @@ -730,20 +820,21 @@ def dilate( """ return clic._dilate(device, input_image, output_image, str(connectivity)) + @plugin_function(categories=["combine", "in assistant"]) def divide_images( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Divides two images X and Y by each other pixel wise.
f(x, y) = x / y
Parameters ---------- - input_image0: Image + input_image0: Image First input image to process. - input_image1: Image + input_image1: Image Second input image to process. output_image: Optional[Image] (= None) Output result image. @@ -760,23 +851,24 @@ def divide_images( """ return clic._divide_images(device, input_image0, input_image1, output_image) + @plugin_function(categories=["filter", "in assistant"]) def divide_scalar_by_image( input_image: Image, - output_image: Optional[Image] =None, - scalar: float =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + scalar: float = 0, + device: Optional[Device] = None, ) -> Image: """Divides a scalar by an image pixel by pixel.
f(x, s) = s / x
Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. scalar: float (= 0) - + device: Optional[Device] (= None) Device to perform the operation on. @@ -784,23 +876,26 @@ def divide_scalar_by_image( ------- Image """ - return clic._divide_scalar_by_image(device, input_image, output_image, float(scalar)) + return clic._divide_scalar_by_image( + device, input_image, output_image, float(scalar) + ) + @plugin_function(categories=["combine", "binarize", "in assistant"]) def equal( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines if two images A and B equal pixel wise.
f(a, b) = 1 if a == b; 0
     otherwise.
Parameters ---------- - input_image0: Image + input_image0: Image The first image to be compared with. - input_image1: Image + input_image1: Image The second image to be compared with the first. output_image: Optional[Image] (= None) The resulting binary image where pixels will be 1 only if source1 @@ -817,19 +912,20 @@ def equal( """ return clic._equal(device, input_image0, input_image1, output_image) + @plugin_function(categories=["binarize", "in assistant"]) def equal_constant( input_image: Image, - output_image: Optional[Image] =None, - scalar: float =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + scalar: float = 0, + device: Optional[Device] = None, ) -> Image: """Determines if an image A and a constant b are equal.
f(a, b) = 1 if a == b;
     0 otherwise.
Parameters ---------- - input_image: Image + input_image: Image The image where every pixel is compared to the constant. output_image: Optional[Image] (= None) The resulting binary image where pixels will be 1 only if source1 @@ -848,11 +944,12 @@ def equal_constant( """ return clic._equal_constant(device, input_image, output_image, float(scalar)) + @plugin_function(categories=["binary processing"]) def erode_box( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Computes a binary image with pixel values 0 and 1 containing the binary erosion of a given input image. The erosion takes the Mooreneighborhood (8 pixels in 2D @@ -863,7 +960,7 @@ def erode_box( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -880,11 +977,12 @@ def erode_box( """ return clic._erode_box(device, input_image, output_image) + @plugin_function(categories=["binary processing"]) def erode_sphere( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Computes a binary image with pixel values 0 and 1 containing the binary erosion of a given input image. The erosion takes the vonNeumannneighborhood (4 pixels @@ -893,7 +991,7 @@ def erode_sphere( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -910,12 +1008,13 @@ def erode_sphere( """ return clic._erode_sphere(device, input_image, output_image) + @plugin_function(categories=["binary processing"]) def erode( input_image: Image, - output_image: Optional[Image] =None, - connectivity: str ="box", - device: Optional[Device] =None + output_image: Optional[Image] = None, + connectivity: str = "box", + device: Optional[Device] = None, ) -> Image: """Computes a binary image with pixel values 0 and 1 containing the binary erosion of a given input image. The erosion apply the Mooreneighborhood (8 pixels in 2D @@ -925,7 +1024,7 @@ def erode( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -945,18 +1044,19 @@ def erode( """ return clic._erode(device, input_image, output_image, str(connectivity)) + @plugin_function(categories=["filter", "in assistant"]) def exponential( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Computes base exponential of all pixels values. f(x) = exp(x) Author(s): Peter Haub, Robert Haase Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -973,20 +1073,21 @@ def exponential( """ return clic._exponential(device, input_image, output_image) + @plugin_function def flip( input_image: Image, - output_image: Optional[Image] =None, - flip_x: bool =True, - flip_y: bool =True, - flip_z: bool =True, - device: Optional[Device] =None + output_image: Optional[Image] = None, + flip_x: bool = True, + flip_y: bool = True, + flip_z: bool = True, + device: Optional[Device] = None, ) -> Image: """Flips an image in X, Y and/or Z direction depending on boolean flags. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1009,14 +1110,15 @@ def flip( """ return clic._flip(device, input_image, output_image, flip_x, flip_y, flip_z) + @plugin_function(categories=["filter", "denoise", "in assistant", "bia-bob-suggestion"]) def gaussian_blur( input_image: Image, - output_image: Optional[Image] =None, - sigma_x: float =0, - sigma_y: float =0, - sigma_z: float =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + sigma_x: float = 0, + sigma_y: float = 0, + sigma_z: float = 0, + device: Optional[Device] = None, ) -> Image: """Computes the Gaussian blurred image of an image given sigma values in X, Y and Z. Thus, the filter kernel can have nonisotropic shape. The implementation is @@ -1024,7 +1126,7 @@ def gaussian_blur( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1045,14 +1147,22 @@ def gaussian_blur( ---------- [1] https://clij.github.io/clij2-docs/reference_gaussianBlur3D """ - return clic._gaussian_blur(device, input_image, output_image, float(sigma_x), float(sigma_y), float(sigma_z)) + return clic._gaussian_blur( + device, + input_image, + output_image, + float(sigma_x), + float(sigma_y), + float(sigma_z), + ) + @plugin_function def generate_distance_matrix( coordinate_list1: Image, coordinate_list2: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Computes the distance between all point coordinates given in two point lists. Takes two images containing pointlists (dimensionality n * d, n: number of @@ -1066,9 +1176,9 @@ def generate_distance_matrix( Parameters ---------- - coordinate_list1: Image + coordinate_list1: Image First coordinate list to process. - coordinate_list2: Image + coordinate_list2: Image Second coordinate list to process. output_image: Optional[Image] (= None) Output result image. @@ -1083,13 +1193,16 @@ def generate_distance_matrix( ---------- [1] https://clij.github.io/clij2-docs/reference_generateDistanceMatrix """ - return clic._generate_distance_matrix(device, coordinate_list1, coordinate_list2, output_image) + return clic._generate_distance_matrix( + device, coordinate_list1, coordinate_list2, output_image + ) + @plugin_function(categories=["filter", "edge detection", "in assistant"]) def gradient_x( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Computes the gradient of gray values along X. Assuming a, b and c are three adjacent pixels in X direction. In the target image will be saved as:
b' =
@@ -1097,7 +1210,7 @@ def gradient_x(
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1114,11 +1227,12 @@ def gradient_x(
     """
     return clic._gradient_x(device, input_image, output_image)
 
+
 @plugin_function(categories=["filter", "edge detection", "in assistant"])
 def gradient_y(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    device: Optional[Device] = None,
 ) -> Image:
     """Computes the gradient of gray values along Y. Assuming a, b and c are three
     adjacent pixels in Y direction. In the target image will be saved as: 
b' =
@@ -1126,7 +1240,7 @@ def gradient_y(
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1143,11 +1257,12 @@ def gradient_y(
     """
     return clic._gradient_y(device, input_image, output_image)
 
+
 @plugin_function(categories=["filter", "edge detection", "in assistant"])
 def gradient_z(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    device: Optional[Device] = None,
 ) -> Image:
     """Computes the gradient of gray values along Z. Assuming a, b and c are three
     adjacent pixels in Z direction. In the target image will be saved as: 
b' =
@@ -1155,7 +1270,7 @@ def gradient_z(
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1172,21 +1287,22 @@ def gradient_z(
     """
     return clic._gradient_z(device, input_image, output_image)
 
+
 @plugin_function(categories=["combine", "binarize", "in assistant"])
 def greater(
     input_image0: Image,
     input_image1: Image,
-    output_image: Optional[Image] =None,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    device: Optional[Device] = None,
 ) -> Image:
     """Determines if two images A and B greater pixel wise. f(a, b) = 1 if a > b; 0
     otherwise.
 
     Parameters
     ----------
-    input_image0: Image 
+    input_image0: Image
         First input image to process.
-    input_image1: Image 
+    input_image1: Image
         Second input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1203,24 +1319,25 @@ def greater(
     """
     return clic._greater(device, input_image0, input_image1, output_image)
 
+
 @plugin_function(categories=["binarize", "in assistant"])
 def greater_constant(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    scalar: float =0,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    scalar: float = 0,
+    device: Optional[Device] = None,
 ) -> Image:
     """Determines if two images A and B greater pixel wise. f(a, b) = 1 if a > b; 0
     otherwise.
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
     scalar: float (= 0)
-        
+
     device: Optional[Device] (= None)
         Device to perform the operation on.
 
@@ -1234,21 +1351,22 @@ def greater_constant(
     """
     return clic._greater_constant(device, input_image, output_image, float(scalar))
 
+
 @plugin_function(categories=["combine", "binarize", "in assistant"])
 def greater_or_equal(
     input_image0: Image,
     input_image1: Image,
-    output_image: Optional[Image] =None,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    device: Optional[Device] = None,
 ) -> Image:
     """Determines if two images A and B greater or equal pixel wise. f(a, b) = 1 if a
     >= b; 0 otherwise.
 
     Parameters
     ----------
-    input_image0: Image 
+    input_image0: Image
         First input image to process.
-    input_image1: Image 
+    input_image1: Image
         Second input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1265,19 +1383,20 @@ def greater_or_equal(
     """
     return clic._greater_or_equal(device, input_image0, input_image1, output_image)
 
+
 @plugin_function(categories=["binarize", "in assistant"])
 def greater_or_equal_constant(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    scalar: float =0,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    scalar: float = 0,
+    device: Optional[Device] = None,
 ) -> Image:
     """Determines if two images A and B greater or equal pixel wise. f(a, b) = 1 if a
     >= b; 0 otherwise.
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1294,15 +1413,18 @@ def greater_or_equal_constant(
     ----------
     [1] https://clij.github.io/clij2-docs/reference_greaterOrEqualConstant
     """
-    return clic._greater_or_equal_constant(device, input_image, output_image, float(scalar))
+    return clic._greater_or_equal_constant(
+        device, input_image, output_image, float(scalar)
+    )
+
 
 @plugin_function
 def hessian_eigenvalues(
     input_image: Image,
-    small_eigenvalue: Optional[Image] =None,
-    middle_eigenvalue: Optional[Image] =None,
-    large_eigenvalue: Optional[Image] =None,
-    device: Optional[Device] =None
+    small_eigenvalue: Optional[Image] = None,
+    middle_eigenvalue: Optional[Image] = None,
+    large_eigenvalue: Optional[Image] = None,
+    device: Optional[Device] = None,
 ) -> Image:
     """Computes the eigenvalues of the hessian matrix of a 2d or 3d image. Hessian
     matrix or 2D images: [Ixx, Ixy] [Ixy, Iyy] Hessian matrix for 3D images: [Ixx,
@@ -1316,7 +1438,7 @@ def hessian_eigenvalues(
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     small_eigenvalue: Optional[Image] (= None)
         Output result image.
@@ -1331,19 +1453,22 @@ def hessian_eigenvalues(
     -------
     Image
     """
-    return clic._hessian_eigenvalues(device, input_image, small_eigenvalue, middle_eigenvalue, large_eigenvalue)
+    return clic._hessian_eigenvalues(
+        device, input_image, small_eigenvalue, middle_eigenvalue, large_eigenvalue
+    )
+
 
 @plugin_function(categories=["filter", "edge detection", "in assistant"])
 def laplace_box(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    device: Optional[Device] = None,
 ) -> Image:
     """Applies the Laplace operator (Box neighborhood) to an image.
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1360,17 +1485,18 @@ def laplace_box(
     """
     return clic._laplace_box(device, input_image, output_image)
 
+
 @plugin_function(categories=["filter", "edge detection"])
 def laplace_diamond(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    device: Optional[Device] = None,
 ) -> Image:
     """Applies the Laplace operator (Diamond neighborhood) to an image.
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1387,19 +1513,20 @@ def laplace_diamond(
     """
     return clic._laplace_diamond(device, input_image, output_image)
 
+
 @plugin_function(categories=["filter", "edge detection"])
 def laplace(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    connectivity: str ="box",
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    connectivity: str = "box",
+    device: Optional[Device] = None,
 ) -> Image:
     """Applies the Laplace operator with a "box" or a "sphere" neighborhood to an
     image.
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1418,20 +1545,21 @@ def laplace(
     """
     return clic._laplace(device, input_image, output_image, str(connectivity))
 
+
 @plugin_function(categories=["filter", "combine", "in assistant"])
 def local_cross_correlation(
     input_image0: Image,
     input_image1: Image,
-    output_image: Optional[Image] =None,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    device: Optional[Device] = None,
 ) -> Image:
     """Compute the cross correlation of an image to a given kernel.
 
     Parameters
     ----------
-    input_image0: Image 
+    input_image0: Image
         First input image to process.
-    input_image1: Image 
+    input_image1: Image
         Second input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1442,20 +1570,23 @@ def local_cross_correlation(
     -------
     Image
     """
-    return clic._local_cross_correlation(device, input_image0, input_image1, output_image)
+    return clic._local_cross_correlation(
+        device, input_image0, input_image1, output_image
+    )
+
 
 @plugin_function(categories=["filter", "in assistant"])
 def logarithm(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    device: Optional[Device] = None,
 ) -> Image:
     """Computes base e logarithm of all pixels values. f(x) = log(x) Author(s): Peter
     Haub, Robert Haase
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1472,12 +1603,13 @@ def logarithm(
     """
     return clic._logarithm(device, input_image, output_image)
 
+
 @plugin_function
 def mask(
     input_image: Image,
     mask: Image,
-    output_image: Optional[Image] =None,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    device: Optional[Device] = None,
 ) -> Image:
     """Computes a masked image by applying a binary mask to an image. All pixel values
     x of image X will be copied to the destination image in case pixel value m at
@@ -1486,9 +1618,9 @@ def mask(
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
-    mask: Image 
+    mask: Image
         Mask image to apply.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1505,13 +1637,14 @@ def mask(
     """
     return clic._mask(device, input_image, mask, output_image)
 
+
 @plugin_function
 def mask_label(
     input_image0: Image,
     input_image1: Image,
-    output_image: Optional[Image] =None,
-    label: float =1,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    label: float = 1,
+    device: Optional[Device] = None,
 ) -> Image:
     """Computes a masked image by applying a label mask to an image. All pixel values x
     of image X will be copied to the destination image in case pixel value m at the
@@ -1520,9 +1653,9 @@ def mask_label(
 
     Parameters
     ----------
-    input_image0: Image 
+    input_image0: Image
         Input Intensity image.
-    input_image1: Image 
+    input_image1: Image
         Input Label image.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1539,21 +1672,24 @@ def mask_label(
     ----------
     [1] https://clij.github.io/clij2-docs/reference_maskLabel
     """
-    return clic._mask_label(device, input_image0, input_image1, output_image, float(label))
+    return clic._mask_label(
+        device, input_image0, input_image1, output_image, float(label)
+    )
+
 
 @plugin_function(categories=["filter", "in assistant"])
 def maximum_image_and_scalar(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    scalar: float =0,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    scalar: float = 0,
+    device: Optional[Device] = None,
 ) -> Image:
     """Computes the maximum of a constant scalar s and each pixel value x in a given
     image X. 
f(x, s) = max(x, s)
Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1570,23 +1706,26 @@ def maximum_image_and_scalar( ---------- [1] https://clij.github.io/clij2-docs/reference_maximumImageAndScalar """ - return clic._maximum_image_and_scalar(device, input_image, output_image, float(scalar)) + return clic._maximum_image_and_scalar( + device, input_image, output_image, float(scalar) + ) + @plugin_function(categories=["combine", "in assistant"]) def maximum_images( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Computes the maximum of a pair of pixel values x, y from two given images X and Y.
f(x, y) = max(x, y)
Parameters ---------- - input_image0: Image + input_image0: Image First input image to process. - input_image1: Image + input_image1: Image Second input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1603,21 +1742,22 @@ def maximum_images( """ return clic._maximum_images(device, input_image0, input_image1, output_image) + @plugin_function(categories=["filter", "in assistant"]) def maximum_box( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =1, - radius_y: int =1, - radius_z: int =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 1, + radius_y: int = 1, + radius_z: int = 1, + device: Optional[Device] = None, ) -> Image: """Computes the local maximum of a pixels cube neighborhood. The cubes size is specified by its halfwidth, halfheight and halfdepth (radius). Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1638,17 +1778,20 @@ def maximum_box( ---------- [1] https://clij.github.io/clij2-docs/reference_maximum3DBox """ - return clic._maximum_box(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)) + return clic._maximum_box( + device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z) + ) + @plugin_function(categories=["filter", "in assistant"]) def maximum_filter( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =0, - radius_y: int =0, - radius_z: int =0, - connectivity: str ="box", - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 0, + radius_y: int = 0, + radius_z: int = 0, + connectivity: str = "box", + device: Optional[Device] = None, ) -> Image: """Computes the local maximum of a pixels neighborhood (box or sphere). The neighborhood size is specified by its halfwidth, halfheight and halfdepth @@ -1656,7 +1799,7 @@ def maximum_filter( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1680,19 +1823,28 @@ def maximum_filter( [1] https://clij.github.io/clij2-docs/reference_maximum3DBox [2] https://clij.github.io/clij2-docs/reference_maximum3DSphere """ - return clic._maximum_filter(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z), str(connectivity)) + return clic._maximum_filter( + device, + input_image, + output_image, + int(radius_x), + int(radius_y), + int(radius_z), + str(connectivity), + ) + @plugin_function(categories=["projection"]) def maximum_x_projection( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines the maximum intensity projection of an image along X. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1709,17 +1861,18 @@ def maximum_x_projection( """ return clic._maximum_x_projection(device, input_image, output_image) + @plugin_function(categories=["projection"]) def maximum_y_projection( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines the maximum intensity projection of an image along X. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1736,17 +1889,18 @@ def maximum_y_projection( """ return clic._maximum_y_projection(device, input_image, output_image) + @plugin_function(categories=["projection", "in assistant", "bia-bob-suggestion"]) def maximum_z_projection( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines the maximum intensity projection of an image along Z. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1763,21 +1917,22 @@ def maximum_z_projection( """ return clic._maximum_z_projection(device, input_image, output_image) + @plugin_function(categories=["filter", "denoise", "in assistant"]) def mean_box( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =1, - radius_y: int =1, - radius_z: int =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 1, + radius_y: int = 1, + radius_z: int = 1, + device: Optional[Device] = None, ) -> Image: """Computes the local mean average of a pixels boxshaped neighborhood. The cubes size is specified by its halfwidth, halfheight and halfdepth (radius). Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1798,23 +1953,26 @@ def mean_box( ---------- [1] https://clij.github.io/clij2-docs/reference_mean3DBox """ - return clic._mean_box(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)) + return clic._mean_box( + device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z) + ) + @plugin_function(categories=["filter", "denoise", "in assistant", "bia-bob-suggestion"]) def mean_sphere( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =1, - radius_y: int =1, - radius_z: int =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 1, + radius_y: int = 1, + radius_z: int = 1, + device: Optional[Device] = None, ) -> Image: """Computes the local mean average of a pixels spherical neighborhood. The spheres size is specified by its halfwidth, halfheight and halfdepth (radius). Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1835,17 +1993,20 @@ def mean_sphere( ---------- [1] https://clij.github.io/clij2-docs/reference_mean3DSphere """ - return clic._mean_sphere(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)) + return clic._mean_sphere( + device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z) + ) + @plugin_function(categories=["filter", "denoise", "in assistant"]) def mean_filter( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =1, - radius_y: int =1, - radius_z: int =1, - connectivity: str ="box", - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 1, + radius_y: int = 1, + radius_z: int = 1, + connectivity: str = "box", + device: Optional[Device] = None, ) -> Image: """Computes the local mean average of a pixels neighborhood defined as a boxshaped or a sphereshaped. The shape size is specified by its halfwidth, halfheight and @@ -1853,7 +2014,7 @@ def mean_filter( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1876,19 +2037,28 @@ def mean_filter( ---------- [1] https://clij.github.io/clij2-docs/reference_mean3DSphere """ - return clic._mean_filter(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z), str(connectivity)) + return clic._mean_filter( + device, + input_image, + output_image, + int(radius_x), + int(radius_y), + int(radius_z), + str(connectivity), + ) + @plugin_function(categories=["projection"]) def mean_x_projection( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines the mean average intensity projection of an image along X. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1905,17 +2075,18 @@ def mean_x_projection( """ return clic._mean_x_projection(device, input_image, output_image) + @plugin_function(categories=["projection"]) def mean_y_projection( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines the mean average intensity projection of an image along Y. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1932,17 +2103,18 @@ def mean_y_projection( """ return clic._mean_y_projection(device, input_image, output_image) + @plugin_function(categories=["projection", "in assistant", "bia-bob-suggestion"]) def mean_z_projection( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines the mean average intensity projection of an image along Z. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1959,14 +2131,15 @@ def mean_z_projection( """ return clic._mean_z_projection(device, input_image, output_image) + @plugin_function(categories=["filter", "denoise", "in assistant"]) def median_box( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =1, - radius_y: int =1, - radius_z: int =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 1, + radius_y: int = 1, + radius_z: int = 1, + device: Optional[Device] = None, ) -> Image: """Computes the local median of a pixels box shaped neighborhood. The box is specified by its halfwidth and halfheight (radius). For technical reasons, the @@ -1974,7 +2147,7 @@ def median_box( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1995,16 +2168,19 @@ def median_box( ---------- [1] https://clij.github.io/clij2-docs/reference_median3DBox """ - return clic._median_box(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)) + return clic._median_box( + device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z) + ) + @plugin_function(categories=["filter", "denoise", "in assistant"]) def median_sphere( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =1, - radius_y: int =1, - radius_z: int =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 1, + radius_y: int = 1, + radius_z: int = 1, + device: Optional[Device] = None, ) -> Image: """Computes the local median of a pixels sphere shaped neighborhood. The sphere is specified by its halfwidth and halfheight (radius). For technical reasons, the @@ -2012,7 +2188,7 @@ def median_sphere( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -2033,17 +2209,20 @@ def median_sphere( ---------- [1] https://clij.github.io/clij2-docs/reference_median3DSphere """ - return clic._median_sphere(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)) + return clic._median_sphere( + device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z) + ) + @plugin_function(categories=["filter", "denoise", "in assistant"]) def median( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =1, - radius_y: int =1, - radius_z: int =1, - connectivity: str ="box", - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 1, + radius_y: int = 1, + radius_z: int = 1, + connectivity: str = "box", + device: Optional[Device] = None, ) -> Image: """Computes the local median of a pixels neighborhood. The neighborhood is defined as a box or a sphere shape. Its size is specified by its halfwidth, halfheight, @@ -2052,7 +2231,7 @@ def median( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -2075,23 +2254,32 @@ def median( ---------- [1] https://clij.github.io/clij2-docs/reference_median3DSphere """ - return clic._median(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z), str(connectivity)) + return clic._median( + device, + input_image, + output_image, + int(radius_x), + int(radius_y), + int(radius_z), + str(connectivity), + ) + @plugin_function(categories=["filter", "in assistant"]) def minimum_box( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =0, - radius_y: int =0, - radius_z: int =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 0, + radius_y: int = 0, + radius_z: int = 0, + device: Optional[Device] = None, ) -> Image: """Computes the local minimum of a pixels cube neighborhood. The cubes size is specified by its halfwidth, halfheight and halfdepth (radius). Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -2112,24 +2300,27 @@ def minimum_box( ---------- [1] https://clij.github.io/clij2-docs/reference_minimum3DBox """ - return clic._minimum_box(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)) + return clic._minimum_box( + device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z) + ) + @plugin_function(categories=["filter", "in assistant"]) def minimum_filter( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =0, - radius_y: int =0, - radius_z: int =0, - connectivity: str ="box", - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 0, + radius_y: int = 0, + radius_z: int = 0, + connectivity: str = "box", + device: Optional[Device] = None, ) -> Image: """Computes the local minimum of a pixels cube neighborhood. The cubes size is specified by its halfwidth, halfheight and halfdepth (radius). Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -2153,21 +2344,30 @@ def minimum_filter( [1] https://clij.github.io/clij2-docs/reference_minimum3DBox [2] https://clij.github.io/clij2-docs/reference_minimum3DSphere """ - return clic._minimum_filter(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z), str(connectivity)) + return clic._minimum_filter( + device, + input_image, + output_image, + int(radius_x), + int(radius_y), + int(radius_z), + str(connectivity), + ) + @plugin_function(categories=["filter", "in assistant"]) def minimum_image_and_scalar( input_image: Image, - output_image: Optional[Image] =None, - scalar: float =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + scalar: float = 0, + device: Optional[Device] = None, ) -> Image: """Computes the minimum of a constant scalar s and each pixel value x in a given image X.
f(x, s) = min(x, s)
Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -2184,23 +2384,26 @@ def minimum_image_and_scalar( ---------- [1] https://clij.github.io/clij2-docs/reference_minimumImageAndScalar """ - return clic._minimum_image_and_scalar(device, input_image, output_image, float(scalar)) + return clic._minimum_image_and_scalar( + device, input_image, output_image, float(scalar) + ) + @plugin_function(categories=["combine", "in assistant"]) def minimum_images( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Computes the minimum of a pair of pixel values x, y from two given images X and Y.
f(x, y) = min(x, y)
Parameters ---------- - input_image0: Image + input_image0: Image First input image to process. - input_image1: Image + input_image1: Image Second input image to process. output_image: Optional[Image] (= None) Output result image. @@ -2217,17 +2420,18 @@ def minimum_images( """ return clic._minimum_images(device, input_image0, input_image1, output_image) + @plugin_function(categories=["projection"]) def minimum_x_projection( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines the minimum intensity projection of an image along Y. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -2244,17 +2448,18 @@ def minimum_x_projection( """ return clic._minimum_x_projection(device, input_image, output_image) + @plugin_function(categories=["projection"]) def minimum_y_projection( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines the minimum intensity projection of an image along Y. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -2271,17 +2476,18 @@ def minimum_y_projection( """ return clic._minimum_y_projection(device, input_image, output_image) + @plugin_function(categories=["projection", "in assistant", "bia-bob-suggestion"]) def minimum_z_projection( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines the minimum intensity projection of an image along Z. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -2298,14 +2504,15 @@ def minimum_z_projection( """ return clic._minimum_z_projection(device, input_image, output_image) + @plugin_function(categories=["label processing", "in assistant"]) def mode_box( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =1, - radius_y: int =1, - radius_z: int =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 1, + radius_y: int = 1, + radius_z: int = 1, + device: Optional[Device] = None, ) -> Image: """Computes the local mode of a pixels box shaped neighborhood. This can be used to postprocess and locally correct semantic segmentation results. The box is @@ -2315,7 +2522,7 @@ def mode_box( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -2332,16 +2539,19 @@ def mode_box( ------- Image """ - return clic._mode_box(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)) + return clic._mode_box( + device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z) + ) + @plugin_function(categories=["label processing", "in assistant", "bia-bob-suggestion"]) def mode_sphere( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =1, - radius_y: int =1, - radius_z: int =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 1, + radius_y: int = 1, + radius_z: int = 1, + device: Optional[Device] = None, ) -> Image: """Computes the local mode of a pixels sphere shaped neighborhood. This can be used to postprocess and locally correct semantic segmentation results. The sphere is @@ -2351,7 +2561,7 @@ def mode_sphere( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -2368,17 +2578,20 @@ def mode_sphere( ------- Image """ - return clic._mode_sphere(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)) + return clic._mode_sphere( + device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z) + ) + @plugin_function(categories=["label processing", "in assistant"]) def mode( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =1, - radius_y: int =1, - radius_z: int =1, - connectivity: str ="box", - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 1, + radius_y: int = 1, + radius_z: int = 1, + connectivity: str = "box", + device: Optional[Device] = None, ) -> Image: """Computes the local mode of a pixels neighborhood. This neighborhood can be shaped as a box or a sphere. This can be used to postprocess and locally correct @@ -2389,7 +2602,7 @@ def mode( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -2408,22 +2621,31 @@ def mode( ------- Image """ - return clic._mode(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z), str(connectivity)) + return clic._mode( + device, + input_image, + output_image, + int(radius_x), + int(radius_y), + int(radius_z), + str(connectivity), + ) + @plugin_function(categories=["combine"]) def modulo_images( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Computes the remainder of a division of pairwise pixel values in two images Parameters ---------- - input_image0: Image + input_image0: Image First input image to process. - input_image1: Image + input_image1: Image Second input image to process. output_image: Optional[Image] (= None) Output result image. @@ -2436,19 +2658,20 @@ def modulo_images( """ return clic._modulo_images(device, input_image0, input_image1, output_image) + @plugin_function def multiply_image_and_position( input_image: Image, - output_image: Optional[Image] =None, - dimension: int =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + dimension: int = 0, + device: Optional[Device] = None, ) -> Image: """Multiplies all pixel intensities with the x, y or z coordinate, depending on specified dimension. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -2465,21 +2688,24 @@ def multiply_image_and_position( ---------- [1] https://clij.github.io/clij2-docs/reference_multiplyImageAndCoordinate """ - return clic._multiply_image_and_position(device, input_image, output_image, int(dimension)) + return clic._multiply_image_and_position( + device, input_image, output_image, int(dimension) + ) + @plugin_function(categories=["filter", "in assistant"]) def multiply_image_and_scalar( input_image: Image, - output_image: Optional[Image] =None, - scalar: float =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + scalar: float = 0, + device: Optional[Device] = None, ) -> Image: """Multiplies all pixels value x in a given image X with a constant scalar s.
f(x, s) = x * s
Parameters ---------- - input_image: Image + input_image: Image The input image to be multiplied with a constant. output_image: Optional[Image] (= None) The output image where results are written into. @@ -2496,23 +2722,26 @@ def multiply_image_and_scalar( ---------- [1] https://clij.github.io/clij2-docs/reference_multiplyImageAndScalar """ - return clic._multiply_image_and_scalar(device, input_image, output_image, float(scalar)) + return clic._multiply_image_and_scalar( + device, input_image, output_image, float(scalar) + ) + @plugin_function(categories=["combine", "in assistant"]) def multiply_images( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Multiplies all pairs of pixel values x and y from two image X and Y.
f(x,
     y) = x * y
Parameters ---------- - input_image0: Image + input_image0: Image The first input image to be multiplied. - input_image1: Image + input_image1: Image The second image to be multiplied. output_image: Optional[Image] (= None) The output image where results are written into. @@ -2529,14 +2758,15 @@ def multiply_images( """ return clic._multiply_images(device, input_image0, input_image1, output_image) + @plugin_function def nan_to_num( input_image: Image, - output_image: Optional[Image] =None, - nan: float =0, - posinf: float =np.nan_to_num(float('inf')), - neginf: float =np.nan_to_num(float('-inf')), - device: Optional[Device] =None + output_image: Optional[Image] = None, + nan: float = 0, + posinf: float = np.nan_to_num(float("inf")), + neginf: float = np.nan_to_num(float("-inf")), + device: Optional[Device] = None, ) -> Image: """Copies all pixels instead those which are not a number (NaN), or positive/negative infinity which are replaced by a defined new value, default 0. @@ -2546,7 +2776,7 @@ def nan_to_num( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) The output image where results are written into. @@ -2567,14 +2797,17 @@ def nan_to_num( ---------- [1] https://numpy.org/doc/stable/reference/generated/numpy.nan_to_num.html """ - return clic._nan_to_num(device, input_image, output_image, float(nan), float(posinf), float(neginf)) + return clic._nan_to_num( + device, input_image, output_image, float(nan), float(posinf), float(neginf) + ) + @plugin_function def nonzero_maximum_box( input_image: Image, output_image0: Image, - output_image1: Optional[Image] =None, - device: Optional[Device] =None + output_image1: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Apply a maximum filter (box shape) to the input image. The radius is fixed to 1 and pixels with value 0 are ignored. Note: Pixels with 0 value in the input @@ -2583,9 +2816,9 @@ def nonzero_maximum_box( Parameters ---------- - input_image: Image + input_image: Image Input image to process. - output_image0: Image + output_image0: Image Output flag (0 or 1). output_image1: Optional[Image] (= None) Output image where results are written into. @@ -2602,12 +2835,13 @@ def nonzero_maximum_box( """ return clic._nonzero_maximum_box(device, input_image, output_image0, output_image1) + @plugin_function def nonzero_maximum_diamond( input_image: Image, output_image0: Image, - output_image1: Optional[Image] =None, - device: Optional[Device] =None + output_image1: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Apply a maximum filter (diamond shape) to the input image. The radius is fixed to 1 and pixels with value 0 are ignored. Note: Pixels with 0 value in the input @@ -2616,9 +2850,9 @@ def nonzero_maximum_diamond( Parameters ---------- - input_image: Image + input_image: Image Input image to process. - output_image0: Image + output_image0: Image Output flag (0 or 1). output_image1: Optional[Image] (= None) Output image where results are written into. @@ -2633,15 +2867,18 @@ def nonzero_maximum_diamond( ---------- [1] https://clij.github.io/clij2-docs/reference_nonzeroMaximumDiamond """ - return clic._nonzero_maximum_diamond(device, input_image, output_image0, output_image1) + return clic._nonzero_maximum_diamond( + device, input_image, output_image0, output_image1 + ) + @plugin_function def nonzero_maximum( input_image: Image, output_image0: Image, - output_image1: Optional[Image] =None, - connectivity: str ="box", - device: Optional[Device] =None + output_image1: Optional[Image] = None, + connectivity: str = "box", + device: Optional[Device] = None, ) -> Image: """Apply a maximum filter of a neighborhood to the input image. The neighborhood shape can be a box or a sphere. The size is fixed to 1 and pixels with value 0 @@ -2651,9 +2888,9 @@ def nonzero_maximum( Parameters ---------- - input_image: Image + input_image: Image Input image to process. - output_image0: Image + output_image0: Image Output flag (0 or 1). output_image1: Optional[Image] (= None) Output image where results are written into. @@ -2671,14 +2908,17 @@ def nonzero_maximum( [1] https://clij.github.io/clij2-docs/reference_nonzeroMaximumBox [2] https://clij.github.io/clij2-docs/reference_nonzeroMaximumDiamond """ - return clic._nonzero_maximum(device, input_image, output_image0, output_image1, str(connectivity)) + return clic._nonzero_maximum( + device, input_image, output_image0, output_image1, str(connectivity) + ) + @plugin_function def nonzero_minimum_box( input_image: Image, output_image0: Image, - output_image1: Optional[Image] =None, - device: Optional[Device] =None + output_image1: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Apply a minimum filter (box shape) to the input image. The radius is fixed to 1 and pixels with value 0 are ignored. Note: Pixels with 0 value in the input @@ -2687,9 +2927,9 @@ def nonzero_minimum_box( Parameters ---------- - input_image: Image + input_image: Image Input image to process. - output_image0: Image + output_image0: Image Output flag (0 or 1). output_image1: Optional[Image] (= None) Output image where results are written into. @@ -2706,12 +2946,13 @@ def nonzero_minimum_box( """ return clic._nonzero_minimum_box(device, input_image, output_image0, output_image1) + @plugin_function def nonzero_minimum_diamond( input_image: Image, output_image0: Image, - output_image1: Optional[Image] =None, - device: Optional[Device] =None + output_image1: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Apply a minimum filter (diamond shape) to the input image. The radius is fixed to 1 and pixels with value 0 are ignored.Note: Pixels with 0 value in the input @@ -2720,9 +2961,9 @@ def nonzero_minimum_diamond( Parameters ---------- - input_image: Image + input_image: Image Input image to process. - output_image0: Image + output_image0: Image Output flag (0 or 1). output_image1: Optional[Image] (= None) Output image where results are written into. @@ -2737,15 +2978,18 @@ def nonzero_minimum_diamond( ---------- [1] https://clij.github.io/clij2-docs/reference_nonzeroMinimumDiamond """ - return clic._nonzero_minimum_diamond(device, input_image, output_image0, output_image1) + return clic._nonzero_minimum_diamond( + device, input_image, output_image0, output_image1 + ) + @plugin_function def nonzero_minimum( input_image: Image, output_image0: Image, - output_image1: Optional[Image] =None, - connectivity: str ="box", - device: Optional[Device] =None + output_image1: Optional[Image] = None, + connectivity: str = "box", + device: Optional[Device] = None, ) -> Image: """Apply a minimum filter of a neighborhood to the input image. The neighborhood shape can be a box or a sphere. The radius is fixed to 1 and pixels with value 0 @@ -2755,9 +2999,9 @@ def nonzero_minimum( Parameters ---------- - input_image: Image + input_image: Image Input image to process. - output_image0: Image + output_image0: Image Output flag (0 or 1). output_image1: Optional[Image] (= None) Output image where results are written into. @@ -2775,23 +3019,26 @@ def nonzero_minimum( [1] https://clij.github.io/clij2-docs/reference_nonzeroMinimumBox [2] https://clij.github.io/clij2-docs/reference_nonzeroMinimumDiamond """ - return clic._nonzero_minimum(device, input_image, output_image0, output_image1, str(connectivity)) + return clic._nonzero_minimum( + device, input_image, output_image0, output_image1, str(connectivity) + ) + @plugin_function(categories=["combine", "binarize", "in assistant"]) def not_equal( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines if two images A and B equal pixel wise. f(a, b) = 1 if a != b; 0 otherwise. Parameters ---------- - input_image0: Image + input_image0: Image The first image to be compared with. - input_image1: Image + input_image1: Image The second image to be compared with the first. output_image: Optional[Image] (= None) The resulting binary image where pixels will be 1 only if source1 @@ -2808,19 +3055,20 @@ def not_equal( """ return clic._not_equal(device, input_image0, input_image1, output_image) + @plugin_function(categories=["binarize", "in assistant"]) def not_equal_constant( input_image: Image, - output_image: Optional[Image] =None, - scalar: float =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + scalar: float = 0, + device: Optional[Device] = None, ) -> Image: """Determines if two images A and B equal pixel wise. f(a, b) = 1 if a != b; 0 otherwise. Parameters ---------- - input_image: Image + input_image: Image The image where every pixel is compared to the constant. output_image: Optional[Image] (= None) The resulting binary image where pixels will be 1 only if source1 @@ -2839,20 +3087,21 @@ def not_equal_constant( """ return clic._not_equal_constant(device, input_image, output_image, float(scalar)) + @plugin_function(categories=["combine", "in assistant"]) def paste( input_image: Image, - output_image: Optional[Image] =None, - destination_x: int =0, - destination_y: int =0, - destination_z: int =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + destination_x: int = 0, + destination_y: int = 0, + destination_z: int = 0, + device: Optional[Device] = None, ) -> Image: """Pastes an image into another image at a given position. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -2873,23 +3122,31 @@ def paste( ---------- [1] https://clij.github.io/clij2-docs/reference_paste3D """ - return clic._paste(device, input_image, output_image, int(destination_x), int(destination_y), int(destination_z)) + return clic._paste( + device, + input_image, + output_image, + int(destination_x), + int(destination_y), + int(destination_z), + ) + @plugin_function def onlyzero_overwrite_maximum_box( input_image: Image, output_image0: Image, - output_image1: Optional[Image] =None, - device: Optional[Device] =None + output_image1: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Apply a local maximum filter to an image which only overwrites pixels with value 0. Parameters ---------- - input_image: Image + input_image: Image Input image to process. - output_image0: Image + output_image0: Image Output flag value, 0 or 1. output_image1: Optional[Image] (= None) Output image. @@ -2904,23 +3161,26 @@ def onlyzero_overwrite_maximum_box( ---------- [1] https://clij.github.io/clij2-docs/reference_onlyzeroOverwriteMaximumBox """ - return clic._onlyzero_overwrite_maximum_box(device, input_image, output_image0, output_image1) + return clic._onlyzero_overwrite_maximum_box( + device, input_image, output_image0, output_image1 + ) + @plugin_function def onlyzero_overwrite_maximum_diamond( input_image: Image, output_image0: Image, - output_image1: Optional[Image] =None, - device: Optional[Device] =None + output_image1: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Apply a local maximum filter to an image which only overwrites pixels with value 0. Parameters ---------- - input_image: Image + input_image: Image Input image to process. - output_image0: Image + output_image0: Image Output flag value, 0 or 1. output_image1: Optional[Image] (= None) Output image. @@ -2935,24 +3195,27 @@ def onlyzero_overwrite_maximum_diamond( ---------- [1] https://clij.github.io/clij2-docs/reference_onlyzeroOverwriteMaximumDiamond """ - return clic._onlyzero_overwrite_maximum_diamond(device, input_image, output_image0, output_image1) + return clic._onlyzero_overwrite_maximum_diamond( + device, input_image, output_image0, output_image1 + ) + @plugin_function def onlyzero_overwrite_maximum( input_image: Image, output_image0: Image, - output_image1: Optional[Image] =None, - connectivity: str ="box", - device: Optional[Device] =None + output_image1: Optional[Image] = None, + connectivity: str = "box", + device: Optional[Device] = None, ) -> Image: """Apply a local maximum filter to an image which only overwrites pixels with value 0. Parameters ---------- - input_image: Image + input_image: Image Input image to process. - output_image0: Image + output_image0: Image Output flag value, 0 or 1. output_image1: Optional[Image] (= None) Output image. @@ -2970,21 +3233,24 @@ def onlyzero_overwrite_maximum( [1] https://clij.github.io/clij2-docs/reference_onlyzeroOverwriteMaximumBox [2] https://clij.github.io/clij2-docs/reference_onlyzeroOverwriteMaximumDiamond """ - return clic._onlyzero_overwrite_maximum(device, input_image, output_image0, output_image1, str(connectivity)) + return clic._onlyzero_overwrite_maximum( + device, input_image, output_image0, output_image1, str(connectivity) + ) + @plugin_function(categories=["filter", "in assistant"]) def power( input_image: Image, - output_image: Optional[Image] =None, - scalar: float =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + scalar: float = 1, + device: Optional[Device] = None, ) -> Image: """Computes all pixels value x to the power of a given exponent a.
f(x, a) = x
     ^ a
Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -3003,20 +3269,21 @@ def power( """ return clic._power(device, input_image, output_image, float(scalar)) + @plugin_function(categories=["combine", "in assistant"]) def power_images( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Calculates x to the power of y pixel wise of two images X and Y. Parameters ---------- - input_image0: Image + input_image0: Image First input image to process. - input_image1: Image + input_image1: Image Second input image to process. output_image: Optional[Image] (= None) Output result image. @@ -3033,26 +3300,27 @@ def power_images( """ return clic._power_images(device, input_image0, input_image1, output_image) + @plugin_function(categories=["transform", "in assistant"]) def range( input_image: Image, - output_image: Optional[Image] =None, - start_x: Optional[int] =None, - stop_x: Optional[int] =None, - step_x: Optional[int] =None, - start_y: Optional[int] =None, - stop_y: Optional[int] =None, - step_y: Optional[int] =None, - start_z: Optional[int] =None, - stop_z: Optional[int] =None, - step_z: Optional[int] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + start_x: Optional[int] = None, + stop_x: Optional[int] = None, + step_x: Optional[int] = None, + start_y: Optional[int] = None, + stop_y: Optional[int] = None, + step_y: Optional[int] = None, + start_z: Optional[int] = None, + stop_z: Optional[int] = None, + step_z: Optional[int] = None, + device: Optional[Device] = None, ) -> Image: """Crops an image according to a defined range and step size. Parameters ---------- - input_image: Image + input_image: Image First input image to process. output_image: Optional[Image] (= None) Output result image. @@ -3081,14 +3349,28 @@ def range( ------- Image """ - return clic._range(device, input_image, output_image, start_x, stop_x, step_x, start_y, stop_y, step_y, start_z, stop_z, step_z) + return clic._range( + device, + input_image, + output_image, + start_x, + stop_x, + step_x, + start_y, + stop_y, + step_y, + start_z, + stop_z, + step_z, + ) + @plugin_function def read_values_from_positions( input_image: Image, list: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Go to positions in a given image specified by a pointlist and read intensities of those pixels. The intensities are stored in a new vector. The positions are @@ -3096,9 +3378,9 @@ def read_values_from_positions( Parameters ---------- - input_image: Image + input_image: Image Input image to process. - list: Image + list: Image List of coordinate, as a 2D matrix. output_image: Optional[Image] (= None) Output vector image of intensities. @@ -3111,12 +3393,13 @@ def read_values_from_positions( """ return clic._read_values_from_positions(device, input_image, list, output_image) + @plugin_function(categories=["bia-bob-suggestion"]) def replace_values( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Replaces integer intensities specified in a vector image. The values are passed as a vector of values. The vector index represents the old intensity and the @@ -3124,9 +3407,9 @@ def replace_values( Parameters ---------- - input_image0: Image + input_image0: Image Input image to process. - input_image1: Image + input_image1: Image List of intensities to replace, as a vector of values. output_image: Optional[Image] (= None) Output result image. @@ -3143,19 +3426,20 @@ def replace_values( """ return clic._replace_values(device, input_image0, input_image1, output_image) + @plugin_function def replace_value( input_image: Image, - output_image: Optional[Image] =None, - value_to_replace: float =0, - value_replacement: float =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + value_to_replace: float = 0, + value_replacement: float = 1, + device: Optional[Device] = None, ) -> Image: """Replaces a specific intensity in an image with a given new value. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -3174,21 +3458,28 @@ def replace_value( ---------- [1] https://clij.github.io/clij2-docs/reference_replaceIntensity """ - return clic._replace_value(device, input_image, output_image, float(value_to_replace), float(value_replacement)) + return clic._replace_value( + device, + input_image, + output_image, + float(value_to_replace), + float(value_replacement), + ) + @plugin_function def replace_intensity( input_image: Image, - output_image: Optional[Image] =None, - value_to_replace: float =0, - value_replacement: float =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + value_to_replace: float = 0, + value_replacement: float = 1, + device: Optional[Device] = None, ) -> Image: """Replaces a specific intensity in an image with a given new value. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -3207,14 +3498,21 @@ def replace_intensity( ---------- [1] https://clij.github.io/clij2-docs/reference_replaceIntensity """ - return clic._replace_intensity(device, input_image, output_image, float(value_to_replace), float(value_replacement)) + return clic._replace_intensity( + device, + input_image, + output_image, + float(value_to_replace), + float(value_replacement), + ) + @plugin_function def replace_intensities( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Replaces integer intensities specified in a vector image. The values are passed as a vector of values. The vector index represents the old intensity and the @@ -3222,9 +3520,9 @@ def replace_intensities( Parameters ---------- - input_image0: Image + input_image0: Image Input image to process. - input_image1: Image + input_image1: Image List of intensities to replace, as a vector of values. output_image: Optional[Image] (= None) Output result image. @@ -3241,21 +3539,22 @@ def replace_intensities( """ return clic._replace_intensities(device, input_image0, input_image1, output_image) + @plugin_function(categories=["filter", "in assistant", "bia-bob-suggestion"]) def maximum_sphere( input_image: Image, - output_image: Optional[Image] =None, - radius_x: float =1, - radius_y: float =1, - radius_z: float =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: float = 1, + radius_y: float = 1, + radius_z: float = 0, + device: Optional[Device] = None, ) -> Image: """Computes the local maximum of a pixels spherical neighborhood. The spheres size is specified by its halfwidth, halfheight and halfdepth (radius). Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -3276,23 +3575,31 @@ def maximum_sphere( ---------- [1] https://clij.github.io/clij2-docs/reference_maximum3DSphere """ - return clic._maximum_sphere(device, input_image, output_image, float(radius_x), float(radius_y), float(radius_z)) + return clic._maximum_sphere( + device, + input_image, + output_image, + float(radius_x), + float(radius_y), + float(radius_z), + ) + @plugin_function(categories=["filter", "in assistant", "bia-bob-suggestion"]) def minimum_sphere( input_image: Image, - output_image: Optional[Image] =None, - radius_x: float =1, - radius_y: float =1, - radius_z: float =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: float = 1, + radius_y: float = 1, + radius_z: float = 1, + device: Optional[Device] = None, ) -> Image: """Computes the local minimum of a pixels spherical neighborhood. The spheres size is specified by its halfwidth, halfheight and halfdepth (radius). Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -3313,23 +3620,31 @@ def minimum_sphere( ---------- [1] https://clij.github.io/clij2-docs/reference_minimum3DSphere """ - return clic._minimum_sphere(device, input_image, output_image, float(radius_x), float(radius_y), float(radius_z)) + return clic._minimum_sphere( + device, + input_image, + output_image, + float(radius_x), + float(radius_y), + float(radius_z), + ) + @plugin_function def multiply_matrix( matrix1: Image, matrix2: Image, - matrix_destination: Optional[Image] =None, - device: Optional[Device] =None + matrix_destination: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Multiplies two matrices with each other. Shape of matrix1 should be equal to shape of matrix2 transposed. Parameters ---------- - matrix1: Image + matrix1: Image First matrix to process. - matrix2: Image + matrix2: Image Second matrix to process. matrix_destination: Optional[Image] (= None) Output result matrix. @@ -3346,18 +3661,19 @@ def multiply_matrix( """ return clic._multiply_matrix(device, matrix1, matrix2, matrix_destination) + @plugin_function(categories=["filter", "in assistant"]) def reciprocal( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Computes 1/x for every pixel value This function is supposed to work similarly to its counter part in numpy [1] Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -3374,18 +3690,17 @@ def reciprocal( """ return clic._reciprocal(device, input_image, output_image) + @plugin_function def set( - input_image: Image, - scalar: float =0, - device: Optional[Device] =None + input_image: Image, scalar: float = 0, device: Optional[Device] = None ) -> Image: """Sets all pixel values x of a given image X to a constant value v.
f(x) =
     v
Parameters ---------- - input_image: Image + input_image: Image Input image to process. scalar: float (= 0) Value to set. @@ -3402,18 +3717,19 @@ def set( """ return clic._set(device, input_image, float(scalar)) + @plugin_function def set_column( input_image: Image, - column_index: int =0, - value: float =0, - device: Optional[Device] =None + column_index: int = 0, + value: float = 0, + device: Optional[Device] = None, ) -> Image: """Sets all pixel values x of a given column in X to a constant value v. Parameters ---------- - input_image: Image + input_image: Image Input image to process. column_index: int (= 0) Column index. @@ -3432,17 +3748,16 @@ def set_column( """ return clic._set_column(device, input_image, int(column_index), float(value)) + @plugin_function def set_image_borders( - input_image: Image, - value: float =0, - device: Optional[Device] =None + input_image: Image, value: float = 0, device: Optional[Device] = None ) -> Image: """Sets all pixel values at the image border to a given value. Parameters ---------- - input_image: Image + input_image: Image Input image to process. value: float (= 0) Value to set. @@ -3459,18 +3774,19 @@ def set_image_borders( """ return clic._set_image_borders(device, input_image, float(value)) + @plugin_function def set_plane( input_image: Image, - plane_index: int =0, - value: float =0, - device: Optional[Device] =None + plane_index: int = 0, + value: float = 0, + device: Optional[Device] = None, ) -> Image: """Sets all pixel values x of a given plane in X to a constant value v. Parameters ---------- - input_image: Image + input_image: Image Input image to process. plane_index: int (= 0) Plane index. @@ -3489,16 +3805,14 @@ def set_plane( """ return clic._set_plane(device, input_image, int(plane_index), float(value)) + @plugin_function -def set_ramp_x( - input_image: Image, - device: Optional[Device] =None -) -> Image: +def set_ramp_x(input_image: Image, device: Optional[Device] = None) -> Image: """Sets all pixel values to their X coordinate. Parameters ---------- - input_image: Image + input_image: Image Input image to process. device: Optional[Device] (= None) Device to perform the operation on. @@ -3513,16 +3827,14 @@ def set_ramp_x( """ return clic._set_ramp_x(device, input_image) + @plugin_function -def set_ramp_y( - input_image: Image, - device: Optional[Device] =None -) -> Image: +def set_ramp_y(input_image: Image, device: Optional[Device] = None) -> Image: """Sets all pixel values to their Y coordinate. Parameters ---------- - input_image: Image + input_image: Image Input image to process. device: Optional[Device] (= None) Device to perform the operation on. @@ -3537,16 +3849,14 @@ def set_ramp_y( """ return clic._set_ramp_y(device, input_image) + @plugin_function -def set_ramp_z( - input_image: Image, - device: Optional[Device] =None -) -> Image: +def set_ramp_z(input_image: Image, device: Optional[Device] = None) -> Image: """Sets all pixel values to their Z coordinate. Parameters ---------- - input_image: Image + input_image: Image Input image to process. device: Optional[Device] (= None) Device to perform the operation on. @@ -3561,23 +3871,24 @@ def set_ramp_z( """ return clic._set_ramp_z(device, input_image) + @plugin_function def set_row( input_image: Image, - row_index: int =0, - value: float =0, - device: Optional[Device] =None + row_index: int = 0, + value: float = 0, + device: Optional[Device] = None, ) -> Image: """Sets all pixel values x of a given row in X to a constant value v. Parameters ---------- - input_image: Image + input_image: Image Input image to process. row_index: int (= 0) - + value: float (= 0) - + device: Optional[Device] (= None) Device to perform the operation on. @@ -3591,18 +3902,19 @@ def set_row( """ return clic._set_row(device, input_image, int(row_index), float(value)) + @plugin_function def set_nonzero_pixels_to_pixelindex( input_image: Image, - output_image: Optional[Image] =None, - offset: int =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + offset: int = 1, + device: Optional[Device] = None, ) -> Image: """Replaces all 0 value pixels in an image with the index of a pixel. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output image. @@ -3615,13 +3927,14 @@ def set_nonzero_pixels_to_pixelindex( ------- Image """ - return clic._set_nonzero_pixels_to_pixelindex(device, input_image, output_image, int(offset)) + return clic._set_nonzero_pixels_to_pixelindex( + device, input_image, output_image, int(offset) + ) + @plugin_function def set_where_x_equals_y( - input_image: Image, - value: float =0, - device: Optional[Device] =None + input_image: Image, value: float = 0, device: Optional[Device] = None ) -> Image: """Sets all pixel values a of a given image A to a constant value v in case its coordinates x == y. Otherwise the pixel is not overwritten. If you want to @@ -3629,7 +3942,7 @@ def set_where_x_equals_y( Parameters ---------- - input_image: Image + input_image: Image Input image to process. value: float (= 0) Value to set. @@ -3646,11 +3959,10 @@ def set_where_x_equals_y( """ return clic._set_where_x_equals_y(device, input_image, float(value)) + @plugin_function def set_where_x_greater_than_y( - input_image: Image, - value: float =0, - device: Optional[Device] =None + input_image: Image, value: float = 0, device: Optional[Device] = None ) -> Image: """Sets all pixel values a of a given image A to a constant value v in case its coordinates x > y. Otherwise the pixel is not overwritten. If you want to @@ -3658,7 +3970,7 @@ def set_where_x_greater_than_y( Parameters ---------- - input_image: Image + input_image: Image Input image to process. value: float (= 0) Value to set. @@ -3675,11 +3987,10 @@ def set_where_x_greater_than_y( """ return clic._set_where_x_greater_than_y(device, input_image, float(value)) + @plugin_function def set_where_x_smaller_than_y( - input_image: Image, - value: float =0, - device: Optional[Device] =None + input_image: Image, value: float = 0, device: Optional[Device] = None ) -> Image: """Sets all pixel values a of a given image A to a constant value v in case its coordinates x < y. Otherwise the pixel is not overwritten. If you want to @@ -3687,7 +3998,7 @@ def set_where_x_smaller_than_y( Parameters ---------- - input_image: Image + input_image: Image Input image to process. value: float (= 0) Value to set. @@ -3704,11 +4015,12 @@ def set_where_x_smaller_than_y( """ return clic._set_where_x_smaller_than_y(device, input_image, float(value)) + @plugin_function def sign( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Extracts the sign of pixels. If a pixel value < 0, resulting pixel value will be 1. If it was > 0, it will be 1. Otherwise it will be 0. This function aims to @@ -3716,7 +4028,7 @@ def sign( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -3729,21 +4041,22 @@ def sign( """ return clic._sign(device, input_image, output_image) + @plugin_function(categories=["combine", "binarize", "in assistant"]) def smaller( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines if two images A and B smaller pixel wise. f(a, b) = 1 if a < b; 0 otherwise. Parameters ---------- - input_image0: Image + input_image0: Image First input image to process. - input_image1: Image + input_image1: Image Second input image to process. output_image: Optional[Image] (= None) Output result image. @@ -3760,19 +4073,20 @@ def smaller( """ return clic._smaller(device, input_image0, input_image1, output_image) + @plugin_function(categories=["binarize", "in assistant"]) def smaller_constant( input_image: Image, - output_image: Optional[Image] =None, - scalar: float =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + scalar: float = 0, + device: Optional[Device] = None, ) -> Image: """Determines if two images A and B smaller pixel wise. f(a, b) = 1 if a < b; 0 otherwise. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -3791,21 +4105,22 @@ def smaller_constant( """ return clic._smaller_constant(device, input_image, output_image, float(scalar)) + @plugin_function(categories=["combine", "binarize", "in assistant"]) def smaller_or_equal( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines if two images A and B smaller or equal pixel wise. f(a, b) = 1 if a <= b; 0 otherwise. Parameters ---------- - input_image0: Image + input_image0: Image First input image to process. - input_image1: Image + input_image1: Image Second input image to process. output_image: Optional[Image] (= None) Output result image. @@ -3822,19 +4137,20 @@ def smaller_or_equal( """ return clic._smaller_or_equal(device, input_image0, input_image1, output_image) + @plugin_function(categories=["binarize", "in assistant"]) def smaller_or_equal_constant( input_image: Image, - output_image: Optional[Image] =None, - scalar: float =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + scalar: float = 0, + device: Optional[Device] = None, ) -> Image: """Determines if two images A and B smaller or equal pixel wise. f(a, b) = 1 if a <= b; 0 otherwise. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -3851,20 +4167,25 @@ def smaller_or_equal_constant( ---------- [1] https://clij.github.io/clij2-docs/reference_smallerOrEqualConstant """ - return clic._smaller_or_equal_constant(device, input_image, output_image, float(scalar)) + return clic._smaller_or_equal_constant( + device, input_image, output_image, float(scalar) + ) -@plugin_function(categories=["filter", "edge detection", "in assistant", "bia-bob-suggestion"]) + +@plugin_function( + categories=["filter", "edge detection", "in assistant", "bia-bob-suggestion"] +) def sobel( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Convolve the image with the Sobel kernel. Author(s): Ruth WhelanJeans, Robert Haase Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -3881,17 +4202,18 @@ def sobel( """ return clic._sobel(device, input_image, output_image) + @plugin_function(categories=["filter", "in assistant"]) def square_root( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Computes the square root of each pixel. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -3904,18 +4226,19 @@ def square_root( """ return clic._square_root(device, input_image, output_image) + @plugin_function(categories=["projection", "in assistant", "bia-bob-suggestion"]) def std_z_projection( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines the standard deviation intensity projection of an image stack along Z. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -3932,18 +4255,19 @@ def std_z_projection( """ return clic._std_z_projection(device, input_image, output_image) + @plugin_function(categories=["filter", "in assistant"]) def subtract_image_from_scalar( input_image: Image, - output_image: Optional[Image] =None, - scalar: float =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + scalar: float = 0, + device: Optional[Device] = None, ) -> Image: """Subtracts one image X from a scalar s pixel wise.
f(x, s) = s x
Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -3960,14 +4284,17 @@ def subtract_image_from_scalar( ---------- [1] https://clij.github.io/clij2-docs/reference_subtractImageFromScalar """ - return clic._subtract_image_from_scalar(device, input_image, output_image, float(scalar)) + return clic._subtract_image_from_scalar( + device, input_image, output_image, float(scalar) + ) + @plugin_function def sum_reduction_x( input_image: Image, - output_image: Optional[Image] =None, - blocksize: int =256, - device: Optional[Device] =None + output_image: Optional[Image] = None, + blocksize: int = 256, + device: Optional[Device] = None, ) -> Image: """Takes an image and reduces it in width by factor blocksize. The new pixels contain the sum of the reduced pixels. For example, given the following image @@ -3975,7 +4302,7 @@ def sum_reduction_x( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -3990,17 +4317,18 @@ def sum_reduction_x( """ return clic._sum_reduction_x(device, input_image, output_image, int(blocksize)) + @plugin_function(categories=["projection"]) def sum_x_projection( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines the sum intensity projection of an image along Z. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -4017,17 +4345,18 @@ def sum_x_projection( """ return clic._sum_x_projection(device, input_image, output_image) + @plugin_function(categories=["projection"]) def sum_y_projection( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines the sum intensity projection of an image along Z. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -4044,17 +4373,18 @@ def sum_y_projection( """ return clic._sum_y_projection(device, input_image, output_image) + @plugin_function(categories=["projection", "in assistant", "bia-bob-suggestion"]) def sum_z_projection( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines the sum intensity projection of an image along Z. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -4071,17 +4401,18 @@ def sum_z_projection( """ return clic._sum_z_projection(device, input_image, output_image) + @plugin_function(categories=["transform"]) def transpose_xy( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Transpose X and Y axes of an image. Parameters ---------- - input_image: Image + input_image: Image The input image. output_image: Optional[Image] (= None) The output image where results are written into. @@ -4098,17 +4429,18 @@ def transpose_xy( """ return clic._transpose_xy(device, input_image, output_image) + @plugin_function(categories=["transform"]) def transpose_xz( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Transpose X and Z axes of an image. Parameters ---------- - input_image: Image + input_image: Image The input image. output_image: Optional[Image] (= None) The output image where results are written into. @@ -4125,17 +4457,18 @@ def transpose_xz( """ return clic._transpose_xz(device, input_image, output_image) + @plugin_function(categories=["transform"]) def transpose_yz( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Transpose Y and Z axes of an image. Parameters ---------- - input_image: Image + input_image: Image The input image. output_image: Optional[Image] (= None) The output image where results are written into. @@ -4152,18 +4485,19 @@ def transpose_yz( """ return clic._transpose_yz(device, input_image, output_image) + @plugin_function def undefined_to_zero( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Copies all pixels instead those which are not a number (NaN) or infinity (inf), which are replaced by 0. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -4180,14 +4514,15 @@ def undefined_to_zero( """ return clic._undefined_to_zero(device, input_image, output_image) + @plugin_function(categories=["filter", "edge detection", "in assistant"]) def variance_box( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =1, - radius_y: int =1, - radius_z: int =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 1, + radius_y: int = 1, + radius_z: int = 1, + device: Optional[Device] = None, ) -> Image: """Computes the local variance of a pixels box neighborhood. The box size is specified by its halfwidth, halfheight and halfdepth (radius). If 2D images are @@ -4195,7 +4530,7 @@ def variance_box( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -4216,16 +4551,19 @@ def variance_box( ---------- [1] https://clij.github.io/clij2-docs/reference_varianceBox """ - return clic._variance_box(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)) + return clic._variance_box( + device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z) + ) + @plugin_function(categories=["filter", "edge detection", "in assistant"]) def variance_sphere( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =1, - radius_y: int =1, - radius_z: int =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 1, + radius_y: int = 1, + radius_z: int = 1, + device: Optional[Device] = None, ) -> Image: """Computes the local variance of a pixels sphere neighborhood. The sphere size is specified by its halfwidth, halfheight and halfdepth (radius). If 2D images are @@ -4233,7 +4571,7 @@ def variance_sphere( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -4254,17 +4592,20 @@ def variance_sphere( ---------- [1] https://clij.github.io/clij2-docs/reference_varianceSphere """ - return clic._variance_sphere(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)) + return clic._variance_sphere( + device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z) + ) + @plugin_function(categories=["filter", "edge detection", "in assistant"]) def variance_filter( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =1, - radius_y: int =1, - radius_z: int =1, - connectivity: str ="box", - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 1, + radius_y: int = 1, + radius_z: int = 1, + connectivity: str = "box", + device: Optional[Device] = None, ) -> Image: """Computes the local variance of a pixels neighborhood (box or sphere). The neighborhood size is specified by its halfwidth, halfheight and halfdepth @@ -4272,7 +4613,7 @@ def variance_filter( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -4296,13 +4637,22 @@ def variance_filter( [1] https://clij.github.io/clij2-docs/reference_varianceBox [2] https://clij.github.io/clij2-docs/reference_varianceSphere """ - return clic._variance_filter(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z), str(connectivity)) + return clic._variance_filter( + device, + input_image, + output_image, + int(radius_x), + int(radius_y), + int(radius_z), + str(connectivity), + ) + @plugin_function def write_values_to_positions( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Takes an image with three/four rows (2D: height = 3; 3D: height = 4): x, y [, z] and v and target image. The value v will be written at position x/y[/z] in the @@ -4310,7 +4660,7 @@ def write_values_to_positions( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -4327,11 +4677,12 @@ def write_values_to_positions( """ return clic._write_values_to_positions(device, input_image, output_image) + @plugin_function(categories=["projection", "in assistant"]) def x_position_of_maximum_x_projection( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines an Xposition of the maximum intensity along X and writes it into the resulting image. If there are multiple xslices with the same value, the smallest @@ -4339,7 +4690,7 @@ def x_position_of_maximum_x_projection( Parameters ---------- - input_image: Image + input_image: Image Input image stack output_image: Optional[Image] (= None) altitude map @@ -4352,11 +4703,12 @@ def x_position_of_maximum_x_projection( """ return clic._x_position_of_maximum_x_projection(device, input_image, output_image) + @plugin_function(categories=["projection", "in assistant"]) def x_position_of_minimum_x_projection( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines an Xposition of the minimum intensity along X and writes it into the resulting image. If there are multiple xslices with the same value, the smallest @@ -4364,7 +4716,7 @@ def x_position_of_minimum_x_projection( Parameters ---------- - input_image: Image + input_image: Image Input image stack output_image: Optional[Image] (= None) altitude map @@ -4377,11 +4729,12 @@ def x_position_of_minimum_x_projection( """ return clic._x_position_of_minimum_x_projection(device, input_image, output_image) + @plugin_function(categories=["projection", "in assistant"]) def y_position_of_maximum_y_projection( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines an Yposition of the maximum intensity along Y and writes it into the resulting image. If there are multiple yslices with the same value, the smallest @@ -4389,7 +4742,7 @@ def y_position_of_maximum_y_projection( Parameters ---------- - input_image: Image + input_image: Image Input image stack output_image: Optional[Image] (= None) altitude map @@ -4402,11 +4755,12 @@ def y_position_of_maximum_y_projection( """ return clic._y_position_of_maximum_y_projection(device, input_image, output_image) + @plugin_function(categories=["projection", "in assistant"]) def y_position_of_minimum_y_projection( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines an Yposition of the minimum intensity along Y and writes it into the resulting image. If there are multiple yslices with the same value, the smallest @@ -4414,7 +4768,7 @@ def y_position_of_minimum_y_projection( Parameters ---------- - input_image: Image + input_image: Image Input image stack output_image: Optional[Image] (= None) altitude map @@ -4427,11 +4781,12 @@ def y_position_of_minimum_y_projection( """ return clic._y_position_of_minimum_y_projection(device, input_image, output_image) + @plugin_function(categories=["projection", "in assistant"]) def z_position_of_maximum_z_projection( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines a Zposition of the maximum intensity along Z and writes it into the resulting image. If there are multiple zslices with the same value, the smallest @@ -4439,7 +4794,7 @@ def z_position_of_maximum_z_projection( Parameters ---------- - input_image: Image + input_image: Image Input image stack output_image: Optional[Image] (= None) altitude map @@ -4452,11 +4807,12 @@ def z_position_of_maximum_z_projection( """ return clic._z_position_of_maximum_z_projection(device, input_image, output_image) + @plugin_function(categories=["projection", "in assistant"]) def z_position_of_minimum_z_projection( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines a Zposition of the minimum intensity along Z and writes it into the resulting image. If there are multiple zslices with the same value, the smallest @@ -4464,7 +4820,7 @@ def z_position_of_minimum_z_projection( Parameters ---------- - input_image: Image + input_image: Image Input image stack output_image: Optional[Image] (= None) altitude map @@ -4475,4 +4831,4 @@ def z_position_of_minimum_z_projection( ------- Image """ - return clic._z_position_of_minimum_z_projection(device, input_image, output_image) \ No newline at end of file + return clic._z_position_of_minimum_z_projection(device, input_image, output_image) diff --git a/pyclesperanto/_tier2.py b/pyclesperanto/_tier2.py index f8ccb6eb..38327cf8 100644 --- a/pyclesperanto/_tier2.py +++ b/pyclesperanto/_tier2.py @@ -12,23 +12,24 @@ from ._core import Device from ._decorators import plugin_function -clic = importlib.import_module('._pyclesperanto', package='pyclesperanto') +clic = importlib.import_module("._pyclesperanto", package="pyclesperanto") + @plugin_function(categories=["combine", "in assistant"]) def absolute_difference( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines the absolute difference pixel by pixel between two images.
f(x,
     y) = |x y| 
Parameters ---------- - input_image0: Image + input_image0: Image The input image to be subtracted from. - input_image1: Image + input_image1: Image The input image which is subtracted. output_image: Optional[Image] (= None) The output image where results are written into. @@ -45,21 +46,22 @@ def absolute_difference( """ return clic._absolute_difference(device, input_image0, input_image1, output_image) + @plugin_function(categories=["combine", "in assistant"]) def add_images( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Calculates the sum of pairs of pixels x and y of two images X and Y.
f(x,
     y) = x + y
Parameters ---------- - input_image0: Image + input_image0: Image The first input image to added. - input_image1: Image + input_image1: Image The second image to be added. output_image: Optional[Image] (= None) The output image where results are written into. @@ -76,20 +78,21 @@ def add_images( """ return clic._add_images(device, input_image0, input_image1, output_image) + @plugin_function(categories=["filter", "background removal", "in assistant"]) def bottom_hat_box( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =1, - radius_y: int =1, - radius_z: int =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 1, + radius_y: int = 1, + radius_z: int = 1, + device: Optional[Device] = None, ) -> Image: """Apply a bottomhat filter for background subtraction to the input image. Parameters ---------- - input_image: Image + input_image: Image The input image where the background is subtracted from. output_image: Optional[Image] (= None) The output image where results are written into. @@ -110,22 +113,25 @@ def bottom_hat_box( ---------- [1] https://clij.github.io/clij2-docs/reference_bottomHatBox """ - return clic._bottom_hat_box(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)) + return clic._bottom_hat_box( + device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z) + ) + @plugin_function(categories=["filter", "background removal", "in assistant"]) def bottom_hat_sphere( input_image: Image, - output_image: Optional[Image] =None, - radius_x: float =1, - radius_y: float =1, - radius_z: float =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: float = 1, + radius_y: float = 1, + radius_z: float = 1, + device: Optional[Device] = None, ) -> Image: """Applies a bottomhat filter for background subtraction to the input image. Parameters ---------- - input_image: Image + input_image: Image The input image where the background is subtracted from. output_image: Optional[Image] (= None) The output image where results are written into. @@ -146,23 +152,31 @@ def bottom_hat_sphere( ---------- [1] https://clij.github.io/clij2-docs/reference_bottomHatSphere """ - return clic._bottom_hat_sphere(device, input_image, output_image, float(radius_x), float(radius_y), float(radius_z)) + return clic._bottom_hat_sphere( + device, + input_image, + output_image, + float(radius_x), + float(radius_y), + float(radius_z), + ) + @plugin_function(categories=["filter", "background removal", "in assistant"]) def bottom_hat( input_image: Image, - output_image: Optional[Image] =None, - radius_x: float =1, - radius_y: float =1, - radius_z: float =1, - connectivity: str ="box", - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: float = 1, + radius_y: float = 1, + radius_z: float = 1, + connectivity: str = "box", + device: Optional[Device] = None, ) -> Image: """Applies a bottomhat filter for background subtraction to the input image. Parameters ---------- - input_image: Image + input_image: Image The input image where the background is subtracted from. output_image: Optional[Image] (= None) The output image where results are written into. @@ -186,22 +200,31 @@ def bottom_hat( [1] https://clij.github.io/clij2-docs/reference_bottomHatBox [2] https://clij.github.io/clij2-docs/reference_bottomHatSphere """ - return clic._bottom_hat(device, input_image, output_image, float(radius_x), float(radius_y), float(radius_z), str(connectivity)) + return clic._bottom_hat( + device, + input_image, + output_image, + float(radius_x), + float(radius_y), + float(radius_z), + str(connectivity), + ) + @plugin_function(categories=["combine", "in assistant"]) def clip( input_image: Image, - output_image: Optional[Image] =None, - min_intensity: Optional[float] =None, - max_intensity: Optional[float] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + min_intensity: Optional[float] = None, + max_intensity: Optional[float] = None, + device: Optional[Device] = None, ) -> Image: """Limits the range of values in an image. This function is supposed to work similarly as its counter part in numpy [1]. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -222,21 +245,22 @@ def clip( """ return clic._clip(device, input_image, output_image, min_intensity, max_intensity) + @plugin_function(categories=["filter", "in assistant"]) def closing_box( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =0, - radius_y: int =0, - radius_z: int =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 0, + radius_y: int = 0, + radius_z: int = 0, + device: Optional[Device] = None, ) -> Image: """Closing operator, boxshaped Applies morphological closing to intensity images using a boxshaped footprint. This operator also works with binary images. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -253,23 +277,26 @@ def closing_box( ------- Image """ - return clic._closing_box(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)) + return clic._closing_box( + device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z) + ) + @plugin_function(categories=["filter", "in assistant", "bia-bob-suggestion"]) def closing_sphere( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =1, - radius_y: int =1, - radius_z: int =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 1, + radius_y: int = 1, + radius_z: int = 0, + device: Optional[Device] = None, ) -> Image: """Closing operator, sphereshaped Applies morphological closing to intensity images using a sphereshaped footprint. This operator also works with binary images. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -286,24 +313,27 @@ def closing_sphere( ------- Image """ - return clic._closing_sphere(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)) + return clic._closing_sphere( + device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z) + ) + @plugin_function(categories=["filter", "in assistant"]) def closing( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =1, - radius_y: int =1, - radius_z: int =0, - connectivity: str ="box", - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 1, + radius_y: int = 1, + radius_z: int = 0, + connectivity: str = "box", + device: Optional[Device] = None, ) -> Image: """Closing operator, sphereshaped Applies morphological closing to intensity images using a sphereshaped footprint. This operator also works with binary images. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -322,22 +352,33 @@ def closing( ------- Image """ - return clic._closing(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z), str(connectivity)) - -@plugin_function(categories=["combine", "transform", "in assistant", "bia-bob-suggestion"]) + return clic._closing( + device, + input_image, + output_image, + int(radius_x), + int(radius_y), + int(radius_z), + str(connectivity), + ) + + +@plugin_function( + categories=["combine", "transform", "in assistant", "bia-bob-suggestion"] +) def concatenate_along_x( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Concatenate two images or stacks along the X axis. Parameters ---------- - input_image0: Image + input_image0: Image First input image. - input_image1: Image + input_image1: Image Second input image. output_image: Optional[Image] (= None) Output result image. @@ -354,20 +395,23 @@ def concatenate_along_x( """ return clic._concatenate_along_x(device, input_image0, input_image1, output_image) -@plugin_function(categories=["combine", "transform", "in assistant", "bia-bob-suggestion"]) + +@plugin_function( + categories=["combine", "transform", "in assistant", "bia-bob-suggestion"] +) def concatenate_along_y( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Concatenate two images or stacks along the Y axis. Parameters ---------- - input_image0: Image + input_image0: Image First input image. - input_image1: Image + input_image1: Image Second input image. output_image: Optional[Image] (= None) Output result image. @@ -384,20 +428,23 @@ def concatenate_along_y( """ return clic._concatenate_along_y(device, input_image0, input_image1, output_image) -@plugin_function(categories=["combine", "transform", "in assistant", "bia-bob-suggestion"]) + +@plugin_function( + categories=["combine", "transform", "in assistant", "bia-bob-suggestion"] +) def concatenate_along_z( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Concatenate two images or stacks along the Z axis. Parameters ---------- - input_image0: Image + input_image0: Image First input image. - input_image1: Image + input_image1: Image Second input image. output_image: Optional[Image] (= None) Output result image. @@ -414,12 +461,13 @@ def concatenate_along_z( """ return clic._concatenate_along_z(device, input_image0, input_image1, output_image) + @plugin_function def count_touching_neighbors( touch_matrix: Image, - touching_neighbors_count_destination: Optional[Image] =None, - ignore_background: bool =True, - device: Optional[Device] =None + touching_neighbors_count_destination: Optional[Image] = None, + ignore_background: bool = True, + device: Optional[Device] = None, ) -> Image: """Takes a touch matrix as input and delivers a vector with number of touching neighbors per label as a vector. Note: Background is considered as something @@ -428,12 +476,12 @@ def count_touching_neighbors( Parameters ---------- - touch_matrix: Image + touch_matrix: Image Input touch matrix to process. touching_neighbors_count_destination: Optional[Image] (= None) Output vector of touch count. ignore_background: bool (= True) - + device: Optional[Device] (= None) Device to perform the operation on. @@ -445,21 +493,24 @@ def count_touching_neighbors( ---------- [1] https://clij.github.io/clij2-docs/reference_countTouchingNeighbors """ - return clic._count_touching_neighbors(device, touch_matrix, touching_neighbors_count_destination, ignore_background) + return clic._count_touching_neighbors( + device, touch_matrix, touching_neighbors_count_destination, ignore_background + ) + @plugin_function def crop_border( input_image: Image, - output_image: Optional[Image] =None, - border_size: int =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + border_size: int = 1, + device: Optional[Device] = None, ) -> Image: """Crops an image by removing the outer pixels, per default 1. Notes * To make sure the output image has the right size, provide destination_image=None. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -474,20 +525,21 @@ def crop_border( """ return clic._crop_border(device, input_image, output_image, int(border_size)) + @plugin_function(categories=["filter", "background removal", "in assistant"]) def divide_by_gaussian_background( input_image: Image, - output_image: Optional[Image] =None, - sigma_x: float =2, - sigma_y: float =2, - sigma_z: float =2, - device: Optional[Device] =None + output_image: Optional[Image] = None, + sigma_x: float = 2, + sigma_y: float = 2, + sigma_z: float = 2, + device: Optional[Device] = None, ) -> Image: """Applies Gaussian blur to the input image and divides the original by the result. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -508,19 +560,27 @@ def divide_by_gaussian_background( ---------- [1] https://clij.github.io/clij2-docs/reference_divideByGaussianBackground """ - return clic._divide_by_gaussian_background(device, input_image, output_image, float(sigma_x), float(sigma_y), float(sigma_z)) + return clic._divide_by_gaussian_background( + device, + input_image, + output_image, + float(sigma_x), + float(sigma_y), + float(sigma_z), + ) + @plugin_function def degrees_to_radians( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Converts radians to degrees. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -533,14 +593,15 @@ def degrees_to_radians( """ return clic._degrees_to_radians(device, input_image, output_image) + @plugin_function(categories=["binarize", "in assistant"]) def detect_maxima_box( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =0, - radius_y: int =0, - radius_z: int =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 0, + radius_y: int = 0, + radius_z: int = 0, + device: Optional[Device] = None, ) -> Image: """Detects local maxima in a given square/cubic neighborhood. Pixels in the resulting image are set to 1 if there is no other pixel in a given radius which @@ -548,7 +609,7 @@ def detect_maxima_box( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -569,17 +630,20 @@ def detect_maxima_box( ---------- [1] https://clij.github.io/clij2-docs/reference_detectMaximaBox """ - return clic._detect_maxima_box(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)) + return clic._detect_maxima_box( + device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z) + ) + @plugin_function(categories=["binarize", "in assistant"]) def detect_maxima( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =0, - radius_y: int =0, - radius_z: int =0, - connectivity: str ="box", - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 0, + radius_y: int = 0, + radius_z: int = 0, + connectivity: str = "box", + device: Optional[Device] = None, ) -> Image: """Detects local maxima in a given square/cubic neighborhood. Pixels in the resulting image are set to 1 if there is no other pixel in a given radius which @@ -587,7 +651,7 @@ def detect_maxima( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -611,16 +675,25 @@ def detect_maxima( [1] https://clij.github.io/clij2-docs/reference_detectMaximaBox [2] https://clij.github.io/clij2-docs/reference_detectMaximaSphere """ - return clic._detect_maxima(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z), str(connectivity)) + return clic._detect_maxima( + device, + input_image, + output_image, + int(radius_x), + int(radius_y), + int(radius_z), + str(connectivity), + ) + @plugin_function(categories=["binarize", "in assistant"]) def detect_minima_box( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =0, - radius_y: int =0, - radius_z: int =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 0, + radius_y: int = 0, + radius_z: int = 0, + device: Optional[Device] = None, ) -> Image: """Detects local maxima in a given square/cubic neighborhood. Pixels in the resulting image are set to 1 if there is no other pixel in a given radius which @@ -628,7 +701,7 @@ def detect_minima_box( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -649,17 +722,20 @@ def detect_minima_box( ---------- [1] https://clij.github.io/clij2-docs/reference_detectMinimaBox """ - return clic._detect_minima_box(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)) + return clic._detect_minima_box( + device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z) + ) + @plugin_function(categories=["binarize", "in assistant"]) def detect_minima( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =0, - radius_y: int =0, - radius_z: int =0, - connectivity: str ="box", - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 0, + radius_y: int = 0, + radius_z: int = 0, + connectivity: str = "box", + device: Optional[Device] = None, ) -> Image: """Detects local maxima in a given square/cubic neighborhood. Pixels in the resulting image are set to 1 if there is no other pixel in a given radius which @@ -667,7 +743,7 @@ def detect_minima( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -691,19 +767,28 @@ def detect_minima( [1] https://clij.github.io/clij2-docs/reference_detectMinimaBox [2] https://clij.github.io/clij2-docs/reference_detectMinimaSphere """ - return clic._detect_minima(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z), str(connectivity)) + return clic._detect_minima( + device, + input_image, + output_image, + int(radius_x), + int(radius_y), + int(radius_z), + str(connectivity), + ) + @plugin_function(categories=["filter", "background removal", "bia-bob-suggestion"]) def difference_of_gaussian( input_image: Image, - output_image: Optional[Image] =None, - sigma1_x: float =2, - sigma1_y: float =2, - sigma1_z: float =2, - sigma2_x: float =2, - sigma2_y: float =2, - sigma2_z: float =2, - device: Optional[Device] =None + output_image: Optional[Image] = None, + sigma1_x: float = 2, + sigma1_y: float = 2, + sigma1_z: float = 2, + sigma2_x: float = 2, + sigma2_y: float = 2, + sigma2_z: float = 2, + device: Optional[Device] = None, ) -> Image: """Applies Gaussian blur to the input image twice with different sigma values resulting in two images which are then subtracted from each other. It is @@ -712,7 +797,7 @@ def difference_of_gaussian( Parameters ---------- - input_image: Image + input_image: Image The input image to be processed. output_image: Optional[Image] (= None) The output image where results are written into. @@ -739,20 +824,31 @@ def difference_of_gaussian( ---------- [1] https://clij.github.io/clij2-docs/reference_differenceOfGaussian3D """ - return clic._difference_of_gaussian(device, input_image, output_image, float(sigma1_x), float(sigma1_y), float(sigma1_z), float(sigma2_x), float(sigma2_y), float(sigma2_z)) + return clic._difference_of_gaussian( + device, + input_image, + output_image, + float(sigma1_x), + float(sigma1_y), + float(sigma1_z), + float(sigma2_x), + float(sigma2_y), + float(sigma2_z), + ) + @plugin_function(categories=["label processing", "in assistant"]) def extend_labeling_via_voronoi( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Takes a label map image and dilates the regions using a octagon shape until they touch. The resulting label map is written to the output. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -769,11 +865,12 @@ def extend_labeling_via_voronoi( """ return clic._extend_labeling_via_voronoi(device, input_image, output_image) + @plugin_function(categories=["filter"]) def invert( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Computes the negative value of all pixels in a given image. It is recommended to convert images to 32bit float before applying this operation.
f(x) =
@@ -781,7 +878,7 @@ def invert(
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -798,11 +895,12 @@ def invert(
     """
     return clic._invert(device, input_image, output_image)
 
+
 @plugin_function(categories=["label", "in assistant"])
 def label_spots(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    device: Optional[Device] = None,
 ) -> Image:
     """Transforms a binary image with single pixles set to 1 to a labelled spots image.
     Transforms a spots image as resulting from maximum/minimum detection in an image
@@ -810,7 +908,7 @@ def label_spots(
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -827,17 +925,18 @@ def label_spots(
     """
     return clic._label_spots(device, input_image, output_image)
 
+
 @plugin_function(categories=["filter", "in assistant"])
 def large_hessian_eigenvalue(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    device: Optional[Device] = None,
 ) -> Image:
     """Determines the Hessian eigenvalues and returns the large eigenvalue image.
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -850,17 +949,15 @@ def large_hessian_eigenvalue(
     """
     return clic._large_hessian_eigenvalue(device, input_image, output_image)
 
+
 @plugin_function
-def maximum_of_all_pixels(
-    input_image: Image,
-    device: Optional[Device] =None
-) -> float:
+def maximum_of_all_pixels(input_image: Image, device: Optional[Device] = None) -> float:
     """Determines the maximum of all pixels in a given image. It will be stored in a
     new row of ImageJs Results table in the column 'Max'.
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     device: Optional[Device] (= None)
         Device to perform the operation on.
@@ -875,17 +972,15 @@ def maximum_of_all_pixels(
     """
     return clic._maximum_of_all_pixels(device, input_image)
 
+
 @plugin_function
-def minimum_of_all_pixels(
-    input_image: Image,
-    device: Optional[Device] =None
-) -> float:
+def minimum_of_all_pixels(input_image: Image, device: Optional[Device] = None) -> float:
     """Determines the minimum of all pixels in a given image. It will be stored in a
     new row of ImageJs Results table in the column 'Min'.
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     device: Optional[Device] (= None)
         Device to perform the operation on.
@@ -900,20 +995,19 @@ def minimum_of_all_pixels(
     """
     return clic._minimum_of_all_pixels(device, input_image)
 
+
 @plugin_function
 def minimum_of_masked_pixels(
-    input_image: Image,
-    mask: Image,
-    device: Optional[Device] =None
+    input_image: Image, mask: Image, device: Optional[Device] = None
 ) -> float:
     """Determines the minimum intensity in a masked image. But only in pixels which
     have nonzero values in another mask image.
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
-    mask: Image 
+    mask: Image
         Input
     device: Optional[Device] (= None)
         Device to perform the operation on.
@@ -928,21 +1022,22 @@ def minimum_of_masked_pixels(
     """
     return clic._minimum_of_masked_pixels(device, input_image, mask)
 
+
 @plugin_function(categories=["filter", "in assistant"])
 def opening_box(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    radius_x: int =0,
-    radius_y: int =0,
-    radius_z: int =0,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    radius_x: int = 0,
+    radius_y: int = 0,
+    radius_z: int = 0,
+    device: Optional[Device] = None,
 ) -> Image:
     """Opening operator, boxshaped Applies morphological opening to intensity images
     using a boxshaped footprint. This operator also works with binary images.
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -959,23 +1054,26 @@ def opening_box(
     -------
     Image
     """
-    return clic._opening_box(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z))
+    return clic._opening_box(
+        device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)
+    )
+
 
 @plugin_function(categories=["filter", "in assistant"])
 def opening_sphere(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    radius_x: float =1,
-    radius_y: float =1,
-    radius_z: float =0,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    radius_x: float = 1,
+    radius_y: float = 1,
+    radius_z: float = 0,
+    device: Optional[Device] = None,
 ) -> Image:
     """Opening operator, sphereshaped Applies morphological opening to intensity images
     using a sphereshaped footprint. This operator also works with binary images.
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -992,24 +1090,32 @@ def opening_sphere(
     -------
     Image
     """
-    return clic._opening_sphere(device, input_image, output_image, float(radius_x), float(radius_y), float(radius_z))
+    return clic._opening_sphere(
+        device,
+        input_image,
+        output_image,
+        float(radius_x),
+        float(radius_y),
+        float(radius_z),
+    )
+
 
 @plugin_function(categories=["filter", "in assistant"])
 def opening(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    radius_x: float =1,
-    radius_y: float =1,
-    radius_z: float =0,
-    connectivity: str ="box",
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    radius_x: float = 1,
+    radius_y: float = 1,
+    radius_z: float = 0,
+    connectivity: str = "box",
+    device: Optional[Device] = None,
 ) -> Image:
     """Opening operator, sphereshaped Applies morphological opening to intensity images
     using a sphereshaped footprint. This operator also works with binary images.
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1028,19 +1134,28 @@ def opening(
     -------
     Image
     """
-    return clic._opening(device, input_image, output_image, float(radius_x), float(radius_y), float(radius_z), str(connectivity))
+    return clic._opening(
+        device,
+        input_image,
+        output_image,
+        float(radius_x),
+        float(radius_y),
+        float(radius_z),
+        str(connectivity),
+    )
+
 
 @plugin_function
 def radians_to_degrees(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    device: Optional[Device] = None,
 ) -> Image:
     """Converts radians to degrees
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1053,18 +1168,19 @@ def radians_to_degrees(
     """
     return clic._radians_to_degrees(device, input_image, output_image)
 
+
 @plugin_function(categories=["label processing", "in assistant", "bia-bob-suggestion"])
 def reduce_labels_to_label_edges(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    device: Optional[Device] = None,
 ) -> Image:
     """Takes a label map and reduces all labels to their edges. Label IDs stay and
     background will be zero.
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1081,17 +1197,18 @@ def reduce_labels_to_label_edges(
     """
     return clic._reduce_labels_to_label_edges(device, input_image, output_image)
 
+
 @plugin_function(categories=["filter", "in assistant"])
 def small_hessian_eigenvalue(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    device: Optional[Device] = None,
 ) -> Image:
     """Determines the Hessian eigenvalues and returns the small eigenvalue image.
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1104,18 +1221,19 @@ def small_hessian_eigenvalue(
     """
     return clic._small_hessian_eigenvalue(device, input_image, output_image)
 
+
 @plugin_function(categories=["filter"])
 def square(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    device: Optional[Device] = None,
 ) -> Image:
     """Return the elementwise square of the input. This function is supposed to be
     similar to its counterpart in numpy [1]
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1132,20 +1250,21 @@ def square(
     """
     return clic._square(device, input_image, output_image)
 
+
 @plugin_function(categories=["combine", "in assistant"])
 def squared_difference(
     input_image0: Image,
     input_image1: Image,
-    output_image: Optional[Image] =None,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    device: Optional[Device] = None,
 ) -> Image:
     """Determines the squared difference pixel by pixel between two images.
 
     Parameters
     ----------
-    input_image0: Image 
+    input_image0: Image
         First input image.
-    input_image1: Image 
+    input_image1: Image
         Second input image.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1162,14 +1281,15 @@ def squared_difference(
     """
     return clic._squared_difference(device, input_image0, input_image1, output_image)
 
+
 @plugin_function(categories=["filter", "edge detection", "in assistant"])
 def standard_deviation_box(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    radius_x: int =1,
-    radius_y: int =1,
-    radius_z: int =1,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    radius_x: int = 1,
+    radius_y: int = 1,
+    radius_z: int = 1,
+    device: Optional[Device] = None,
 ) -> Image:
     """Computes the local standard deviation of a pixels box neighborhood. The box size
     is specified by its halfwidth, halfheight and halfdepth (radius). If 2D images
@@ -1177,7 +1297,7 @@ def standard_deviation_box(
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1198,16 +1318,19 @@ def standard_deviation_box(
     ----------
     [1] https://clij.github.io/clij2-docs/reference_standardDeviationBox
     """
-    return clic._standard_deviation_box(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z))
+    return clic._standard_deviation_box(
+        device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)
+    )
+
 
 @plugin_function(categories=["filter", "edge detection", "in assistant"])
 def standard_deviation_sphere(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    radius_x: int =1,
-    radius_y: int =1,
-    radius_z: int =1,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    radius_x: int = 1,
+    radius_y: int = 1,
+    radius_z: int = 1,
+    device: Optional[Device] = None,
 ) -> Image:
     """Computes the local standard deviation of a pixels sphere neighborhood. The box
     size is specified by its halfwidth, halfheight and halfdepth (radius). If 2D
@@ -1215,7 +1338,7 @@ def standard_deviation_sphere(
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1236,17 +1359,20 @@ def standard_deviation_sphere(
     ----------
     [1] https://clij.github.io/clij2-docs/reference_standardDeviationSphere
     """
-    return clic._standard_deviation_sphere(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z))
+    return clic._standard_deviation_sphere(
+        device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)
+    )
+
 
 @plugin_function(categories=["filter", "edge detection", "in assistant"])
 def standard_deviation(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    radius_x: int =1,
-    radius_y: int =1,
-    radius_z: int =1,
-    connectivity: str ="box",
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    radius_x: int = 1,
+    radius_y: int = 1,
+    radius_z: int = 1,
+    connectivity: str = "box",
+    device: Optional[Device] = None,
 ) -> Image:
     """Computes the local standard deviation of a pixels sphere neighborhood. The box
     size is specified by its halfwidth, halfheight and halfdepth (radius). If 2D
@@ -1254,7 +1380,7 @@ def standard_deviation(
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1278,23 +1404,34 @@ def standard_deviation(
     [1] https://clij.github.io/clij2-docs/reference_standardDeviationBox
     [2] https://clij.github.io/clij2-docs/reference_standardDeviationSphere
     """
-    return clic._standard_deviation(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z), str(connectivity))
-
-@plugin_function(categories=["filter", "background removal", "in assistant", "bia-bob-suggestion"])
+    return clic._standard_deviation(
+        device,
+        input_image,
+        output_image,
+        int(radius_x),
+        int(radius_y),
+        int(radius_z),
+        str(connectivity),
+    )
+
+
+@plugin_function(
+    categories=["filter", "background removal", "in assistant", "bia-bob-suggestion"]
+)
 def subtract_gaussian_background(
     input_image: Image,
-    output_image: Optional[Image] =None,
-    sigma_x: float =2,
-    sigma_y: float =2,
-    sigma_z: float =2,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    sigma_x: float = 2,
+    sigma_y: float = 2,
+    sigma_z: float = 2,
+    device: Optional[Device] = None,
 ) -> Image:
     """Applies Gaussian blur to the input image and subtracts the result from the
     original.
 
     Parameters
     ----------
-    input_image: Image 
+    input_image: Image
         Input image to process.
     output_image: Optional[Image] (= None)
         Output result image.
@@ -1315,22 +1452,30 @@ def subtract_gaussian_background(
     ----------
     [1] https://clij.github.io/clij2-docs/reference_subtractGaussianBackground
     """
-    return clic._subtract_gaussian_background(device, input_image, output_image, float(sigma_x), float(sigma_y), float(sigma_z))
+    return clic._subtract_gaussian_background(
+        device,
+        input_image,
+        output_image,
+        float(sigma_x),
+        float(sigma_y),
+        float(sigma_z),
+    )
+
 
 @plugin_function(categories=["combine", "in assistant"])
 def subtract_images(
     input_image0: Image,
     input_image1: Image,
-    output_image: Optional[Image] =None,
-    device: Optional[Device] =None
+    output_image: Optional[Image] = None,
+    device: Optional[Device] = None,
 ) -> Image:
     """Subtracts one image X from another image Y pixel wise. 
f(x, y) = x y
Parameters ---------- - input_image0: Image + input_image0: Image First input image. - input_image1: Image + input_image1: Image Second input image. output_image: Optional[Image] (= None) Output result image. @@ -1347,19 +1492,20 @@ def subtract_images( """ return clic._subtract_images(device, input_image0, input_image1, output_image) + @plugin_function(categories=["transform", "in assistant"]) def sub_stack( input_image: Image, - output_image: Optional[Image] =None, - start_z: int =0, - end_z: int =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + start_z: int = 0, + end_z: int = 0, + device: Optional[Device] = None, ) -> Image: """Crop a volume into a new volume, along the z-axis. Parameters ---------- - input_image: Image + input_image: Image Input image. output_image: Optional[Image] (= None) Output image. @@ -1380,13 +1526,14 @@ def sub_stack( """ return clic._sub_stack(device, input_image, output_image, int(start_z), int(end_z)) + @plugin_function(categories=["transform", "in assistant"]) def reduce_stack( input_image: Image, - output_image: Optional[Image] =None, - reduction_factor: int =2, - offset: int =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + reduction_factor: int = 2, + offset: int = 0, + device: Optional[Device] = None, ) -> Image: """Reduces the number of z-slices in a stack by a given factor. With the offset you have control which slices stays: with a factor 3 and offset 0, slices 0,3,6, @@ -1394,7 +1541,7 @@ def reduce_stack( Parameters ---------- - input_image: Image + input_image: Image Input image. output_image: Optional[Image] (= None) Output image. @@ -1413,12 +1560,14 @@ def reduce_stack( ---------- [1] https://clij.github.io/clij2-docs/reference_reduceStack """ - return clic._reduce_stack(device, input_image, output_image, int(reduction_factor), int(offset)) + return clic._reduce_stack( + device, input_image, output_image, int(reduction_factor), int(offset) + ) + @plugin_function def sum_of_all_pixels( - input_image: Optional[Image] =None, - device: Optional[Device] =None + input_image: Optional[Image] = None, device: Optional[Device] = None ) -> float: """Determines the sum of all pixels in a given image. It will be stored in a new row of ImageJs Results table in the column 'Sum'. @@ -1440,20 +1589,21 @@ def sum_of_all_pixels( """ return clic._sum_of_all_pixels(device, input_image) + @plugin_function(categories=["filter", "background removal", "in assistant"]) def top_hat_box( input_image: Image, - output_image: Optional[Image] =None, - radius_x: int =1, - radius_y: int =1, - radius_z: int =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: int = 1, + radius_y: int = 1, + radius_z: int = 1, + device: Optional[Device] = None, ) -> Image: """Applies a tophat filter for background subtraction to the input image. Parameters ---------- - input_image: Image + input_image: Image The input image where the background is subtracted from. output_image: Optional[Image] (= None) The output image where results are written into. @@ -1474,22 +1624,27 @@ def top_hat_box( ---------- [1] https://clij.github.io/clij2-docs/reference_topHatBox """ - return clic._top_hat_box(device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z)) + return clic._top_hat_box( + device, input_image, output_image, int(radius_x), int(radius_y), int(radius_z) + ) + -@plugin_function(categories=["filter", "background removal", "in assistant", "bia-bob-suggestion"]) +@plugin_function( + categories=["filter", "background removal", "in assistant", "bia-bob-suggestion"] +) def top_hat_sphere( input_image: Image, - output_image: Optional[Image] =None, - radius_x: float =1, - radius_y: float =1, - radius_z: float =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: float = 1, + radius_y: float = 1, + radius_z: float = 1, + device: Optional[Device] = None, ) -> Image: """Applies a tophat filter for background subtraction to the input image. Parameters ---------- - input_image: Image + input_image: Image The input image where the background is subtracted from. output_image: Optional[Image] (= None) The output image where results are written into. @@ -1510,23 +1665,31 @@ def top_hat_sphere( ---------- [1] https://clij.github.io/clij2-docs/reference_topHatSphere """ - return clic._top_hat_sphere(device, input_image, output_image, float(radius_x), float(radius_y), float(radius_z)) + return clic._top_hat_sphere( + device, + input_image, + output_image, + float(radius_x), + float(radius_y), + float(radius_z), + ) + @plugin_function(categories=["filter", "background removal", "in assistant"]) def top_hat( input_image: Image, - output_image: Optional[Image] =None, - radius_x: float =1, - radius_y: float =1, - radius_z: float =1, - connectivity: str ="box", - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius_x: float = 1, + radius_y: float = 1, + radius_z: float = 1, + connectivity: str = "box", + device: Optional[Device] = None, ) -> Image: """Applies a tophat filter for background subtraction to the input image. Parameters ---------- - input_image: Image + input_image: Image The input image where the background is subtracted from. output_image: Optional[Image] (= None) The output image where results are written into. @@ -1550,4 +1713,12 @@ def top_hat( [1] https://clij.github.io/clij2-docs/reference_topHatBox [2] https://clij.github.io/clij2-docs/reference_topHatSphere """ - return clic._top_hat(device, input_image, output_image, float(radius_x), float(radius_y), float(radius_z), str(connectivity)) \ No newline at end of file + return clic._top_hat( + device, + input_image, + output_image, + float(radius_x), + float(radius_y), + float(radius_z), + str(connectivity), + ) diff --git a/pyclesperanto/_tier3.py b/pyclesperanto/_tier3.py index c695a89b..ecfc2ca0 100644 --- a/pyclesperanto/_tier3.py +++ b/pyclesperanto/_tier3.py @@ -12,20 +12,18 @@ from ._core import Device from ._decorators import plugin_function -clic = importlib.import_module('._pyclesperanto', package='pyclesperanto') +clic = importlib.import_module("._pyclesperanto", package="pyclesperanto") + @plugin_function -def bounding_box( - input_image: Image, - device: Optional[Device] =None -) -> list: +def bounding_box(input_image: Image, device: Optional[Device] = None) -> list: """Determines the bounding box of all nonzero pixels in a binary image. The positions are returned in an array of 6 values as follows: minX, minY, minZ, maxX, maxY, maxZ. Parameters ---------- - input_image: Image + input_image: Image Input binary image device: Optional[Device] (= None) Device to perform the operation on. @@ -40,17 +38,15 @@ def bounding_box( """ return clic._bounding_box(device, input_image) + @plugin_function -def center_of_mass( - input_image: Image, - device: Optional[Device] =None -) -> list: +def center_of_mass(input_image: Image, device: Optional[Device] = None) -> list: """Determines the center of mass of an image or image stack. It writes the result in the results table in the columns MassX, MassY and MassZ. Parameters ---------- - input_image: Image + input_image: Image Input image device: Optional[Device] (= None) Device to perform the operation on. @@ -65,12 +61,13 @@ def center_of_mass( """ return clic._center_of_mass(device, input_image) + @plugin_function def remove_labels( input_image: Image, list: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """This operation removes labels from a labelmap and renumbers the remaining labels. Hand over a binary flag list vector starting with a flag for the @@ -80,9 +77,9 @@ def remove_labels( Parameters ---------- - input_image: Image + input_image: Image Input label image - list: Image + list: Image Vector of 0 and 1 flagging labels to remove output_image: Optional[Image] (= None) Output label image @@ -99,12 +96,13 @@ def remove_labels( """ return clic._remove_labels(device, input_image, list, output_image) + @plugin_function def exclude_labels( input_image: Image, list: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """This operation removes labels from a labelmap and renumbers the remaining labels. Hand over a binary flag list vector starting with a flag for the @@ -114,9 +112,9 @@ def exclude_labels( Parameters ---------- - input_image: Image + input_image: Image Input label image - list: Image + list: Image Vector of 0 and 1 flagging labels to remove output_image: Optional[Image] (= None) Output label image @@ -133,21 +131,22 @@ def exclude_labels( """ return clic._exclude_labels(device, input_image, list, output_image) + @plugin_function(categories=["label processing", "in assistant", "bia-bob-suggestion"]) def remove_labels_on_edges( input_image: Image, - output_image: Optional[Image] =None, - exclude_x: bool =True, - exclude_y: bool =True, - exclude_z: bool =True, - device: Optional[Device] =None + output_image: Optional[Image] = None, + exclude_x: bool = True, + exclude_y: bool = True, + exclude_z: bool = True, + device: Optional[Device] = None, ) -> Image: """Removes all labels from a label map which touch the edges of the image. Remaining label elements are renumbered afterwards. Parameters ---------- - input_image: Image + input_image: Image Input label image output_image: Optional[Image] (= None) Output label image @@ -168,23 +167,26 @@ def remove_labels_on_edges( ---------- [1] https://clij.github.io/clij2-docs/reference_excludeLabelsOnEdges """ - return clic._remove_labels_on_edges(device, input_image, output_image, exclude_x, exclude_y, exclude_z) + return clic._remove_labels_on_edges( + device, input_image, output_image, exclude_x, exclude_y, exclude_z + ) + @plugin_function(categories=["label processing", "in assistant"]) def exclude_labels_on_edges( input_image: Image, - output_image: Optional[Image] =None, - exclude_x: bool =True, - exclude_y: bool =True, - exclude_z: bool =True, - device: Optional[Device] =None + output_image: Optional[Image] = None, + exclude_x: bool = True, + exclude_y: bool = True, + exclude_z: bool = True, + device: Optional[Device] = None, ) -> Image: """Removes all labels from a label map which touch the edges of the image. Remaining label elements are renumbered afterwards. Parameters ---------- - input_image: Image + input_image: Image Input label image output_image: Optional[Image] (= None) Output label image @@ -205,13 +207,16 @@ def exclude_labels_on_edges( ---------- [1] https://clij.github.io/clij2-docs/reference_excludeLabelsOnEdges """ - return clic._exclude_labels_on_edges(device, input_image, output_image, exclude_x, exclude_y, exclude_z) + return clic._exclude_labels_on_edges( + device, input_image, output_image, exclude_x, exclude_y, exclude_z + ) + @plugin_function def flag_existing_labels( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Given a label map this function will generate a binary vector where all pixels are set to 1 if label with given xcoordinate in the vector exists. For example a @@ -220,7 +225,7 @@ def flag_existing_labels( Parameters ---------- - input_image: Image + input_image: Image a label image output_image: Optional[Image] (= None) binary vector, if given should have size 1*n with n = maximum label + 1 @@ -233,12 +238,13 @@ def flag_existing_labels( """ return clic._flag_existing_labels(device, input_image, output_image) + @plugin_function(categories=["filter", "in assistant"]) def gamma_correction( input_image: Image, - output_image: Optional[Image] =None, - gamma: float =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + gamma: float = 1, + device: Optional[Device] = None, ) -> Image: """Applies a gamma correction to an image. Therefore, all pixels x of the Image X are normalized and the power to gamma g is computed, before normlization is @@ -246,12 +252,12 @@ def gamma_correction( Parameters ---------- - input_image: Image + input_image: Image Input image output_image: Optional[Image] (= None) Output image gamma: float (= 1) - + device: Optional[Device] (= None) Device to perform the operation on. @@ -265,12 +271,13 @@ def gamma_correction( """ return clic._gamma_correction(device, input_image, output_image, float(gamma)) + @plugin_function def generate_binary_overlap_matrix( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Takes two labelmaps with n and m labels and generates a (n+1)*(m+1) matrix where all pixels are set to 0 exept those where labels overlap between the label maps. @@ -279,9 +286,9 @@ def generate_binary_overlap_matrix( Parameters ---------- - input_image0: Image + input_image0: Image First input label image - input_image1: Image + input_image1: Image Second input label image output_image: Optional[Image] (= None) Output overlap matrix @@ -296,13 +303,16 @@ def generate_binary_overlap_matrix( ---------- [1] https://clij.github.io/clij2-docs/reference_generateBinaryOverlapMatrix """ - return clic._generate_binary_overlap_matrix(device, input_image0, input_image1, output_image) + return clic._generate_binary_overlap_matrix( + device, input_image0, input_image1, output_image + ) + @plugin_function def generate_touch_matrix( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Takes a labelmap with n labels and generates a (n+1)*(n+1) matrix where all pixels are set to 0 exept those where labels are touching. Only half of the @@ -312,7 +322,7 @@ def generate_touch_matrix( Parameters ---------- - input_image: Image + input_image: Image Input label image output_image: Optional[Image] (= None) Output touch matrix @@ -329,14 +339,15 @@ def generate_touch_matrix( """ return clic._generate_touch_matrix(device, input_image, output_image) + @plugin_function def histogram( input_image: Image, - output_image: Optional[Image] =None, - num_bins: int =256, - minimum_intensity: Optional[float] =None, - maximum_intensity: Optional[float] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + num_bins: int = 256, + minimum_intensity: Optional[float] = None, + maximum_intensity: Optional[float] = None, + device: Optional[Device] = None, ) -> Image: """Determines the histogram of a given image. The histogram image is of dimensions number_of_bins/1/1; a 3D image with height=1 and depth=1. Histogram bins contain @@ -357,16 +368,16 @@ def histogram( Parameters ---------- - input_image: Image + input_image: Image Input image to derive histogram from output_image: Optional[Image] (= None) Output histogram num_bins: int (= 256) - + minimum_intensity: Optional[float] (= None) - + maximum_intensity: Optional[float] (= None) - + device: Optional[Device] (= None) Device to perform the operation on. @@ -378,13 +389,19 @@ def histogram( ---------- [1] https://clij.github.io/clij2-docs/reference_histogram """ - return clic._histogram(device, input_image, output_image, int(num_bins), minimum_intensity, maximum_intensity) + return clic._histogram( + device, + input_image, + output_image, + int(num_bins), + minimum_intensity, + maximum_intensity, + ) + @plugin_function def jaccard_index( - input_image0: Image, - input_image1: Image, - device: Optional[Device] =None + input_image0: Image, input_image1: Image, device: Optional[Device] = None ) -> float: """Determines the overlap of two binary images using the Jaccard index. A value of 0 suggests no overlap, 1 means perfect overlap. The resulting Jaccard index is @@ -394,9 +411,9 @@ def jaccard_index( Parameters ---------- - input_image0: Image + input_image0: Image First binary image to compare - input_image1: Image + input_image1: Image Second binary image to compare device: Optional[Device] (= None) Device to perform the operation on. @@ -411,11 +428,12 @@ def jaccard_index( """ return clic._jaccard_index(device, input_image0, input_image1) + @plugin_function def labelled_spots_to_pointlist( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Generates a coordinate list of points in a labelled spot image. Transforms a labelmap of spots (single pixels with values 1, 2,..., n for n spots) as @@ -425,7 +443,7 @@ def labelled_spots_to_pointlist( Parameters ---------- - input_image: Image + input_image: Image Input label image output_image: Optional[Image] (= None) Output coordinate list @@ -442,16 +460,14 @@ def labelled_spots_to_pointlist( """ return clic._labelled_spots_to_pointlist(device, input_image, output_image) + @plugin_function -def maximum_position( - input_image: Image, - device: Optional[Device] =None -) -> list: +def maximum_position(input_image: Image, device: Optional[Device] = None) -> list: """Determines the position of the maximum of all pixels in a given image. Parameters ---------- - input_image: Image + input_image: Image The image of which the position of the maximum of all pixels will be determined. device: Optional[Device] (= None) Device to perform the operation on. @@ -462,16 +478,14 @@ def maximum_position( """ return clic._maximum_position(device, input_image) + @plugin_function -def mean_of_all_pixels( - input_image: Image, - device: Optional[Device] =None -) -> float: +def mean_of_all_pixels(input_image: Image, device: Optional[Device] = None) -> float: """Determines the mean average of all pixels in a given image. Parameters ---------- - input_image: Image + input_image: Image The image of which the mean average of all pixels will be determined. device: Optional[Device] (= None) Device to perform the operation on. @@ -486,16 +500,14 @@ def mean_of_all_pixels( """ return clic._mean_of_all_pixels(device, input_image) + @plugin_function -def minimum_position( - input_image: Image, - device: Optional[Device] =None -) -> list: +def minimum_position(input_image: Image, device: Optional[Device] = None) -> list: """Determines the position of the minimum of all pixels in a given image. Parameters ---------- - input_image: Image + input_image: Image The image of which the position of the minimum of all pixels will be determined. device: Optional[Device] (= None) Device to perform the operation on. @@ -506,15 +518,16 @@ def minimum_position( """ return clic._minimum_position(device, input_image) + @plugin_function def morphological_chan_vese( input_image: Image, - output_image: Optional[Image] =None, - num_iter: int =100, - smoothing: int =1, - lambda1: float =1, - lambda2: float =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + num_iter: int = 100, + smoothing: int = 1, + lambda1: float = 1, + lambda2: float = 1, + device: Optional[Device] = None, ) -> Image: """Compute an active contour model using the Chan-Vese morphological algorithm. The output image (dst) should also be initialisation of the contour. If not provided @@ -522,7 +535,7 @@ def morphological_chan_vese( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output contour, can also be use to provide initialisation. @@ -541,13 +554,22 @@ def morphological_chan_vese( ------- Image """ - return clic._morphological_chan_vese(device, input_image, output_image, int(num_iter), int(smoothing), float(lambda1), float(lambda2)) + return clic._morphological_chan_vese( + device, + input_image, + output_image, + int(num_iter), + int(smoothing), + float(lambda1), + float(lambda2), + ) + @plugin_function def statistics_of_labelled_pixels( - intensity: Optional[Image] =None, - label: Optional[Image] =None, - device: Optional[Device] =None + intensity: Optional[Image] = None, + label: Optional[Image] = None, + device: Optional[Device] = None, ) -> dict: """Compute the bounding box, area (in pixels/voxels), minimum intensity, maximum intensity, average intensity, standard deviation of the intensity, and some @@ -574,11 +596,12 @@ def statistics_of_labelled_pixels( """ return clic._statistics_of_labelled_pixels(device, intensity, label) + @plugin_function def statistics_of_background_and_labelled_pixels( - intensity: Optional[Image] =None, - label: Optional[Image] =None, - device: Optional[Device] =None + intensity: Optional[Image] = None, + label: Optional[Image] = None, + device: Optional[Device] = None, ) -> dict: """Compute, for the background and labels, the bounding box, area (in pixels/voxels), minimum intensity, maximum intensity, average intensity, @@ -604,4 +627,4 @@ def statistics_of_background_and_labelled_pixels( ---------- [1] https://clij.github.io/clij2-docs/reference_statisticsOfBackgroundAndLabelledPixels """ - return clic._statistics_of_background_and_labelled_pixels(device, intensity, label) \ No newline at end of file + return clic._statistics_of_background_and_labelled_pixels(device, intensity, label) diff --git a/pyclesperanto/_tier4.py b/pyclesperanto/_tier4.py index 0c5251c2..55ffbafe 100644 --- a/pyclesperanto/_tier4.py +++ b/pyclesperanto/_tier4.py @@ -12,13 +12,12 @@ from ._core import Device from ._decorators import plugin_function -clic = importlib.import_module('._pyclesperanto', package='pyclesperanto') +clic = importlib.import_module("._pyclesperanto", package="pyclesperanto") + @plugin_function def label_bounding_box( - input_image: Image, - label_id: int, - device: Optional[Device] =None + input_image: Image, label_id: int, device: Optional[Device] = None ) -> list: """Determines the bounding box of the specified label from a label image. The positions are returned in an array of 6 values as follows: minX, minY, minZ, @@ -26,9 +25,9 @@ def label_bounding_box( Parameters ---------- - input_image: Image + input_image: Image Label image - label_id: int + label_id: int Identifier of label device: Optional[Device] (= None) Device to perform the operation on. @@ -43,20 +42,19 @@ def label_bounding_box( """ return clic._label_bounding_box(device, input_image, int(label_id)) + @plugin_function(categories=["in assistant", "combine", "bia-bob-suggestion"]) def mean_squared_error( - input_image0: Image, - input_image1: Image, - device: Optional[Device] =None + input_image0: Image, input_image1: Image, device: Optional[Device] = None ) -> float: """Determines the mean squared error (MSE) between two images. The MSE will be stored in a new row of ImageJs Results table in the column 'MSE'. Parameters ---------- - input_image0: Image + input_image0: Image First image to compare - input_image1: Image + input_image1: Image Second image to compare device: Optional[Device] (= None) Device to perform the operation on. @@ -71,11 +69,12 @@ def mean_squared_error( """ return clic._mean_squared_error(device, input_image0, input_image1) + @plugin_function def spots_to_pointlist( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Transforms a spots image as resulting from maximum/minimum detection in an image where every column contains d pixels (with d = dimensionality of the original @@ -83,7 +82,7 @@ def spots_to_pointlist( Parameters ---------- - input_image: Image + input_image: Image Input binary image of spots output_image: Optional[Image] (= None) Output coordinate list of spots @@ -100,12 +99,13 @@ def spots_to_pointlist( """ return clic._spots_to_pointlist(device, input_image, output_image) + @plugin_function(categories=["label processing", "in assistant", "bia-bob-suggestion"]) def relabel_sequential( input_image: Image, - output_image: Optional[Image] =None, - blocksize: int =4096, - device: Optional[Device] =None + output_image: Optional[Image] = None, + blocksize: int = 4096, + device: Optional[Device] = None, ) -> Image: """Analyses a label map and if there are gaps in the indexing (e.g. label 5 is not present) all subsequent labels will be relabelled. Thus, afterwards number of @@ -114,7 +114,7 @@ def relabel_sequential( Parameters ---------- - input_image: Image + input_image: Image Input label image. output_image: Optional[Image] (= None) Output label image. @@ -133,18 +133,19 @@ def relabel_sequential( """ return clic._relabel_sequential(device, input_image, output_image, int(blocksize)) + @plugin_function(categories=["binarize", "in assistant", "bia-bob-suggestion"]) def threshold_otsu( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Binarizes an image using Otsu's threshold method [3] implemented in scikit-image[2] using a histogram determined on the GPU to create binary images. Parameters ---------- - input_image: Image + input_image: Image Input image to threshold. output_image: Optional[Image] (= None) Output binary image. @@ -163,12 +164,13 @@ def threshold_otsu( """ return clic._threshold_otsu(device, input_image, output_image) + @plugin_function(categories=["label measurement", "map", "in assistant", "combine"]) def mean_intensity_map( input_image: Image, labels: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Takes an image and a corresponding label map, determines the mean intensity per label and replaces every label with the that number. This results in a @@ -176,9 +178,9 @@ def mean_intensity_map( Parameters ---------- - input_image: Image + input_image: Image intensity image - labels: Image + labels: Image label image output_image: Optional[Image] (= None) Parametric image computed @@ -195,11 +197,12 @@ def mean_intensity_map( """ return clic._mean_intensity_map(device, input_image, labels, output_image) + @plugin_function(categories=["label measurement", "map", "in assistant"]) def pixel_count_map( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Takes a label map, determines the number of pixels per label and replaces every label with the that number. This results in a parametric image expressing area @@ -207,7 +210,7 @@ def pixel_count_map( Parameters ---------- - input_image: Image + input_image: Image Label image to measure output_image: Optional[Image] (= None) Parametric image computed @@ -224,11 +227,12 @@ def pixel_count_map( """ return clic._pixel_count_map(device, input_image, output_image) + @plugin_function(categories=["label measurement", "map", "in assistant"]) def label_pixel_count_map( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Takes a label map, determines the number of pixels per label and replaces every label with the that number. This results in a parametric image expressing area @@ -236,7 +240,7 @@ def label_pixel_count_map( Parameters ---------- - input_image: Image + input_image: Image Label image to measure output_image: Optional[Image] (= None) Parametric image computed @@ -253,12 +257,13 @@ def label_pixel_count_map( """ return clic._label_pixel_count_map(device, input_image, output_image) + @plugin_function def centroids_of_labels( label_image: Image, coorindate_list_destination: Image, - include_background: bool =False, - device: Optional[Device] =None + include_background: bool = False, + device: Optional[Device] = None, ) -> Image: """Determines the centroids of all labels in a label image or image stack. It writes the resulting coordinates in point list image of dimensions n * d where n @@ -267,9 +272,9 @@ def centroids_of_labels( Parameters ---------- - label_image: Image + label_image: Image Label image where the centroids will be determined from. - coorindate_list_destination: Image + coorindate_list_destination: Image Output list of coordinates where the centroids will be written to. include_background: bool (= False) Determines if the background label should be included. @@ -284,25 +289,28 @@ def centroids_of_labels( ---------- [1] https://clij.github.io/clij2-docs/reference_centroidsOfLabels """ - return clic._centroids_of_labels(device, label_image, coorindate_list_destination, include_background) + return clic._centroids_of_labels( + device, label_image, coorindate_list_destination, include_background + ) + @plugin_function(categories=["label processing", "combine"]) def remove_labels_with_map_values_out_of_range( input_image: Image, values: Image, - output_image: Optional[Image] =None, - min_value: float =0, - max_value: float =100, - device: Optional[Device] =None + output_image: Optional[Image] = None, + min_value: float = 0, + max_value: float = 100, + device: Optional[Device] = None, ) -> Image: """Remove labels with values outside a given value range based on a vector of values associated with the labels. Parameters ---------- - input_image: Image + input_image: Image Input image where labels will be filtered. - values: Image + values: Image Vector of output_image: Optional[Image] (= None) Output image where labels will be written to. @@ -321,25 +329,28 @@ def remove_labels_with_map_values_out_of_range( ---------- [1] https://clij.github.io/clij2-docs/reference_excludeLabelsWithValuesOutOfRange """ - return clic._remove_labels_with_map_values_out_of_range(device, input_image, values, output_image, float(min_value), float(max_value)) + return clic._remove_labels_with_map_values_out_of_range( + device, input_image, values, output_image, float(min_value), float(max_value) + ) + @plugin_function(categories=["label processing", "combine"]) def remove_labels_with_map_values_within_range( input_image: Image, values: Image, - output_image: Optional[Image] =None, - min_value: float =0, - max_value: float =100, - device: Optional[Device] =None + output_image: Optional[Image] = None, + min_value: float = 0, + max_value: float = 100, + device: Optional[Device] = None, ) -> Image: """Remove labels with values inside a given value range based on a vector of values associated with the labels. Parameters ---------- - input_image: Image + input_image: Image Input image where labels will be filtered. - values: Image + values: Image Vector of output_image: Optional[Image] (= None) Output image where labels will be written to. @@ -358,25 +369,28 @@ def remove_labels_with_map_values_within_range( ---------- [1] https://clij.github.io/clij2-docs/reference_excludeLabelsWithValuesWithinRange """ - return clic._remove_labels_with_map_values_within_range(device, input_image, values, output_image, float(min_value), float(max_value)) + return clic._remove_labels_with_map_values_within_range( + device, input_image, values, output_image, float(min_value), float(max_value) + ) + @plugin_function(categories=["label processing", "combine"]) def exclude_labels_with_map_values_out_of_range( values_map: Image, label_map_input: Image, - output_image: Optional[Image] =None, - minimum_value_range: float =0, - maximum_value_range: float =100, - device: Optional[Device] =None + output_image: Optional[Image] = None, + minimum_value_range: float = 0, + maximum_value_range: float = 100, + device: Optional[Device] = None, ) -> Image: """Exclude labels with values outside a given value range based on a vector of values associated with the labels. Parameters ---------- - values_map: Image + values_map: Image Vector of values associated with the labels. - label_map_input: Image + label_map_input: Image Input image where labels will be filtered. output_image: Optional[Image] (= None) Output image where labels will be written to. @@ -395,25 +409,33 @@ def exclude_labels_with_map_values_out_of_range( ---------- [1] https://clij.github.io/clij2-docs/reference_excludeLabelsWithValuesOutOfRange """ - return clic._exclude_labels_with_map_values_out_of_range(device, values_map, label_map_input, output_image, float(minimum_value_range), float(maximum_value_range)) + return clic._exclude_labels_with_map_values_out_of_range( + device, + values_map, + label_map_input, + output_image, + float(minimum_value_range), + float(maximum_value_range), + ) + @plugin_function(categories=["label processing", "combine"]) def exclude_labels_with_map_values_within_range( values_map: Image, label_map_input: Image, - output_image: Optional[Image] =None, - minimum_value_range: float =0, - maximum_value_range: float =100, - device: Optional[Device] =None + output_image: Optional[Image] = None, + minimum_value_range: float = 0, + maximum_value_range: float = 100, + device: Optional[Device] = None, ) -> Image: """Exclude labels with values inside a given value range based on a vector of values associated with the labels. Parameters ---------- - values_map: Image + values_map: Image Vector of values associated with the labels. - label_map_input: Image + label_map_input: Image Input image where labels will be filtered. output_image: Optional[Image] (= None) Output image where labels will be written to. @@ -432,13 +454,21 @@ def exclude_labels_with_map_values_within_range( ---------- [1] https://clij.github.io/clij2-docs/reference_excludeLabelsWithValuesWithinRange """ - return clic._exclude_labels_with_map_values_within_range(device, values_map, label_map_input, output_image, float(minimum_value_range), float(maximum_value_range)) + return clic._exclude_labels_with_map_values_within_range( + device, + values_map, + label_map_input, + output_image, + float(minimum_value_range), + float(maximum_value_range), + ) + @plugin_function(categories=["label processing", "in assistant", "map"]) def extension_ratio_map( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Determines the ratio of the extension for every label in a label map and returns it as a parametric map. The extension ration is defined as the maximum distance @@ -447,7 +477,7 @@ def extension_ratio_map( Parameters ---------- - input_image: Image + input_image: Image Input label image. output_image: Optional[Image] (= None) Output parametric image. @@ -462,4 +492,4 @@ def extension_ratio_map( ---------- [1] https://clij.github.io/clij2-docs/reference_extensionRatioMap """ - return clic._extension_ratio_map(device, input_image, output_image) \ No newline at end of file + return clic._extension_ratio_map(device, input_image, output_image) diff --git a/pyclesperanto/_tier5.py b/pyclesperanto/_tier5.py index 37b169d2..ac54cd55 100644 --- a/pyclesperanto/_tier5.py +++ b/pyclesperanto/_tier5.py @@ -12,13 +12,12 @@ from ._core import Device from ._decorators import plugin_function -clic = importlib.import_module('._pyclesperanto', package='pyclesperanto') +clic = importlib.import_module("._pyclesperanto", package="pyclesperanto") + @plugin_function(categories=["combine"]) def array_equal( - input_image0: Image, - input_image1: Image, - device: Optional[Device] =None + input_image0: Image, input_image1: Image, device: Optional[Device] = None ) -> bool: """Compares if all pixels of two images are identical. If shape of the images or any pixel are different, returns False. True otherwise This function is supposed @@ -26,9 +25,9 @@ def array_equal( Parameters ---------- - input_image0: Image + input_image0: Image First array to compare - input_image1: Image + input_image1: Image Second array to compare device: Optional[Device] (= None) Device to perform the operation on. @@ -43,12 +42,20 @@ def array_equal( """ return clic._array_equal(device, input_image0, input_image1) -@plugin_function(categories=["label processing", "combine labels", "in assistant", "bia-bob-suggestion"]) + +@plugin_function( + categories=[ + "label processing", + "combine labels", + "in assistant", + "bia-bob-suggestion", + ] +) def combine_labels( input_image0: Image, input_image1: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Combines two label images by adding labels of a given label image to another. Labels in the second image overwrite labels in the first passed image. @@ -56,9 +63,9 @@ def combine_labels( Parameters ---------- - input_image0: Image + input_image0: Image label image to add labels to. - input_image1: Image + input_image1: Image label image to add labels from. output_image: Optional[Image] (= None) Output label image. @@ -71,19 +78,20 @@ def combine_labels( """ return clic._combine_labels(device, input_image0, input_image1, output_image) + @plugin_function(categories=["label", "in assistant"]) def connected_components_labeling( input_image: Image, - output_image: Optional[Image] =None, - connectivity: str ='box', - device: Optional[Device] =None + output_image: Optional[Image] = None, + connectivity: str = "box", + device: Optional[Device] = None, ) -> Image: """Performs connected components analysis inspecting the box neighborhood of every pixel to a binary image and generates a label map. Parameters ---------- - input_image: Image + input_image: Image Binary image to label. output_image: Optional[Image] (= None) Output label image. @@ -100,21 +108,24 @@ def connected_components_labeling( ---------- [1] https://clij.github.io/clij2-docs/reference_connectedComponentsLabelingBox """ - return clic._connected_components_labeling(device, input_image, output_image, str(connectivity)) + return clic._connected_components_labeling( + device, input_image, output_image, str(connectivity) + ) + @plugin_function(categories=["label", "in assistant", "bia-bob-suggestion"]) def connected_component_labeling( input_image: Image, - output_image: Optional[Image] =None, - connectivity: str ='box', - device: Optional[Device] =None + output_image: Optional[Image] = None, + connectivity: str = "box", + device: Optional[Device] = None, ) -> Image: """Performs connected components analysis inspecting the box neighborhood of every pixel to a binary image and generates a label map. Parameters ---------- - input_image: Image + input_image: Image Binary image to label. output_image: Optional[Image] (= None) Output label image. @@ -131,19 +142,22 @@ def connected_component_labeling( ---------- [1] https://clij.github.io/clij2-docs/reference_connectedComponentsLabelingBox """ - return clic._connected_component_labeling(device, input_image, output_image, str(connectivity)) + return clic._connected_component_labeling( + device, input_image, output_image, str(connectivity) + ) + @plugin_function(categories=["label processing", "in assistant", "bia-bob-suggestion"]) def reduce_labels_to_centroids( input_image: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Take a label map and reduce each label to its centroid. Parameters ---------- - input_image: Image + input_image: Image Label image to reduce. output_image: Optional[Image] (= None) Output label image with centroids. @@ -160,19 +174,20 @@ def reduce_labels_to_centroids( """ return clic._reduce_labels_to_centroids(device, input_image, output_image) + @plugin_function(categories=["label processing", "in assistant"]) def filter_label_by_size( input_image: Image, - output_image: Optional[Image] =None, - minimum_size: float =0, - maximum_size: float =100, - device: Optional[Device] =None + output_image: Optional[Image] = None, + minimum_size: float = 0, + maximum_size: float = 100, + device: Optional[Device] = None, ) -> Image: """Filter labelled objects outside of the min/max size range value. Parameters ---------- - input_image: Image + input_image: Image Input label image. output_image: Optional[Image] (= None) Output label image. @@ -191,21 +206,24 @@ def filter_label_by_size( ---------- [1] https://clij.github.io/clij2-docs/reference_excludeLabelsOutsideSizeRange """ - return clic._filter_label_by_size(device, input_image, output_image, float(minimum_size), float(maximum_size)) + return clic._filter_label_by_size( + device, input_image, output_image, float(minimum_size), float(maximum_size) + ) + @plugin_function(categories=["label processing", "in assistant"]) def exclude_labels_outside_size_range( input_image: Image, - output_image: Optional[Image] =None, - minimum_size: float =0, - maximum_size: float =100, - device: Optional[Device] =None + output_image: Optional[Image] = None, + minimum_size: float = 0, + maximum_size: float = 100, + device: Optional[Device] = None, ) -> Image: """Filter labelled objects outside of the min/max size range value. Parameters ---------- - input_image: Image + input_image: Image Input label image. output_image: Optional[Image] (= None) Output label image. @@ -224,4 +242,6 @@ def exclude_labels_outside_size_range( ---------- [1] https://clij.github.io/clij2-docs/reference_excludeLabelsOutsideSizeRange """ - return clic._exclude_labels_outside_size_range(device, input_image, output_image, float(minimum_size), float(maximum_size)) \ No newline at end of file + return clic._exclude_labels_outside_size_range( + device, input_image, output_image, float(minimum_size), float(maximum_size) + ) diff --git a/pyclesperanto/_tier6.py b/pyclesperanto/_tier6.py index 032f5d68..b6870d95 100644 --- a/pyclesperanto/_tier6.py +++ b/pyclesperanto/_tier6.py @@ -12,14 +12,15 @@ from ._core import Device from ._decorators import plugin_function -clic = importlib.import_module('._pyclesperanto', package='pyclesperanto') +clic = importlib.import_module("._pyclesperanto", package="pyclesperanto") + @plugin_function(categories=["label processing", "in assistant", "bia-bob-suggestion"]) def dilate_labels( input_image: Image, - output_image: Optional[Image] =None, - radius: int =2, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius: int = 2, + device: Optional[Device] = None, ) -> Image: """Dilates labels to a larger size. No label overwrites another label. Similar to the implementation in scikitimage [2] and MorpholibJ[3] Notes * This operation @@ -27,12 +28,12 @@ def dilate_labels( Parameters ---------- - input_image: Image + input_image: Image Input label image to erode output_image: Optional[Image] (= None) Output label image radius: int (= 2) - + device: Optional[Device] (= None) Device to perform the operation on. @@ -42,13 +43,14 @@ def dilate_labels( """ return clic._dilate_labels(device, input_image, output_image, int(radius)) + @plugin_function(categories=["label processing", "in assistant"]) def erode_labels( input_image: Image, - output_image: Optional[Image] =None, - radius: int =1, - relabel: bool =False, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius: int = 1, + relabel: bool = False, + device: Optional[Device] = None, ) -> Image: """Erodes labels to a smaller size. Note: Depending on the label image and the radius, labels may disappear and labels may split into multiple islands. Thus, @@ -57,12 +59,12 @@ def erode_labels( Parameters ---------- - input_image: Image + input_image: Image Input label image output_image: Optional[Image] (= None) Output label image radius: int (= 1) - + relabel: bool (= False) Relabel the image, e.g. if object disappear or split. device: Optional[Device] (= None) @@ -74,12 +76,13 @@ def erode_labels( """ return clic._erode_labels(device, input_image, output_image, int(radius), relabel) + @plugin_function(categories=["label", "in assistant"]) def gauss_otsu_labeling( input_image0: Image, - output_image: Optional[Image] =None, - outline_sigma: float =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + outline_sigma: float = 0, + device: Optional[Device] = None, ) -> Image: """Labels objects directly from grey-value images. The outline_sigma parameter allows tuning the segmentation result. Under the hood, this filter applies a @@ -89,7 +92,7 @@ def gauss_otsu_labeling( Parameters ---------- - input_image0: Image + input_image0: Image Intensity image to segment output_image: Optional[Image] (= None) Output label image. @@ -107,14 +110,17 @@ def gauss_otsu_labeling( [1] https://ieeexplore.ieee.org/document/4310076 [2] https://en.wikipedia.org/wiki/Connected-component_labeling """ - return clic._gauss_otsu_labeling(device, input_image0, output_image, float(outline_sigma)) + return clic._gauss_otsu_labeling( + device, input_image0, output_image, float(outline_sigma) + ) + @plugin_function(categories=["label"]) def masked_voronoi_labeling( input_image: Image, mask: Image, - output_image: Optional[Image] =None, - device: Optional[Device] =None + output_image: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Takes a binary image, labels connected components and dilates the regions using a octagon shape until they touch. The region growing is limited to a masked @@ -122,9 +128,9 @@ def masked_voronoi_labeling( Parameters ---------- - input_image: Image + input_image: Image Input binary image - mask: Image + mask: Image Input output_image: Optional[Image] (= None) Output label image @@ -141,11 +147,12 @@ def masked_voronoi_labeling( """ return clic._masked_voronoi_labeling(device, input_image, mask, output_image) + @plugin_function(categories=["label", "in assistant", "bia-bob-suggestion"]) def voronoi_labeling( input_binary: Image, - output_labels: Optional[Image] =None, - device: Optional[Device] =None + output_labels: Optional[Image] = None, + device: Optional[Device] = None, ) -> Image: """Takes a binary image, labels connected components and dilates the regions using a octagon shape until they touch. The resulting label map is written to the @@ -153,7 +160,7 @@ def voronoi_labeling( Parameters ---------- - input_binary: Image + input_binary: Image Input binary image output_labels: Optional[Image] (= None) Output label image @@ -170,18 +177,19 @@ def voronoi_labeling( """ return clic._voronoi_labeling(device, input_binary, output_labels) + @plugin_function(categories=["label processing", "in assistant", "bia-bob-suggestion"]) def remove_small_labels( input_image: Image, - output_image: Optional[Image] =None, - minimum_size: float =100, - device: Optional[Device] =None + output_image: Optional[Image] = None, + minimum_size: float = 100, + device: Optional[Device] = None, ) -> Image: """Removes labelled objects small than a given size (in pixels) from a label map. Parameters ---------- - input_image: Image + input_image: Image Label image to filter. output_image: Optional[Image] (= None) Output label image filtered. @@ -198,20 +206,23 @@ def remove_small_labels( ---------- [1] https://clij.github.io/clij2-docs/reference_excludeLabelsOutsideSizeRange """ - return clic._remove_small_labels(device, input_image, output_image, float(minimum_size)) + return clic._remove_small_labels( + device, input_image, output_image, float(minimum_size) + ) + @plugin_function(categories=["label processing", "in assistant"]) def exclude_small_labels( input_image: Image, - output_image: Optional[Image] =None, - maximum_size: float =100, - device: Optional[Device] =None + output_image: Optional[Image] = None, + maximum_size: float = 100, + device: Optional[Device] = None, ) -> Image: """Removes labels from a label map which are below a given maximum size. Parameters ---------- - input_image: Image + input_image: Image Label image to filter. output_image: Optional[Image] (= None) Output label image filtered. @@ -228,20 +239,23 @@ def exclude_small_labels( ---------- [1] https://clij.github.io/clij2-docs/reference_excludeLabelsOutsideSizeRange """ - return clic._exclude_small_labels(device, input_image, output_image, float(maximum_size)) + return clic._exclude_small_labels( + device, input_image, output_image, float(maximum_size) + ) + @plugin_function(categories=["label processing", "in assistant", "bia-bob-suggestion"]) def remove_large_labels( input_image: Image, - output_image: Optional[Image] =None, - maximum_size: float =100, - device: Optional[Device] =None + output_image: Optional[Image] = None, + maximum_size: float = 100, + device: Optional[Device] = None, ) -> Image: """Removes labeled objects bigger than a given size (in pixels) from a label map. Parameters ---------- - input_image: Image + input_image: Image Label image to filter. output_image: Optional[Image] (= None) Output label image filtered. @@ -258,20 +272,23 @@ def remove_large_labels( ---------- [1] https://clij.github.io/clij2-docs/reference_excludeLabelsOutsideSizeRange """ - return clic._remove_large_labels(device, input_image, output_image, float(maximum_size)) + return clic._remove_large_labels( + device, input_image, output_image, float(maximum_size) + ) + @plugin_function(categories=["label processing", "in assistant"]) def exclude_large_labels( input_image: Image, - output_image: Optional[Image] =None, - minimum_size: float =100, - device: Optional[Device] =None + output_image: Optional[Image] = None, + minimum_size: float = 100, + device: Optional[Device] = None, ) -> Image: """Removes labels from a label map which are higher a given minimum size. Parameters ---------- - input_image: Image + input_image: Image Label image to filter. output_image: Optional[Image] (= None) Output label image filtered. @@ -288,4 +305,6 @@ def exclude_large_labels( ---------- [1] https://clij.github.io/clij2-docs/reference_excludeLabelsOutsideSizeRange """ - return clic._exclude_large_labels(device, input_image, output_image, float(minimum_size)) \ No newline at end of file + return clic._exclude_large_labels( + device, input_image, output_image, float(minimum_size) + ) diff --git a/pyclesperanto/_tier7.py b/pyclesperanto/_tier7.py index 1075b31a..0840ce7a 100644 --- a/pyclesperanto/_tier7.py +++ b/pyclesperanto/_tier7.py @@ -12,16 +12,17 @@ from ._core import Device from ._decorators import plugin_function -clic = importlib.import_module('._pyclesperanto', package='pyclesperanto') +clic = importlib.import_module("._pyclesperanto", package="pyclesperanto") + @plugin_function def affine_transform( input_image: Image, - output_image: Optional[Image] =None, - transform_matrix: Optional[list] =None, - interpolate: bool =False, - resize: bool =False, - device: Optional[Device] =None + output_image: Optional[Image] = None, + transform_matrix: Optional[list] = None, + interpolate: bool = False, + resize: bool = False, + device: Optional[Device] = None, ) -> Image: """Apply an affine transformation matrix to an array and return the result. The transformation matrix must be 3x3 or 4x4 stored as a 1D array. The matrix @@ -30,7 +31,7 @@ def affine_transform( Parameters ---------- - input_image: Image + input_image: Image Input image to be transformed. output_image: Optional[Image] (= None) Output image. @@ -47,15 +48,18 @@ def affine_transform( ------- Image """ - return clic._affine_transform(device, input_image, output_image, transform_matrix, interpolate, resize) + return clic._affine_transform( + device, input_image, output_image, transform_matrix, interpolate, resize + ) + @plugin_function(categories=["label", "in assistant"]) def eroded_otsu_labeling( input_image: Image, - output_image: Optional[Image] =None, - number_of_erosions: int =5, - outline_sigma: float =2, - device: Optional[Device] =None + output_image: Optional[Image] = None, + number_of_erosions: int = 5, + outline_sigma: float = 2, + device: Optional[Device] = None, ) -> Image: """Segments and labels an image using blurring, Otsu-thresholding, binary erosion and masked Voronoi-labeling. After bluring and Otsu-thresholding the image, @@ -69,7 +73,7 @@ def eroded_otsu_labeling( Parameters ---------- - input_image: Image + input_image: Image Input image to be transformed. output_image: Optional[Image] (= None) Output label image. @@ -89,22 +93,25 @@ def eroded_otsu_labeling( [1] https://github.com/biovoxxel/bv3dbox (BV_LabelSplitter.java#L83) [2] https://zenodo.org/badge/latestdoi/434949702 """ - return clic._eroded_otsu_labeling(device, input_image, output_image, int(number_of_erosions), float(outline_sigma)) + return clic._eroded_otsu_labeling( + device, input_image, output_image, int(number_of_erosions), float(outline_sigma) + ) + @plugin_function(categories=["transform", "in assistant"]) def rigid_transform( input_image: Image, - output_image: Optional[Image] =None, - translate_x: float =0, - translate_y: float =0, - translate_z: float =0, - angle_x: float =0, - angle_y: float =0, - angle_z: float =0, - centered: bool =True, - interpolate: bool =False, - resize: bool =False, - device: Optional[Device] =None + output_image: Optional[Image] = None, + translate_x: float = 0, + translate_y: float = 0, + translate_z: float = 0, + angle_x: float = 0, + angle_y: float = 0, + angle_z: float = 0, + centered: bool = True, + interpolate: bool = False, + resize: bool = False, + device: Optional[Device] = None, ) -> Image: """Translate the image by a given vector and rotate it by given angles. Angles are given in degrees. To convert radians to degrees, use this formula: @@ -112,7 +119,7 @@ def rigid_transform( Parameters ---------- - input_image: Image + input_image: Image Input image to be transformed. output_image: Optional[Image] (= None) Output image. @@ -141,19 +148,33 @@ def rigid_transform( ------- Image """ - return clic._rigid_transform(device, input_image, output_image, float(translate_x), float(translate_y), float(translate_z), float(angle_x), float(angle_y), float(angle_z), centered, interpolate, resize) + return clic._rigid_transform( + device, + input_image, + output_image, + float(translate_x), + float(translate_y), + float(translate_z), + float(angle_x), + float(angle_y), + float(angle_z), + centered, + interpolate, + resize, + ) + @plugin_function(categories=["transform", "in assistant"]) def rotate( input_image: Image, - output_image: Optional[Image] =None, - angle_x: float =0, - angle_y: float =0, - angle_z: float =0, - centered: bool =True, - interpolate: bool =False, - resize: bool =False, - device: Optional[Device] =None + output_image: Optional[Image] = None, + angle_x: float = 0, + angle_y: float = 0, + angle_z: float = 0, + centered: bool = True, + interpolate: bool = False, + resize: bool = False, + device: Optional[Device] = None, ) -> Image: """Rotate the image by given angles. Angles are given in degrees. To convert radians to degrees, use this formula: angle_in_degrees = angle_in_radians / @@ -161,7 +182,7 @@ def rotate( Parameters ---------- - input_image: Image + input_image: Image Input image to be rotated. output_image: Optional[Image] (= None) Output image. @@ -184,25 +205,36 @@ def rotate( ------- Image """ - return clic._rotate(device, input_image, output_image, float(angle_x), float(angle_y), float(angle_z), centered, interpolate, resize) + return clic._rotate( + device, + input_image, + output_image, + float(angle_x), + float(angle_y), + float(angle_z), + centered, + interpolate, + resize, + ) + @plugin_function(categories=["transform", "in assistant"]) def scale( input_image: Image, - output_image: Optional[Image] =None, - factor_x: float =1, - factor_y: float =1, - factor_z: float =1, - centered: bool =True, - interpolate: bool =False, - resize: bool =False, - device: Optional[Device] =None + output_image: Optional[Image] = None, + factor_x: float = 1, + factor_y: float = 1, + factor_z: float = 1, + centered: bool = True, + interpolate: bool = False, + resize: bool = False, + device: Optional[Device] = None, ) -> Image: """Scale the image by given factors. Parameters ---------- - input_image: Image + input_image: Image Input image to be scaled. output_image: Optional[Image] (= None) Output image. @@ -225,23 +257,34 @@ def scale( ------- Image """ - return clic._scale(device, input_image, output_image, float(factor_x), float(factor_y), float(factor_z), centered, interpolate, resize) + return clic._scale( + device, + input_image, + output_image, + float(factor_x), + float(factor_y), + float(factor_z), + centered, + interpolate, + resize, + ) + @plugin_function(categories=["transform", "in assistant"]) def translate( input_image: Image, - output_image: Optional[Image] =None, - translate_x: float =0, - translate_y: float =0, - translate_z: float =0, - interpolate: bool =False, - device: Optional[Device] =None + output_image: Optional[Image] = None, + translate_x: float = 0, + translate_y: float = 0, + translate_z: float = 0, + interpolate: bool = False, + device: Optional[Device] = None, ) -> Image: """Translate the image by a given vector. Parameters ---------- - input_image: Image + input_image: Image Input image to be translated. output_image: Optional[Image] (= None) Output image. @@ -260,14 +303,23 @@ def translate( ------- Image """ - return clic._translate(device, input_image, output_image, float(translate_x), float(translate_y), float(translate_z), interpolate) + return clic._translate( + device, + input_image, + output_image, + float(translate_x), + float(translate_y), + float(translate_z), + interpolate, + ) + @plugin_function(categories=["label processing", "in assistant"]) def closing_labels( input_image: Image, - output_image: Optional[Image] =None, - radius: int =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius: int = 0, + device: Optional[Device] = None, ) -> Image: """Apply a morphological closing operation to a label image. The operation consists of iterative dilation and erosion of the labels. With every iteration, box and @@ -277,7 +329,7 @@ def closing_labels( Parameters ---------- - input_image: Image + input_image: Image Input label image. output_image: Optional[Image] (= None) Output label image. @@ -292,12 +344,13 @@ def closing_labels( """ return clic._closing_labels(device, input_image, output_image, int(radius)) + @plugin_function(categories=["label processing", "in assistant"]) def erode_connected_labels( input_image: Image, - output_image: Optional[Image] =None, - radius: int =1, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius: int = 1, + device: Optional[Device] = None, ) -> Image: """Erodes labels to a smaller size. Note: Depending on the label image and the radius, labels may disappear and labels may split into multiple islands. Thus, @@ -305,12 +358,12 @@ def erode_connected_labels( Parameters ---------- - input_image: Image + input_image: Image Input image to process output_image: Optional[Image] (= None) Output label image radius: int (= 1) - + device: Optional[Device] (= None) Device to perform the operation on. @@ -320,12 +373,13 @@ def erode_connected_labels( """ return clic._erode_connected_labels(device, input_image, output_image, int(radius)) + @plugin_function(categories=["label processing", "in assistant"]) def opening_labels( input_image: Image, - output_image: Optional[Image] =None, - radius: int =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius: int = 0, + device: Optional[Device] = None, ) -> Image: """Apply a morphological opening operation to a label image. The operation consists of iterative erosion and dilation of the labels. With every iteration, box and @@ -335,7 +389,7 @@ def opening_labels( Parameters ---------- - input_image: Image + input_image: Image Input label image. output_image: Optional[Image] (= None) Output label image. @@ -350,13 +404,14 @@ def opening_labels( """ return clic._opening_labels(device, input_image, output_image, int(radius)) + @plugin_function(categories=["label", "in assistant", "bia-bob-suggestion"]) def voronoi_otsu_labeling( input_image: Image, - output_image: Optional[Image] =None, - spot_sigma: float =2, - outline_sigma: float =2, - device: Optional[Device] =None + output_image: Optional[Image] = None, + spot_sigma: float = 2, + outline_sigma: float = 2, + device: Optional[Device] = None, ) -> Image: """Labels objects directly from greyvalue images. The two sigma parameters allow tuning the segmentation result. Under the hood, this filter applies two Gaussian @@ -367,7 +422,7 @@ def voronoi_otsu_labeling( Parameters ---------- - input_image: Image + input_image: Image Input intensity image. output_image: Optional[Image] (= None) Output label image. @@ -388,4 +443,6 @@ def voronoi_otsu_labeling( [2] https://ieeexplore.ieee.org/document/4310076 [3] https://en.wikipedia.org/wiki/Voronoi_diagram """ - return clic._voronoi_otsu_labeling(device, input_image, output_image, float(spot_sigma), float(outline_sigma)) \ No newline at end of file + return clic._voronoi_otsu_labeling( + device, input_image, output_image, float(spot_sigma), float(outline_sigma) + ) diff --git a/pyclesperanto/_tier8.py b/pyclesperanto/_tier8.py index 85b62701..e9ebe9de 100644 --- a/pyclesperanto/_tier8.py +++ b/pyclesperanto/_tier8.py @@ -12,14 +12,15 @@ from ._core import Device from ._decorators import plugin_function -clic = importlib.import_module('._pyclesperanto', package='pyclesperanto') +clic = importlib.import_module("._pyclesperanto", package="pyclesperanto") + @plugin_function(categories=["label processing", "in assistant", "bia-bob-suggestion"]) def smooth_labels( input_image: Image, - output_image: Optional[Image] =None, - radius: int =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius: int = 0, + device: Optional[Device] = None, ) -> Image: """Apply a morphological opening operation to a label image and afterwards fills gaps between the labels using voronoi-labeling. Finally, the result label @@ -28,7 +29,7 @@ def smooth_labels( Parameters ---------- - input_image: Image + input_image: Image Input label image output_image: Optional[Image] (= None) Output label image @@ -43,12 +44,13 @@ def smooth_labels( """ return clic._smooth_labels(device, input_image, output_image, int(radius)) + @plugin_function(categories=["label processing", "in assistant", "bia-bob-suggestion"]) def smooth_connected_labels( input_image: Image, - output_image: Optional[Image] =None, - radius: int =0, - device: Optional[Device] =None + output_image: Optional[Image] = None, + radius: int = 0, + device: Optional[Device] = None, ) -> Image: """Apply a morphological erosion and dilation of the label image with respect to the connectivity of the labels. Note: It is recommended to process isotropic @@ -56,7 +58,7 @@ def smooth_connected_labels( Parameters ---------- - input_image: Image + input_image: Image Input label image output_image: Optional[Image] (= None) Output label image @@ -69,4 +71,4 @@ def smooth_connected_labels( ------- Image """ - return clic._smooth_connected_labels(device, input_image, output_image, int(radius)) \ No newline at end of file + return clic._smooth_connected_labels(device, input_image, output_image, int(radius)) diff --git a/src/wrapper/tier1_.cpp b/src/wrapper/tier1_.cpp index d8ba3138..6a04570c 100644 --- a/src/wrapper/tier1_.cpp +++ b/src/wrapper/tier1_.cpp @@ -1,5 +1,5 @@ // this code is auto-generated, do not edit manually - + #include "pycle_wrapper.hpp" #include "tier1.hpp" @@ -577,4 +577,4 @@ m.def("_absolute", &cle::tier1::absolute_func, "Call cle::tier1::absolute_func f m.def("_z_position_of_minimum_z_projection", &cle::tier1::z_position_of_minimum_z_projection_func, "Call cle::tier1::z_position_of_minimum_z_projection_func from C++ CLIc.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); -} \ No newline at end of file +} diff --git a/src/wrapper/tier2_.cpp b/src/wrapper/tier2_.cpp index 0fd56464..5c9163de 100644 --- a/src/wrapper/tier2_.cpp +++ b/src/wrapper/tier2_.cpp @@ -1,5 +1,5 @@ // this code is auto-generated, do not edit manually - + #include "pycle_wrapper.hpp" #include "tier2.hpp" @@ -193,4 +193,4 @@ m.def("_absolute_difference", &cle::tier2::absolute_difference_func, "Call cle:: m.def("_top_hat", &cle::tier2::top_hat_func, "Call cle::tier2::top_hat_func from C++ CLIc.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z"), py::arg("connectivity")); -} \ No newline at end of file +} diff --git a/src/wrapper/tier3_.cpp b/src/wrapper/tier3_.cpp index c9d63f6f..ab41ee1c 100644 --- a/src/wrapper/tier3_.cpp +++ b/src/wrapper/tier3_.cpp @@ -1,5 +1,5 @@ // this code is auto-generated, do not edit manually - + #include "pycle_wrapper.hpp" #include "tier3.hpp" @@ -81,4 +81,4 @@ m.def("_bounding_box", &cle::tier3::bounding_box_func, "Call cle::tier3::boundin m.def("_statistics_of_background_and_labelled_pixels", &cle::tier3::statistics_of_background_and_labelled_pixels_func, "Call cle::tier3::statistics_of_background_and_labelled_pixels_func from C++ CLIc.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("intensity"), py::arg("label")); -} \ No newline at end of file +} diff --git a/src/wrapper/tier4_.cpp b/src/wrapper/tier4_.cpp index 9ada218b..86078ad5 100644 --- a/src/wrapper/tier4_.cpp +++ b/src/wrapper/tier4_.cpp @@ -1,5 +1,5 @@ // this code is auto-generated, do not edit manually - + #include "pycle_wrapper.hpp" #include "tier4.hpp" @@ -61,4 +61,4 @@ m.def("_label_bounding_box", &cle::tier4::label_bounding_box_func, "Call cle::ti m.def("_extension_ratio_map", &cle::tier4::extension_ratio_map_func, "Call cle::tier4::extension_ratio_map_func from C++ CLIc.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); -} \ No newline at end of file +} diff --git a/src/wrapper/tier5_.cpp b/src/wrapper/tier5_.cpp index aff53eca..e7582a8f 100644 --- a/src/wrapper/tier5_.cpp +++ b/src/wrapper/tier5_.cpp @@ -1,5 +1,5 @@ // this code is auto-generated, do not edit manually - + #include "pycle_wrapper.hpp" #include "tier5.hpp" @@ -33,4 +33,4 @@ m.def("_array_equal", &cle::tier5::array_equal_func, "Call cle::tier5::array_equ m.def("_exclude_labels_outside_size_range", &cle::tier5::exclude_labels_outside_size_range_func, "Call cle::tier5::exclude_labels_outside_size_range_func from C++ CLIc.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("minimum_size"), py::arg("maximum_size")); -} \ No newline at end of file +} diff --git a/src/wrapper/tier6_.cpp b/src/wrapper/tier6_.cpp index 8fef651c..d3db847d 100644 --- a/src/wrapper/tier6_.cpp +++ b/src/wrapper/tier6_.cpp @@ -1,5 +1,5 @@ // this code is auto-generated, do not edit manually - + #include "pycle_wrapper.hpp" #include "tier6.hpp" @@ -41,4 +41,4 @@ m.def("_dilate_labels", &cle::tier6::dilate_labels_func, "Call cle::tier6::dilat m.def("_exclude_large_labels", &cle::tier6::exclude_large_labels_func, "Call cle::tier6::exclude_large_labels_func from C++ CLIc.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("minimum_size")); -} \ No newline at end of file +} diff --git a/src/wrapper/tier7_.cpp b/src/wrapper/tier7_.cpp index be567a9d..bbd95fae 100644 --- a/src/wrapper/tier7_.cpp +++ b/src/wrapper/tier7_.cpp @@ -1,5 +1,5 @@ // this code is auto-generated, do not edit manually - + #include "pycle_wrapper.hpp" #include "tier7.hpp" @@ -45,4 +45,4 @@ m.def("_affine_transform", &cle::tier7::affine_transform_func, "Call cle::tier7: m.def("_voronoi_otsu_labeling", &cle::tier7::voronoi_otsu_labeling_func, "Call cle::tier7::voronoi_otsu_labeling_func from C++ CLIc.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("spot_sigma"), py::arg("outline_sigma")); -} \ No newline at end of file +} diff --git a/src/wrapper/tier8_.cpp b/src/wrapper/tier8_.cpp index b0550569..ba276bdc 100644 --- a/src/wrapper/tier8_.cpp +++ b/src/wrapper/tier8_.cpp @@ -1,5 +1,5 @@ // this code is auto-generated, do not edit manually - + #include "pycle_wrapper.hpp" #include "tier8.hpp" @@ -13,4 +13,4 @@ m.def("_smooth_labels", &cle::tier8::smooth_labels_func, "Call cle::tier8::smoot m.def("_smooth_connected_labels", &cle::tier8::smooth_connected_labels_func, "Call cle::tier8::smooth_connected_labels_func from C++ CLIc.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius")); -} \ No newline at end of file +} diff --git a/tests/test_extension_ratio_map.py b/tests/test_extension_ratio_map.py index be9bf74b..24743b4d 100644 --- a/tests/test_extension_ratio_map.py +++ b/tests/test_extension_ratio_map.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + def test_extension_ratio_map_2d(): diff --git a/tests/test_filter_labels_by_size.py b/tests/test_filter_labels_by_size.py index 47f512bc..eb19c2f4 100644 --- a/tests/test_filter_labels_by_size.py +++ b/tests/test_filter_labels_by_size.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + def test_exclude_labels_out_of_size_range_2d(): diff --git a/tests/test_label_pixelcount_map.py b/tests/test_label_pixelcount_map.py index 40feaf66..f2e7012f 100644 --- a/tests/test_label_pixelcount_map.py +++ b/tests/test_label_pixelcount_map.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + def test_label_pixel_count_map(): diff --git a/tests/test_reduce_labels_to_centroids.py b/tests/test_reduce_labels_to_centroids.py index 5d027261..1307fd80 100644 --- a/tests/test_reduce_labels_to_centroids.py +++ b/tests/test_reduce_labels_to_centroids.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + def test_reduce_labels_to_centroids(): test = np.asarray( diff --git a/tests/test_threshold_otsu.py b/tests/test_threshold_otsu.py index 65c78c81..a779b55d 100644 --- a/tests/test_threshold_otsu.py +++ b/tests/test_threshold_otsu.py @@ -32,16 +32,11 @@ def test_threshold_otsu_against_scikit_image(): assert np.allclose(binary, (cle.pull(gpu_binary) > 0)) - def test_threshold_otsu_low_values(): - input = np.asarray([[0,0,0], - [0,0.003,0], - [0,0,0]]) - - reference = np.asarray([[0,0,0], - [0,1,0], - [0,0,0]]) - + input = np.asarray([[0, 0, 0], [0, 0.003, 0], [0, 0, 0]]) + + reference = np.asarray([[0, 0, 0], [0, 1, 0], [0, 0, 0]]) + result = cle.threshold_otsu(input) - assert np.allclose(reference, cle.pull(result) > 0) \ No newline at end of file + assert np.allclose(reference, cle.pull(result) > 0)