diff --git a/pyclesperanto/_tier1.py b/pyclesperanto/_tier1.py index ddab42e1..a7ed8a3e 100644 --- a/pyclesperanto/_tier1.py +++ b/pyclesperanto/_tier1.py @@ -12,24 +12,23 @@ 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. + Output image where results are written into. device: Optional[Device] (= None) Device to perform the operation on. @@ -43,27 +42,26 @@ 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 * bParameters ---------- - input_image0: Image - The first input image to added. - input_image1: Image - The second image to be added. + input_image0: Image + First input image to add. + input_image1: Image + Second image to add. output_image: Optional[Image] (= None) - The output image where results are written into. + Output image where results are written into. factor1: float (= 1) Multiplication factor of each pixel of src0 before adding it. factor2: float (= 1) @@ -79,29 +77,26 @@ 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 + sParameters ---------- - input_image: Image - The input image where scalare should be added. + input_image: Image + Input image to process. output_image: Optional[Image] (= None) - The output image where results are written into. + Output image. scalar: float (= 1) - The constant number which will be added to all pixels. + Scalar number to add to all pixels. device: Optional[Device] (= None) Device to perform the operation on. @@ -115,21 +110,12 @@ 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 @@ -138,12 +124,12 @@ def binary_and( Parameters ---------- - input_image0: Image - The first binary input image to be processed. - input_image1: Image - The second binary input image to be processed. + input_image0: Image + First binary input image to be processed. + input_image1: Image + Second binary input image to be processed. output_image: Optional[Image] (= None) - The output image where results are written into. + Output image where results are written into. device: Optional[Device] (= None) Device to perform the operation on. @@ -157,29 +143,21 @@ 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 - The binary input image where edges will be searched. + input_image: Image + Binary input image where edges will be searched. output_image: Optional[Image] (= None) - The output image where edge pixels will be 1. + Output image where edge pixels will be 1. device: Optional[Device] (= None) Device to perform the operation on. @@ -193,20 +171,11 @@ 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 @@ -214,10 +183,10 @@ def binary_not( Parameters ---------- - input_image: Image - The binary input image to be inverted. + input_image: Image + Binary input image to be inverted. output_image: Optional[Image] (= None) - The output image where results are written into. + Output image where results are written into. device: Optional[Device] (= None) Device to perform the operation on. @@ -231,21 +200,12 @@ 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 @@ -254,12 +214,12 @@ def binary_or( Parameters ---------- - input_image0: Image - The first binary input image to be processed. - input_image1: Image - The second binary input image to be processed. + input_image0: Image + First binary input image to be processed. + input_image1: Image + Second binary input image to be processed. output_image: Optional[Image] (= None) - The output image where results are written into. + Output image where results are written into. device: Optional[Device] (= None) Device to perform the operation on. @@ -273,32 +233,23 @@ 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 - The first binary input image to be processed. - input_image1: Image - The second binary input image to be subtracted from the first. + input_image0: Image + First binary input image to be processed. + input_image1: Image + Second binary input image to be subtracted from the first. output_image: Optional[Image] (= None) - The output image where results are written into. + Output image where results are written into. device: Optional[Device] (= None) Device to perform the operation on. @@ -312,21 +263,12 @@ 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 | @@ -335,12 +277,12 @@ def binary_xor( Parameters ---------- - input_image0: Image - The first binary input image to be processed. - input_image1: Image - The second binary input image to be processed. + input_image0: Image + First binary input image to be processed. + input_image1: Image + Second binary input image to be processed. output_image: Optional[Image] (= None) - The output image where results are written into. + Output image where results are written into. device: Optional[Device] (= None) Device to perform the operation on. @@ -354,22 +296,21 @@ 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. + Output image where results are written into. device: Optional[Device] (= None) Device to perform the operation on. @@ -379,22 +320,21 @@ 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. + Output image where results are written into. device: Optional[Device] (= None) Device to perform the operation on. @@ -404,14 +344,13 @@ 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, @@ -423,14 +362,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. @@ -438,26 +377,23 @@ 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. @@ -474,18 +410,17 @@ 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) = xParameters ---------- - input_image: Image + input_image: Image Input image to copy. output_image: Optional[Image] (= None) Output copy image. @@ -502,13 +437,12 @@ 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 @@ -519,12 +453,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) - + Index of the slice to copy. device: Optional[Device] (= None) Device to perform the operation on. @@ -538,13 +472,12 @@ 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 @@ -552,12 +485,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) - + Index of the slice to copy. device: Optional[Device] (= None) Device to perform the operation on. @@ -569,17 +502,14 @@ 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 @@ -587,12 +517,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) - + Index of the slice to copy. device: Optional[Device] (= None) Device to perform the operation on. @@ -604,29 +534,26 @@ 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. @@ -653,30 +580,19 @@ 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. @@ -689,21 +605,18 @@ 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. @@ -720,23 +633,55 @@ def detect_label_edges( """ return clic._detect_label_edges(device, input_image, output_image) +@plugin_function(categories=["binary processing" "filter"]) +def dilation( + input_image: Image, + footprint: Image, + output_image: Optional[Image] =None, + device: Optional[Device] =None +) -> Image: + """Computes the dilation operation between an image and a structuring element. The + operation is applied in grayscale if the image is in grayscale. The structuring + element is a binary image with pixel values 0 and 1, and must have the same + dimensionality as the image (3D is the image is 3D, 2D if the image is 2D). + + Parameters + ---------- + input_image: Image + Input image to process. + footprint: Image + Structuring element to use for the operation. + output_image: Optional[Image] (= None) + Output result image. + device: Optional[Device] (= None) + Device to perform the operation on. + + Returns + ------- + Image + + References + ---------- + [1] https://clij.github.io/clij2-docs/reference_erodeBox + """ + return clic._dilation(device, input_image, footprint, 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 - and 26 pixels in 3d) into account. The pixels in the input image with pixel + of a given input image. The dilation takes the Moore neighborhood (8 pixels in + 2D and 26 pixels in 3d) into account. The pixels in the input image with pixel value not equal to 0 will be interpreted as 1. This method is comparable to the 'Dilate' menu in ImageJ in case it is applied to a 2D image. The only difference is that the output image contains values 0 and 1 instead of 0 and 255. 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. @@ -753,21 +698,20 @@ 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 - in 2D and 6 pixels in 3d) into account. The pixels in the input image with pixel - value not equal to 0 will be interpreted as 1. + of a given input image. The dilation takes the von Neumann neighborhood (4 + pixels in 2D and 6 pixels in 3d) into account. The pixels in the input image + with pixel value not equal to 0 will be interpreted as 1. 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. @@ -784,26 +728,36 @@ def dilate_sphere( """ return clic._dilate_sphere(device, input_image, output_image) - @plugin_function(categories=["binary processing"]) -def dilate( +def binary_dilate( input_image: Image, - output_image: Optional[Image] = None, - 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: """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 - and 26 pixels in 3d) for the "box" connectivity and the vonNeumannneighborhood - (4 pixels in 2D and 6 pixels in 3d) for a "sphere" connectivity. The pixels in - the input image with pixel value not equal to 0 will be interpreted as 1. + of a given input image. The dilation apply the Moore neighborhood (8 pixels in + 2D and 26 pixels in 3d) for the "box" connectivity and the von Neumann + neighborhood (4 pixels in 2D and 6 pixels in 3d) for a "sphere" connectivity. + The pixels in the input image with pixel value not equal to 0 will be + interpreted as 1. For a more flexible dilation with arbitrary shapes, use + dilation() instead. 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. + radius_x: float (= 1) + Radius of sphere or box structuring element in X. + radius_y: float (= 1) + Radius of sphere or box structuring element in Y. + radius_z: float (= 1) + Radius of sphere or box structuring element in Z. connectivity: str (= "box") Element shape, "box" or "sphere". device: Optional[Device] (= None) @@ -818,23 +772,22 @@ def dilate( [1] https://clij.github.io/clij2-docs/reference_dilateBox [2] https://clij.github.io/clij2-docs/reference_dilateSphere """ - return clic._dilate(device, input_image, output_image, str(connectivity)) - + return clic._binary_dilate(device, input_image, output_image, float(radius_x), float(radius_y), float(radius_z), 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, + dividend: Image, + divisor: Image, + 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 / yParameters ---------- - input_image0: Image - First input image to process. - input_image1: Image + dividend: Image + Input image to process. + divisor: Image Second input image to process. output_image: Optional[Image] (= None) Output result image. @@ -849,26 +802,25 @@ def divide_images( ---------- [1] https://clij.github.io/clij2-docs/reference_divideImages """ - return clic._divide_images(device, input_image0, input_image1, output_image) - + return clic._divide_images(device, dividend, divisor, 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 / xParameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. scalar: float (= 0) - + Scalar value to divide the image with. device: Optional[Device] (= None) Device to perform the operation on. @@ -876,29 +828,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 - The first image to be compared with. - input_image1: Image - The second image to be compared with the first. + input_image0: Image + First image to be compared with. + input_image1: Image + 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 + Output binary image. device: Optional[Device] (= None) Device to perform the operation on. @@ -912,25 +861,24 @@ 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 - The image where every pixel is compared to the constant. + input_image: Image + Input omage 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 + Output binary image. scalar: float (= 0) - The constant where every pixel is compared to. + Scalar value to compare pixel with. device: Optional[Device] (= None) Device to perform the operation on. @@ -944,15 +892,47 @@ def equal_constant( """ return clic._equal_constant(device, input_image, output_image, float(scalar)) +@plugin_function(categories=["binary processing" "filter"]) +def erosion( + input_image: Image, + footprint: Image, + output_image: Optional[Image] =None, + device: Optional[Device] =None +) -> Image: + """Computes the erosion operation between an image and a structuring element. The + operation is applied in grayscale if the image is in grayscale. The structuring + element is a binary image with pixel values 0 and 1, and must have the same + dimensionality as the image (3D is the image is 3D, 2D if the image is 2D). + + Parameters + ---------- + input_image: Image + Input image to process. + footprint: Image + Structuring element to use for the operation. + output_image: Optional[Image] (= None) + Output result image. + device: Optional[Device] (= None) + Device to perform the operation on. + + Returns + ------- + Image + + References + ---------- + [1] https://clij.github.io/clij2-docs/reference_erodeBox + """ + return clic._erosion(device, input_image, footprint, output_image) @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 + of a given input image. The erosion takes the Moore neighborhood (8 pixels in 2D and 26 pixels in 3d) into account. The pixels in the input image with pixel value not equal to 0 will be interpreted as 1. This method is comparable to the 'Erode' menu in ImageJ in case it is applied to a 2D image. The only difference @@ -960,7 +940,7 @@ def erode_box( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -977,21 +957,20 @@ 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 + of a given input image. The erosion takes the von Neumann neighborhood (4 pixels in 2D and 6 pixels in 3d) into account. The pixels in the input image with pixel value not equal to 0 will be interpreted as 1. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1008,26 +987,35 @@ 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, + radius_x: float =1, + radius_y: float =1, + radius_z: float =1, + 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 - and 26 pixels in 3d) for the "box" connectivity and the vonNeumannneighborhood + of a given input image. The erosion apply the Moore neighborhood (8 pixels in 2D + and 26 pixels in 3d) for the "box" connectivity and the von Neumann neighborhood (4 pixels in 2D and 6 pixels in 3d) for a "sphere" connectivity. The pixels in - the input image with pixel value not equal to 0 will be interpreted as 1. + the input image with pixel value not equal to 0 will be interpreted as 1. For a + more flexible erosion with arbitrary shapes, use erosion() instead. Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. + radius_x: float (= 1) + Radius of the eroding sphere or box structuring element in X. + radius_y: float (= 1) + Radius of the eroding sphere or box structuring element in Y. + radius_z: float (= 1) + Radius of the eroding sphere or box structuring element in Z. connectivity: str (= "box") Element shape, "box" or "sphere". device: Optional[Device] (= None) @@ -1042,21 +1030,20 @@ def erode( [1] https://clij.github.io/clij2-docs/reference_erodeBox [2] https://clij.github.io/clij2-docs/reference_erodeSphere """ - return clic._erode(device, input_image, output_image, str(connectivity)) - + return clic._erode(device, input_image, output_image, float(radius_x), float(radius_y), float(radius_z), 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. @@ -1073,21 +1060,20 @@ 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. @@ -1110,15 +1096,14 @@ 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 @@ -1126,7 +1111,7 @@ def gaussian_blur( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1147,22 +1132,14 @@ 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, + distance_matrix_destination: 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 @@ -1176,11 +1153,11 @@ 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) + distance_matrix_destination: Optional[Image] (= None) Output result image. device: Optional[Device] (= None) Device to perform the operation on. @@ -1193,16 +1170,13 @@ 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, distance_matrix_destination) @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' = @@ -1210,7 +1184,7 @@ def gradient_x( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1227,12 +1201,11 @@ 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' = @@ -1240,7 +1213,7 @@ def gradient_y( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1257,12 +1230,11 @@ 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' = @@ -1270,7 +1242,7 @@ def gradient_z( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -1287,22 +1259,21 @@ 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. @@ -1319,25 +1290,24 @@ 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) - + Scalar value to compare pixel with. device: Optional[Device] (= None) Device to perform the operation on. @@ -1351,22 +1321,21 @@ 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. @@ -1383,25 +1352,24 @@ 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. scalar: float (= 0) - Scalar value used in the comparison. + Scalar value to compare pixel with. device: Optional[Device] (= None) Device to perform the operation on. @@ -1413,18 +1381,15 @@ 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, @@ -1438,7 +1403,7 @@ def hessian_eigenvalues( Parameters ---------- - input_image: Image + input_image: Image Input image to process. small_eigenvalue: Optional[Image] (= None) Output result image. @@ -1453,22 +1418,19 @@ 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. @@ -1485,18 +1447,17 @@ 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. @@ -1513,20 +1474,19 @@ 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. @@ -1545,22 +1505,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, + input_image: Image, + kernel: Image, + 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 - First input image to process. - input_image1: Image - Second input image to process. + input_image: Image + Input image to process. + kernel: Image + Input output_image: Optional[Image] (= None) Output result image. device: Optional[Device] (= None) @@ -1570,23 +1529,20 @@ def local_cross_correlation( ------- Image """ - return clic._local_cross_correlation( - device, input_image0, input_image1, output_image - ) - + return clic._local_cross_correlation(device, input_image, kernel, 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. @@ -1603,13 +1559,12 @@ 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 @@ -1618,9 +1573,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. @@ -1637,25 +1592,24 @@ 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 - same position in the label_map image has the right index value i. f(x,m,i) = (x - if (m == i); (0 otherwise)) + same position in the label_map image has the right index value i.f(x,m,i) + = (x if (m == i); (0 otherwise))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. @@ -1672,24 +1626,21 @@ 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. @@ -1706,26 +1657,23 @@ 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. @@ -1742,30 +1690,29 @@ 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: float =1, + radius_y: float =1, + radius_z: float =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. - radius_x: int (= 1) + radius_x: float (= 1) Radius size along x axis. - radius_y: int (= 1) + radius_y: float (= 1) Radius size along y axis. - radius_z: int (= 1) + radius_z: float (= 1) Radius size along z axis. device: Optional[Device] (= None) Device to perform the operation on. @@ -1778,20 +1725,17 @@ 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, float(radius_x), float(radius_y), float(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: float =1, + radius_y: float =1, + radius_z: float =1, + 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 @@ -1799,15 +1743,15 @@ def maximum_filter( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. - radius_x: int (= 0) + radius_x: float (= 1) Radius size along x axis. - radius_y: int (= 0) + radius_y: float (= 1) Radius size along y axis. - radius_z: int (= 0) + radius_z: float (= 1) Radius size along z axis. connectivity: str (= "box") Filter neigborhood @@ -1823,28 +1767,63 @@ 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, float(radius_x), float(radius_y), float(radius_z), str(connectivity)) + +@plugin_function(categories=["filter", "in assistant"]) +def grayscale_dilate( + 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 +) -> Image: + """Computes a grayscale image containing the grayscale dilation of a given input + image. The erosion apply the Moore neighborhood (8 pixels in 2D and 26 pixels in + 3d) for the "box" connectivity and the von Neumann neighborhood (4 pixels in 2D + and 6 pixels in 3d) for a "sphere" connectivity. The pixels in the input image + with pixel value not equal to 0 will be interpreted as 1. + + Parameters + ---------- + input_image: Image + Input image to process. + output_image: Optional[Image] (= None) + Output result image. + radius_x: float (= 1) + Radius size along x axis. + radius_y: float (= 1) + Radius size along y axis. + radius_z: float (= 1) + Radius size along z axis. + connectivity: str (= "box") + Filter neigborhood + device: Optional[Device] (= None) + Device to perform the operation on. + Returns + ------- + Image + + References + ---------- + [1] https://clij.github.io/clij2-docs/reference_minimum3DBox + [2] https://clij.github.io/clij2-docs/reference_minimum3DSphere + """ + return clic._grayscale_dilate(device, input_image, output_image, float(radius_x), float(radius_y), float(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. @@ -1861,18 +1840,17 @@ 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. @@ -1889,18 +1867,17 @@ 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. @@ -1917,30 +1894,29 @@ 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: float =1, + radius_y: float =1, + radius_z: float =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. - radius_x: int (= 1) + radius_x: float (= 1) Radius size along x axis. - radius_y: int (= 1) + radius_y: float (= 1) Radius size along y axis. - radius_z: int (= 1) + radius_z: float (= 1) Radius size along z axis. device: Optional[Device] (= None) Device to perform the operation on. @@ -1953,34 +1929,31 @@ 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, float(radius_x), float(radius_y), float(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: float =1, + radius_y: float =1, + radius_z: float =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. - radius_x: int (= 1) + radius_x: float (= 1) Radius size along x axis. - radius_y: int (= 1) + radius_y: float (= 1) Radius size along y axis. - radius_z: int (= 1) + radius_z: float (= 1) Radius size along z axis. device: Optional[Device] (= None) Device to perform the operation on. @@ -1993,20 +1966,17 @@ 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, float(radius_x), float(radius_y), float(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: float =1, + radius_y: float =1, + radius_z: float =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 @@ -2014,15 +1984,15 @@ def mean_filter( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. - radius_x: int (= 1) + radius_x: float (= 1) Radius size along x axis. - radius_y: int (= 1) + radius_y: float (= 1) Radius size along y axis. - radius_z: int (= 1) + radius_z: float (= 1) Radius size along z axis. connectivity: str (= "box") Filter neigborhood @@ -2037,28 +2007,19 @@ 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, float(radius_x), float(radius_y), float(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. @@ -2075,18 +2036,17 @@ 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. @@ -2103,18 +2063,17 @@ 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. @@ -2131,15 +2090,14 @@ 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: float =1, + radius_y: float =1, + radius_z: float =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 @@ -2147,15 +2105,15 @@ def median_box( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. - radius_x: int (= 1) + radius_x: float (= 1) Radius size along x axis. - radius_y: int (= 1) + radius_y: float (= 1) Radius size along y axis. - radius_z: int (= 1) + radius_z: float (= 1) Radius size along z axis. device: Optional[Device] (= None) Device to perform the operation on. @@ -2168,19 +2126,16 @@ 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, float(radius_x), float(radius_y), float(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: float =1, + radius_y: float =1, + radius_z: float =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 @@ -2188,15 +2143,15 @@ def median_sphere( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. - radius_x: int (= 1) + radius_x: float (= 1) Radius size along x axis. - radius_y: int (= 1) + radius_y: float (= 1) Radius size along y axis. - radius_z: int (= 1) + radius_z: float (= 1) Radius size along z axis. device: Optional[Device] (= None) Device to perform the operation on. @@ -2209,20 +2164,17 @@ 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, float(radius_x), float(radius_y), float(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: float =1, + radius_y: float =1, + radius_z: float =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, @@ -2231,15 +2183,15 @@ def median( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. - radius_x: int (= 1) + radius_x: float (= 1) Radius size along x axis. - radius_y: int (= 1) + radius_y: float (= 1) Radius size along y axis. - radius_z: int (= 1) + radius_z: float (= 1) Radius size along z axis. connectivity: str (= "box") Filter neigborhood @@ -2254,40 +2206,31 @@ 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, float(radius_x), float(radius_y), float(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: float =1, + radius_y: float =1, + radius_z: float =1, + 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. - radius_x: int (= 0) + radius_x: float (= 1) Radius size along x axis. - radius_y: int (= 0) + radius_y: float (= 1) Radius size along y axis. - radius_z: int (= 0) + radius_z: float (= 1) Radius size along z axis. device: Optional[Device] (= None) Device to perform the operation on. @@ -2300,35 +2243,32 @@ 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, float(radius_x), float(radius_y), float(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: float =1, + radius_y: float =1, + radius_z: float =1, + 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. - radius_x: int (= 0) + radius_x: float (= 1) Radius size along x axis. - radius_y: int (= 0) + radius_y: float (= 1) Radius size along y axis. - radius_z: int (= 0) + radius_z: float (= 1) Radius size along z axis. connectivity: str (= "box") Filter neigborhood @@ -2344,30 +2284,65 @@ 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, float(radius_x), float(radius_y), float(radius_z), str(connectivity)) +@plugin_function(categories=["filter", "in assistant"]) +def grayscale_erode( + 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 +) -> Image: + """Computes a grayscale image containing the grayscale erosion of a given input + image. The erosion apply the Mooreneighborhood (8 pixels in 2D and 26 pixels in + 3d) for the "box" connectivity and the vonNeumannneighborhood (4 pixels in 2D + and 6 pixels in 3d) for a "sphere" connectivity. The pixels in the input image + with pixel value not equal to 0 will be interpreted as 1. + + Parameters + ---------- + input_image: Image + Input image to process. + output_image: Optional[Image] (= None) + Output result image. + radius_x: float (= 1) + Radius size along x axis. + radius_y: float (= 1) + Radius size along y axis. + radius_z: float (= 1) + Radius size along z axis. + connectivity: str (= "box") + Filter neigborhood + device: Optional[Device] (= None) + Device to perform the operation on. + + Returns + ------- + Image + + References + ---------- + [1] https://clij.github.io/clij2-docs/reference_minimum3DBox + [2] https://clij.github.io/clij2-docs/reference_minimum3DSphere + """ + return clic._grayscale_erode(device, input_image, output_image, float(radius_x), float(radius_y), float(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. @@ -2384,26 +2359,23 @@ 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. @@ -2420,18 +2392,17 @@ 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. @@ -2448,18 +2419,17 @@ 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. @@ -2476,18 +2446,17 @@ 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. @@ -2504,15 +2473,14 @@ 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: float =1, + radius_y: float =1, + radius_z: float =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 @@ -2522,15 +2490,15 @@ def mode_box( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. - radius_x: int (= 1) + radius_x: float (= 1) Radius size along x axis. - radius_y: int (= 1) + radius_y: float (= 1) Radius size along y axis. - radius_z: int (= 1) + radius_z: float (= 1) Radius size along z axis. device: Optional[Device] (= None) Device to perform the operation on. @@ -2539,19 +2507,16 @@ 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, float(radius_x), float(radius_y), float(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: float =1, + radius_y: float =1, + radius_z: float =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 @@ -2561,15 +2526,15 @@ def mode_sphere( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. - radius_x: int (= 1) + radius_x: float (= 1) Radius size along x axis. - radius_y: int (= 1) + radius_y: float (= 1) Radius size along y axis. - radius_z: int (= 1) + radius_z: float (= 1) Radius size along z axis. device: Optional[Device] (= None) Device to perform the operation on. @@ -2578,20 +2543,17 @@ 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, float(radius_x), float(radius_y), float(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: float =1, + radius_y: float =1, + radius_z: float =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 @@ -2602,15 +2564,15 @@ def mode( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. - radius_x: int (= 1) + radius_x: float (= 1) Radius size along x axis. - radius_y: int (= 1) + radius_y: float (= 1) Radius size along y axis. - radius_z: int (= 1) + radius_z: float (= 1) Radius size along z axis. connectivity: str (= "box") Filter neigborhood @@ -2621,31 +2583,22 @@ 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, float(radius_x), float(radius_y), float(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. @@ -2658,20 +2611,19 @@ 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. @@ -2688,27 +2640,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 * sParameters ---------- - 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. + Output image where results are written into. scalar: float (= 0) The number with which every pixel will be multiplied with. device: Optional[Device] (= None) @@ -2722,29 +2671,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 * yParameters ---------- - input_image0: Image - The first input image to be multiplied. - input_image1: Image - The second image to be multiplied. + input_image0: Image + First input image to be multiplied. + input_image1: Image + Second image to be multiplied. output_image: Optional[Image] (= None) - The output image where results are written into. + Output image where results are written into. device: Optional[Device] (= None) Device to perform the operation on. @@ -2758,15 +2704,14 @@ 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. @@ -2776,10 +2721,10 @@ 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. + Output image where results are written into. nan: float (= 0) Value to replace posinf: float (= np.nan_to_num(float('inf'))) @@ -2797,17 +2742,14 @@ 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 @@ -2816,9 +2758,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. @@ -2835,13 +2777,12 @@ 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 @@ -2850,9 +2791,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. @@ -2867,18 +2808,15 @@ 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 @@ -2888,9 +2826,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. @@ -2908,17 +2846,14 @@ 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 @@ -2927,9 +2862,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. @@ -2946,13 +2881,12 @@ 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 @@ -2961,9 +2895,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. @@ -2978,18 +2912,15 @@ 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 @@ -2999,9 +2930,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. @@ -3019,27 +2950,24 @@ 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 - The first image to be compared with. - input_image1: Image - The second image to be compared with the first. + input_image0: Image + First image to be compared with. + input_image1: Image + 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 device: Optional[Device] (= None) @@ -3055,20 +2983,19 @@ 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 @@ -3087,21 +3014,20 @@ 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. @@ -3122,33 +3048,25 @@ 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, + flag: Image, + output_image: 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 flag value, 0 or 1. - output_image1: Optional[Image] (= None) + flag: Image + Output + output_image: Optional[Image] (= None) Output image. device: Optional[Device] (= None) Device to perform the operation on. @@ -3161,28 +3079,25 @@ 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, flag, output_image) @plugin_function def onlyzero_overwrite_maximum_diamond( input_image: Image, - output_image0: Image, - output_image1: Optional[Image] = None, - device: Optional[Device] = None, + flag: Image, + output_image: 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 flag value, 0 or 1. - output_image1: Optional[Image] (= None) + flag: Image + Output + output_image: Optional[Image] (= None) Output image. device: Optional[Device] (= None) Device to perform the operation on. @@ -3195,29 +3110,26 @@ 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, flag, output_image) @plugin_function def onlyzero_overwrite_maximum( input_image: Image, - output_image0: Image, - output_image1: Optional[Image] = None, - connectivity: str = "box", - device: Optional[Device] = None, + flag: Image, + output_image: 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 flag value, 0 or 1. - output_image1: Optional[Image] (= None) + flag: Image + Output + output_image: Optional[Image] (= None) Output image. connectivity: str (= "box") Filter neigborhood @@ -3233,24 +3145,21 @@ 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, flag, output_image, 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 ^ aParameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -3269,21 +3178,20 @@ 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. @@ -3300,27 +3208,26 @@ 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. @@ -3349,28 +3256,14 @@ 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 @@ -3378,9 +3271,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. @@ -3393,13 +3286,12 @@ 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 @@ -3407,9 +3299,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. @@ -3426,20 +3318,19 @@ 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. @@ -3458,28 +3349,21 @@ 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. @@ -3498,21 +3382,14 @@ 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 @@ -3520,9 +3397,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. @@ -3539,22 +3416,21 @@ 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. @@ -3575,31 +3451,23 @@ 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. @@ -3620,31 +3488,23 @@ 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. @@ -3661,19 +3521,18 @@ 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. @@ -3690,17 +3549,18 @@ 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) = vParameters ---------- - input_image: Image + input_image: Image Input image to process. scalar: float (= 0) Value to set. @@ -3717,19 +3577,18 @@ 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. @@ -3748,16 +3607,17 @@ 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. @@ -3774,19 +3634,18 @@ 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. @@ -3805,14 +3664,16 @@ 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. @@ -3827,14 +3688,16 @@ def set_ramp_x(input_image: Image, device: Optional[Device] = None) -> Image: """ 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. @@ -3849,14 +3712,16 @@ def set_ramp_y(input_image: Image, device: Optional[Device] = None) -> Image: """ 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. @@ -3871,24 +3736,23 @@ def set_ramp_z(input_image: Image, device: Optional[Device] = None) -> Image: """ 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. @@ -3902,19 +3766,18 @@ 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. @@ -3927,14 +3790,13 @@ 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 @@ -3942,7 +3804,7 @@ def set_where_x_equals_y( Parameters ---------- - input_image: Image + input_image: Image Input image to process. value: float (= 0) Value to set. @@ -3959,10 +3821,11 @@ 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 @@ -3970,7 +3833,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. @@ -3987,10 +3850,11 @@ 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 @@ -3998,7 +3862,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. @@ -4015,12 +3879,11 @@ 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 @@ -4028,7 +3891,7 @@ def sign( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -4041,22 +3904,21 @@ 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. @@ -4073,20 +3935,19 @@ 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. @@ -4105,22 +3966,21 @@ 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. @@ -4137,20 +3997,19 @@ 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. @@ -4167,25 +4026,20 @@ 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. @@ -4202,18 +4056,17 @@ 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. @@ -4226,19 +4079,18 @@ 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. @@ -4255,19 +4107,18 @@ 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 xParameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -4284,17 +4135,14 @@ 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 @@ -4302,7 +4150,7 @@ def sum_reduction_x( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -4317,18 +4165,17 @@ 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. @@ -4345,18 +4192,17 @@ 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. @@ -4373,18 +4219,17 @@ 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. @@ -4401,21 +4246,20 @@ 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. + Output image where results are written into. device: Optional[Device] (= None) Device to perform the operation on. @@ -4429,21 +4273,20 @@ 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. + Output image where results are written into. device: Optional[Device] (= None) Device to perform the operation on. @@ -4457,21 +4300,20 @@ 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. + Output image where results are written into. device: Optional[Device] (= None) Device to perform the operation on. @@ -4485,19 +4327,18 @@ 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. @@ -4514,15 +4355,14 @@ 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: float =1, + radius_y: float =1, + radius_z: float =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 @@ -4530,15 +4370,15 @@ def variance_box( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. - radius_x: int (= 1) + radius_x: float (= 1) Radius size along x axis. - radius_y: int (= 1) + radius_y: float (= 1) Radius size along y axis. - radius_z: int (= 1) + radius_z: float (= 1) Radius size along z axis. device: Optional[Device] (= None) Device to perform the operation on. @@ -4551,19 +4391,16 @@ 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, float(radius_x), float(radius_y), float(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: float =1, + radius_y: float =1, + radius_z: float =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 @@ -4571,15 +4408,15 @@ def variance_sphere( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. - radius_x: int (= 1) + radius_x: float (= 1) Radius size along x axis. - radius_y: int (= 1) + radius_y: float (= 1) Radius size along y axis. - radius_z: int (= 1) + radius_z: float (= 1) Radius size along z axis. device: Optional[Device] (= None) Device to perform the operation on. @@ -4592,20 +4429,17 @@ 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, float(radius_x), float(radius_y), float(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: float =1, + radius_y: float =1, + radius_z: float =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 @@ -4613,15 +4447,15 @@ def variance_filter( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. - radius_x: int (= 1) + radius_x: float (= 1) Radius size along x axis. - radius_y: int (= 1) + radius_y: float (= 1) Radius size along y axis. - radius_z: int (= 1) + radius_z: float (= 1) Radius size along z axis. connectivity: str (= "box") Filter neigborhood @@ -4637,22 +4471,13 @@ 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, float(radius_x), float(radius_y), float(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 @@ -4660,7 +4485,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. @@ -4677,12 +4502,11 @@ 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 @@ -4690,7 +4514,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 @@ -4703,12 +4527,11 @@ 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 @@ -4716,7 +4539,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 @@ -4729,12 +4552,11 @@ 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 @@ -4742,7 +4564,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 @@ -4755,12 +4577,11 @@ 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 @@ -4768,7 +4589,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 @@ -4781,12 +4602,11 @@ 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 @@ -4794,7 +4614,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 @@ -4807,12 +4627,11 @@ 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 @@ -4820,7 +4639,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 @@ -4831,4 +4650,4 @@ def z_position_of_minimum_z_projection( ------- Image """ - return clic._z_position_of_minimum_z_projection(device, input_image, output_image) + return clic._z_position_of_minimum_z_projection(device, input_image, output_image) \ No newline at end of file diff --git a/pyclesperanto/_tier2.py b/pyclesperanto/_tier2.py index 38327cf8..3e351550 100644 --- a/pyclesperanto/_tier2.py +++ b/pyclesperanto/_tier2.py @@ -12,24 +12,23 @@ 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. @@ -46,22 +45,21 @@ 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 + yParameters ---------- - 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. @@ -78,29 +76,28 @@ 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: float =1, + radius_y: float =1, + radius_z: float =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. - radius_x: int (= 1) + radius_x: float (= 1) Radius of the background determination region in X. - radius_y: int (= 1) + radius_y: float (= 1) Radius of the background determination region in Y. - radius_z: int (= 1) + radius_z: float (= 1) Radius of the background determination region in Z. device: Optional[Device] (= None) Device to perform the operation on. @@ -113,25 +110,22 @@ 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, float(radius_x), float(radius_y), float(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. @@ -152,31 +146,23 @@ 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. @@ -200,31 +186,22 @@ 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. @@ -245,30 +222,29 @@ 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 =1, + radius_y: int =1, + radius_z: int =1, + 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. + """Closing operator, applies grayscale morphological closing to intensity images + using a box shaped 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. - radius_x: int (= 0) + radius_x: int (= 1) Radius along the x axis. - radius_y: int (= 0) + radius_y: int (= 1) Radius along the y axis. - radius_z: int (= 0) + radius_z: int (= 1) Radius along the z axis. device: Optional[Device] (= None) Device to perform the operation on. @@ -277,34 +253,31 @@ 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: float =1, + radius_y: float =1, + radius_z: float =1, + 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. + """Closing operator, applies grayscale morphological closing to intensity images + using a sphere shaped 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. - radius_x: int (= 1) + radius_x: float (= 1) Radius along the x axis. - radius_y: int (= 1) + radius_y: float (= 1) Radius along the y axis. - radius_z: int (= 0) + radius_z: float (= 1) Radius along the z axis. device: Optional[Device] (= None) Device to perform the operation on. @@ -313,35 +286,33 @@ 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, float(radius_x), float(radius_y), float(radius_z)) @plugin_function(categories=["filter", "in assistant"]) -def closing( +def grayscale_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: float =1, + radius_y: float =1, + radius_z: float =1, + 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. + """Closing operator, applies grayscale morphological closing to intensity images + using a sphere or box shaped 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. - radius_x: int (= 1) + radius_x: float (= 1) Radius along the x axis. - radius_y: int (= 1) + radius_y: float (= 1) Radius along the y axis. - radius_z: int (= 0) + radius_z: float (= 1) Radius along the z axis. connectivity: str (= "box") Element shape, "box" or "sphere" @@ -352,33 +323,86 @@ 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._grayscale_closing(device, input_image, output_image, float(radius_x), float(radius_y), float(radius_z), str(connectivity)) + +@plugin_function(categories=["filter", "in assistant"]) +def closing( + input_image: Image, + footprint: Image, + output_image: Optional[Image] =None, + device: Optional[Device] =None +) -> Image: + """Closing operator, applies morphological closing to intensity images using a + custom structuring element provided as input. This operator also works with + binary images. + + Parameters + ---------- + input_image: Image + Input image to process. + footprint: Image + Structuring element for the operation. + output_image: Optional[Image] (= None) + Output result image. + device: Optional[Device] (= None) + Device to perform the operation on. + + Returns + ------- + Image + """ + return clic._closing(device, input_image, footprint, output_image) + +@plugin_function(categories=["filter", "in assistant"]) +def binary_closing( + 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 +) -> Image: + """Closing operator, applies binary morphological closing to intensity images using + a sphere or box shaped footprint. This operator also works with binary images. + + Parameters + ---------- + input_image: Image + Input image to process. + output_image: Optional[Image] (= None) + Output result image. + radius_x: float (= 1) + Radius of the sphere or box element along the x axis. + radius_y: float (= 1) + Radius of the sphere or box element along the y axis. + radius_z: float (= 1) + Radius of the sphere or box element along the z axis. + connectivity: str (= "box") + Element shape, "box" or "sphere" + device: Optional[Device] (= None) + Device to perform the operation on. + + Returns + ------- + Image + """ + return clic._binary_closing(device, input_image, output_image, float(radius_x), float(radius_y), float(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. @@ -395,23 +419,20 @@ 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. @@ -428,23 +449,20 @@ 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. @@ -461,13 +479,12 @@ 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 @@ -476,12 +493,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. @@ -493,24 +510,21 @@ 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. @@ -525,21 +539,20 @@ 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. @@ -560,27 +573,19 @@ 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. @@ -593,15 +598,14 @@ 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: float =1, + radius_y: float =1, + radius_z: float =1, + 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 @@ -609,15 +613,15 @@ def detect_maxima_box( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. - radius_x: int (= 0) + radius_x: float (= 1) Radius along the x axis. - radius_y: int (= 0) + radius_y: float (= 1) Radius along the y axis. - radius_z: int (= 0) + radius_z: float (= 1) Radius along the z axis. device: Optional[Device] (= None) Device to perform the operation on. @@ -630,20 +634,17 @@ 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, float(radius_x), float(radius_y), float(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: float =1, + radius_y: float =1, + radius_z: float =1, + 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 @@ -651,15 +652,15 @@ def detect_maxima( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. - radius_x: int (= 0) + radius_x: float (= 1) Radius along the x axis. - radius_y: int (= 0) + radius_y: float (= 1) Radius along the y axis. - radius_z: int (= 0) + radius_z: float (= 1) Radius along the z axis. connectivity: str (= "box") Element shape, "box" or "sphere" @@ -675,25 +676,16 @@ 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, float(radius_x), float(radius_y), float(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: float =1, + radius_y: float =1, + radius_z: float =1, + 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 @@ -701,15 +693,15 @@ def detect_minima_box( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. - radius_x: int (= 0) + radius_x: float (= 1) Radius along the x axis. - radius_y: int (= 0) + radius_y: float (= 1) Radius along the y axis. - radius_z: int (= 0) + radius_z: float (= 1) Radius along the z axis. device: Optional[Device] (= None) Device to perform the operation on. @@ -722,20 +714,17 @@ 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, float(radius_x), float(radius_y), float(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: float =1, + radius_y: float =1, + radius_z: float =1, + 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 @@ -743,15 +732,15 @@ def detect_minima( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. - radius_x: int (= 0) + radius_x: float (= 1) Radius along the x axis. - radius_y: int (= 0) + radius_y: float (= 1) Radius along the y axis. - radius_z: int (= 0) + radius_z: float (= 1) Radius along the z axis. connectivity: str (= "box") Element shape, "box" or "sphere" @@ -767,28 +756,19 @@ 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, float(radius_x), float(radius_y), float(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 @@ -797,7 +777,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. @@ -824,31 +804,20 @@ 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. @@ -865,12 +834,11 @@ 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) = @@ -878,7 +846,7 @@ def invert( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -895,12 +863,11 @@ 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 @@ -908,7 +875,7 @@ def label_spots( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. @@ -925,18 +892,17 @@ 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. @@ -949,15 +915,17 @@ 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. @@ -972,15 +940,17 @@ def maximum_of_all_pixels(input_image: Image, device: Optional[Device] = None) - """ 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. @@ -995,19 +965,20 @@ def minimum_of_all_pixels(input_image: Image, device: Optional[Device] = None) - """ 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. @@ -1022,30 +993,29 @@ 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: float =1, + radius_y: float =1, + radius_z: float =1, + 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. + """Opening operator, 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. - radius_x: int (= 0) + radius_x: float (= 1) Radius along the x axis. - radius_y: int (= 0) + radius_y: float (= 1) Radius along the y axis. - radius_z: int (= 0) + radius_z: float (= 1) Radius along the z axis. device: Optional[Device] (= None) Device to perform the operation on. @@ -1054,26 +1024,23 @@ 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, float(radius_x), float(radius_y), float(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 =1, + 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. + """Opening operator, 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. @@ -1081,7 +1048,7 @@ def opening_sphere( Radius along the x axis. radius_y: float (= 1) Radius along the y axis. - radius_z: float (= 0) + radius_z: float (= 1) Radius along the z axis. device: Optional[Device] (= None) Device to perform the operation on. @@ -1090,32 +1057,24 @@ 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 =1, + 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. + """Opening operator, Applies morphological opening to intensity images using a + sphereshaped or boxshepd 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. @@ -1123,7 +1082,7 @@ def opening( Radius along the x axis. radius_y: float (= 1) Radius along the y axis. - radius_z: float (= 0) + radius_z: float (= 1) Radius along the z axis. connectivity: str (= "box") Element shape, "box" or "sphere" @@ -1134,28 +1093,83 @@ 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(categories=["filter", "in assistant"]) +def opening( + input_image: Image, + footprint: Image, + output_image: Optional[Image] =None, + device: Optional[Device] =None +) -> Image: + """Closing operator, applies morphological opening to intensity images using a + custom structuring element provided as input. This operator also works with + binary images. + + Parameters + ---------- + input_image: Image + Input image to process. + footprint: Image + Structuring element for the operation. + output_image: Optional[Image] (= None) + Output result image. + device: Optional[Device] (= None) + Device to perform the operation on. + + Returns + ------- + Image + """ + return clic._opening(device, input_image, footprint, output_image) + +@plugin_function(categories=["filter", "in assistant"]) +def binary_opening( + 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 +) -> Image: + """Closing operator, applies binary morphological opening to intensity images using + a sphere or box shaped footprint. This operator also works with binary images. + + Parameters + ---------- + input_image: Image + Input image to process. + output_image: Optional[Image] (= None) + Output result image. + radius_x: float (= 1) + Radius of the sphere or box element along the x axis. + radius_y: float (= 1) + Radius of the sphere or box element along the y axis. + radius_z: float (= 1) + Radius of the sphere or box element along the z axis. + connectivity: str (= "box") + Element shape, "box" or "sphere" + device: Optional[Device] (= None) + Device to perform the operation on. + Returns + ------- + Image + """ + return clic._binary_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. @@ -1168,19 +1182,18 @@ 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. @@ -1197,18 +1210,17 @@ 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. @@ -1221,19 +1233,18 @@ 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. @@ -1250,21 +1261,20 @@ 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. @@ -1281,15 +1291,14 @@ 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: float =1, + radius_y: float =1, + radius_z: float =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 @@ -1297,15 +1306,15 @@ def standard_deviation_box( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. - radius_x: int (= 1) + radius_x: float (= 1) Radius along the x axis. - radius_y: int (= 1) + radius_y: float (= 1) Radius along the y axis. - radius_z: int (= 1) + radius_z: float (= 1) Radius along the z axis. device: Optional[Device] (= None) Device to perform the operation on. @@ -1318,19 +1327,16 @@ 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, float(radius_x), float(radius_y), float(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: float =1, + radius_y: float =1, + radius_z: float =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 @@ -1338,15 +1344,15 @@ def standard_deviation_sphere( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. - radius_x: int (= 1) + radius_x: float (= 1) Radius along the x axis. - radius_y: int (= 1) + radius_y: float (= 1) Radius along the y axis. - radius_z: int (= 1) + radius_z: float (= 1) Radius along the z axis. device: Optional[Device] (= None) Device to perform the operation on. @@ -1359,20 +1365,17 @@ 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, float(radius_x), float(radius_y), float(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: float =1, + radius_y: float =1, + radius_z: float =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 @@ -1380,15 +1383,15 @@ def standard_deviation( Parameters ---------- - input_image: Image + input_image: Image Input image to process. output_image: Optional[Image] (= None) Output result image. - radius_x: int (= 1) + radius_x: float (= 1) Radius along the x axis. - radius_y: int (= 1) + radius_y: float (= 1) Radius along the y axis. - radius_z: int (= 1) + radius_z: float (= 1) Radius along the z axis. connectivity: str (= "box") Neigborhood shape, "box" or "sphere" @@ -1404,34 +1407,23 @@ 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, float(radius_x), float(radius_y), float(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. @@ -1452,30 +1444,22 @@ 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 yParameters ---------- - 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. @@ -1492,20 +1476,19 @@ 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. @@ -1526,14 +1509,13 @@ 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, @@ -1541,7 +1523,7 @@ def reduce_stack( Parameters ---------- - input_image: Image + input_image: Image Input image. output_image: Optional[Image] (= None) Output image. @@ -1560,14 +1542,12 @@ 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'. @@ -1589,29 +1569,28 @@ 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: 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. - radius_x: int (= 1) + radius_x: float (= 1) Radius of the background determination region in X. - radius_y: int (= 1) + radius_y: float (= 1) Radius of the background determination region in Y. - radius_z: int (= 1) + radius_z: float (= 1) Radius of the background determination region in Z. device: Optional[Device] (= None) Device to perform the operation on. @@ -1624,27 +1603,22 @@ 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, float(radius_x), float(radius_y), float(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. @@ -1665,31 +1639,23 @@ 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. @@ -1713,12 +1679,4 @@ 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), - ) + 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 diff --git a/pyclesperanto/_tier3.py b/pyclesperanto/_tier3.py index ecfc2ca0..85085e57 100644 --- a/pyclesperanto/_tier3.py +++ b/pyclesperanto/_tier3.py @@ -12,18 +12,20 @@ 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. @@ -38,15 +40,17 @@ def bounding_box(input_image: Image, device: Optional[Device] = None) -> list: """ 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. @@ -61,13 +65,12 @@ def center_of_mass(input_image: Image, device: Optional[Device] = None) -> list: """ 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 @@ -77,9 +80,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 @@ -96,13 +99,12 @@ 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 @@ -112,9 +114,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 @@ -131,22 +133,21 @@ 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 @@ -167,26 +168,23 @@ 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 @@ -207,16 +205,13 @@ 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 @@ -225,7 +220,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 @@ -238,13 +233,12 @@ 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 @@ -252,12 +246,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. @@ -271,13 +265,12 @@ 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. @@ -286,9 +279,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 @@ -303,16 +296,13 @@ 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 @@ -322,7 +312,7 @@ def generate_touch_matrix( Parameters ---------- - input_image: Image + input_image: Image Input label image output_image: Optional[Image] (= None) Output touch matrix @@ -339,15 +329,14 @@ 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 @@ -368,16 +357,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. @@ -389,19 +378,13 @@ 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 @@ -411,9 +394,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. @@ -428,12 +411,11 @@ 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, + label: Image, + pointlist: 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 @@ -443,9 +425,9 @@ def labelled_spots_to_pointlist( Parameters ---------- - input_image: Image - Input label image - output_image: Optional[Image] (= None) + label: Image + Input + pointlist: Optional[Image] (= None) Output coordinate list device: Optional[Device] (= None) Device to perform the operation on. @@ -458,16 +440,18 @@ def labelled_spots_to_pointlist( ---------- [1] https://clij.github.io/clij2-docs/reference_labelledSpotsToPointList """ - return clic._labelled_spots_to_pointlist(device, input_image, output_image) - + return clic._labelled_spots_to_pointlist(device, label, pointlist) @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. @@ -478,14 +462,16 @@ def maximum_position(input_image: Image, device: Optional[Device] = None) -> lis """ 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. @@ -500,14 +486,16 @@ def mean_of_all_pixels(input_image: Image, device: Optional[Device] = None) -> f """ 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. @@ -518,16 +506,15 @@ def minimum_position(input_image: Image, device: Optional[Device] = None) -> lis """ 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 @@ -535,7 +522,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. @@ -554,22 +541,13 @@ 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 @@ -596,12 +574,11 @@ 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, @@ -627,4 +604,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) + return clic._statistics_of_background_and_labelled_pixels(device, intensity, label) \ No newline at end of file diff --git a/pyclesperanto/_tier4.py b/pyclesperanto/_tier4.py index 55ffbafe..4b2d875d 100644 --- a/pyclesperanto/_tier4.py +++ b/pyclesperanto/_tier4.py @@ -12,12 +12,13 @@ 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, @@ -25,9 +26,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. @@ -42,19 +43,20 @@ 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. @@ -69,12 +71,11 @@ 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 @@ -82,7 +83,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 @@ -99,13 +100,12 @@ 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,19 +133,18 @@ 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. @@ -164,13 +163,12 @@ 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 @@ -178,9 +176,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 @@ -197,12 +195,11 @@ 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 @@ -210,7 +207,7 @@ def pixel_count_map( Parameters ---------- - input_image: Image + input_image: Image Label image to measure output_image: Optional[Image] (= None) Parametric image computed @@ -227,12 +224,11 @@ 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 @@ -240,7 +236,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 @@ -257,13 +253,12 @@ 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, + centroids_coordinates: Image, + 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 @@ -272,9 +267,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 + centroids_coordinates: Image Output list of coordinates where the centroids will be written to. include_background: bool (= False) Determines if the background label should be included. @@ -289,28 +284,25 @@ 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, centroids_coordinates, 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. @@ -329,28 +321,25 @@ 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. @@ -369,28 +358,25 @@ 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. @@ -409,33 +395,25 @@ 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. @@ -454,21 +432,13 @@ 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 @@ -477,7 +447,7 @@ def extension_ratio_map( Parameters ---------- - input_image: Image + input_image: Image Input label image. output_image: Optional[Image] (= None) Output parametric image. @@ -492,4 +462,4 @@ def extension_ratio_map( ---------- [1] https://clij.github.io/clij2-docs/reference_extensionRatioMap """ - return clic._extension_ratio_map(device, input_image, output_image) + return clic._extension_ratio_map(device, input_image, output_image) \ No newline at end of file diff --git a/pyclesperanto/_tier5.py b/pyclesperanto/_tier5.py index ac54cd55..37b169d2 100644 --- a/pyclesperanto/_tier5.py +++ b/pyclesperanto/_tier5.py @@ -12,12 +12,13 @@ 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 @@ -25,9 +26,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. @@ -42,20 +43,12 @@ 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. @@ -63,9 +56,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. @@ -78,20 +71,19 @@ 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. @@ -108,24 +100,21 @@ 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. @@ -142,22 +131,19 @@ 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. @@ -174,20 +160,19 @@ 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. @@ -206,24 +191,21 @@ 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. @@ -242,6 +224,4 @@ 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) - ) + return clic._exclude_labels_outside_size_range(device, input_image, output_image, float(minimum_size), float(maximum_size)) \ No newline at end of file diff --git a/pyclesperanto/_tier6.py b/pyclesperanto/_tier6.py index b6870d95..032f5d68 100644 --- a/pyclesperanto/_tier6.py +++ b/pyclesperanto/_tier6.py @@ -12,15 +12,14 @@ 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 @@ -28,12 +27,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. @@ -43,14 +42,13 @@ 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, @@ -59,12 +57,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) @@ -76,13 +74,12 @@ 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 @@ -92,7 +89,7 @@ def gauss_otsu_labeling( Parameters ---------- - input_image0: Image + input_image0: Image Intensity image to segment output_image: Optional[Image] (= None) Output label image. @@ -110,17 +107,14 @@ 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 @@ -128,9 +122,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 @@ -147,12 +141,11 @@ 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 @@ -160,7 +153,7 @@ def voronoi_labeling( Parameters ---------- - input_binary: Image + input_binary: Image Input binary image output_labels: Optional[Image] (= None) Output label image @@ -177,19 +170,18 @@ 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. @@ -206,23 +198,20 @@ 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. @@ -239,23 +228,20 @@ 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. @@ -272,23 +258,20 @@ 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. @@ -305,6 +288,4 @@ 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) - ) + return clic._exclude_large_labels(device, input_image, output_image, float(minimum_size)) \ No newline at end of file diff --git a/pyclesperanto/_tier7.py b/pyclesperanto/_tier7.py index 0840ce7a..1075b31a 100644 --- a/pyclesperanto/_tier7.py +++ b/pyclesperanto/_tier7.py @@ -12,17 +12,16 @@ 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 @@ -31,7 +30,7 @@ def affine_transform( Parameters ---------- - input_image: Image + input_image: Image Input image to be transformed. output_image: Optional[Image] (= None) Output image. @@ -48,18 +47,15 @@ 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, @@ -73,7 +69,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. @@ -93,25 +89,22 @@ 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: @@ -119,7 +112,7 @@ def rigid_transform( Parameters ---------- - input_image: Image + input_image: Image Input image to be transformed. output_image: Optional[Image] (= None) Output image. @@ -148,33 +141,19 @@ 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 / @@ -182,7 +161,7 @@ def rotate( Parameters ---------- - input_image: Image + input_image: Image Input image to be rotated. output_image: Optional[Image] (= None) Output image. @@ -205,36 +184,25 @@ 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. @@ -257,34 +225,23 @@ 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. @@ -303,23 +260,14 @@ 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 @@ -329,7 +277,7 @@ def closing_labels( Parameters ---------- - input_image: Image + input_image: Image Input label image. output_image: Optional[Image] (= None) Output label image. @@ -344,13 +292,12 @@ 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, @@ -358,12 +305,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. @@ -373,13 +320,12 @@ 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 @@ -389,7 +335,7 @@ def opening_labels( Parameters ---------- - input_image: Image + input_image: Image Input label image. output_image: Optional[Image] (= None) Output label image. @@ -404,14 +350,13 @@ 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 @@ -422,7 +367,7 @@ def voronoi_otsu_labeling( Parameters ---------- - input_image: Image + input_image: Image Input intensity image. output_image: Optional[Image] (= None) Output label image. @@ -443,6 +388,4 @@ 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) - ) + return clic._voronoi_otsu_labeling(device, input_image, output_image, float(spot_sigma), float(outline_sigma)) \ No newline at end of file diff --git a/pyclesperanto/_tier8.py b/pyclesperanto/_tier8.py index e9ebe9de..85b62701 100644 --- a/pyclesperanto/_tier8.py +++ b/pyclesperanto/_tier8.py @@ -12,15 +12,14 @@ 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 @@ -29,7 +28,7 @@ def smooth_labels( Parameters ---------- - input_image: Image + input_image: Image Input label image output_image: Optional[Image] (= None) Output label image @@ -44,13 +43,12 @@ 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 @@ -58,7 +56,7 @@ def smooth_connected_labels( Parameters ---------- - input_image: Image + input_image: Image Input label image output_image: Optional[Image] (= None) Output label image @@ -71,4 +69,4 @@ def smooth_connected_labels( ------- Image """ - return clic._smooth_connected_labels(device, input_image, output_image, int(radius)) + return clic._smooth_connected_labels(device, input_image, output_image, int(radius)) \ No newline at end of file diff --git a/pyclesperanto/_version.py b/pyclesperanto/_version.py index 65cb09fd..cb43d8cd 100644 --- a/pyclesperanto/_version.py +++ b/pyclesperanto/_version.py @@ -1,3 +1,3 @@ -VERSION = "0.14.2" -CLIC_VERSION = "0.14.2" +VERSION = "0.15.0" +CLIC_VERSION = "0.15.0" COMMON_ALIAS = "cle" diff --git a/src/wrapper/tier1_.cpp b/src/wrapper/tier1_.cpp index 6a04570c..80a9487d 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" @@ -86,6 +86,10 @@ m.def("_absolute", &cle::tier1::absolute_func, "Call cle::tier1::absolute_func f py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); + m.def("_dilation", &cle::tier1::dilation_func, "Call cle::tier1::dilation_func from C++ CLIc.", + py::return_value_policy::take_ownership, + py::arg("device"), py::arg("src"), py::arg("footprint"), py::arg("dst")); + m.def("_dilate_box", &cle::tier1::dilate_box_func, "Call cle::tier1::dilate_box_func from C++ CLIc.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); @@ -94,13 +98,13 @@ m.def("_absolute", &cle::tier1::absolute_func, "Call cle::tier1::absolute_func f py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - m.def("_dilate", &cle::tier1::dilate_func, "Call cle::tier1::dilate_func from C++ CLIc.", + m.def("_binary_dilate", &cle::tier1::binary_dilate_func, "Call cle::tier1::binary_dilate_func from C++ CLIc.", py::return_value_policy::take_ownership, - py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("connectivity")); + py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z"), py::arg("connectivity")); m.def("_divide_images", &cle::tier1::divide_images_func, "Call cle::tier1::divide_images_func from C++ CLIc.", py::return_value_policy::take_ownership, - py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); + py::arg("device"), py::arg("dividend"), py::arg("divisor"), py::arg("dst")); m.def("_divide_scalar_by_image", &cle::tier1::divide_scalar_by_image_func, "Call cle::tier1::divide_scalar_by_image_func from C++ CLIc.", py::return_value_policy::take_ownership, @@ -114,6 +118,10 @@ m.def("_absolute", &cle::tier1::absolute_func, "Call cle::tier1::absolute_func f py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("scalar")); + m.def("_erosion", &cle::tier1::erosion_func, "Call cle::tier1::erosion_func from C++ CLIc.", + py::return_value_policy::take_ownership, + py::arg("device"), py::arg("src"), py::arg("footprint"), py::arg("dst")); + m.def("_erode_box", &cle::tier1::erode_box_func, "Call cle::tier1::erode_box_func from C++ CLIc.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); @@ -124,7 +132,7 @@ m.def("_absolute", &cle::tier1::absolute_func, "Call cle::tier1::absolute_func f m.def("_erode", &cle::tier1::erode_func, "Call cle::tier1::erode_func from C++ CLIc.", py::return_value_policy::take_ownership, - py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("connectivity")); + py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z"), py::arg("connectivity")); m.def("_exponential", &cle::tier1::exponential_func, "Call cle::tier1::exponential_func from C++ CLIc.", py::return_value_policy::take_ownership, @@ -140,7 +148,7 @@ m.def("_absolute", &cle::tier1::absolute_func, "Call cle::tier1::absolute_func f m.def("_generate_distance_matrix", &cle::tier1::generate_distance_matrix_func, "Call cle::tier1::generate_distance_matrix_func from C++ CLIc.", py::return_value_policy::take_ownership, - py::arg("device"), py::arg("coordinate_list1"), py::arg("coordinate_list2"), py::arg("dst")); + py::arg("device"), py::arg("coordinate_list1"), py::arg("coordinate_list2"), py::arg("distance_matrix_destination")); m.def("_gradient_x", &cle::tier1::gradient_x_func, "Call cle::tier1::gradient_x_func from C++ CLIc.", py::return_value_policy::take_ownership, @@ -188,7 +196,7 @@ m.def("_absolute", &cle::tier1::absolute_func, "Call cle::tier1::absolute_func f m.def("_local_cross_correlation", &cle::tier1::local_cross_correlation_func, "Call cle::tier1::local_cross_correlation_func from C++ CLIc.", py::return_value_policy::take_ownership, - py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); + py::arg("device"), py::arg("src"), py::arg("kernel"), py::arg("dst")); m.def("_logarithm", &cle::tier1::logarithm_func, "Call cle::tier1::logarithm_func from C++ CLIc.", py::return_value_policy::take_ownership, @@ -218,6 +226,10 @@ m.def("_absolute", &cle::tier1::absolute_func, "Call cle::tier1::absolute_func f 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")); + m.def("_grayscale_dilate", &cle::tier1::grayscale_dilate_func, "Call cle::tier1::grayscale_dilate_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")); + m.def("_maximum_x_projection", &cle::tier1::maximum_x_projection_func, "Call cle::tier1::maximum_x_projection_func from C++ CLIc.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); @@ -274,6 +286,10 @@ m.def("_absolute", &cle::tier1::absolute_func, "Call cle::tier1::absolute_func f 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")); + m.def("_grayscale_erode", &cle::tier1::grayscale_erode_func, "Call cle::tier1::grayscale_erode_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")); + m.def("_minimum_image_and_scalar", &cle::tier1::minimum_image_and_scalar_func, "Call cle::tier1::minimum_image_and_scalar_func from C++ CLIc.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("scalar")); @@ -364,15 +380,15 @@ m.def("_absolute", &cle::tier1::absolute_func, "Call cle::tier1::absolute_func f m.def("_onlyzero_overwrite_maximum_box", &cle::tier1::onlyzero_overwrite_maximum_box_func, "Call cle::tier1::onlyzero_overwrite_maximum_box_func from C++ CLIc.", py::return_value_policy::take_ownership, - py::arg("device"), py::arg("src"), py::arg("dst0"), py::arg("dst1")); + py::arg("device"), py::arg("src"), py::arg("flag"), py::arg("dst")); m.def("_onlyzero_overwrite_maximum_diamond", &cle::tier1::onlyzero_overwrite_maximum_diamond_func, "Call cle::tier1::onlyzero_overwrite_maximum_diamond_func from C++ CLIc.", py::return_value_policy::take_ownership, - py::arg("device"), py::arg("src"), py::arg("dst0"), py::arg("dst1")); + py::arg("device"), py::arg("src"), py::arg("flag"), py::arg("dst")); m.def("_onlyzero_overwrite_maximum", &cle::tier1::onlyzero_overwrite_maximum_func, "Call cle::tier1::onlyzero_overwrite_maximum_func from C++ CLIc.", py::return_value_policy::take_ownership, - py::arg("device"), py::arg("src"), py::arg("dst0"), py::arg("dst1"), py::arg("connectivity")); + py::arg("device"), py::arg("src"), py::arg("flag"), py::arg("dst"), py::arg("connectivity")); m.def("_power", &cle::tier1::power_func, "Call cle::tier1::power_func from C++ CLIc.", py::return_value_policy::take_ownership, @@ -577,4 +593,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 5c9163de..4a3e29b0 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" @@ -38,8 +38,16 @@ m.def("_absolute_difference", &cle::tier2::absolute_difference_func, "Call cle:: 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")); + m.def("_grayscale_closing", &cle::tier2::grayscale_closing_func, "Call cle::tier2::grayscale_closing_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")); + m.def("_closing", &cle::tier2::closing_func, "Call cle::tier2::closing_func from C++ CLIc.", py::return_value_policy::take_ownership, + py::arg("device"), py::arg("src"), py::arg("footprint"), py::arg("dst")); + + m.def("_binary_closing", &cle::tier2::binary_closing_func, "Call cle::tier2::binary_closing_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")); m.def("_concatenate_along_x", &cle::tier2::concatenate_along_x_func, "Call cle::tier2::concatenate_along_x_func from C++ CLIc.", @@ -130,6 +138,14 @@ m.def("_absolute_difference", &cle::tier2::absolute_difference_func, "Call cle:: 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")); + m.def("_opening", &cle::tier2::opening_func, "Call cle::tier2::opening_func from C++ CLIc.", + py::return_value_policy::take_ownership, + py::arg("device"), py::arg("src"), py::arg("footprint"), py::arg("dst")); + + m.def("_binary_opening", &cle::tier2::binary_opening_func, "Call cle::tier2::binary_opening_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")); + m.def("_radians_to_degrees", &cle::tier2::radians_to_degrees_func, "Call cle::tier2::radians_to_degrees_func from C++ CLIc.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); @@ -193,4 +209,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 ab41ee1c..2717d832 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" @@ -56,7 +56,7 @@ m.def("_bounding_box", &cle::tier3::bounding_box_func, "Call cle::tier3::boundin m.def("_labelled_spots_to_pointlist", &cle::tier3::labelled_spots_to_pointlist_func, "Call cle::tier3::labelled_spots_to_pointlist_func from C++ CLIc.", py::return_value_policy::take_ownership, - py::arg("device"), py::arg("src"), py::arg("dst")); + py::arg("device"), py::arg("label"), py::arg("pointlist")); m.def("_maximum_position", &cle::tier3::maximum_position_func, "Call cle::tier3::maximum_position_func from C++ CLIc.", py::return_value_policy::take_ownership, @@ -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 86078ad5..96606846 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" @@ -40,7 +40,7 @@ m.def("_label_bounding_box", &cle::tier4::label_bounding_box_func, "Call cle::ti m.def("_centroids_of_labels", &cle::tier4::centroids_of_labels_func, "Call cle::tier4::centroids_of_labels_func from C++ CLIc.", py::return_value_policy::take_ownership, - py::arg("device"), py::arg("label_image"), py::arg("coorindate_list_destination"), py::arg("include_background")); + py::arg("device"), py::arg("label_image"), py::arg("centroids_coordinates"), py::arg("include_background")); m.def("_remove_labels_with_map_values_out_of_range", &cle::tier4::remove_labels_with_map_values_out_of_range_func, "Call cle::tier4::remove_labels_with_map_values_out_of_range_func from C++ CLIc.", py::return_value_policy::take_ownership, @@ -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 e7582a8f..aff53eca 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 d3db847d..8fef651c 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 bbd95fae..be567a9d 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 ba276bdc..b0550569 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