API Documentation

Core functions

Collection of functions explore and select system devices (e.g. GPUs) and initialize a device to work with.

default_initialisation()[source]

Set default backend and device

get_device() pyclesperanto._pyclesperanto._Device[source]

Return the current device instance

Returns:

device

Return type:

Device

gpu_info()[source]
list_available_backends() list[source]

Retrieve a list of names of available backends

Will test system for available backends installed and return a list of their names.

Returns:

name list

Return type:

list[str]

list_available_devices(device_type: str = 'all') list[source]

Retrieve a list of names of available devices

Will search the system for backend compatible device available and return a list of their names. This will NOT set the device! Use ‘select_device’ to select devices. Use ‘get_device’ to retrieve the current device.

Parameters:

device_type (str, default = "all") – Type of device to be selected (e.g. “all”, “cpu”, “gpu”)

Returns:

name list

Return type:

list[str]

select_backend(backend: str = 'opencl') str[source]

select backend

Select the backend used by pyclesperanto, OpenCL or CUDA. Default is OpenCL.

Parameters:

type (str, default = "opencl") – determine the backend to use between opencl and cuda

select_device(device_id: str | int = '', device_type: str = 'all') pyclesperanto._pyclesperanto._Device[source]

Select a device by ‘name’ or ‘index’ and by ‘type’, and store it as the current device

If selecting the device by string, the function compares the device name and substring. (e.g. “NVIDIA”, “RTX”, “Iris”, etc. will match the device name “NVIDIA RTX 2080” or “Intel Iris Pro”) If selecting the device by index, the function will select the device at the given index in the list of available devices. (e.g. 0, 1, 2, etc. will select the first, second, third, etc. device in the list) If device_id is an empty string, the function will select the first available device. The device_type enables selecting the type of device to be selected (e.g. “all”, “cpu”, “gpu”) To retrieve a list of available devices, use list_available_devices()

Parameters:
  • device_id (Union[str, int], default = "") – Substring of device name or device index.

  • device_type (str, default = "all") – Type of device to be selected (e.g. “all”, “cpu”, “gpu”)

Returns:

device

Return type:

Device

wait_for_kernel_to_finish(flag: bool = True, device: pyclesperanto._pyclesperanto._Device | None = None)[source]

Wait for kernel to finish

Enforce the system to wait for the kernel to finish before continuing. Introducing a slowdown in the workflow. This is useful for debugging purposes, benchmarking and profiling, as well as for complex workflows where the order of operations is important.

Parameters:
  • flag (bool, default = True) – if True, wait for kernel to finish

  • device (Device, default = None) – the device to set the flag. If None, set it to the current device

Memory operations

Collection of functions to manage memory on the device, e.g. to allocate and free memory. And to send or retrieve data from the device.

create(dim, dtype: type | None = None, mtype: str | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) pyclesperanto._pyclesperanto._Array[source]

Create a new image on the device.

Parameters:
  • shape (Tuple[int, ...]) – Shape of the image in (z,y,x)

  • dtype (type, optional) – Data type of the image (np.int8, np.float32, etc.), np.float32 by default if None

  • mtype (str, optional) – Memory type of the image (buffer, image), buffer by default if None

  • device (Device, optional) – Device on which the image is created, current device by default if None

Returns:

Created an empty Array on the device

Return type:

Array

create_like(array: numpy.ndarray | pyclesperanto._pyclesperanto._Array, dtype: type | None = None, mtype: str | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) pyclesperanto._pyclesperanto._Array[source]

Create a new image on the device with the same shape and dtype as the input image.

Parameters:
  • array (Image) – Input image

  • dtype (type, optional) – Data type of the image (np.int8, np.float32, etc.), np.float32 by default if None

  • mtype (str, optional) – Memory type of the image (buffer, image), buffer by default if None

  • device (Device, optional) – Device on which the image is created, current device by default if None

Returns:

Created an empty Array on the device

Return type:

Array

pull(array: numpy.ndarray | pyclesperanto._pyclesperanto._Array) numpy.ndarray[source]

Pull the input image from the device to the host.

Parameters:

array (Image) – Input image

Returns:

Image data

Return type:

np.ndarray

push(array: numpy.ndarray | pyclesperanto._pyclesperanto._Array, dtype: type | None = None, mtype: str | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) pyclesperanto._pyclesperanto._Array[source]

Create a new image on the device and push the input image into it.

Parameters:
  • array (Image) – Input image

  • dtype (type, optional) – If provided, the input image is cast to the given dtype before being pushed to the device. Examples are np.int8, np.float32, etc. By default, no casting is performed and the dtype of the pushed image will match the dtype of the input image.

  • mtype (str, optional) – Memory type of the image (buffer, image), buffer by default if None

  • device (Device, optional) – Device on which the image is created, current device by default if None

Returns:

Created Array on the device with the input image data

Return type:

Array

Array class

The main data structure in pyclesperanto is the Array class which behave similar to numpy arrays, but point to a memory location on the device. Here is a collection of class functions, operators, and methods to work with Array objects. Mainly to create, manipulate, and transfer them, as well as to apply arythmetic and logical operations on them.

T(self)[source]

Transpose the Array. Only works for 2D and 3D arrays.

empty(cls, shape, dtype=<class 'float'>, *args, **kwargs)[source]

Create an empty Array object from a shape.

Parameters:
  • shape (tuple, list or np.ndarray) – The shape of the array, maximum 3 elements.

  • dtype (np.dtype, default float) – The dtype of the array.

  • mtype (str, optional) – The memory type, by default “buffer”

  • device (Device, optional) – The device, by default None

Returns:

A new Array object.

Return type:

Array

empty_like(cls, arr)[source]

Create an empty Array object from an other array.

Parameters:

arr (np.ndarray or Array or other array-like structure) – The array to create like.

Returns:

The created array.

Return type:

Array

from_array(cls, arr, *args, **kwargs)[source]

Create an Array object from a numpy array (same shape, dtype, and memory).

Parameters:
  • arr (np.ndarray) – The array to convert.

  • mtype (str, optional) – The memory type, by default “buffer”

  • device (Device, optional) – The device, by default None

Returns:

The converted array.

Return type:

Array

get(self, origin: tuple | None = None, region: tuple | None = None) numpy.ndarray[source]

Get the content of the Array into a numpy array.

Parameters:
  • origin (tuple, optional) – The origin of the region of interest, by default None

  • region (tuple, optional) – The region of interest, by default None

Returns:

The array itself.

Return type:

np.ndarray

is_image(object)[source]

Returns True if the given object is an image.

set(self, array: numpy.ndarray, origin: tuple | None = None, region: tuple | None = None) None[source]

Set the content of the Array to the given numpy array.

Parameters:
  • array (np.ndarray) – The array to set from.

  • origin (tuple, optional) – The origin of the region of interest, by default None

  • region (tuple, optional) – The region of interest, by default None

Returns:

The array itself.

Return type:

Array

to_device(cls, arr, *args, **kwargs)[source]

Create an Array object from a numpy array (same shape, dtype, and memory).

Parameters:
  • arr (np.ndarray) – The array to convert.

  • mtype (str, optional) – The memory type, by default “buffer”

  • device (Device, optional) – The device, by default None

Returns:

The converted array.

Return type:

Array

zeros(cls, shape, dtype=<class 'float'>, *args, **kwargs)[source]

Create an Array object full of zeros from a shape.

Parameters:
  • shape (tuple, list or np.ndarray) – The shape of the array, maximum 3 elements.

  • dtype (np.dtype, default float) – The dtype of the array.

  • mtype (str, optional) – The memory type, by default “buffer”

  • device (Device, optional) – The device, by default None

Returns:

The created array.

Return type:

Array

zeros_like(cls, arr)[source]

Create an Array object filled with zeros from an other array.

Parameters:

arr (np.ndarray or Array or other array-like structure) – The array to create like.

Returns:

The created array.

Return type:

Array

Functionalities

Collection of operations aiming to help in displaying and analyzing results, e.g. to visualize images.

execute(anchor='/home/runner/work/pyclesperanto/pyclesperanto/pyclesperanto/_functionalities.py', kernel_source: str = '', kernel_name: str = '', global_size: tuple = (1, 1, 1), parameters: dict = {}, constants: dict = {}, device: pyclesperanto._pyclesperanto._Device | None = None)[source]

Execute a kernel from a file or a string

Call, build, and execute a kernel compatible with CLIj framework. The kernel can be called from a file or a string.

Parameters:
  • anchor (str, default = '__file__') – Enter __file__ when calling this method and the corresponding open.cl file lies in the same folder as the python file calling it. Ignored if kernel_source is a string.

  • kernel_source (str) – Filename of the open.cl file to be called or string containing the open.cl source code

  • kernel_name (str) – Kernel method inside the open.cl file to be called most clij/clesperanto kernel functions have the same name as the file they are in

  • global_size (tuple (z,y,x), default = (1, 1, 1)) – Global_size according to OpenCL definition (usually shape of the destination image).

  • parameters (dict(str, [Array, float, int])) – Dictionary containing parameters. Take care: They must be of the right type and in the right order as specified in the open.cl file.

  • constants (dict(str, int), optional) – Dictionary with names/values which will be added to the define statements. They are necessary, e.g. to create arrays of a given maximum size in OpenCL as variable array lengths are not supported.

  • device (Device, default = None) – The device to execute the kernel on. If None, use the current device

imshow(image, title: str | None = None, labels: bool | None = False, min_display_intensity: float | None = None, max_display_intensity: float | None = None, color_map: str | None = None, plot=None, colorbar: bool | None = False, colormap: str | matplotlib.colors.ListedColormap | None = None, alpha: float | None = None, continue_drawing: bool | None = False)[source]

Visualize an image, e.g. in Jupyter notebooks using matplotlib.

Parameters:
  • image (np.ndarray) – numpy or OpenCL-backed image to visualize

  • title (str, optional) – Obsolete (kept for ImageJ-compatibility)

  • labels (bool, optional) – True: integer labels will be visualized with colors False: Specified or default colormap will be used to display intensities.

  • min_display_intensity (float, optional) – lower limit for display range

  • max_display_intensity (float, optional) – upper limit for display range

  • color_map (str, optional) – deprecated, use colormap instead

  • plot (matplotlib axis, optional) – Plot object where the image should be shown. Useful for putting multiple images in subfigures.

  • colorbar (bool, optional) – True puts a colorbar next to the image. Will not work with label images and when visualizing multiple images (continue_drawing=True).

  • colormap (str or matplotlib colormap, optional) –

  • alpha (float, optional) – alpha blending value

  • continue_drawing (float) – True: the next shown image can be visualized on top of the current one, e.g. with alpha = 0.5

list_operations(search_term=None)[source]
native_execute(anchor='/home/runner/work/pyclesperanto/pyclesperanto/pyclesperanto/_functionalities.py', kernel_source: str = '', kernel_name: str = '', global_size: tuple = (1, 1, 1), local_size: tuple = (1, 1, 1), parameters: dict = {}, device: pyclesperanto._pyclesperanto._Device | None = None)[source]

Execute an OpenCL kernel from a file or a string

Call, build, and execute a kernel compatible with OpenCL language. The kernel can be called from a file or a string.

The parameters must still be passed as a dictionary with the correct types and order. Buffer parameters must be passed as Array objects. Scalars must be passed as Python native float or int.

Warning: Only 1D buffers are supported for now.

Parameters:
  • anchor (str, default = '__file__') – Enter __file__ when calling this method and the corresponding open.cl file lies in the same folder as the python file calling it. Ignored if kernel_source is a string.

  • kernel_source (str) – Filename of the open.cl file to be called or string containing the open.cl source code

  • kernel_name (str) – Kernel method inside the open.cl file to be called most clij/clesperanto kernel functions have the same name as the file they are in

  • global_size (tuple (z,y,x), default = (1, 1, 1)) – Global_size according to OpenCL definition (usually shape of the destination image).

  • local_size (tuple (z,y,x), default = (1, 1, 1)) – Local_size according to OpenCL definition (usually default is good).

  • parameters (dict(str, [Array, float, int])) – Dictionary containing parameters. Take care: They must be of the right type and in the right order as specified in the open.cl file.

  • device (Device, default = None) – The device to execute the kernel on. If None, use the current device

operations(must_have_categories: list | None = None, must_not_have_categories: list | None = None) dict[source]

Retrieve a dictionary of operations, which can be filtered by annotated categories.

Parameters:
  • must_have_categories (list of str, optional) – if provided, the result will be filtered so that operations must contain all given categories.

  • must_not_have_categories (list of str, optional) – if provided, the result will be filtered so that operations must not contain all given categories.

Returns:

dict of str

Return type:

function

Filters

Complete list, organized by complexity, of all available filters in pyclesperanto.

tier1

absolute(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Computes the absolute value of every individual pixel x in a given image. <pre>f(x) = |x| </pre>

Parameters:
  • input_image (Image) – The input image to be processed.

  • output_image (Optional[Image] = None) – The output image where results are written into.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_absolute

add_image_and_scalar(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, scalar: float = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Adds a scalar value s to all pixels x of a given image X. <pre>f(x, s) = x + s</pre>

Parameters:
  • input_image (Image) – The input image where scalare should be added.

  • output_image (Optional[Image] = None) – The output image where results are written into.

  • scalar (float = 1) – The constant number which will be added to all pixels.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_addImageAndScalar

add_images_weighted(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, factor0: float = 1, factor1: float = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Calculates the sum of pairs of pixels x and y from images X and Y weighted with factors a and b. <pre>f(x, y, a, b) = x * a + y * b</pre>

Parameters:
  • input_image0 (Image) – The first input image to added.

  • input_image1 (Image) – The second image to be added.

  • output_image (Optional[Image] = None) – The output image where results are written into.

  • factor0 (float = 1) – Multiplication factor of each pixel of src0 before adding it.

  • factor1 (float = 1) – Multiplication factor of each pixel of src1 before adding it.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_addImagesWeighted

binary_and(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 pixel values except 0 in the input images are interpreted as 1. <pre>f(x, y) = x & y</pre>

Parameters:
  • input_image0 (Image) – The first binary input image to be processed.

  • input_image1 (Image) – The second binary input image to be processed.

  • output_image (Optional[Image] = None) – The output image where results are written into.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_binaryAnd

binary_edge_detection(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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.

  • output_image (Optional[Image] = None) – The output image where edge pixels will be 1.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_binaryEdgeDetection

binary_not(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 except 0 in the input image are interpreted as 1. <pre>f(x) = !x</pre>

Parameters:
  • input_image (Image) – The binary input image to be inverted.

  • output_image (Optional[Image] = None) – The output image where results are written into.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_binaryNot

binary_or(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 values except 0 in the input images are interpreted as 1.<pre>f(x, y) = x | y</pre>

Parameters:
  • input_image0 (Image) – The first binary input image to be processed.

  • input_image1 (Image) – The second binary input image to be processed.

  • output_image (Optional[Image] = None) – The output image where results are written into.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_binaryOr

binary_subtract(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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.

  • output_image (Optional[Image] = None) – The output image where results are written into.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_binarySubtract

binary_xor(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 | and NOT ! implementing the XOR operator. All pixel values except 0 in the input images are interpreted as 1. <pre>f(x, y) = (x & !y) | (!x & y)</pre>

Parameters:
  • input_image0 (Image) – The first binary input image to be processed.

  • input_image1 (Image) – The second binary input image to be processed.

  • output_image (Optional[Image] = None) – The output image where results are written into.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_binaryXOr

block_enumerate(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, blocksize: int = 256, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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, 0, 3, 0, 4, 5] This functionality is important in connected component neccessary (see also sum_reduction_x). In the above example, with blocksize 4, that would be the sum array: [2, 3] labeling. Processing is accelerated by paralellization in blocks. Therefore, handing over precomputed block sums is Note that the block size when calling this function and sum_reduction must be identical

Parameters:
  • input_image0 (Image) – input binary vector 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.

Return type:

Image

convolve(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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) – First input image to process.

  • input_image1 (Image) – Second input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_convolve

copy(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Copies an image. <pre>f(x) = x</pre>

Parameters:
  • input_image (Image) – Input image to copy.

  • output_image (Optional[Image] = None) – Output copy image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_copy

copy_horizontal_slice(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, slice: int = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

This method has two purposes: It copies a 2D image to a given slice y position in a 3D image stack or It copies a given slice at position y in an image stack to a 2D image.

Parameters:
  • input_image (Image) – Input image to copy from.

  • output_image (Optional[Image] = None) – Output copy image slice.

  • slice (int = 0) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_copySlice

copy_slice(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, slice: int = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

This method has two purposes: It copies a 2D image to a given slice z position in a 3D image stack or It copies a given slice at position z in an image stack to a 2D image. The first case is only available via ImageJ macro. If you are using it, it is recommended that the target 3D image already preexists in GPU memory before calling this method. Otherwise, CLIJ create the image stack with z planes.

Parameters:
  • input_image (Image) – Input image to copy from.

  • output_image (Optional[Image] = None) – Output copy image slice.

  • slice (int = 0) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_copySlice

copy_vertical_slice(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, slice: int = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

This method has two purposes: It copies a 2D image to a given slice x position in a 3D image stack or It copies a given slice at position x in an image stack to a 2D image.

Parameters:
  • input_image (Image) – Input image to copy from.

  • output_image (Optional[Image] = None) – Output copy image slice.

  • slice (int = 0) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_copySlice

crop(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, start_x: int = 0, start_y: int = 0, start_z: int = 0, width: int = 1, height: int = 1, depth: int = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 to process.

  • output_image (Optional[Image] = None) – Output result image.

  • start_x (int = 0) – Starting index coordicante x.

  • start_y (int = 0) – Starting index coordicante y.

  • start_z (int = 0) – Starting index coordicante z.

  • width (int = 1) – Width size of the region to crop.

  • height (int = 1) – Height size of the region to crop.

  • depth (int = 1) – Depth size of the region to crop.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_crop3D

cubic_root(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Computes the cubic root of each pixel.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

detect_label_edges(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_detectLabelEdges

dilate(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, connectivity: str = 'box', device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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.

Parameters:
  • input_image (Image) – Input image to process. Input image to process.

  • output_image (Optional[Image] = None) – Output result image. Output result image.

  • connectivity (str = "box") – Element shape, “box” or “sphere”.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_dilateBox

[2] https://clij.github.io/clij2-docs/reference_dilateSphere

dilate_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 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 to process. Input image to process.

  • output_image (Optional[Image] = None) – Output result image. Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_dilateBox

dilate_sphere(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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.

Parameters:
  • input_image (Image) – Input image to process. Input image to process.

  • output_image (Optional[Image] = None) – Output result image. Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_dilateSphere

divide_images(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Divides two images X and Y by each other pixel wise. <pre>f(x, y) = x / y</pre>

Parameters:
  • input_image0 (Image) – First input image to process.

  • input_image1 (Image) – Second input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_divideImages

divide_scalar_by_image(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, scalar: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Divides a scalar by an image pixel by pixel. <pre>f(x, s) = s / x</pre>

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • scalar (float = 0) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

equal(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines if two images A and B equal pixel wise. <pre>f(a, b) = 1 if a == b; 0 otherwise.</pre>

Parameters:
  • input_image0 (Image) – The first image to be compared with.

  • input_image1 (Image) – The second image to be compared with the first.

  • output_image (Optional[Image] = None) – The resulting binary image where pixels will be 1 only if source1

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_equal

equal_constant(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, scalar: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines if an image A and a constant b are equal. <pre>f(a, b) = 1 if a == b; 0 otherwise.</pre>

Parameters:
  • 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

  • scalar (float = 0) – The constant where every pixel is compared to.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_equalConstant

erode(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, connectivity: str = 'box', device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 (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.

  • connectivity (str = "box") – Element shape, “box” or “sphere”.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_erodeBox

[2] https://clij.github.io/clij2-docs/reference_erodeSphere

erode_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 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 is that the output image contains values 0 and 1 instead of 0 and 255.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_erodeBox

erode_sphere(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 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 to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_erodeSphere

exponential(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Computes base exponential of all pixels values. f(x) = exp(x) Author(s): Peter Haub, Robert Haase

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_exponential

flip(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, flip_x: bool = True, flip_y: bool = True, flip_z: bool = True, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Flips an image in X, Y and/or Z direction depending on boolean flags.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • flip_x (bool = True) – Flip along the x axis if true.

  • flip_y (bool = True) – Flip along the y axis if true.

  • flip_z (bool = True) – Flip along the z axis if true.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_flip3D

gaussian_blur(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, sigma_x: float = 0, sigma_y: float = 0, sigma_z: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 done separable. In case a sigma equals zero, the direction is not blurred.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • sigma_x (float = 0) – Sigma value along the x axis.

  • sigma_y (float = 0) – Sigma value along the y axis.

  • sigma_z (float = 0) – Sigma value along the z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_gaussianBlur3D

generate_distance_matrix(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Computes the distance between all point coordinates given in two point lists. Takes two images containing pointlists (dimensionality n * d, n: number of points and d: dimensionality) and builds up a matrix containing the distances between these points. Convention: Given two point lists with dimensionality n * d and m * d, the distance matrix will be of size(n + 1) * (m + 1). The first row and column contain zeros. They represent the distance of the (see generateTouchMatrix). Thus, one can threshold a distance matrix to generate a touch matrix out of it for drawing objects to a theoretical background object. In that way, distance matrices are of the same size as touch matrices meshes.

Parameters:
  • input_image0 (Image) – First input image to process.

  • input_image1 (Image) – Second input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_generateDistanceMatrix

gradient_x(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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: <pre>b’ = c a;</pre>

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_gradientX

gradient_y(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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: <pre>b’ = c a;</pre>

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_gradientY

gradient_z(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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: <pre>b’ = c a;</pre>

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_gradientZ

greater(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines if two images A and B greater pixel wise. f(a, b) = 1 if a > b; 0 otherwise.

Parameters:
  • input_image0 (Image) – First input image to process.

  • input_image1 (Image) – Second input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_greater

greater_constant(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, scalar: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 to process.

  • output_image (Optional[Image] = None) – Output result image.

  • scalar (float = 0) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_greaterConstant

greater_or_equal(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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) – First input image to process.

  • input_image1 (Image) – Second input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_greaterOrEqual

greater_or_equal_constant(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, scalar: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 to process.

  • output_image (Optional[Image] = None) – Output result image.

  • scalar (float = 0) – Scalar value used in the comparison.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_greaterOrEqualConstant

hessian_eigenvalues(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, small_eigenvalue: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, middle_eigenvalue: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, large_eigenvalue: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) list

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, Ixy, Ixz] [Ixy, Iyy, Iyz] [Ixz, Iyz, Izz] Ixx denotes the second derivative in x. Ixx and Iyy are calculated by convolving the image with the 1d kernel [1 2 1]. Ixy is calculated by a convolution with the 2d kernel: [ 0.25 0 0.25] [ 0 0 0] [0.25 0 0.25] Note: This is the only clesperanto function that returns multiple images. This API might be subject to change in the future. Consider using small_hessian_eigenvalue() and/or large_hessian_eigenvalue() instead which return only one image.

Parameters:
  • input_image (Image) – Input image to process.

  • small_eigenvalue (Optional[Image] = None) – Output result image.

  • middle_eigenvalue (Optional[Image] = None) – Output result image, null if input is 2D.

  • large_eigenvalue (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

list

laplace(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, connectivity: str = 'box', device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Applies the Laplace operator with a “box” or a “sphere” neighborhood to an image.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • connectivity (str = "box") – Filter neigborhood

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_laplaceDiamond

laplace_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Applies the Laplace operator (Box neighborhood) to an image.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_laplaceBox

laplace_diamond(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Applies the Laplace operator (Diamond neighborhood) to an image.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_laplaceDiamond

local_cross_correlation(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

logarithm(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Computes base e logarithm of all pixels values. f(x) = log(x) Author(s): Peter Haub, Robert Haase

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_logarithm

mask(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, mask: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 the same position in the mask image is not equal to zero. <pre>f(x,m) = (x if (m != 0); (0 otherwise))</pre>

Parameters:
  • input_image (Image) – Input image to process.

  • mask (Image) – Mask image to apply.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_mask

mask_label(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, label: float = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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))

Parameters:
  • input_image0 (Image) – Input Intensity image.

  • input_image1 (Image) – Input Label image.

  • output_image (Optional[Image] = None) – Output result image.

  • label (float = 1) – Label value to use.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_maskLabel

maximum(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 0, radius_y: int = 0, radius_z: int = 0, connectivity: str = 'box', device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Computes the local maximum of a pixels neighborhood (box or sphere). The neighborhood size is specified by its halfwidth, halfheight and halfdepth (radius).

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 0) – Radius size along x axis.

  • radius_y (int = 0) – Radius size along y axis.

  • radius_z (int = 0) – Radius size along z axis.

  • connectivity (str = "box") – Filter neigborhood

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_maximum3DBox

[2] https://clij.github.io/clij2-docs/reference_maximum3DSphere

maximum_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 1) – Radius size along x axis.

  • radius_y (int = 1) – Radius size along y axis.

  • radius_z (int = 1) – Radius size along z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_maximum3DBox

maximum_image_and_scalar(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, scalar: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Computes the maximum of a constant scalar s and each pixel value x in a given image X. <pre>f(x, s) = max(x, s)</pre>

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • scalar (float = 0) – Scalar value used in the comparison.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_maximumImageAndScalar

maximum_images(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Computes the maximum of a pair of pixel values x, y from two given images X and Y. <pre>f(x, y) = max(x, y)</pre>

Parameters:
  • input_image0 (Image) – First input image to process.

  • input_image1 (Image) – Second input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_maximumImages

maximum_sphere(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 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 = 0) – Radius size along z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_maximum3DSphere

maximum_x_projection(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines the maximum intensity projection of an image along X.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_maximumXProjection

maximum_y_projection(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines the maximum intensity projection of an image along X.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_maximumYProjection

maximum_z_projection(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines the maximum intensity projection of an image along Z.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_maximumZProjection

mean(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, connectivity: str = 'box', device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 halfdepth (radius).

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 1) – Radius size along x axis.

  • radius_y (int = 1) – Radius size along y axis.

  • radius_z (int = 1) – Radius size along z axis.

  • connectivity (str = "box") – Filter neigborhood

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_mean3DSphere

mean_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 1) – Radius size along x axis.

  • radius_y (int = 1) – Radius size along y axis.

  • radius_z (int = 1) – Radius size along z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_mean3DBox

mean_sphere(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 1) – Radius size along x axis.

  • radius_y (int = 1) – Radius size along y axis.

  • radius_z (int = 1) – Radius size along z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_mean3DSphere

mean_x_projection(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines the mean average intensity projection of an image along X.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_meanXProjection

mean_y_projection(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines the mean average intensity projection of an image along Y.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_meanYProjection

mean_z_projection(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines the mean average intensity projection of an image along Z.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_meanZProjection

median(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, connectivity: str = 'box', device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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, and halfdepth (radius). For technical reasons, the area of the shpae must have less than 1000 pixels.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 1) – Radius size along x axis.

  • radius_y (int = 1) – Radius size along y axis.

  • radius_z (int = 1) – Radius size along z axis.

  • connectivity (str = "box") – Filter neigborhood

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_median3DSphere

median_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Computes the local median of a pixels box shaped neighborhood. The box is specified by its halfwidth and halfheight (radius). For technical reasons, the area of the box must have less than 1000 pixels.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 1) – Radius size along x axis.

  • radius_y (int = 1) – Radius size along y axis.

  • radius_z (int = 1) – Radius size along z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_median3DBox

median_sphere(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Computes the local median of a pixels sphere shaped neighborhood. The sphere is specified by its halfwidth and halfheight (radius). For technical reasons, the area of the box must have less than 1000 pixels.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 1) – Radius size along x axis.

  • radius_y (int = 1) – Radius size along y axis.

  • radius_z (int = 1) – Radius size along z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_median3DSphere

minimum(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 0, radius_y: int = 0, radius_z: int = 0, connectivity: str = 'box', device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 0) – Radius size along x axis.

  • radius_y (int = 0) – Radius size along y axis.

  • radius_z (int = 0) – Radius size along z axis.

  • connectivity (str = "box") – Filter neigborhood

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_minimum3DBox

[2] https://clij.github.io/clij2-docs/reference_minimum3DSphere

minimum_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 0, radius_y: int = 0, radius_z: int = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 0) – Radius size along x axis.

  • radius_y (int = 0) – Radius size along y axis.

  • radius_z (int = 0) – Radius size along z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_minimum3DBox

minimum_image_and_scalar(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, scalar: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Computes the minimum of a constant scalar s and each pixel value x in a given image X. <pre>f(x, s) = min(x, s)</pre>

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • scalar (float = 0) – Scalar value used in the comparison.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_minimumImageAndScalar

minimum_images(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Computes the minimum of a pair of pixel values x, y from two given images X and Y. <pre>f(x, y) = min(x, y)</pre>

Parameters:
  • input_image0 (Image) – First input image to process.

  • input_image1 (Image) – Second input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_minimumImages

minimum_sphere(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 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.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_minimum3DSphere

minimum_x_projection(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines the minimum intensity projection of an image along Y.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_minimumXProjection

minimum_y_projection(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines the minimum intensity projection of an image along Y.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_minimumYProjection

minimum_z_projection(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines the minimum intensity projection of an image along Z.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_minimumZProjection

mode(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, connectivity: str = 'box', device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 semantic segmentation results. The shape size is specified by its halfwidth, halfheight, and halfdepth (radius). For technical reasons, the intensities must lie within a range from 0 to 255 (uint8). In case multiple values have maximum frequency, the smallest one is returned.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 1) – Radius size along x axis.

  • radius_y (int = 1) – Radius size along y axis.

  • radius_z (int = 1) – Radius size along z axis.

  • connectivity (str = "box") – Filter neigborhood

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

mode_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 specified by its halfwidth and halfheight (radius). For technical reasons, the intensities must lie within a range from 0 to 255. In case multiple values have maximum frequency, the smallest one is returned.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 1) – Radius size along x axis.

  • radius_y (int = 1) – Radius size along y axis.

  • radius_z (int = 1) – Radius size along z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

mode_sphere(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 specified by its halfwidth and halfheight (radius). For technical reasons, the intensities must lie within a range from 0 to 255. In case multiple values have maximum frequency, the smallest one is returned.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 1) – Radius size along x axis.

  • radius_y (int = 1) – Radius size along y axis.

  • radius_z (int = 1) – Radius size along z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

modulo_images(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Computes the remainder of a division of pairwise pixel values in two images

Parameters:
  • input_image0 (Image) – First input image to process.

  • input_image1 (Image) – Second input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

multiply_image_and_position(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, dimension: int = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Multiplies all pixel intensities with the x, y or z coordinate, depending on specified dimension.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • dimension (int = 0) – Dimension (0,1,2) to use in the operation.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_multiplyImageAndCoordinate

multiply_image_and_scalar(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, scalar: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Multiplies all pixels value x in a given image X with a constant scalar s. <pre>f(x, s) = x * s</pre>

Parameters:
  • 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.

  • scalar (float = 0) – The number with which every pixel will be multiplied with.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_multiplyImageAndScalar

multiply_images(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Multiplies all pairs of pixel values x and y from two image X and Y. <pre>f(x, y) = x * y</pre>

Parameters:
  • input_image0 (Image) – The first input image to be multiplied.

  • input_image1 (Image) – The second image to be multiplied.

  • output_image (Optional[Image] = None) – The output image where results are written into.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_multiplyImages

multiply_matrix(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Multiplies two matrices with each other. Shape of matrix1 should be equal to shape of matrix2 transposed.

Parameters:
  • input_image0 (Image) – First input image to process.

  • input_image1 (Image) – Second input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_multiplyMatrix

nan_to_num(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, nan: float = 0, posinf: float = numpy.nan_to_num, neginf: float = numpy.nan_to_num, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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. This function aims to work similarly as its counterpart in numpy [1]. Default values for posinf and neginf may differ from numpy and even differ depending on compute hardware. It is recommended to specify those values.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – The output image where results are written into.

  • nan (float = 0) – Value to replace

  • posinf (float = np.nan_to_num(float('inf'))) – Value to replace +inf with.

  • neginf (float = np.nan_to_num(float('-inf'))) – Value to replace -inf with.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://numpy.org/doc/stable/reference/generated/numpy.nan_to_num.html

nonzero_maximum(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, connectivity: str = 'box', device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 are ignored. Note: Pixels with 0 value in the input image will not be overwritten in the output image. Thus, the result image should be initialized by copying the original image in advance.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image0 (Image) – Output flag (0 or 1).

  • output_image1 (Optional[Image] = None) – Output image where results are written into.

  • connectivity (str = "box") – Filter neigborhood

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_nonzeroMaximumBox

[2] https://clij.github.io/clij2-docs/reference_nonzeroMaximumDiamond

nonzero_maximum_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 image will not be overwritten in the output image. Thus, the result image should be initialized by copying the original image in advance.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image0 (Image) – Output flag (0 or 1).

  • output_image1 (Optional[Image] = None) – Output image where results are written into.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_nonzeroMaximumBox

nonzero_maximum_diamond(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 image will not be overwritten in the output image. Thus, the result image should be initialized by copying the original image in advance.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image0 (Image) – Output flag (0 or 1).

  • output_image1 (Optional[Image] = None) – Output image where results are written into.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_nonzeroMaximumDiamond

nonzero_minimum(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, connectivity: str = 'box', device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 are ignored.Note: Pixels with 0 value in the input image will not be overwritten in the output image. Thus, the result image should be initialized by copying the original image in advance.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image0 (Image) – Output flag (0 or 1).

  • output_image1 (Optional[Image] = None) – Output image where results are written into.

  • connectivity (str = "box") – Filter neigborhood

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_nonzeroMinimumBox

[2] https://clij.github.io/clij2-docs/reference_nonzeroMinimumDiamond

nonzero_minimum_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 image will not be overwritten in the output image. Thus, the result image should be initialized by copying the original image in advance.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image0 (Image) – Output flag (0 or 1).

  • output_image1 (Optional[Image] = None) – Output image where results are written into.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_nonzeroMinimumBox

nonzero_minimum_diamond(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 image will not be overwritten in the output image. Thus, the result image should be initialized by copying the original image in advance.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image0 (Image) – Output flag (0 or 1).

  • output_image1 (Optional[Image] = None) – Output image where results are written into.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_nonzeroMinimumDiamond

not_equal(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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.

  • output_image (Optional[Image] = None) – The resulting binary image where pixels will be 1 only if source1

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_notEqual

not_equal_constant(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, scalar: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines if two images A and B equal pixel wise. f(a, b) = 1 if a != b; 0 otherwise.

Parameters:
  • 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

  • scalar (float = 0) – The constant where every pixel is compared to.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_notEqualConstant

onlyzero_overwrite_maximum(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, connectivity: str = 'box', device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Apply a local maximum filter to an image which only overwrites pixels with value 0.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image0 (Image) – Output flag value, 0 or 1.

  • output_image1 (Optional[Image] = None) – Output image.

  • connectivity (str = "box") – Filter neigborhood

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_onlyzeroOverwriteMaximumBox

[2] https://clij.github.io/clij2-docs/reference_onlyzeroOverwriteMaximumDiamond

onlyzero_overwrite_maximum_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Apply a local maximum filter to an image which only overwrites pixels with value 0.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image0 (Image) – Output flag value, 0 or 1.

  • output_image1 (Optional[Image] = None) – Output image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_onlyzeroOverwriteMaximumBox

onlyzero_overwrite_maximum_diamond(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Apply a local maximum filter to an image which only overwrites pixels with value 0.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image0 (Image) – Output flag value, 0 or 1.

  • output_image1 (Optional[Image] = None) – Output image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_onlyzeroOverwriteMaximumDiamond

paste(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, index_x: int = 0, index_y: int = 0, index_z: int = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Pastes an image into another image at a given position.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • index_x (int = 0) – Origin pixel coodinate in x to paste.

  • index_y (int = 0) – Origin pixel coodinate in y to paste.

  • index_z (int = 0) – Origin pixel coodinate in z to paste.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_paste3D

power(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, scalar: float = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Computes all pixels value x to the power of a given exponent a. <pre>f(x, a) = x ^ a</pre>

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • scalar (float = 1) – Power value.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_power

power_images(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Calculates x to the power of y pixel wise of two images X and Y.

Parameters:
  • input_image0 (Image) – First input image to process.

  • input_image1 (Image) – Second input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_powerImages

range(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, start_x: int | None = None, stop_x: int | None = None, step_x: int | None = None, start_y: int | None = None, stop_y: int | None = None, step_y: int | None = None, start_z: int | None = None, stop_z: int | None = None, step_z: int | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Crops an image according to a defined range and step size.

Parameters:
  • input_image (Image) – First input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • start_x (Optional[int] = None) – Range starting value in x

  • stop_x (Optional[int] = None) – Range stop value in x

  • step_x (Optional[int] = None) – Range step value in x

  • start_y (Optional[int] = None) – Range starting value in y

  • stop_y (Optional[int] = None) – Range stop value in y

  • step_y (Optional[int] = None) – Range step value in y

  • start_z (Optional[int] = None) – Range starting value in z

  • stop_z (Optional[int] = None) – Range stop value in z

  • step_z (Optional[int] = None) – Range step value in z

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

read_values_from_positions(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, list: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 passed as a (x,y,z) coordinate per column.

Parameters:
  • input_image (Image) – Input image to process.

  • list (Image) – List of coordinate, as a 2D matrix.

  • output_image (Optional[Image] = None) – Output vector image of intensities.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

reciprocal(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://numpy.org/doc/stable/reference/generated/numpy.reciprocal.html

replace_value(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, scalar0: float = 0, scalar1: float = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Replaces a specific intensity in an image with a given new value.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • scalar0 (float = 0) – Old value.

  • scalar1 (float = 1) – New value.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_replaceIntensity

replace_values(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 value at that position represents the new intensity.s

Parameters:
  • input_image0 (Image) – Input image to process.

  • input_image1 (Image) – List of intensities to replace, as a vector of values.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_replaceIntensities

set(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, scalar: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Sets all pixel values x of a given image X to a constant value v. <pre>f(x) = v</pre>

Parameters:
  • input_image (Image) – Input image to process.

  • scalar (float = 0) – Value to set.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_set

set_column(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, column: int = 0, value: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Sets all pixel values x of a given column in X to a constant value v.

Parameters:
  • input_image (Image) – Input image to process.

  • column (int = 0) – Column index.

  • value (float = 0) – Value to set.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_setColumn

set_image_borders(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, value: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Sets all pixel values at the image border to a given value.

Parameters:
  • input_image (Image) – Input image to process.

  • value (float = 0) – Value to set.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_setImageBorders

set_nonzero_pixels_to_pixelindex(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, offset: int = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Replaces all 0 value pixels in an image with the index of a pixel.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output image.

  • offset (int = 1) – Offset value to start the indexing.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

set_plane(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, plane: int = 0, value: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Sets all pixel values x of a given plane in X to a constant value v.

Parameters:
  • input_image (Image) – Input image to process.

  • plane (int = 0) – Plane index.

  • value (float = 0) – Value to set.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_setPlane

set_ramp_x(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Sets all pixel values to their X coordinate.

Parameters:
  • input_image (Image) – Input image to process.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_setRampX

set_ramp_y(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Sets all pixel values to their Y coordinate.

Parameters:
  • input_image (Image) – Input image to process.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_setRampY

set_ramp_z(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Sets all pixel values to their Z coordinate.

Parameters:
  • input_image (Image) – Input image to process.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_setRampZ

set_row(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, row: int = 0, value: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Sets all pixel values x of a given row in X to a constant value v.

Parameters:
  • input_image (Image) – Input image to process.

  • row (int = 0) –

  • value (float = 0) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_setRow

set_where_x_equals_y(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, value: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 initialize an identity transfrom matrix, set all pixels to 0 first.

Parameters:
  • input_image (Image) – Input image to process.

  • value (float = 0) – Value to set.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_setWhereXequalsY

set_where_x_greater_than_y(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, value: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 initialize an identity transfrom matrix, set all pixels to 0 first.

Parameters:
  • input_image (Image) – Input image to process.

  • value (float = 0) – Value to set.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_setWhereXgreaterThanY

set_where_x_smaller_than_y(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, value: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 initialize an identity transfrom matrix, set all pixels to 0 first.

Parameters:
  • input_image (Image) – Input image to process.

  • value (float = 0) – Value to set.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_setWhereXsmallerThanY

sign(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 work similarly as its counterpart in numpy [1].

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

smaller(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines if two images A and B smaller pixel wise. f(a, b) = 1 if a < b; 0 otherwise.

Parameters:
  • input_image0 (Image) – First input image to process.

  • input_image1 (Image) – Second input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_smaller

smaller_constant(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, scalar: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 to process.

  • output_image (Optional[Image] = None) – Output result image.

  • scalar (float = 0) – Scalar used in the comparison.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_smallerConstant

smaller_or_equal(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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) – First input image to process.

  • input_image1 (Image) – Second input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_smallerOrEqual

smaller_or_equal_constant(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, scalar: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 to process.

  • output_image (Optional[Image] = None) – Output result image.

  • scalar (float = 0) – Scalar used in the comparison.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_smallerOrEqualConstant

sobel(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Convolve the image with the Sobel kernel. Author(s): Ruth WhelanJeans, Robert Haase

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_sobel

square_root(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Computes the square root of each pixel.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

std_z_projection(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines the standard deviation intensity projection of an image stack along Z.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_standardDeviationZProjection

subtract_image_from_scalar(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, scalar: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Subtracts one image X from a scalar s pixel wise. <pre>f(x, s) = s x</pre>

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • scalar (float = 0) – Scalar used in the subtraction.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_subtractImageFromScalar

sum_reduction_x(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, blocksize: int = 256, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 and block size 4: [0, 1, 1, 0, 1, 0, 1, 1] would lead to an image [2, 3]

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • blocksize (int = 256) – Blocksize value.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

sum_x_projection(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines the sum intensity projection of an image along Z.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_sumXProjection

sum_y_projection(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines the sum intensity projection of an image along Z.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_sumYProjection

sum_z_projection(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines the sum intensity projection of an image along Z.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_sumZProjection

transpose_xy(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Transpose X and Y axes of an image.

Parameters:
  • input_image (Image) – The input image.

  • output_image (Optional[Image] = None) – The output image where results are written into.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_transposeXY

transpose_xz(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Transpose X and Z axes of an image.

Parameters:
  • input_image (Image) – The input image.

  • output_image (Optional[Image] = None) – The output image where results are written into.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_transposeXZ

transpose_yz(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Transpose Y and Z axes of an image.

Parameters:
  • input_image (Image) – The input image.

  • output_image (Optional[Image] = None) – The output image where results are written into.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_transposeYZ

undefined_to_zero(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_undefinedToZero

variance(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, connectivity: str = 'box', device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Computes the local variance of a pixels neighborhood (box or sphere). The neighborhood size is specified by its halfwidth, halfheight and halfdepth (radius). If 2D images are given, radius_z will be ignored.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 1) – Radius size along x axis.

  • radius_y (int = 1) – Radius size along y axis.

  • radius_z (int = 1) – Radius size along z axis.

  • connectivity (str = "box") – Filter neigborhood

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_varianceBox

[2] https://clij.github.io/clij2-docs/reference_varianceSphere

variance_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 given, radius_z will be ignored.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 1) – Radius size along x axis.

  • radius_y (int = 1) – Radius size along y axis.

  • radius_z (int = 1) – Radius size along z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_varianceBox

variance_sphere(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 given, radius_z will be ignored.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 1) – Radius size along x axis.

  • radius_y (int = 1) – Radius size along y axis.

  • radius_z (int = 1) – Radius size along z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_varianceSphere

write_values_to_positions(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 target image.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_writeValuesToPositions

x_position_of_maximum_x_projection(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 X will be chosen.

Parameters:
  • input_image (Image) – Input image stack

  • output_image (Optional[Image] = None) – altitude map

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

x_position_of_minimum_x_projection(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 X will be chosen.

Parameters:
  • input_image (Image) – Input image stack

  • output_image (Optional[Image] = None) – altitude map

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

y_position_of_maximum_y_projection(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 Y will be chosen.

Parameters:
  • input_image (Image) – Input image stack

  • output_image (Optional[Image] = None) – altitude map

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

y_position_of_minimum_y_projection(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 Y will be chosen.

Parameters:
  • input_image (Image) – Input image stack

  • output_image (Optional[Image] = None) – altitude map

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

z_position_of_maximum_z_projection(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 Z will be chosen.

Parameters:
  • input_image (Image) – Input image stack

  • output_image (Optional[Image] = None) – altitude map

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

z_position_of_minimum_z_projection(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 Z will be chosen.

Parameters:
  • input_image (Image) – Input image stack

  • output_image (Optional[Image] = None) – altitude map

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

tier2

absolute_difference(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines the absolute difference pixel by pixel between two images. <pre>f(x, y) = |x y| </pre>

Parameters:
  • input_image0 (Image) – The input image to be subtracted from.

  • input_image1 (Image) – The input image which is subtracted.

  • output_image (Optional[Image] = None) – The output image where results are written into.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_absoluteDifference

add_images(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Calculates the sum of pairs of pixels x and y of two images X and Y. <pre>f(x, y) = x + y</pre>

Parameters:
  • input_image0 (Image) – The first input image to added.

  • input_image1 (Image) – The second image to be added.

  • output_image (Optional[Image] = None) – The output image where results are written into.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_addImages

bottom_hat(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1, connectivity: str = 'box', device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Applies a bottomhat filter for background subtraction to the input image.

Parameters:
  • 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 (float = 1) – Radius of the background determination region in X.

  • radius_y (float = 1) – Radius of the background determination region in Y.

  • radius_z (float = 1) – Radius of the background determination region in Z.

  • connectivity (str = "box") – Element shape, “box” or “sphere”

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_bottomHatBox

[2] https://clij.github.io/clij2-docs/reference_bottomHatSphere

bottom_hat_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Apply a bottomhat filter for background subtraction to the input image.

Parameters:
  • 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 of the background determination region in X.

  • radius_y (int = 1) – Radius of the background determination region in Y.

  • radius_z (int = 1) – Radius of the background determination region in Z.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_bottomHatBox

bottom_hat_sphere(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Applies a bottomhat filter for background subtraction to the input image.

Parameters:
  • 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 (float = 1) – Radius of the background determination region in X.

  • radius_y (float = 1) – Radius of the background determination region in Y.

  • radius_z (float = 1) – Radius of the background determination region in Z.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_bottomHatSphere

clip(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, min_intensity: float | None = None, max_intensity: float | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 to process.

  • output_image (Optional[Image] = None) – Output result image.

  • min_intensity (Optional[float] = None) – new, lower limit of the intensity range

  • max_intensity (Optional[float] = None) – new, upper limit of the intensity range

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://numpy.org/doc/stable/reference/generated/numpy.clip.html

closing(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 0, connectivity: str = 'box', device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Closing operator, sphereshaped Applies morphological closing to intensity images using a sphereshaped footprint. This operator also works with binary images.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 1) – Radius along the x axis.

  • radius_y (int = 1) – Radius along the y axis.

  • radius_z (int = 0) – Radius along the z axis.

  • connectivity (str = "box") – Element shape, “box” or “sphere”

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

closing_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 0, radius_y: int = 0, radius_z: int = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Closing operator, boxshaped Applies morphological closing to intensity images using a boxshaped footprint. This operator also works with binary images.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 0) – Radius along the x axis.

  • radius_y (int = 0) – Radius along the y axis.

  • radius_z (int = 0) – Radius along the z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

closing_sphere(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Closing operator, sphereshaped Applies morphological closing to intensity images using a sphereshaped footprint. This operator also works with binary images.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 1) – Radius along the x axis.

  • radius_y (int = 1) – Radius along the y axis.

  • radius_z (int = 0) – Radius along the z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

concatenate_along_x(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Concatenate two images or stacks along the X axis.

Parameters:
  • input_image0 (Image) – First input image.

  • input_image1 (Image) – Second input image.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_combineHorizontally

concatenate_along_y(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Concatenate two images or stacks along the Y axis.

Parameters:
  • input_image0 (Image) – First input image.

  • input_image1 (Image) – Second input image.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_combineVertically

concatenate_along_z(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Concatenate two images or stacks along the Z axis.

Parameters:
  • input_image0 (Image) – First input image.

  • input_image1 (Image) – Second input image.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_concatenateStacks

count_touching_neighbors(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, ignore_background: bool = True, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 that can touch. To ignore touches with background, hand over a touch matrix where the first column (index = 0) has been set to 0. Use set_column for that.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • ignore_background (bool = True) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_countTouchingNeighbors

crop_border(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, border_size: int = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 to process.

  • output_image (Optional[Image] = None) – Output result image.

  • border_size (int = 1) – Border size to crop.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

degrees_to_radians(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Converts radians to degrees.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

detect_maxima(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 0, radius_y: int = 0, radius_z: int = 0, connectivity: str = 'box', device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 has a higher intensity, and to 0 otherwise.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 0) – Radius along the x axis.

  • radius_y (int = 0) – Radius along the y axis.

  • radius_z (int = 0) – Radius along the z axis.

  • connectivity (str = "box") – Element shape, “box” or “sphere”

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_detectMaximaBox

[2] https://clij.github.io/clij2-docs/reference_detectMaximaSphere

detect_maxima_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 0, radius_y: int = 0, radius_z: int = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 has a higher intensity, and to 0 otherwise.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 0) – Radius along the x axis.

  • radius_y (int = 0) – Radius along the y axis.

  • radius_z (int = 0) – Radius along the z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_detectMaximaBox

detect_minima(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 0, radius_y: int = 0, radius_z: int = 0, connectivity: str = 'box', device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 has a lower intensity, and to 0 otherwise.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 0) – Radius along the x axis.

  • radius_y (int = 0) – Radius along the y axis.

  • radius_z (int = 0) – Radius along the z axis.

  • connectivity (str = "box") – Element shape, “box” or “sphere”

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_detectMinimaBox

[2] https://clij.github.io/clij2-docs/reference_detectMinimaSphere

detect_minima_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 0, radius_y: int = 0, radius_z: int = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 has a lower intensity, and to 0 otherwise.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 0) – Radius along the x axis.

  • radius_y (int = 0) – Radius along the y axis.

  • radius_z (int = 0) – Radius along the z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_detectMinimaBox

difference_of_gaussian(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = 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: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 recommended to apply this operation to images of type Float (32 bit) as results might be negative.

Parameters:
  • input_image (Image) – The input image to be processed.

  • output_image (Optional[Image] = None) – The output image where results are written into.

  • sigma1_x (float = 2) – Sigma of the first Gaussian filter in x

  • sigma1_y (float = 2) – Sigma of the first Gaussian filter in y

  • sigma1_z (float = 2) – Sigma of the first Gaussian filter in z

  • sigma2_x (float = 2) – Sigma of the second Gaussian filter in x

  • sigma2_y (float = 2) – Sigma of the second Gaussian filter in y

  • sigma2_z (float = 2) – Sigma of the second Gaussian filter in z

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_differenceOfGaussian3D

divide_by_gaussian_background(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, sigma_x: float = 2, sigma_y: float = 2, sigma_z: float = 2, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Applies Gaussian blur to the input image and divides the original by the result.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • sigma_x (float = 2) – Gaussian sigma value along x.

  • sigma_y (float = 2) – Gaussian sigma value along y.

  • sigma_z (float = 2) – Gaussian sigma value along z.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_divideByGaussianBackground

extend_labeling_via_voronoi(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_extendLabelingViaVoronoi

invert(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Computes the negative value of all pixels in a given image. It is recommended to convert images to 32bit float before applying this operation. <pre>f(x) = x</pre> For binary images, use binaryNot.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_invert

label_spots(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 of the same size where every spot has a number 1, 2,… n.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_labelSpots

large_hessian_eigenvalue(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines the Hessian eigenvalues and returns the large eigenvalue image.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

maximum_of_all_pixels(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, device: pyclesperanto._pyclesperanto._Device | None = 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 to process.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

float

References

[1] https://clij.github.io/clij2-docs/reference_maximumOfAllPixels

minimum_of_all_pixels(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, device: pyclesperanto._pyclesperanto._Device | None = 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 to process.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

float

References

[1] https://clij.github.io/clij2-docs/reference_minimumOfAllPixels

minimum_of_masked_pixels(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, mask: numpy.ndarray | pyclesperanto._pyclesperanto._Array, device: pyclesperanto._pyclesperanto._Device | None = 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 to process.

  • mask (Image) – Input

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

float

References

[1] https://clij.github.io/clij2-docs/reference_minimumOfMaskedPixels

opening(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 0, connectivity: str = 'box', device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Opening operator, sphereshaped Applies morphological opening to intensity images using a sphereshaped footprint. This operator also works with binary images.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (float = 1) – Radius along the x axis.

  • radius_y (float = 1) – Radius along the y axis.

  • radius_z (float = 0) – Radius along the z axis.

  • connectivity (str = "box") – Element shape, “box” or “sphere”

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

opening_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 0, radius_y: int = 0, radius_z: int = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Opening operator, boxshaped Applies morphological opening to intensity images using a boxshaped footprint. This operator also works with binary images.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 0) – Radius along the x axis.

  • radius_y (int = 0) – Radius along the y axis.

  • radius_z (int = 0) – Radius along the z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

opening_sphere(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Opening operator, sphereshaped Applies morphological opening to intensity images using a sphereshaped footprint. This operator also works with binary images.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (float = 1) – Radius along the x axis.

  • radius_y (float = 1) – Radius along the y axis.

  • radius_z (float = 0) – Radius along the z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

radians_to_degrees(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Converts radians to degrees

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

reduce_labels_to_label_edges(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_reduceLabelsToLabelEdges

small_hessian_eigenvalue(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines the Hessian eigenvalues and returns the small eigenvalue image.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

square(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 to process.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://numpy.org/doc/stable/reference/generated/numpy.square.html

squared_difference(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Determines the squared difference pixel by pixel between two images.

Parameters:
  • input_image0 (Image) – First input image.

  • input_image1 (Image) – Second input image.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_squaredDifference

standard_deviation(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, connectivity: str = 'box', device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Computes the local standard deviation of a pixels sphere neighborhood. The box size is specified by its halfwidth, halfheight and halfdepth (radius). If 2D images are given, radius_z will be ignored.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 1) – Radius along the x axis.

  • radius_y (int = 1) – Radius along the y axis.

  • radius_z (int = 1) – Radius along the z axis.

  • connectivity (str = "box") – Neigborhood shape, “box” or “sphere”

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_standardDeviationBox

[2] https://clij.github.io/clij2-docs/reference_standardDeviationSphere

standard_deviation_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 are given, radius_z will be ignored.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 1) – Radius along the x axis.

  • radius_y (int = 1) – Radius along the y axis.

  • radius_z (int = 1) – Radius along the z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_standardDeviationBox

standard_deviation_sphere(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Computes the local standard deviation of a pixels sphere neighborhood. The box size is specified by its halfwidth, halfheight and halfdepth (radius). If 2D images are given, radius_z will be ignored.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • radius_x (int = 1) – Radius along the x axis.

  • radius_y (int = 1) – Radius along the y axis.

  • radius_z (int = 1) – Radius along the z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_standardDeviationSphere

subtract_gaussian_background(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, sigma_x: float = 2, sigma_y: float = 2, sigma_z: float = 2, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Applies Gaussian blur to the input image and subtracts the result from the original.

Parameters:
  • input_image (Image) – Input image to process.

  • output_image (Optional[Image] = None) – Output result image.

  • sigma_x (float = 2) – Radius along the x axis.

  • sigma_y (float = 2) – Radius along the y axis.

  • sigma_z (float = 2) – Radius along the z axis.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_subtractGaussianBackground

subtract_images(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Subtracts one image X from another image Y pixel wise. <pre>f(x, y) = x y</pre>

Parameters:
  • input_image0 (Image) – First input image.

  • input_image1 (Image) – Second input image.

  • output_image (Optional[Image] = None) – Output result image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_subtractImages

sum_of_all_pixels(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = 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’.

Parameters:
  • input_image (Optional[Image] = None) – Input image to process.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

float

References

[1] https://clij.github.io/clij2-docs/reference_sumOfAllPixels

top_hat(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1, connectivity: str = 'box', device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Applies a tophat filter for background subtraction to the input image.

Parameters:
  • 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 (float = 1) – Radius of the background determination region in X.

  • radius_y (float = 1) – Radius of the background determination region in Y.

  • radius_z (float = 1) – Radius of the background determination region in Z.

  • connectivity (str = "box") – Element shape, “box” or “sphere”

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_topHatBox

[2] https://clij.github.io/clij2-docs/reference_topHatSphere

top_hat_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Applies a tophat filter for background subtraction to the input image.

Parameters:
  • 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 of the background determination region in X.

  • radius_y (int = 1) – Radius of the background determination region in Y.

  • radius_z (int = 1) – Radius of the background determination region in Z.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_topHatBox

top_hat_sphere(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Applies a tophat filter for background subtraction to the input image.

Parameters:
  • 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 (float = 1) – Radius of the background determination region in X.

  • radius_y (float = 1) – Radius of the background determination region in Y.

  • radius_z (float = 1) – Radius of the background determination region in Z.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_topHatSphere

tier3

bounding_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, device: pyclesperanto._pyclesperanto._Device | None = 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) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

list

References

[1] https://clij.github.io/clij2-docs/reference_boundingBox

center_of_mass(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, device: pyclesperanto._pyclesperanto._Device | None = 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) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

list

References

[1] https://clij.github.io/clij2-docs/reference_centerOfMass

exclude_labels(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, list: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 background, continuing with label1, label2,… For example if you pass 0,1,0,0,1: Labels 1 and 4 will be removed (those with a 1 in the vector will be excluded). Labels 2 and 3 will be kept and renumbered to 1 and 2.

Parameters:
  • input_image (Image) –

  • list (Image) –

  • output_image (Optional[Image] = None) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_excludeLabels

exclude_labels_on_edges(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, exclude_x: bool = True, exclude_y: bool = True, exclude_z: bool = True, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Removes all labels from a label map which touch the edges of the image. Remaining label elements are renumbered afterwards.

Parameters:
  • input_image (Image) –

  • output_image (Optional[Image] = None) –

  • exclude_x (bool = True) – Exclude labels along min and max x

  • exclude_y (bool = True) – Exclude labels along min and max y

  • exclude_z (bool = True) – Exclude labels along min and max z

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_excludeLabelsOnEdges

flag_existing_labels(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 label image such as ` 0 1 3 5 ` will produce a flag_vector like this: ` 1 1 0 1 0 1 `

Parameters:
  • 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

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

gamma_correction(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, gamma: float = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 reversed (^ is the power operator):f(x) = (x / max(X)) ^ gamma * max(X)

Parameters:
  • input_image (Image) –

  • output_image (Optional[Image] = None) –

  • gamma (float = 1) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_gammaCorrection

generate_binary_overlap_matrix(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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. For example, if labels 3 in labelmap1 and 4 in labelmap2 are touching then the pixel (3,4) in the matrix will be set to 1.

Parameters:
  • input_image0 (Image) –

  • input_image1 (Image) –

  • output_image (Optional[Image] = None) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_generateBinaryOverlapMatrix

generate_touch_matrix(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 matrix is filled (with x < y). For example, if labels 3 and 4 are touching then the pixel (3,4) in the matrix will be set to 1. The touch matrix is a representation of a region adjacency graph

Parameters:
  • input_image (Image) –

  • output_image (Optional[Image] = None) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_generateTouchMatrix

histogram(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, nbins: int = 256, min: float | None = None, max: float | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 the number of pixels with intensity in this corresponding bin. The histogram bins are uniformly distributed between given minimum and maximum grey value intensity. If the flag determine_min_max is set, minimum and maximum intensity will be determined. When calling this operation many times, it is recommended to determine minimum and maximum intensity once at the beginning and handing over these values. Author(s): Robert Haase adapted work from Aaftab Munshi, Benedict Gaster, Timothy Mattson, James Fung, Dan Ginsburg License: adapted code from https://github.com/bgaster/openclbooksamples/blob/master/src/Chapter_14/histogram/histogram_image.cl It was published unter BSD license according to https://code.google.com/archive/p/openclbooksamples/ Book: OpenCL(R) Programming Guide Authors: Aaftab Munshi, Benedict Gaster, Timothy Mattson, James Fung, Dan Ginsburg ISBN10: 0321749642 ISBN13: 9780321749642 Publisher: AddisonWesley Professional URLs: http://safari.informit.com/9780132488006/ http://www.openclprogrammingguide.com

Parameters:
  • input_image (Image) –

  • output_image (Optional[Image] = None) –

  • nbins (int = 256) –

  • min (Optional[float] = None) –

  • max (Optional[float] = None) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_histogram

jaccard_index(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, device: pyclesperanto._pyclesperanto._Device | None = 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 saved to the results table in the ‘Jaccard_Index’ column. Note that the SorensenDice coefficient can be calculated from the Jaccard index j using this formula: <pre>s = f(j) = 2 j / (j + 1)</pre>

Parameters:
  • input_image0 (Image) –

  • input_image1 (Image) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

float

References

[1] https://clij.github.io/clij2-docs/reference_jaccardIndex

labelled_spots_to_pointlist(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 resulting from connected components analysis in an image where every column contains d pixels (with d = dimensionality of the original image) with the coordinates of the maxima/minima.

Parameters:
  • input_image (Image) –

  • output_image (Optional[Image] = None) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_labelledSpotsToPointList

maximum_position(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, device: pyclesperanto._pyclesperanto._Device | None = None) list

Determines the position of the maximum of all pixels in a given image.

Parameters:
  • 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.

Return type:

list

mean_of_all_pixels(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, device: pyclesperanto._pyclesperanto._Device | None = None) float

Determines the mean average of all pixels in a given image.

Parameters:
  • 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.

Return type:

float

References

[1] https://clij.github.io/clij2-docs/reference_meanOfAllPixels

minimum_position(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, device: pyclesperanto._pyclesperanto._Device | None = None) list

Determines the position of the minimum of all pixels in a given image.

Parameters:
  • 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.

Return type:

list

tier4

label_bounding_box(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, label_id: int, device: pyclesperanto._pyclesperanto._Device | None = 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, maxX, maxY, maxZ.

Parameters:
  • input_image (Image) –

  • label_id (int) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

list

References

[1] https://clij.github.io/clij2-docs/reference_boundingBox

mean_squared_error(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, device: pyclesperanto._pyclesperanto._Device | None = 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_image1 (Image) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

float

References

[1] https://clij.github.io/clij2-docs/reference_meanSquaredError

relabel_sequential(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, blocksize: int = 4096, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 labels and maximum label index are equal. This operation is mostly performed on the CPU.

Parameters:
  • input_image (Image) –

  • output_image (Optional[Image] = None) –

  • blocksize (int = 4096) – Renumbering is done in blocks for performance reasons.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_closeIndexGapsInLabelMap

spots_to_pointlist(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 image) with the coordinates of the maxima/minima.

Parameters:
  • input_image (Image) –

  • output_image (Optional[Image] = None) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_spotsToPointList

threshold_otsu(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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) –

  • output_image (Optional[Image] = None) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_thresholdOtsu

[2] https://scikit-image.org/docs/dev/api/skimage.filters.html#skimage.filters.threshold_otsu [3] https://ieeexplore.ieee.org/document/4310076

tier5

array_equal(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, device: pyclesperanto._pyclesperanto._Device | None = 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 to work similarly like its counterpart in numpy [1].

Parameters:
  • input_image0 (Image) –

  • input_image1 (Image) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

bool

References

[1] https://numpy.org/doc/stable/reference/generated/numpy.array_equal.html

combine_labels(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, input_image1: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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. Afterwards, labels are relabeled sequentially.

Parameters:
  • input_image0 (Image) – label image to add labels to.

  • input_image1 (Image) – label image to add labels from.

  • output_image (Optional[Image] = None) – Output label image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

connected_components_labeling(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, connectivity: str = 'box', device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Performs connected components analysis inspecting the box neighborhood of every pixel to a binary image and generates a label map.

Parameters:
  • input_image (Image) – Binary image to label.

  • output_image (Optional[Image] = None) – Output label image.

  • connectivity (str = 'box') – Defines pixel neighborhood relationship, “box” or “sphere”.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_connectedComponentsLabelingBox

tier6

dilate_labels(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius: int = 2, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Dilates labels to a larger size. No label overwrites another label. Similar to the implementation in scikitimage [2] and MorpholibJ[3] Notes * This operation assumes input images are isotropic.

Parameters:
  • input_image (Image) – label image to erode

  • output_image (Optional[Image] = None) – result

  • radius (int = 2) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

erode_labels(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius: int = 1, relabel: bool = False, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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, overlapping labels of input and output may not have the same identifier. Notes * This operation assumes input images are isotropic.

Parameters:
  • input_image (Image) – result

  • output_image (Optional[Image] = None) –

  • radius (int = 1) –

  • relabel (bool = False) – and all label indices exist.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

gauss_otsu_labeling(input_image0: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, outline_sigma: float = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Labels objects directly from grey-value images. The outline_sigma parameter allows tuning the segmentation result. Under the hood, this filter applies a Gaussian blur, Otsu-thresholding [1] and connected component labeling [2]. The thresholded binary image is flooded using the Voronoi tesselation approach starting from the found local maxima.

Parameters:
  • input_image0 (Image) – intensity image to add labels

  • output_image (Optional[Image] = None) – Output label image.

  • outline_sigma (float = 0) – Gaussian blur sigma along all axes

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://ieeexplore.ieee.org/document/4310076

[2] https://en.wikipedia.org/wiki/Connected-component_labeling

masked_voronoi_labeling(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, mask: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 area. The resulting label map is written to the output.

Parameters:
  • input_image (Image) –

  • mask (Image) –

  • output_image (Optional[Image] = None) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_maskedVoronoiLabeling

voronoi_labeling(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 output.

Parameters:
  • input_image (Image) –

  • output_image (Optional[Image] = None) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_voronoiLabeling

tier7

affine_transform(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, transform_matrix: list | None = None, interpolate: bool = False, resize: bool = False, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 should be row-major, i.e. the first 3 elements are the first row of the matrix. If no matrix is given, the identity matrix will be used.

Parameters:
  • input_image (Image) – Input Array to be transformed.

  • output_image (Optional[Image] = None) – Output Array.

  • transform_matrix (Optional[list] = None) – Affine transformation matrix (3x3 or 4x4).

  • interpolate (bool = False) – If true, bi/trilinear interpolation will be applied, if hardware allows.

  • resize (bool = False) – Automatically determines the size of the output depending on the rotation angles.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

closing_labels(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius: int = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 diamond/sphere structuring elements are used and thus, the operation has an octagon as structuring element. Notes * This operation assumes input images are isotropic.

Parameters:
  • input_image (Image) – Input label Array.

  • output_image (Optional[Image] = None) – Output label Array.

  • radius (int = 0) – Radius size for the closing.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

erode_connected_labels(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius: int = 1, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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, overlapping labels of input and output may not have the same identifier.

Parameters:
  • input_image (Image) – result

  • output_image (Optional[Image] = None) –

  • radius (int = 1) –

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

eroded_otsu_labeling(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, number_of_erosions: int = 5, outline_sigma: float = 2, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Segments and labels an image using blurring, Otsu-thresholding, binary erosion and masked Voronoi-labeling. After bluring and Otsu-thresholding the image, iterative binary erosion is applied. Objects in the eroded image are labeled and the labels are extended to fit again into the initial binary image using masked-Voronoi labeling. This function is similar to voronoi_otsu_labeling. It is intended to deal better in case labels of objects swapping into each other if objects are dense. Like when using Voronoi-Otsu-labeling, small objects may disappear when applying this operation. This function is inspired by a similar implementation in Java by Jan Brocher (Biovoxxel) [0] [1]

Parameters:
  • input_image (Image) – Input Array to be transformed.

  • output_image (Optional[Image] = None) – Output Array.

  • number_of_erosions (int = 5) – Number of iteration of erosion.

  • outline_sigma (float = 2) – Gaussian blur sigma applied before Otsu thresholding.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://github.com/biovoxxel/bv3dbox (BV_LabelSplitter.java#L83)

[2] https://zenodo.org/badge/latestdoi/434949702

opening_labels(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, radius: int = 0, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 diamond/sphere structuring elements are used and thus, the operation has an octagon as structuring element. Notes * This operation assumes input images are isotropic.

Parameters:
  • input_image (Image) – Input label Array.

  • output_image (Optional[Image] = None) – Output label Array.

  • radius (int = 0) – Radius size for the opening.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

rigid_transform(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = 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: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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: angle_in_degrees = angle_in_radians / numpy.pi * 180.0

Parameters:
  • input_image (Image) – Input Array to be transformed.

  • output_image (Optional[Image] = None) – Output Array.

  • translate_x (float = 0) – Translation along x axis in pixels.

  • translate_y (float = 0) – Translation along y axis in pixels.

  • translate_z (float = 0) – Translation along z axis in pixels.

  • angle_x (float = 0) – Rotation around x axis in radians.

  • angle_y (float = 0) – Rotation around y axis in radians.

  • angle_z (float = 0) – Rotation around z axis in radians.

  • centered (bool = True) – If true, rotate image around center, else around the origin.

  • interpolate (bool = False) – If true, bi/trilinear interpolation will be applied, if hardware allows.

  • resize (bool = False) – Automatically determines the size of the output depending on the rotation angles.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

rotate(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, angle_x: float = 0, angle_y: float = 0, angle_z: float = 0, centered: bool = True, interpolate: bool = False, resize: bool = False, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

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 / numpy.pi * 180.0

Parameters:
  • input_image (Image) – Input Array to be rotated.

  • output_image (Optional[Image] = None) – Output Array.

  • angle_x (float = 0) – Rotation around x axis in degrees.

  • angle_y (float = 0) – Rotation around y axis in degrees.

  • angle_z (float = 0) – Rotation around z axis in degrees.

  • centered (bool = True) – If true, rotate image around center, else around the origin.

  • interpolate (bool = False) – If true, bi/trilinear interpolation will be applied, if hardware allows.

  • resize (bool = False) – Automatically determines the size of the output depending on the rotation angles.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

scale(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, factor_x: float = 1, factor_y: float = 1, factor_z: float = 1, centered: bool = True, interpolate: bool = False, resize: bool = False, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Scale the image by given factors.

Parameters:
  • input_image (Image) – Input Array to be scaleded.

  • output_image (Optional[Image] = None) – Output Array.

  • factor_x (float = 1) – Scaling along x axis.

  • factor_y (float = 1) – Scaling along y axis.

  • factor_z (float = 1) – Scaling along z axis.

  • centered (bool = True) – If true, the image will be scaled to the center of the image.

  • interpolate (bool = False) – If true, bi/trilinear interplation will be applied.

  • resize (bool = False) – Automatically determines output size image.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

translate(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, translate_x: float = 0, translate_y: float = 0, translate_z: float = 0, interpolate: bool = False, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Translate the image by a given vector.

Parameters:
  • input_image (Image) – Input Array to be translated.

  • output_image (Optional[Image] = None) – Output Array.

  • translate_x (float = 0) – Translation along x axis in pixels.

  • translate_y (float = 0) – Translation along y axis in pixels.

  • translate_z (float = 0) – Translation along z axis in pixels.

  • interpolate (bool = False) – If true, bi/trilinear interplation will be applied.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

voronoi_otsu_labeling(input_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array, output_image: numpy.ndarray | pyclesperanto._pyclesperanto._Array | None = None, spot_sigma: float = 2, outline_sigma: float = 2, device: pyclesperanto._pyclesperanto._Device | None = None) numpy.ndarray | pyclesperanto._pyclesperanto._Array

Labels objects directly from greyvalue images. The two sigma parameters allow tuning the segmentation result. Under the hood, this filter applies two Gaussian blurs, spot detection, Otsuthresholding [2] and Voronoilabeling [3]. The thresholded binary image is flooded using the Voronoi tesselation approach starting from the found local maxima. Notes * This operation assumes input images are isotropic.

Parameters:
  • input_image (Image) – Input intensity Array.

  • output_image (Optional[Image] = None) – Output label Array.

  • spot_sigma (float = 2) – Controls how close detected cells can be.

  • outline_sigma (float = 2) – Controls how precise segmented objects are outlined.

  • device (Optional[Device] = None) – Device to perform the operation on.

Return type:

Image

References

[1] https://clij.github.io/clij2-docs/reference_voronoiOtsuLabeling

[2] https://ieeexplore.ieee.org/document/4310076 [3] https://en.wikipedia.org/wiki/Voronoi_diagram