API reference
You find the documentation on github. Here you only find the API reference.
- class pyclesperanto_prototype.AffineTransform3D(transform=None, image=None)
This class is a convenience class to setup affine transform matrices. When initialized, this object corresponds to a null transform. Afterwards, you can append transforms, e.g. by calling transform.translate(10, 20).
The API aims to be compatible to Imglib2 AffineTransform3D.
- center(shape, undo: bool = False)
Change the center of the image to the root of the coordinate system
- Parameters
shape (iterable) – shape of the image which should be centered
undo (bool, optional) – if False (default), the image is moved so that the center of the image is in the root of the coordinate system if True, it is translated in the opposite direction
- Return type
self
- concatenate(transform)
Concatenate an AffineTransform3D with another.
- Parameters
transform (AffineTransform3D) –
- Return type
self
- copy()
Makes a copy of the current transform which can then be manipulated without changing the source.
- Return type
copy of the current transform
- inverse()
Computes the inverse of the transformation.
This can be useful, e.g. when you want to know the transformation from image B to image A but you only know the transformation from A to B.
- Return type
self
- rotate(axis: int = 2, angle_in_degrees: float = 0)
Rotation around a given axis (default: z-axis, meaning rotation in x-y-plane)
- Parameters
axis (int) – axis to rotate around (0=x, 1=y, 2=z)
angle_in_degrees (int) – angle in degrees. To convert radians to degrees use this formula: angle_in_deg = angle_in_rad / numpy.pi * 180.0
- Return type
self
- rotate_around_x_axis(angle_in_degrees: float)
Rotation around the X-axis.
- Parameters
angle_in_degrees (int) – angle in degrees. To convert radians to degrees use this formula: angle_in_deg = angle_in_rad / numpy.pi * 180.0
- Return type
self
- rotate_around_y_axis(angle_in_degrees: float)
Rotation around the Y-axis.
- Parameters
angle_in_degrees (int) – angle in degrees. To convert radians to degrees use this formula: angle_in_deg = angle_in_rad / numpy.pi * 180.0
- Return type
self
- rotate_around_z_axis(angle_in_degrees: float)
Rotation around the Z-axis.
- Parameters
angle_in_degrees (int) – angle in degrees. To convert radians to degrees use this formula: angle_in_deg = angle_in_rad / numpy.pi * 180.0
- Return type
self
- scale(scale_x: Optional[float] = None, scale_y: Optional[float] = None, scale_z: Optional[float] = None)
Scaling the current affine transform matrix.
- Parameters
scale_x (float) – scaling along x axis
scale_y (float) – scaling along y axis
scale_z (float) – scaling along z axis
- Return type
self
- shear_in_x_plane(angle_y_in_degrees: float = 0, angle_z_in_degrees: float = 0)
Shear image in X-plane (a.k.a. YZ-plane) along Y and/or Z direction.
Tip: This can be used for single objective lightsheet image reconstruction / deskewing. For Janelia lattice, use angle_x_in_degrees and for Zeiss lattice, use angle_y_in_degrees.
- Angles need to be specified in degrees. To convert radians to degrees use this formula:
angle_in_deg = angle_in_rad / numpy.pi * 180.0
- Parameters
(float (angle_z_in_degrees) – shear angle along Y-axis in degrees. Defaults to 0.
optional) – shear angle along Y-axis in degrees. Defaults to 0.
(float – shear angle along Z-axis in degrees. Defaults to 0.
optional) – shear angle along Z-axis in degrees. Defaults to 0.
- Return type
self
- shear_in_y_plane(angle_x_in_degrees: float = 0, angle_z_in_degrees: float = 0)
Shear image in Y-plane (a.k.a. XZ-plane) along X and/or Z direction.
- Angles need to be specified in degrees. To convert radians to degrees use this formula:
angle_in_deg = angle_in_rad / numpy.pi * 180.0
- Parameters
(float (angle_z_in_degrees) – shear angle along Y-axis in degrees. Defaults to 0.
optional) – shear angle along Y-axis in degrees. Defaults to 0.
(float – shear angle along Z-axis in degrees. Defaults to 0.
optional) – shear angle along Z-axis in degrees. Defaults to 0.
- Return type
self
- shear_in_z_plane(angle_x_in_degrees: float = 0, angle_y_in_degrees: float = 0)
Shear image in Z-plane (a.k.a. XY-plane) along X and/or Y direction.
- Angles need to be specified in degrees. To convert radians to degrees use this formula:
angle_in_deg = angle_in_rad / numpy.pi * 180.0
- Parameters
(float (angle_y_in_degrees) – shear angle along X-axis in degrees. Defaults to 0.
optional) – shear angle along X-axis in degrees. Defaults to 0.
(float – shear angle along Y-axis in degrees. Defaults to 0.
optional) – shear angle along Y-axis in degrees. Defaults to 0.
- Return type
self
- translate(translate_x: float = 0, translate_y: float = 0, translate_z: float = 0)
Translation along axes.
- Parameters
translate_x (float) – translation along x-axis
translate_y (float) – translation along y-axis
translate_z (float) – translation along z-axis
- Return type
self
- class pyclesperanto_prototype.STATISTICS_ENTRY(value)
This enum allows to access a specific column in a measurement table corresponding to a specific measurement. It is the python counter part for the Java version in CLIJ2: https://github.com/clij/clij2/blob/master/src/main/java/net/haesleinhuepf/clij2/plugins/StatisticsOfLabelledPixels.java#L30
- BOUNDING_BOX_DEPTH = 9
- BOUNDING_BOX_END_X = 4
- BOUNDING_BOX_END_Y = 5
- BOUNDING_BOX_END_Z = 6
- BOUNDING_BOX_HEIGHT = 8
- BOUNDING_BOX_WIDTH = 7
- BOUNDING_BOX_X = 1
- BOUNDING_BOX_Y = 2
- BOUNDING_BOX_Z = 3
- CENTROID_X = 25
- CENTROID_Y = 26
- CENTROID_Z = 27
- IDENTIFIER = 0
- MASS_CENTER_X = 19
- MASS_CENTER_Y = 20
- MASS_CENTER_Z = 21
- MAXIMUM_INTENSITY = 11
- MAX_DISTANCE_TO_CENTROID = 34
- MAX_DISTANCE_TO_MASS_CENTER = 30
- MAX_MEAN_DISTANCE_TO_CENTROID_RATIO = 35
- MAX_MEAN_DISTANCE_TO_MASS_CENTER_RATIO = 31
- MEAN_DISTANCE_TO_CENTROID = 33
- MEAN_DISTANCE_TO_MASS_CENTER = 29
- MEAN_INTENSITY = 12
- MINIMUM_INTENSITY = 10
- NUMBER_OF_ENTRIES = 36
- PIXEL_COUNT = 15
- STANDARD_DEVIATION_INTENSITY = 14
- SUM_DISTANCE_TO_CENTROID = 32
- SUM_DISTANCE_TO_MASS_CENTER = 28
- SUM_INTENSITY = 13
- SUM_INTENSITY_TIMES_X = 16
- SUM_INTENSITY_TIMES_Y = 17
- SUM_INTENSITY_TIMES_Z = 18
- SUM_X = 22
- SUM_Y = 23
- SUM_Z = 24
- pyclesperanto_prototype.absolute(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the absolute value of every individual pixel x in a given image.
<pre>f(x) = |x| </pre>
- Parameters
source (Image) – The input image to be processed.
destination (Image, optional) – The output image where results are written into.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.absolute(source, destination)
References
- pyclesperanto_prototype.absolute_difference(source1: Union[ndarray, OCLArray, Image, _OCLImage], source2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the absolute difference pixel by pixel between two images.
<pre>f(x, y) = |x - y| </pre>
- Parameters
source1 (Image) – The input image to be subtracted from.
source2 (Image) – The input image which is subtracted.
destination (Image, optional) – The output image where results are written into.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.absolute_difference(source1, source2, destination)
References
- pyclesperanto_prototype.add_image_and_scalar(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, scalar: float = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Adds a scalar value s to all pixels x of a given image X.
<pre>f(x, s) = x + s</pre>
- Parameters
source (Image) – The input image where scalare should be added.
destination (Image, optional) – The output image where results are written into.
scalar (float, optional) – The constant number which will be added to all pixels.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.add_image_and_scalar(source, destination, scalar)
References
- pyclesperanto_prototype.add_images(summand1: Union[ndarray, OCLArray, Image, _OCLImage], summand2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Calculates the sum of pairs of pixels x and y of two images X and Y.
<pre>f(x, y) = x + y</pre>
- Parameters
summand1 (Image) – The first input image to added.
summand2 (Image) – The second image to be added.
destination (Image, optional) – The output image where results are written into.
- Return type
destination
References
- pyclesperanto_prototype.add_images_weighted(summand1: Union[ndarray, OCLArray, Image, _OCLImage], summand2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, factor1: float = 1, factor2: float = 1) Union[ndarray, OCLArray, Image, _OCLImage]
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
summand1 (Image) – The first input image to added.
summand2 (Image) – The second image to be added.
destination (Image, optional) – The output image where results are written into.
factor1 (float, optional) – The constant number which will be multiplied with each pixel of summand1 before adding it.
factor2 (float, optional) – The constant number which will be multiplied with each pixel of summand2 before adding it.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.add_images_weighted(summand1, summand2, destination, factor1, factor2)
References
- pyclesperanto_prototype.affine_transform(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, transform: Union[ndarray, AffineTransform3D, AffineTransform] = None, linear_interpolation: bool = False, auto_size: bool = False) Union[ndarray, OCLArray, Image, _OCLImage]
Applies an affine transform to an image.
- Parameters
source (Image) – image to be transformed
destination (Image, optional) – image where the transformed image should be written to
transform (4x4 numpy array or AffineTransform3D object or skimage.transform.AffineTransform object or str, optional) – transform matrix or object or string describing the transformation
linear_interpolation (bool, optional) – If true, bi-/tri-linear interplation will be applied; if hardware supports it. If false, nearest-neighbor interpolation wille be applied.
auto_size (bool, optional) – If true, modifies the transform and the destination image size will be determined automatically, depending on the provided transform. the transform might be modified so that all voxels of the result image have positions x>=0, y>=0, z>=0 and sit tight to the coordinate origin. No voxels will cropped, the result image will fit in the returned destination. Hence, the applied transform may have an additional translation vector that was not explicitly provided. This also means that any given translation vector will be neglected. If false, the destination image will have the same size as the input image. Note: The value of auto-size is ignored if: destination is not None or transform is not an instance of AffineTransform3D.
- Return type
destination
- pyclesperanto_prototype.apply_vector_field(source: Union[ndarray, OCLArray, Image, _OCLImage], vector_x: Union[ndarray, OCLArray, Image, _OCLImage], vector_y: Union[ndarray, OCLArray, Image, _OCLImage], vector_z: Union[ndarray, OCLArray, Image, _OCLImage] = None, destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, linear_interpolation: bool = False) Union[ndarray, OCLArray, Image, _OCLImage]
Deforms an image stack according to distances provided in the given vector image stacks.
- Parameters
source (Image) – The input image to be processed.
vector_x (Image) – Pixels in this image describe the distance in X direction pixels should be shifted during warping.
vector_y (Image) – Pixels in this image describe the distance in Y direction pixels should be shifted during warping.
vector_z (Image, optional) – Pixels in this image describe the distance in Z direction pixels should be shifted during warping.
destination (Image, optional) – The output image where results are written into.
linear_interpolation (bool, optional) –
- Return type
destination
- pyclesperanto_prototype.arg_maximum_z_projection(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines a Z-position of the maximum intensity along Z and writes it into the resulting image.
If there are multiple z-slices with the same value, the smallest Z will be chosen.
- Parameters
source (Image) – Input image stack
destination (Image, optional) – altitude map
- Return type
destination
See also
- pyclesperanto_prototype.arg_minimum_z_projection(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines a Z-position of the minimum intensity along Z and writes it into the resulting image.
If there are multiple z-slices with the same value, the smallest Z will be chosen.
- Parameters
source (Image) – Input image stack
destination (Image, optional) – altitude map
- Return type
destination
See also
- pyclesperanto_prototype.array_equal(source1: Union[ndarray, OCLArray, Image, _OCLImage], source2: Union[ndarray, OCLArray, Image, _OCLImage]) 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
source1 (Image) –
source2 (Image) –
- Return type
bool
References
..[1] https://numpy.org/doc/stable/reference/generated/numpy.array_equal.html
- pyclesperanto_prototype.array_equiv(source1: Union[ndarray, OCLArray, Image, _OCLImage], source2: Union[ndarray, OCLArray, Image, _OCLImage]) 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
source1 (Image) –
source2 (Image) –
- Return type
bool
References
..[1] https://numpy.org/doc/stable/reference/generated/numpy.array_equal.html
- pyclesperanto_prototype.artificial_objects_2d() Union[ndarray, OCLArray, Image, _OCLImage]
Creates an image showing artificial objects such as lines, blobs, membranes and nuclei.
For practical application, it is recommended to blur this image, and up/downscale it.
- Returns
image
- Return type
Image
- pyclesperanto_prototype.artificial_tissue_2d(width: int = 256, height: int = 256, delta_x=24, delta_y=16, random_sigma_x=3, random_sigma_y=3) Union[ndarray, OCLArray, Image, _OCLImage]
- Parameters
width –
height –
delta_x –
delta_y –
random_sigma_x –
random_sigma_y –
- pyclesperanto_prototype.asarray(any_array)
Copies an image to GPU memory and returns its handle
Deprecated since version 0.6.0: push behaviour will be changed pyclesperanto_prototype 0.7.0 to do the same as push_zyx because it’s faster and having both doing different things is confusing.
- Parameters
image (numpy array) –
- Return type
object of type backend.array_type()
Examples
>>> import pyclesperanto_prototype as cle >>> cle.push(image)
References
- pyclesperanto_prototype.available_device_names(dev_type: Optional[str] = None, score_key=None) List[str]
Retrieve a list of names of available OpenCL-devices
- Parameters
dev_type (str) – ‘cpu’, ‘gpu’, or None; None means any type of device
score_key (callable) – scoring function, accepts device and returns int, defaults to None
- Return type
list of OpenCL-device names
See also
filter_devices
Returns list of devices instead of device names
Examples
>>> import pyclesperanto_prototype as cle >>> gpu_devices = cle.available_device_names(dev_type="gpu") >>> print("Available GPU OpenCL devices:" + str(gpu_devices)) >>> >>> cpu_devices = cle.available_device_names(dev_type="cpu") >>> print("Available CPU OpenCL devices:" + str(cpu_devices))
- pyclesperanto_prototype.average_distance_of_n_closest_neighbors_map(labels: Union[ndarray, OCLArray, Image, _OCLImage], distance_map: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines distances between all centroids and replaces every label with the average distance to the n closest neighboring labels.
- Parameters
labels (Image) –
distance_map (Image, optional) –
n (Number, optional) –
- Return type
distance_map
References
- pyclesperanto_prototype.average_distance_of_n_closest_points(distance_matrix: Union[ndarray, OCLArray, Image, _OCLImage], distance_vector_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the n shortest distances for each column in a distance matrix and puts the average of these in a vector.
Note: This function takes the distance to the identical label NOT into account.
- Parameters
distance_matrix (Image) –
distance_vector_destination (Image, optional) –
n (int) –
- Return type
distance_vector_destination
- pyclesperanto_prototype.average_distance_of_n_far_off_distances(distance_matrix: Union[ndarray, OCLArray, Image, _OCLImage], distance_vector_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the n highest distances for each column in a distance matrix and puts the average of these in a vector.
- Parameters
distance_matrix (Image) –
distance_vector_destination (Image, optional) –
n (int) –
- Return type
distance_vector_destination
- pyclesperanto_prototype.average_distance_of_n_far_off_points(distance_matrix: Union[ndarray, OCLArray, Image, _OCLImage], distance_vector_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the n highest distances for each column in a distance matrix and puts the average of these in a vector.
- Parameters
distance_matrix (Image) –
distance_vector_destination (Image, optional) –
n (int) –
- Return type
distance_vector_destination
- pyclesperanto_prototype.average_distance_of_n_nearest_distances(distance_matrix: Union[ndarray, OCLArray, Image, _OCLImage], distance_vector_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the n shortest distances for each column in a distance matrix and puts the average of these in a vector.
Note: This function takes the distance to the identical label into account.
- Parameters
distance_matrix (Image) –
distance_vector_destination (Image, optional) –
n (int) –
- Return type
distance_vector_destination
- pyclesperanto_prototype.average_distance_of_n_nearest_neighbors_map(labels: Union[ndarray, OCLArray, Image, _OCLImage], distance_map: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines distances between all centroids and replaces every label with the average distance to the n closest neighboring labels.
- Parameters
labels (Image) –
distance_map (Image, optional) –
n (Number, optional) –
- Return type
distance_map
References
- pyclesperanto_prototype.average_distance_of_n_shortest_distances(distance_matrix: Union[ndarray, OCLArray, Image, _OCLImage], distance_vector_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the n shortest distances for each column in a distance matrix and puts the average of these in a vector.
Note: This function takes the distance to the identical label NOT into account.
- Parameters
distance_matrix (Image) –
distance_vector_destination (Image, optional) –
n (int) –
- Return type
distance_vector_destination
- pyclesperanto_prototype.average_distance_of_touching_neighbors(distance_matrix: Union[ndarray, OCLArray, Image, _OCLImage], touch_matrix: Union[ndarray, OCLArray, Image, _OCLImage], average_distancelist_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a touch matrix and a distance matrix to determine the average distance of touching neighbors
for every object.
- Parameters
distance_matrix (Image) –
touch_matrix (Image) –
average_distancelist_destination (Image, optional) –
- Return type
average_distancelist_destination
References
- pyclesperanto_prototype.average_distance_to_n_nearest_other_labels_map(labels: Union[ndarray, OCLArray, Image, _OCLImage], other_labels: Union[ndarray, OCLArray, Image, _OCLImage], distance_map: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Takes two label maps and determines the centroid distances from each label in the first label image to the labels in the second. The average distance of the n nearest neighbors is then averaged and stored in a parametric distance map image.
- Parameters
labels (Image) –
other_labels (Image) –
distance_map (Image, optional) –
n (Number, optional) –
- Return type
distance_map
- pyclesperanto_prototype.average_neighbor_distance_map(labels: Union[ndarray, OCLArray, Image, _OCLImage], distance_map: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines which labels touch and replaces every label with the average distance to their neighboring labels.
To determine the distances, the centroid of the labels is determined internally.
- Parameters
input (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.binary_and(operand1: Union[ndarray, OCLArray, Image, _OCLImage], operand2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
operand1 (Image) – The first binary input image to be processed.
operand2 (Image) – The second binary input image to be processed.
destination (Image, optional) – The output image where results are written into.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.binary_and(operand1, operand2, destination)
References
- pyclesperanto_prototype.binary_edge_detection(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) – The binary input image where edges will be searched.
destination (Image, optional) – The output image where edge pixels will be 1.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.binary_edge_detection(source, destination)
References
- pyclesperanto_prototype.binary_intersection(operand1: Union[ndarray, OCLArray, Image, _OCLImage], operand2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
operand1 (Image) – The first binary input image to be processed.
operand2 (Image) – The second binary input image to be processed.
destination (Image, optional) – The output image where results are written into.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.binary_and(operand1, operand2, destination)
References
- pyclesperanto_prototype.binary_not(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) – The binary input image to be inverted.
destination (Image, optional) – The output image where results are written into.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.binary_not(source, destination)
References
- pyclesperanto_prototype.binary_or(operand1: Union[ndarray, OCLArray, Image, _OCLImage], operand2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
operand1 (Image) – The first binary input image to be processed.
operand2 (Image) – The second binary input image to be processed.
destination (Image, optional) – The output image where results are written into.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.binary_or(operand1, operand2, destination)
References
- pyclesperanto_prototype.binary_subtract(minuend: Union[ndarray, OCLArray, Image, _OCLImage], subtrahend: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Subtracts one binary image from another.
- Parameters
minuend (Image) – The first binary input image to be processed.
subtrahend (Image) – The second binary input image to be subtracted from the first.
destination (Image, optional) – The output image where results are written into.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.binary_subtract(minuend, subtrahend, destination)
References
- pyclesperanto_prototype.binary_union(operand1: Union[ndarray, OCLArray, Image, _OCLImage], operand2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
operand1 (Image) – The first binary input image to be processed.
operand2 (Image) – The second binary input image to be processed.
destination (Image, optional) – The output image where results are written into.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.binary_or(operand1, operand2, destination)
References
- pyclesperanto_prototype.binary_xor(operand1: Union[ndarray, OCLArray, Image, _OCLImage], operand2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
operand1 (Image) – The first binary input image to be processed.
operand2 (Image) – The second binary input image to be processed.
destination (Image, optional) – The output image where results are written into.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.binary_xor(operand1, operand2, destination)
References
- pyclesperanto_prototype.block_enumerate(src: Union[ndarray, OCLArray, Image, _OCLImage], src_sums: Union[ndarray, OCLArray, Image, _OCLImage], dst: Union[ndarray, OCLArray, Image, _OCLImage] = None, blocksize: int = 256) Union[ndarray, OCLArray, Image, _OCLImage]
Enumerates pixels with value 1 in a one-dimensional 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 labeling.
Processing is accelerated by paralellization in blocks. Therefore, handing over pre-computed block sums is neccessary (see also sum_reduction_x). In the above example, with blocksize 4, that would be the sum array: [2, 3] Note that the block size when calling this function and sum_reduction must be identical
- Parameters
src (Image) – input binary vector image
src_sums (Image) – pre-computed sums of blocks
dst (Image, optional) – output enumerated vector image
blocksize (int, optional) – blocksize; must correspond correctly to how the block sums were computed
- Return type
dst
- pyclesperanto_prototype.bottom_hat_box(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Apply a bottom-hat filter for background subtraction to the input image.
- Parameters
source (Image) – The input image where the background is subtracted from.
destination (Image, optional) – The output image where results are written into.
radius_x (Image, optional) – Radius of the background determination region in X.
radius_y (Image, optional) – Radius of the background determination region in Y.
radius_z (Image, optional) – Radius of the background determination region in Z.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.bottom_hat_box(input, destination, radiusX, radiusY, radiusZ)
References
- pyclesperanto_prototype.bottom_hat_sphere(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Applies a bottom-hat filter for background subtraction to the input image.
- Parameters
source (Image) – The input image where the background is subtracted from.
destination (Image, optional) – The output image where results are written into.
radius_x (Image, optional) – Radius of the background determination region in X.
radius_y (Image, optional) – Radius of the background determination region in Y.
radius_z (Image, optional) – Radius of the background determination region in Z.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.bottom_hat_sphere(input, destination, radiusX, radiusY, radiusZ)
References
- pyclesperanto_prototype.bounding_box(source: Union[ndarray, OCLArray, Image, _OCLImage])
Determines the bounding box of all non-zero pixels in a binary image.
If called from macro, the positions will be stored in a new row of ImageJs Results table in the columns ‘BoundingBoxX’, ‘BoundingBoxY’, ‘BoundingBoxZ’, ‘BoundingBoxWidth’, ‘BoundingBoxHeight’ ‘BoundingBoxDepth’.In case of 2D images Z and depth will be zero.
- Parameters
source (Image) –
- Returns
in 2D: min_x, min_y, max_x, max_y in 3D: min_x, min_y, min_z, max_x, max_y, max_z
- Return type
list of ints
Examples
>>> import pyclesperanto_prototype as cle >>> cle.bounding_box(source)
References
- pyclesperanto_prototype.categories()
- pyclesperanto_prototype.cbrt(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the cubic root of each pixel.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
- pyclesperanto_prototype.center_of_mass(source: Union[ndarray, OCLArray, Image, _OCLImage])
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
source (Image) –
- Returns
list of coordinates
- Return type
[x,y,z]
Examples
>>> import pyclesperanto_prototype as cle >>> cle.center_of_mass(source)
References
- pyclesperanto_prototype.centroids_of_background_and_labels(source: Union[ndarray, OCLArray, Image, _OCLImage], pointlist_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
See centroids_of_labels
- pyclesperanto_prototype.centroids_of_labels(labels: Union[ndarray, OCLArray, Image, _OCLImage], pointlist_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, include_background: bool = False) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the centroids of all labels in a label image or image stack.
It writes the resulting coordinates in a pointlist image. Depending on the dimensionality d of the labelmap and the number of labels n, the pointlist image will have n*d pixels.
- Parameters
labels (Image) – input label image
pointlist_destination (Image, optional) – target image of size d*n for a d-dimensional label image with n labels. In case the background should be determined as well, this image needs to be one pixel wider
include_background (bool, optional) – measure the centroid of the background as well
- Return type
pointlist_destination
References
- pyclesperanto_prototype.cl_info()
- pyclesperanto_prototype.clip(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, a_min: float = None, a_max: float = None) Union[ndarray, OCLArray, Image, _OCLImage]
Limits the range of values in an image.
This function is supposed to work similarly as its counter part in numpy [1].
- Parameters
source (Image) –
destination (Image, optional) –
a_min (float, optional) – new, lower limit of the intensity range
a_max (float, optional) – new, upper limit of the intensity range
- Return type
destination
References
- pyclesperanto_prototype.close_index_gaps_in_label_map(source: Union[ndarray, OCLArray, Image, _OCLImage], output: Union[ndarray, OCLArray, Image, _OCLImage] = None, blocksize: int = 4096) Union[ndarray, OCLArray, Image, _OCLImage]
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
labeling_input (Image) –
labeling_destination (Image, optional) –
blocksize (int, optional) – Renumbering is done in blocks for performance reasons. Change the blocksize to adapt to your data and hardware
- Return type
labeling_destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.relabel_sequential(labeling_input, labeling_destination)
References
- pyclesperanto_prototype.closing_box(input_image: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: int = 0, radius_y: int = 0, radius_z: int = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Closing operator, box-shaped
Applies morphological closing to intensity images using a box-shaped footprint. This operator also works with binary images.
- Parameters
input_image (Image) –
destination (Image, optional) –
radius_x (int, optional) –
radius_y (int, optional) –
radius_z (int, optional) –
- Return type
destination
- pyclesperanto_prototype.closing_labels(labels_input: Union[ndarray, OCLArray, Image, _OCLImage], labels_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius: int = 0) Union[ndarray, OCLArray, Image, _OCLImage]
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
labels_input (Image) –
labels_destination (Image, optional) –
radius (int, optional) –
- Returns
labels_destination
- Return type
Image
- pyclesperanto_prototype.closing_sphere(input_image: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Closing operator, sphere-shaped
Applies morphological closing to intensity images using a sphere-shaped footprint. This operator also works with binary images.
- Parameters
input_image (Image) –
destination (Image, optional) –
radius_x (int, optional) –
radius_y (int, optional) –
radius_z (int, optional) –
- Returns
destination
- Return type
Image
- pyclesperanto_prototype.combine_horizontally(stack1: Union[ndarray, OCLArray, Image, _OCLImage], stack2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Combines two images or stacks in X.
- Parameters
stack1 (Image) –
stack2 (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.combine_labels(labels_input1: Union[ndarray, OCLArray, Image, _OCLImage], labels_input2: Union[ndarray, OCLArray, Image, _OCLImage], labels_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
labels_input1 (Image) – label image to add labels to
labels_input2 (Image) – label image to add labels from
labels_destination (Image, optional) – result
- Return type
labels_destination
- pyclesperanto_prototype.combine_vertically(stack1: Union[ndarray, OCLArray, Image, _OCLImage], stack2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Combines two images or stacks in Y.
- Parameters
stack1 (Image) –
stack2 (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.concatenate_stacks(stack1: Union[ndarray, OCLArray, Image, _OCLImage], stack2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Concatenates two stacks in Z.
- Parameters
stack1 (Image) –
stack2 (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.connected_components_labeling_box(binary_input: ~typing.Union[~numpy.ndarray, ~pyclesperanto_prototype._tier0._pycl.OCLArray, ~pyopencl._cl.Image, ~pyclesperanto_prototype._tier0._pycl._OCLImage], labeling_destination: ~typing.Union[~numpy.ndarray, ~pyclesperanto_prototype._tier0._pycl.OCLArray, ~pyopencl._cl.Image, ~pyclesperanto_prototype._tier0._pycl._OCLImage] = None, flagged_nonzero_minimum_filter: callable = <function nonzero_minimum_box>) Union[ndarray, OCLArray, Image, _OCLImage]
Performs connected components analysis inspecting the box neighborhood of every pixel to a binary image and generates a label map.
- Parameters
binary_input (Image) –
labeling_destination (Image, optional) –
- Return type
labeling_destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.connected_components_labeling_box(binary_input, labeling_destination)
References
- pyclesperanto_prototype.connected_components_labeling_diamond(binary_input: Union[ndarray, OCLArray, Image, _OCLImage], labeling_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Performs connected components analysis inspecting the diamond neighborhood of every pixel to a binary image and generates a label map.
- Parameters
binary_input (Image) –
labeling_destination (Image, optional) –
- Return type
labeling_destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.connected_components_labeling_diamond(binary_input, labeling_destination)
References
- pyclesperanto_prototype.convolve(source: Union[ndarray, OCLArray, Image, _OCLImage], convolution_kernel: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
convolution_kernel (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.convolve(source, convolution_kernel, destination)
References
- pyclesperanto_prototype.copy(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Copies an image.
<pre>f(x) = x</pre>
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.copy(source, destination)
References
- pyclesperanto_prototype.copy_horizontal_slice(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, slice_index: int = 0) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
destination (Image, optional) –
slice_index (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.copy_slice(source, destination, slice_index)
References
- pyclesperanto_prototype.copy_slice(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, slice_index: int = 0) Union[ndarray, OCLArray, Image, _OCLImage]
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 pre-exists in GPU memory before calling this method. Otherwise, CLIJ create the image stack with z planes.
- Parameters
source (Image) –
destination (Image, optional) –
slice_index (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.copy_slice(source, destination, slice_index)
References
- pyclesperanto_prototype.copy_vertical_slice(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, slice_index: int = 0) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
destination (Image, optional) –
slice_index (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.copy_slice(source, destination, slice_index)
References
- pyclesperanto_prototype.count_touching_neighbors(touch_matrix: Union[ndarray, OCLArray, Image, _OCLImage], touching_neighbors_count_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, ignore_background: bool = True) Union[ndarray, OCLArray, Image, _OCLImage]
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
touch_matrix (Image) –
touching_neighbors_count_destination (Image, optional) –
- Return type
touching_neighbors_count_destination
References
- pyclesperanto_prototype.create(dimensions, dtype=<class 'numpy.float32'>)
Convenience method for creating images on the GPU. This method basically does the same as in CLIJ:
https://github.com/clij/clij2/blob/master/src/main/java/net/haesleinhuepf/clij2/CLIJ2.java#L156
- Parameters
dimensions – size of the image
- Returns
OCLArray, potentially with random values
- pyclesperanto_prototype.create_2d_xy(source)
- pyclesperanto_prototype.create_2d_xz(source)
- pyclesperanto_prototype.create_2d_yx(source)
- pyclesperanto_prototype.create_2d_yz(source)
- pyclesperanto_prototype.create_2d_zx(source)
- pyclesperanto_prototype.create_2d_zy(source)
- pyclesperanto_prototype.create_binary_like(*args)
- pyclesperanto_prototype.create_from_pointlist(pointlist, *args)
- pyclesperanto_prototype.create_image(arr: ndarray, ctx: Optional[Context] = None, *args, **kwargs) Image
- pyclesperanto_prototype.create_labels_like(*args)
- pyclesperanto_prototype.create_like(*args)
- pyclesperanto_prototype.create_matrix_from_pointlists(pointlist1, pointlist2)
- pyclesperanto_prototype.create_none(*args)
- pyclesperanto_prototype.create_pointlist_from_labelmap(source, *args)
- pyclesperanto_prototype.create_square_matrix_from_labelmap(labelmap)
- pyclesperanto_prototype.create_square_matrix_from_pointlist(pointlist1)
- pyclesperanto_prototype.create_square_matrix_from_two_labelmaps(labelmap1, labelmap2)
- pyclesperanto_prototype.create_vector_from_labelmap(source, *args)
- pyclesperanto_prototype.create_vector_from_square_matrix(square_matrix, *args)
- pyclesperanto_prototype.create_zyx(dimensions)
- pyclesperanto_prototype.crop(source: Union[ndarray, OCLArray, Image, _OCLImage], output: Union[ndarray, OCLArray, Image, _OCLImage] = None, start_x: int = 0, start_y: int = 0, start_z: int = 0, width: int = 1, height: int = 1, depth: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Crops a given sub-stack out of a given image stack.
Note: If the destination image pre-exists already, it will be overwritten and keep it’s dimensions.
- Parameters
source (Image) –
destination (Image, optional) –
start_x (Number, optional) –
start_y (Number, optional) –
start_z (Number, optional) –
width (Number, optional) –
height (Number, optional) –
depth (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.crop(source, destination, start_x, start_y, start_z, width, height, depth)
References
- pyclesperanto_prototype.crop_border(input_image: Union[ndarray, OCLArray, Image, _OCLImage], destination_image: Union[ndarray, OCLArray, Image, _OCLImage] = None, border_size: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
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) –
destination_image (Image) –
border_size (int) –
- Return type
destination_image
- pyclesperanto_prototype.cubic_root(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the cubic root of each pixel.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
- pyclesperanto_prototype.degrees_to_radians(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Converts radians to degrees
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
- pyclesperanto_prototype.deskew_x(input_image: Union[ndarray, OCLArray, Image, _OCLImage], output_image: Union[ndarray, OCLArray, Image, _OCLImage] = None, angle_in_degrees: float = 31.8, voxel_size_x: float = 1, voxel_size_y: float = 1, voxel_size_z: float = 1, scale_factor: float = 1, linear_interpolation: bool = False) Union[ndarray, OCLArray, Image, _OCLImage]
Deskew an image stack as acquired with oblique plane light-sheet microscopy.
- Parameters
input_image (Image) – raw image data with Z-planes representing the tilted / swept acquisition plane
output_image (Image, optional) – reconstructed image data with Z-planes in proximal-distal oriental from the objective
angle_in_degrees (float, optional) – default: 31.8 degrees
voxel_size_x (float, optional) –
voxel_size_y (float, optional) –
voxel_size_z (float, optional) – default: 1 micron Voxel size, typically provided in microns
scale_factor (float, optional) – default: 1 If the resulting image becomes too huge, it is possible to reduce output image size by this factor. The isotropic voxel size of the output image will then be voxel_size_x / scaling_factor.
linear_interpolation (bool, optional) – If true, bi-/tri-linear interpolation will be applied, if hardware supports it. If false, nearest-neighbor interpolation wille be applied.
- Return type
output_image
- pyclesperanto_prototype.deskew_y(input_image: Union[ndarray, OCLArray, Image, _OCLImage], output_image: Union[ndarray, OCLArray, Image, _OCLImage] = None, angle_in_degrees: float = 30, voxel_size_x: float = 1, voxel_size_y: float = 1, voxel_size_z: float = 1, scale_factor: float = 1, linear_interpolation: bool = False) Union[ndarray, OCLArray, Image, _OCLImage]
Deskew an image stack as acquired with oblique plane light-sheet microscopy.
- Parameters
input_image (Image) – raw image data with Z-planes representing the tilted / swept acquisition plane
output_image (Image, optional) – reconstructed image data with Z-planes in proximal-distal oriental from the objective
angle_in_degrees (float, optional) – default: 30 degrees
voxel_size_x (float, optional) –
voxel_size_y (float, optional) –
voxel_size_z (float, optional) – default: 1 micron Voxel size, typically provided in microns
scale_factor (float, optional) – default: 1 If the resulting image becomes too huge, it is possible to reduce output image size by this factor. The isotropic voxel size of the output image will then be voxel_size_x / scaling_factor.
linear_interpolation (bool, optional) – If true, bi-/tri-linear interpolation will be applied, if hardware supports it. If false, nearest-neighbor interpolation wille be applied.
- Return type
output_image
- pyclesperanto_prototype.detect_label_edges(label_source: Union[ndarray, OCLArray, Image, _OCLImage], binary_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a labelmap and returns an image where all pixels on label edges are set to 1 and all other pixels to 0.
- Parameters
label_map (Image) –
edge_image_destination (Image, optional) –
- Return type
edge_image_destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.detect_label_edges(label_map, edge_image_destination)
References
- pyclesperanto_prototype.detect_maxima_box(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: int = 0, radius_y: int = 0, radius_z: int = 0) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
destination (Image, optional) –
radius_x (Number, optional) –
radius_y (Number, optional) –
radius_z (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.detect_maxima_box(source, destination, 1, 1, 1)
References
- pyclesperanto_prototype.detect_minima_box(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: int = 0, radius_y: int = 0, radius_z: int = 0) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
destination (Image, optional) –
radius_x (Number, optional) –
radius_y (Number, optional) –
radius_z (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.detect_minima_box(source, destination, 1, 1, 1)
References
- pyclesperanto_prototype.difference_of_gaussian(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = 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) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) – The input image to be processed.
destination (Image, optional) – The output image where results are written into.
sigma1_x (float, optional) – Sigma of the first Gaussian filter in x
sigma1_y (float, optional) – Sigma of the first Gaussian filter in y
sigma1_z (float, optional) – Sigma of the first Gaussian filter in z
sigma2_x (float, optional) – Sigma of the second Gaussian filter in x
sigma2_y (float, optional) – Sigma of the second Gaussian filter in y
sigma2_z (float, optional) – Sigma of the second Gaussian filter in z
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.difference_of_gaussian(input, destination, sigma1x, sigma1y, sigma1z, sigma2x, sigma2y, sigma2z)
References
- pyclesperanto_prototype.dilate_box(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes a binary image with pixel values 0 and 1 containing the binary dilation of a given input image.
The dilation takes the Moore-neighborhood (8 pixels in 2D and 26 pixels in 3d) into account. The pixels in the input image with pixel value not equal to 0 will be interpreted as 1.
This method is comparable to the ‘Dilate’ menu in ImageJ in case it is applied to a 2D image. The only difference is that the output image contains values 0 and 1 instead of 0 and 255.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.dilate_box(source, destination)
References
- pyclesperanto_prototype.dilate_box_slice_by_slice(src: Union[ndarray, OCLArray, Image, _OCLImage], dst: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes a binary image with pixel values 0 and 1 containing the binary dilation of a given input image.
The dilation takes the Moore-neighborhood (8 pixels in 2D and 26 pixels in 3d) into account. The pixels in the input image with pixel value not equal to 0 will be interpreted as 1.
This method is comparable to the ‘Dilate’ menu in ImageJ in case it is applied to a 2D image. The only difference is that the output image contains values 0 and 1 instead of 0 and 255.
This filter is applied slice by slice in 2D.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.dilate_box_slice_by_slice(source, destination)
References
- pyclesperanto_prototype.dilate_labels(labeling_source: Union[ndarray, OCLArray, Image, _OCLImage], labeling_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius: int = 2) Union[ndarray, OCLArray, Image, _OCLImage]
Dilates labels to a larger size. No label overwrites another label. Similar to the implementation in scikit-image [2] and MorpholibJ[3]
Notes
This operation assumes input images are isotropic.
- Parameters
labels_input (Image) – label image to erode
labels_destination (Image, optional, optional) – result
radius (int, optional) –
- Return type
labels_destination
See also
,
,
- pyclesperanto_prototype.dilate_sphere(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes a binary image with pixel values 0 and 1 containing the binary dilation of a given input image.
The dilation takes the von-Neumann-neighborhood (4 pixels in 2D and 6 pixels in 3d) into account. The pixels in the input image with pixel value not equal to 0 will be interpreted as 1.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.dilate_sphere(source, destination)
References
- pyclesperanto_prototype.dilate_sphere_slice_by_slice(src: Union[ndarray, OCLArray, Image, _OCLImage], dst: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes a binary image with pixel values 0 and 1 containing the binary dilation of a given input image.
The dilation takes the von-Neumann-neighborhood (4 pixels in 2D and 6 pixels in 3d) into account. The pixels in the input image with pixel value not equal to 0 will be interpreted as 1.
This filter is applied slice by slice in 2D.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.dilate_sphere_slice_by_slice(source, destination)
References
- pyclesperanto_prototype.distance_matrix_to_mesh(pointlist: Union[ndarray, OCLArray, Image, _OCLImage], distance_matrix: Union[ndarray, OCLArray, Image, _OCLImage], mesh_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, maximum_distance: float = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Generates a mesh from a distance matric and a list of point coordinates.
Takes a pointlist with dimensions n*d with n point coordinates in d dimensions and a distance matrix of size n*n to draw lines from all points to points if the corresponding pixel in the distance matrix is smaller than a given distance threshold.
- Parameters
pointlist (Image) –
distance_matrix (Image) –
mesh_destination (Image, optional) –
maximum_distance (Number, optional) –
- Return type
mesh_destination
References
- pyclesperanto_prototype.divide_by_gaussian_background(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, sigma_x: float = 2, sigma_y: float = 2, sigma_z: float = 2) Union[ndarray, OCLArray, Image, _OCLImage]
Applies Gaussian blur to the input image and divides the original by the result.
- Parameters
source (Image) –
destination (Image, optional) –
sigma_x (Number, optional) –
sigma_y (Number, optional) –
sigma_z (Number, optional) –
- Return type
destination
References
- pyclesperanto_prototype.divide_images(divident: Union[ndarray, OCLArray, Image, _OCLImage], divisor: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Divides two images X and Y by each other pixel wise.
<pre>f(x, y) = x / y</pre>
- Parameters
divident (Image) –
divisor (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.divide_images(divident, divisor, destination)
References
- pyclesperanto_prototype.divide_scalar_by_image(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, scalar: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Divides a scalar by an image pixel by pixel.
<pre>f(x, s) = s / x</pre>
- Parameters
source (Image) –
destination (Image, optional) –
scalar (Number, optional) –
- Return type
destination
- pyclesperanto_prototype.downsample_slice_by_slice_half_median(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Scales an image using scaling factors 0.5 for X and Y dimensions. The Z dimension stays untouched.
Thus, each slice is processed separately. The median method is applied. Thus, each pixel value in the destination image equals to the median of four corresponding pixels in the source image.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.downsample_xy_by_half_median(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Scales an image using scaling factors 0.5 for X and Y dimensions. The Z dimension stays untouched.
Thus, each slice is processed separately. The median method is applied. Thus, each pixel value in the destination image equals to the median of four corresponding pixels in the source image.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.draw_angle_mesh_between_touching_labels(labels: Union[ndarray, OCLArray, Image, _OCLImage], angle_mesh_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Starting from a label map, draw lines between touching neighbors resulting in a mesh.
The end points of the lines correspond to the centroids of the labels. The intensity of the lines corresponds to the angle in degrees between these labels (in pixels or voxels).
- Parameters
labels (Image) –
angle_mesh_destination (Image) –
- Return type
angle_mesh_destination
References
- pyclesperanto_prototype.draw_box(destination: Union[ndarray, OCLArray, Image, _OCLImage], x: int = 0, y: int = 0, z: int = 0, width: int = 1, height: int = 1, depth: int = 1, value: float = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Draws a box at a given start point with given size. All pixels other than in the box are untouched. Consider using set(buffer, 0); in advance.
- Parameters
destination (Image) –
x (Number, optional) –
y (Number, optional) –
z (Number, optional) –
width (Number, optional) –
height (Number, optional) –
depth (Number, optional) –
value (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.draw_box(destination, x, y, z, width, height, depth, value)
References
- pyclesperanto_prototype.draw_distance_mesh_between_proximal_labels(labels: Union[ndarray, OCLArray, Image, _OCLImage], distance_mesh_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, maximum_distance: float = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Starting from a label map, draw lines between neighbors that a closer than a defined upper bound resulting in a mesh.
The end points of the lines correspond to the centroids of the labels. The intensity of the lines corresponds to the distance between these labels (in pixels or voxels).
Notes
This operation assumes input images are isotropic.
- Parameters
labels (Image) –
distance_mesh_destination (Image, optional) –
maximum_distance (float, optional) –
- Return type
destination
References
- pyclesperanto_prototype.draw_distance_mesh_between_touching_labels(labels: Union[ndarray, OCLArray, Image, _OCLImage], distance_mesh_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Starting from a label map, draw lines between touching neighbors resulting in a mesh.
The end points of the lines correspond to the centroids of the labels. The intensity of the lines corresponds to the distance between these labels (in pixels or voxels).
Notes
This operation assumes input images are isotropic.
- Parameters
labels (Image) –
distance_mesh_destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.draw_line(destination: Union[ndarray, OCLArray, Image, _OCLImage], x1: float = 0, y1: float = 0, z1: float = 0, x2: float = 1, y2: float = 1, z2: float = 1, thickness: float = 1, value: float = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Draws a line between two points with a given thickness.
All pixels other than on the line are untouched. Consider using set(buffer, 0); in advance.
- Parameters
destination (Image) –
x1 (Number, optional) –
y1 (Number, optional) –
z1 (Number, optional) –
x2 (Number, optional) –
y2 (Number, optional) –
z2 (Number, optional) –
thickness (Number, optional) – technically specifying the radius including pixels around an inifitely thin line
value (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.draw_line(destination, x1, y1, z1, x2, y2, z2, thickness, value)
References
- pyclesperanto_prototype.draw_mesh_between_labels_with_touch_portion_in_range(labels: Union[ndarray, OCLArray, Image, _OCLImage], mesh_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, minimum_touch_portion: float = 0, maximum_touch_portion: float = 1.1)
Draws a mesh between label centroids where the labels touch portion lies within a given range. Minimum and maximum of that specified range are excluded.
Notes
This operation assumes input images are isotropic.
- Parameters
labels (Image) –
mesh_destination (Image, optional) –
minimum_touch_portion (float, optional) –
maximum_touch_portion (float, optional) –
- Return type
mesh_destination
- pyclesperanto_prototype.draw_mesh_between_n_closest_labels(labels: Union[ndarray, OCLArray, Image, _OCLImage], mesh_target: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Starting from a label map, draw lines between n closest labels for each label resulting in a mesh.
The end points of the lines correspond to the centroids of the labels.
Notes
This operation assumes input images are isotropic.
- Parameters
labels (Image) –
mesh_target (Image, optional) –
n (Number, optional) –
- Return type
destination
References
- pyclesperanto_prototype.draw_mesh_between_n_most_touching_labels(labels: Union[ndarray, OCLArray, Image, _OCLImage], mesh_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Draws a mesh between most touching neighbors
Notes
This operation assumes input images are isotropic.
- Parameters
labels (Image) –
mesh_destination (Image, optional) –
n (int) –
- pyclesperanto_prototype.draw_mesh_between_proximal_labels(labels: Union[ndarray, OCLArray, Image, _OCLImage], mesh_target: Union[ndarray, OCLArray, Image, _OCLImage] = None, maximum_distance: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Starting from a label map, draw lines between labels that are closer than a given distance resulting in a mesh.
The end points of the lines correspond to the centroids of the labels.
Notes
This operation assumes input images are isotropic.
- Parameters
labels (Image) –
mesh_target (Image, optional) –
maximum_distance (Number, optional) –
- Return type
destination
References
- pyclesperanto_prototype.draw_mesh_between_touching_labels(labels: Union[ndarray, OCLArray, Image, _OCLImage], distance_mesh_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Starting from a label map, draw lines between touching neighbors resulting in a mesh.
The end points of the lines correspond to the centroids of the labels.
- Parameters
labels (Image) –
distance_mesh_destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.draw_sphere(destination: Union[ndarray, OCLArray, Image, _OCLImage], x: float = 0, y: float = 0, z: float = 0, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1, value: float = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Draws a sphere around a given point with given radii in x, y and z (if 3D).
All pixels other than in the sphere are untouched. Consider using
set(buffer, 0); in advance.
- Parameters
destination (Image) –
x (Number, optional) –
y (Number, optional) –
z (Number, optional) –
radius_x (Number, optional) –
radius_y (Number, optional) –
radius_z (Number, optional) –
value (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.draw_sphere(destination, x, y, z, radius_x, radius_y, radius_z, value)
References
- pyclesperanto_prototype.draw_touch_portion_mesh_between_touching_labels(labels: Union[ndarray, OCLArray, Image, _OCLImage], touch_portion_mesh_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Starting from a label map, draw lines between touching neighbors resulting in a mesh.
The end points of the lines correspond to the centroids of the labels. The intensity of the lines corresponds to the amount the two labels touch divided by the number of border voxels on both labels. Note: label borders at image borders are ignored in this calculation.
Notes
This operation assumes input images are isotropic.
- Parameters
labels (Image) –
touch_portion_mesh_destination (Image, optional) –
- Return type
touch_portion_mesh_destination
- pyclesperanto_prototype.draw_touch_portion_ratio_mesh_between_touching_labels(labels: Union[ndarray, OCLArray, Image, _OCLImage], touch_portion_ratio_mesh_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Starting from a label map, draw lines between touching neighbors resulting in a mesh.
The end points of the lines correspond to the centroids of the labels. The intensity of the lines corresponds to the ratio between the amount the two labels touch divided by the number of border voxels on both labels. The smaller touch portion is divided by the larger touch portion. Thus, lines in this mesh have values larger or equal to 1. Note: label borders at image borders are ignored in this calculation.
Notes
This operation assumes input images are isotropic.
- Parameters
labels (Image) –
touch_portion_ratio_mesh_destination (Image, optional) –
- Return type
touch_portion_mesh_destination
- pyclesperanto_prototype.empty_image(ctx, shape, dtype, num_channels=1, channel_order=None)
- pyclesperanto_prototype.empty_image_like(arr, ctx=None)
- pyclesperanto_prototype.equal(source1: Union[ndarray, OCLArray, Image, _OCLImage], source2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines if two images A and B equal pixel wise.
<pre>f(a, b) = 1 if a == b; 0 otherwise.</pre>
- Parameters
source1 (Image) – The first image to be compared with.
source2 (Image) – The second image to be compared with the first.
destination (Image, optional) – The resulting binary image where pixels will be 1 only if source1
pixel. (and source2 equal in the given) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.equal(source1, source2, destination)
References
- pyclesperanto_prototype.equal_constant(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, constant: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Determines if an image A and a constant b are equal.
<pre>f(a, b) = 1 if a == b; 0 otherwise.</pre>
- Parameters
source (Image) – The image where every pixel is compared to the constant.
destination (Image, optional) – The resulting binary image where pixels will be 1 only if source1
pixel. (and source2 equal in the given) –
constant (float, optional) – The constant where every pixel is compared to.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.equal_constant(source, destination, constant)
References
- pyclesperanto_prototype.erode_box(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes a binary image with pixel values 0 and 1 containing the binary erosion of a given input image.
The erosion takes the Moore-neighborhood (8 pixels in 2D and 26 pixels in 3d) into account. The pixels in the input image with pixel value not equal to 0 will be interpreted as 1.
This method is comparable to the ‘Erode’ menu in ImageJ in case it is applied to a 2D image. The only difference is that the output image contains values 0 and 1 instead of 0 and 255.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.erode_box(source, destination)
References
- pyclesperanto_prototype.erode_box_slice_by_slice(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes a binary image with pixel values 0 and 1 containing the binary erosion of a given input image.
The erosion takes the Moore-neighborhood (8 pixels in 2D and 26 pixels in 3d) into account. The pixels in the input image with pixel value not equal to 0 will be interpreted as 1.
This method is comparable to the ‘Erode’ menu in ImageJ in case it is applied to a 2D image. The only difference is that the output image contains values 0 and 1 instead of 0 and 255.
This filter is applied slice by slice in 2D.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.erode_box_slice_by_slice(source, destination)
References
- pyclesperanto_prototype.erode_connected_labels(labels_input: Union[ndarray, OCLArray, Image, _OCLImage], labels_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
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
labels_input (Image) – label image to erode
labels_destination (Image, optional) – result
radius (int, optional) –
- Return type
labels_destination
- pyclesperanto_prototype.erode_labels(labels_input: Union[ndarray, OCLArray, Image, _OCLImage], labels_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius: int = 1, relabel_islands: bool = False) Union[ndarray, OCLArray, Image, _OCLImage]
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
labels_input (Image) – label image to erode
labels_destination (Image, optional) – result
radius (int, optional) –
relabel_islands (Boolean, optional) – True: Make sure that the resulting label image has connected components labeled individually and all label indices exist.
- Return type
labels_destination
See also
- pyclesperanto_prototype.erode_sphere(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes a binary image with pixel values 0 and 1 containing the binary erosion of a given input image.
The erosion takes the von-Neumann-neighborhood (4 pixels in 2D and 6 pixels in 3d) into account. The pixels in the input image with pixel value not equal to 0 will be interpreted as 1.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.erode_sphere(source, destination)
References
- pyclesperanto_prototype.erode_sphere_slice_by_slice(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes a binary image with pixel values 0 and 1 containing the binary erosion of a given input image.
The erosion takes the von-Neumann-neighborhood (4 pixels in 2D and 6 pixels in 3d) into account. The pixels in the input image with pixel value not equal to 0 will be interpreted as 1.
This filter is applied slice by slice in 2D.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.erode_sphere_slice_by_slice(source, destination)
References
- pyclesperanto_prototype.eroded_otsu_labeling(image: Union[ndarray, OCLArray, Image, _OCLImage], labels_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, number_of_erosions: int = 5, outline_sigma: float = 2) Union[ndarray, OCLArray, Image, _OCLImage]
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
image (Image) – intensity image
labels_destination (Image, optional) – output label image
number_of_erosions (int, optional) – Number of iterations for an erosion. This number must be smaller than the smallest radius of the objects to segment. If the radius is too high, objects may disappear.
outline_sigma (float, optional) – Before thresholding, a Gaussian blur is applied using this sigma for smoothing the outline.
- Returns
label_image
- Return type
Image
- pyclesperanto_prototype.euclidean_distance_from_label_centroid_map(labels: Union[ndarray, OCLArray, Image, _OCLImage], centroids_pointlist: Union[ndarray, OCLArray, Image, _OCLImage] = None, distance_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines the centroids of all labels and writes the distance of all labelled pixels to their centroid in the result image. Background pixels stay zero.
Notes
This operation assumes input images are isotropic.
- Parameters
labels (Image) –
distance_map_destination (Image, optional) –
- Return type
distance_map_destination
- pyclesperanto_prototype.exclude_labels(binary_flaglist: Union[ndarray, OCLArray, Image, _OCLImage], label_map_input: Union[ndarray, OCLArray, Image, _OCLImage], label_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
binary_flaglist (Image) –
label_map_input (Image) –
label_map_destination (Image, optional) –
- Return type
label_map_destination
References
- pyclesperanto_prototype.exclude_labels_on_edges(label_map_input: Union[ndarray, OCLArray, Image, _OCLImage], label_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Removes all labels from a label map which touch the edges of the image (in X, Y and Z if the image is 3D).
Remaining label elements are renumbered afterwards.
- Parameters
label_map_input (Image) –
label_map_destination (Image, optional) –
- Return type
label_map_destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.exclude_labels_on_edges(label_map_input, label_map_destination)
References
- pyclesperanto_prototype.exclude_labels_out_of_size_range(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, minimum_size: float = 0, maximum_size: float = 100) Union[ndarray, OCLArray, Image, _OCLImage]
Removes labels from a label map which are not within a certain size range.
Size of the labels is given as the number of pixel or voxels per label.
- Parameters
source (Image) –
destination (Image, optional) –
minimum_size (Number, optional) –
maximum_size (Number, optional) –
- Return type
destination
References
- pyclesperanto_prototype.exclude_labels_outside_size_range(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, minimum_size: float = 0, maximum_size: float = 100) Union[ndarray, OCLArray, Image, _OCLImage]
Removes labels from a label map which are not within a certain size range.
Size of the labels is given as the number of pixel or voxels per label.
- Parameters
source (Image) –
destination (Image, optional) –
minimum_size (Number, optional) –
maximum_size (Number, optional) –
- Return type
destination
References
- pyclesperanto_prototype.exclude_labels_with_average_values_out_of_range(values_image: Union[ndarray, OCLArray, Image, _OCLImage], label_map_input: Union[ndarray, OCLArray, Image, _OCLImage], label_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, minimum_value_range: float = 0, maximum_value_range: float = 100) Union[ndarray, OCLArray, Image, _OCLImage]
This operation removes labels from a labelmap and renumbers the remaining labels.
- Parameters
values_image (Image) –
label_map_input (Image) –
label_map_destination (Image, optional) –
minimum_value_range (Number, optional) –
maximum_value_range (Number, optional) –
- Return type
label_map_destination
- pyclesperanto_prototype.exclude_labels_with_average_values_within_range(values_image: Union[ndarray, OCLArray, Image, _OCLImage], label_map_input: Union[ndarray, OCLArray, Image, _OCLImage], label_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, minimum_value_range: float = 0, maximum_value_range: float = 100) Union[ndarray, OCLArray, Image, _OCLImage]
This operation removes labels from a labelmap and renumbers the remaining labels.
- Parameters
values_image (Image) –
label_map_input (Image) –
label_map_destination (Image, optional) –
minimum_value_range (Number, optional) –
maximum_value_range (Number, optional) –
- Return type
label_map_destination
- pyclesperanto_prototype.exclude_labels_with_map_values_equal_to_constant(values_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map_input: Union[ndarray, OCLArray, Image, _OCLImage], label_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, constant: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
This operation removes labels from a labelmap and renumbers the remaining labels.
Notes
Values of all pixels in a label each must be identical.
- Parameters
values_map (Image) –
label_map_input (Image) –
label_map_destination (Image, optional) –
constant (Number, optional) –
- Return type
label_map_destination
References
- pyclesperanto_prototype.exclude_labels_with_map_values_not_equal_to_constant(values_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map_input: Union[ndarray, OCLArray, Image, _OCLImage], label_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, constant: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
This operation removes labels from a labelmap and renumbers the remaining labels.
Notes
Values of all pixels in a label each must be identical.
- Parameters
values_map (Image) –
label_map_input (Image) –
label_map_destination (Image, optional) –
constant (Number, optional) –
- Return type
label_map_destination
References
- pyclesperanto_prototype.exclude_labels_with_map_values_out_of_range(values_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map_input: Union[ndarray, OCLArray, Image, _OCLImage], label_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, minimum_value_range: float = 0, maximum_value_range: float = 100) Union[ndarray, OCLArray, Image, _OCLImage]
This operation removes labels from a labelmap and renumbers the remaining labels.
Notes
Values of all pixels in a label each must be identical.
- Parameters
values_map (Image) –
label_map_input (Image) –
label_map_destination (Image, optional) –
minimum_value_range (Number, optional) –
maximum_value_range (Number, optional) –
- Return type
label_map_destination
References
- pyclesperanto_prototype.exclude_labels_with_map_values_within_range(values_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map_input: Union[ndarray, OCLArray, Image, _OCLImage], label_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, minimum_value_range: float = 0, maximum_value_range: float = 100) Union[ndarray, OCLArray, Image, _OCLImage]
This operation removes labels from a labelmap and renumbers the remaining labels.
Notes
Values of all pixels in a label each must be identical.
- Parameters
values_map (Image) –
label_map_input (Image) –
label_map_destination (Image, optional) –
minimum_value_range (Number, optional) –
maximum_value_range (Number, optional) –
- Return type
label_map_destination
References
- pyclesperanto_prototype.exclude_labels_with_values_equal_to_constant(values_vector: Union[ndarray, OCLArray, Image, _OCLImage], label_map_input: Union[ndarray, OCLArray, Image, _OCLImage], label_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, constant: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
This operation removes labels from a labelmap and renumbers the remaining labels.
- Parameters
values_vector (Image) –
label_map_input (Image) –
label_map_destination (Image, optional) –
constant (Number, optional) –
- Return type
label_map_destination
References
- pyclesperanto_prototype.exclude_labels_with_values_not_equal_to_constant(values_vector: Union[ndarray, OCLArray, Image, _OCLImage], label_map_input: Union[ndarray, OCLArray, Image, _OCLImage], label_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, constant: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
This operation removes labels from a labelmap and renumbers the remaining labels.
- Parameters
values_vector (Image) –
label_map_input (Image) –
label_map_destination (Image, optional) –
constant (Number, optional) –
- Return type
label_map_destination
References
- pyclesperanto_prototype.exclude_labels_with_values_out_of_range(values_vector: Union[ndarray, OCLArray, Image, _OCLImage], label_map_input: Union[ndarray, OCLArray, Image, _OCLImage], label_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, minimum_value_range: float = 0, maximum_value_range: float = 100) Union[ndarray, OCLArray, Image, _OCLImage]
This operation removes labels from a labelmap and renumbers the remaining labels.
Hand over a vector of values and a range specifying which labels with which values are eliminated.
- Parameters
values_vector (Image) –
label_map_input (Image) –
label_map_destination (Image, optional) –
minimum_value_range (Number, optional) –
maximum_value_range (Number, optional) –
- Return type
label_map_destination
References
- pyclesperanto_prototype.exclude_labels_with_values_within_range(values_vector: Union[ndarray, OCLArray, Image, _OCLImage], label_map_input: Union[ndarray, OCLArray, Image, _OCLImage], label_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, minimum_value_range: float = 0, maximum_value_range: float = 100) Union[ndarray, OCLArray, Image, _OCLImage]
This operation removes labels from a labelmap and renumbers the remaining labels.
Hand over a vector of values and a range specifying which labels with which values are eliminated.
- Parameters
values_vector (Image) –
label_map_input (Image) –
label_map_destination (Image, optional) –
minimum_value_range (Number, optional) –
maximum_value_range (Number, optional) –
- Return type
label_map_destination
References
- pyclesperanto_prototype.exclude_large_labels(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, minimum_size: float = 100) Union[ndarray, OCLArray, Image, _OCLImage]
Removes labels from a label map which are above a given maximum size.
Size of the labels is given as the number of pixel or voxels per label.
- Parameters
source (Image) –
destination (Image, optional) –
minimum_size (Number, optional) –
- Return type
destination
References
- pyclesperanto_prototype.exclude_small_labels(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, maximum_size: float = 100) Union[ndarray, OCLArray, Image, _OCLImage]
Removes labels from a label map which are below a given maximum size.
Size of the labels is given as the number of pixel or voxels per label.
- Parameters
source (Image) –
destination (Image, optional) –
maximum_size (Number, optional) –
- Return type
destination
References
- pyclesperanto_prototype.execute(anchor, opencl_kernel_filename, kernel_name, global_size, parameters, prog=None, constants=None, image_size_independent_kernel_compilation: Optional[bool] = None, device=None)
- pyclesperanto_prototype.execute_separable_kernel(src, dst, anchor, opencl_kernel_filename, kernel_name, kernel_size_x, kernel_size_y, kernel_size_z, sigma_x, sigma_y, sigma_z, dimensions) Union[ndarray, OCLArray, Image, _OCLImage]
- pyclesperanto_prototype.exp(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes base exponential of all pixels values.
f(x) = exp(x)
Author(s): Peter Haub, Robert Haase
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.exponential(source, destination)
References
- pyclesperanto_prototype.exponential(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes base exponential of all pixels values.
f(x) = exp(x)
Author(s): Peter Haub, Robert Haase
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.exponential(source, destination)
References
- pyclesperanto_prototype.extend_labeling_via_voronoi(labeling_source: Union[ndarray, OCLArray, Image, _OCLImage], labeling_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
labeling_source (Image) –
labeling_destination (Image, optional) –
- Return type
labeling_destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.extend_labeling_via_voronoi(input, destination)
References
- pyclesperanto_prototype.extend_labels_with_maximum_radius(labeling_source: Union[ndarray, OCLArray, Image, _OCLImage], labeling_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius: int = 2) Union[ndarray, OCLArray, Image, _OCLImage]
Dilates labels to a larger size. No label overwrites another label. Similar to the implementation in scikit-image [2] and MorpholibJ[3]
Notes
This operation assumes input images are isotropic.
- Parameters
labels_input (Image) – label image to erode
labels_destination (Image, optional, optional) – result
radius (int, optional) –
- Return type
labels_destination
See also
,
,
- pyclesperanto_prototype.extended_depth_of_focus_variance_projection(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: int = 10, radius_y: int = 10, sigma: float = 5) Union[ndarray, OCLArray, Image, _OCLImage]
Extended depth of focus projection maximizing local pixel intensity variance.
- Parameters
source (Image) –
destination (Image, optional) –
radius_x (int, optional) – radius of a sphere where the variance should be determined
radius_y (int, optional) – radius of a sphere where the variance should be determined
sigma (float, optional) – The sigma parameter allows controlling a Gaussian blur which smoothes the altitude map.
- Return type
destination
- pyclesperanto_prototype.extension_ratio_map(labels: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines for every label the extension ratio and replaces every label with the that number.
The extension ratio is the maximum distance of any pixel in the label to the label centroid divided by the average distance of all pixels in the label to the centroid.
- Parameters
labels (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.fabs(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the absolute value of every individual pixel x in a given image.
<pre>f(x) = |x| </pre>
- Parameters
source (Image) – The input image to be processed.
destination (Image, optional) – The output image where results are written into.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.absolute(source, destination)
References
- pyclesperanto_prototype.fill_zeros_inpainting(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Replaces 0 pixels in an image with neighboring intensities (if not 0) iteratively until no 0-value pixels are left. This operation can also be called nearest-neighbor inpainting.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
See also
extend_labeling_via_voronoi
- pyclesperanto_prototype.flag_existing_intensities(label_src: Union[ndarray, OCLArray, Image, _OCLImage], flag_vector_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Given a label map this function will generate a binary vector where all pixels are set to 1 if label with given x-coordinate 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
label_src (Image) – a label image
flag_vector_destination (Image, optional) – binary vector, if given should have size 1*n with n = maximum label + 1
:param : binary vector, if given should have size 1*n with n = maximum label + 1 :type : Image, optional
- pyclesperanto_prototype.flag_existing_labels(label_src: Union[ndarray, OCLArray, Image, _OCLImage], flag_vector_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Given a label map this function will generate a binary vector where all pixels are set to 1 if label with given x-coordinate 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
label_src (Image) – a label image
flag_vector_destination (Image, optional) – binary vector, if given should have size 1*n with n = maximum label + 1
:param : binary vector, if given should have size 1*n with n = maximum label + 1 :type : Image, optional
- pyclesperanto_prototype.flip(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, flip_x: bool = True, flip_y: bool = True, flip_z: bool = True) Union[ndarray, OCLArray, Image, _OCLImage]
Flips an image in X, Y and/or Z direction depending on boolean flags.
- Parameters
source (Image) –
destination (Image, optional) –
flip_x (Boolean, optional) –
flip_y (Boolean, optional) –
flip_z (Boolean, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.flip(source, destination, flip_x, flip_y, flip_z)
References
- pyclesperanto_prototype.gamma_correction(source: Union[ndarray, OCLArray, Image, _OCLImage], target: Union[ndarray, OCLArray, Image, _OCLImage] = None, gamma: float = 1) Union[ndarray, OCLArray, Image, _OCLImage]
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) –
destination (Image, optional) –
gamma (Number, optional) –
- Return type
destination
References
- pyclesperanto_prototype.gauss_otsu_labeling(source: Union[ndarray, OCLArray, Image, _OCLImage], label_image_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, outline_sigma: float = 2) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) – Input grey-value image
label_image_destination (Image, optional) – Output image
outline_sigma (float, optional) – controls how precise segmented objects are outlined.
- Return type
label_image_destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.gauss_otsu_labeling(source, label_image_destination, 2)
References
- pyclesperanto_prototype.gaussian_blur(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, sigma_x: float = 0, sigma_y: float = 0, sigma_z: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the Gaussian blurred image of an image given sigma values in X, Y and Z.
Thus, the filter kernel can have non-isotropic shape.
The implementation is done separable. In case a sigma equals zero, the direction is not blurred.
- Parameters
source (Image) –
destination (Image, optional) –
sigma_x (Number, optional) –
sigma_y (Number, optional) –
sigma_z (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.gaussian_blur(source, destination, sigma_x, sigma_y, sigma_z)
References
- pyclesperanto_prototype.generate_angle_matrix(coordinate_list1: Union[ndarray, OCLArray, Image, _OCLImage], coordinate_list2: Union[ndarray, OCLArray, Image, _OCLImage], angle_matrix_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the angle in radians 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 angles between these points.
Convention: Values range from -90 to 90 degrees (-0.5 to 0.5 pi radians) * -90 degreess (-0.5 pi radians): Top * 0 defrees (0 radians): Right * 90 degrees (0.5 pi radians): Bottom
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 objects to a theoretical background object. In that way, distance matrices are of the same size as touch matrices (see generateTouchMatrix). Thus, one can threshold a distance matrix to generate a touch matrix out of it for drawing meshes.
Implemented for 2D only at the moment.
- Parameters
coordinate_list1 (Image) –
coordinate_list2 (Image) –
angle_matrix_destination (Image) –
- Return type
angle_matrix_destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.generate_distance_matrix(coordinate_list1, coordinate_list2, angle_matrix_destination)
References
- pyclesperanto_prototype.generate_binary_overlap_matrix(label_map1: Union[ndarray, OCLArray, Image, _OCLImage], label_map2: Union[ndarray, OCLArray, Image, _OCLImage], binary_overlap_matrix_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
label_map1 (Image) –
label_map2 (Image) –
binary_overlap_matrix_destination (Image, optional) –
- Return type
binary_overlap_matrix_destination
References
- pyclesperanto_prototype.generate_distal_neighbors_matrix(distance_matrix: Union[ndarray, OCLArray, Image, _OCLImage], touch_matrix_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, min_distance: float = 0, max_distance: float = 3.4028235e+38)
Produces a touch-matrix where the neighbors within a given distance range are marked as touching neighbors.
Takes a distance matrix (e.g. derived from a pointlist of centroids) and marks for every column the neighbors whose distance lie within a given distance range (>= min and <= max). The resulting matrix can be use as if it was a touch-matrix (a.k.a. adjacency graph matrix).
- Parameters
distance_matrix (Image) –
touch_matrix_destination (Image, optional) –
min_distance (float, optional, optional) – default : 0
max_distance (float, optional, optional) – default: maximum float value
- Return type
touch_matrix_destination
- pyclesperanto_prototype.generate_distance_matrix(coordinate_list1: Union[ndarray, OCLArray, Image, _OCLImage], coordinate_list2: Union[ndarray, OCLArray, Image, _OCLImage], distance_matrix_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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 objects to a theoretical background object. In that way, distance matrices are of the same size as touch matrices (see generateTouchMatrix). Thus, one can threshold a distance matrix to generate a touch matrix out of it for drawing meshes.
- Parameters
coordinate_list1 (Image) –
coordinate_list2 (Image) –
distance_matrix_destination (Image, optional) –
- Return type
distance_matrix_destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.generate_distance_matrix(coordinate_list1, coordinate_list2, distance_matrix_destination)
References
- pyclesperanto_prototype.generate_n_most_touching_neighbors_matrix(touch_amount_matrix: Union[ndarray, OCLArray, Image, _OCLImage], touch_matrix_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Generates a touch matrix from a matrix describing how much labels touch by selecting the n neighbors most touching.
- touch_amount_matrix: Image
can be either a touch-portion or touch-count
touch_matrix_destination: Image, optional n: int, optional
default: 1
- pyclesperanto_prototype.generate_n_nearest_neighbors_matrix(distance_matrix: Union[ndarray, OCLArray, Image, _OCLImage], touch_matrix_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Produces a touch-matrix where the n nearest neighbors are marked as touching neighbors.
Takes a distance matrix (e.g. derived from a pointlist of centroids) and marks for every column the n smallest distances as neighbors. The resulting matrix can be use as if it was a touch-matrix (a.k.a. adjacency graph matrix).
Inspired by a similar implementation in imglib2 [1]
Note: The implementation is limited to square matrices.
- Parameters
distance_marix (Image) –
touch_matrix_destination (Image, optional) –
n (int, optional) – number of neighbors
References
- Return type
touch_matrix_destination
- pyclesperanto_prototype.generate_proximal_neighbors_matrix(distance_matrix: Union[ndarray, OCLArray, Image, _OCLImage], touch_matrix_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, min_distance: float = 0, max_distance: float = 3.4028235e+38)
Produces a touch-matrix where the neighbors within a given distance range are marked as touching neighbors.
Takes a distance matrix (e.g. derived from a pointlist of centroids) and marks for every column the neighbors whose distance lie within a given distance range (>= min and <= max). The resulting matrix can be use as if it was a touch-matrix (a.k.a. adjacency graph matrix).
- Parameters
distance_matrix (Image) –
touch_matrix_destination (Image, optional) –
min_distance (float, optional, optional) – default : 0
max_distance (float, optional, optional) – default: maximum float value
- Return type
touch_matrix_destination
- pyclesperanto_prototype.generate_touch_count_matrix(label_map: Union[ndarray, OCLArray, Image, _OCLImage], touch_count_matrix_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Take a label image and measure how often labels X and Y touch. Put these numbers in a symmetric touch count matrix.
- Parameters
label_map (Image) –
touch_count_matrix_destination (Image, optional) –
- Return type
touch_count_matrix_destination
- pyclesperanto_prototype.generate_touch_matrix(label_map: Union[ndarray, OCLArray, Image, _OCLImage], touch_matrix_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
label_map (Image) –
touch_matrix_destination (Image, optional) –
- Return type
touch_matrix_destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.generate_touch_matrix(label_map, touch_matrix_destination)
References
- pyclesperanto_prototype.generate_touch_mean_intensity_matrix(intensity_image: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], touch_mean_intensity_matrix_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Take an intensity image and a label image to measure the average intensity along label borders. Results are store to a symmetrical matrix.
Notes
This operation assumes input images are isotropic.
The intensity_image should be of integer type. In case of float images, information might be lost.
- Parameters
intensity_image (Image) –
label_map (Image) –
touch_mean_intensity_matrix_destination (Image, optional) –
- Return type
touch_mean_intensity_matrix_destination
- pyclesperanto_prototype.generate_touch_mean_intensity_within_range_matrix(image: Union[ndarray, OCLArray, Image, _OCLImage], labels: Union[ndarray, OCLArray, Image, _OCLImage], touch_matrix_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, minimum_intensity: float = 0, maximum_intensity: float = 3.4028235e+38)
Takes an image and a label image and determines whose label touch-borders lie within a given range. This results in a touch matrix.
Notes
For technical reasons, only images of integer type are supported. In case images of type float are passed, the results may not be 100% repeatable.
The specified range includes minimum and maximum
- Parameters
image (Image) –
labels (Image) –
touch_matrix_destination (Image, optional) –
minimum_intensity (float, optional) –
maximum_intensity (float, optional) –
- Return type
touch_matrix_destination
- pyclesperanto_prototype.generate_touch_portion_matrix(label_map: Union[ndarray, OCLArray, Image, _OCLImage], touch_portion_matrix_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Take a label image and measure how often labels X and Y touch and divide it by all pixels on the object’s border, excluding the image border. Put these numbers in a symmetric touch count matrix.
Notes
This operation assumes input images are isotropic.
This matrix is not necessarily symmetric because touch portion depends on the amount of label border pixels (divident). Thus, for each edge between labels A and B, two number exist: one ratio to label A and one ratio to label B.
- Parameters
label_map (Image) –
touch_portion_matrix_destination (Image, optional) –
- Return type
touch_count_matrix_destination
- pyclesperanto_prototype.generate_touch_portion_within_range_neighbors_matrix(touch_portion_matrix: Union[ndarray, OCLArray, Image, _OCLImage], touch_matrix_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, minimum_touch_portion: float = 0, maximum_touch_portion: float = 1.1) Union[ndarray, OCLArray, Image, _OCLImage]
Generates a touch matrix from a matrix describing how much labels touch by selecting the neighbors whose touch portion lies within a specified range. Minimum and maximum of that specified range are excluded.
- Parameters
touch_amount_matrix (Image) – can be either a touch-portion or touch-count
touch_matrix_destination (Image, optional) –
minimum_touch_portion (float, optional) –
maximum_touch_portion (float, optional) –
- Return type
touch_matrix_destination
- pyclesperanto_prototype.get_device() Device
Get the current device GPU class.
- pyclesperanto_prototype.gradient_x(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.gradient_x(source, destination)
References
- pyclesperanto_prototype.gradient_y(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.gradient_y(source, destination)
References
- pyclesperanto_prototype.gradient_z(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.gradient_z(source, destination)
References
- pyclesperanto_prototype.greater(source1: Union[ndarray, OCLArray, Image, _OCLImage], source2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines if two images A and B greater pixel wise.
f(a, b) = 1 if a > b; 0 otherwise.
- Parameters
source1 (Image) –
source2 (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.greater(source1, source2, destination)
References
- pyclesperanto_prototype.greater_constant(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, constant: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Determines if two images A and B greater pixel wise.
f(a, b) = 1 if a > b; 0 otherwise.
- Parameters
source (Image) –
destination (Image, optional) –
constant (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.greater_constant(source, destination, constant)
References
- pyclesperanto_prototype.greater_or_equal(source1: Union[ndarray, OCLArray, Image, _OCLImage], source2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines if two images A and B greater or equal pixel wise.
f(a, b) = 1 if a >= b; 0 otherwise.
- Parameters
source1 (Image) –
source2 (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.greater_or_equal(source1, source2, destination)
References
- pyclesperanto_prototype.greater_or_equal_constant(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, constant: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Determines if two images A and B greater or equal pixel wise.
f(a, b) = 1 if a >= b; 0 otherwise.
- Parameters
source (Image) –
destination (Image, optional) –
constant (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.greater_or_equal_constant(source, destination, constant)
References
- pyclesperanto_prototype.hessian_eigenvalues(source: Union[ndarray, OCLArray, Image, _OCLImage], small_eigenvalue_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, middle_eigenvalue_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, large_eigenvalue_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
small_eigenvalue_destination (Image, optional) –
middle_eigenvalue_destination (Image, optional) –
large_eigenvalue_destination (Image, optional) –
- Returns
small_eigenvalue_destination (Image)
middle_eigenvalue_destination (Image)
large_eigenvalue_destination (Image)
- pyclesperanto_prototype.histogram(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, num_bins: int = 256, minimum_intensity: float = None, maximum_intensity: float = None, determine_min_max: bool = True) Union[ndarray, OCLArray, Image, _OCLImage]
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/opencl-book-samples/blob/master/src/Chapter_14/histogram/histogram_image.cl // // It was published unter BSD license according to // https://code.google.com/archive/p/opencl-book-samples/ // // Book: OpenCL(R) Programming Guide // Authors: Aaftab Munshi, Benedict Gaster, Timothy Mattson, James Fung, Dan Ginsburg // ISBN-10: 0-321-74964-2 // ISBN-13: 978-0-321-74964-2 // Publisher: Addison-Wesley Professional // URLs: http://safari.informit.com/9780132488006/ // http://www.openclprogrammingguide.com
- Parameters
source (Image) –
destination (Image, optional) –
num_bins (Number, optional) –
minimum_intensity (Number, optional) –
maximum_intensity (Number, optional) –
determine_min_max (Boolean, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.histogram(source, destination, num_bins, minimum_intensity, maximum_intensity, determine_min_max)
References
- pyclesperanto_prototype.imread(filename: str) Union[ndarray, OCLArray, Image, _OCLImage]
- pyclesperanto_prototype.imshow(image: Union[ndarray, OCLArray, Image, _OCLImage], title: str = None, labels: bool = False, min_display_intensity: float = None, max_display_intensity: float = None, color_map=None, plot=None, colorbar: bool = False, colormap=None, alpha: float = None, continue_drawing: bool = False)
Visualize an image, e.g. in Jupyter notebooks.
- Parameters
image (np.ndarray) – numpy or OpenCL-backed image to visualize
title (str) – Obsolete (kept for ImageJ-compatibility)
labels (bool) – True: integer labels will be visualized with colors False: Specified or default colormap will be used to display intensities.
min_display_intensity (float) – lower limit for display range
max_display_intensity (float) – upper limit for display range
color_map (str) – deprecated, use colormap instead
plot (matplotlib axis) – Plot object where the image should be shown. Useful for putting multiple images in subfigures.
colorbar (bool) – 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) –
alpha (float) – 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
- pyclesperanto_prototype.invert(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the negative value of all pixels in a given image.
It is recommended to convert images to 32-bit float before applying this operation.
<pre>f(x) = - x</pre>
For binary images, use binaryNot.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.invert(source, destination)
References
- pyclesperanto_prototype.is_matrix_symmetric(matrix: Union[ndarray, OCLArray, Image, _OCLImage]) bool
Tests if a matrix is symmetric and returns the result of the test as boolean
- pyclesperanto_prototype.jaccard_index(source1: Union[ndarray, OCLArray, Image, _OCLImage], source2: Union[ndarray, OCLArray, Image, _OCLImage])
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 Sorensen-Dice coefficient can be calculated from the Jaccard index j using this formula: <pre>s = f(j) = 2 j / (j + 1)</pre>
- Parameters
source1 (Image) –
source2 (Image) –
- Return type
float (between 0 and 1)
Examples
>>> import pyclesperanto_prototype as cle >>> cle.jaccard_index(source1, source2)
References
- pyclesperanto_prototype.label(binary_input: ~typing.Union[~numpy.ndarray, ~pyclesperanto_prototype._tier0._pycl.OCLArray, ~pyopencl._cl.Image, ~pyclesperanto_prototype._tier0._pycl._OCLImage], labeling_destination: ~typing.Union[~numpy.ndarray, ~pyclesperanto_prototype._tier0._pycl.OCLArray, ~pyopencl._cl.Image, ~pyclesperanto_prototype._tier0._pycl._OCLImage] = None, flagged_nonzero_minimum_filter: callable = <function nonzero_minimum_box>) Union[ndarray, OCLArray, Image, _OCLImage]
Performs connected components analysis inspecting the box neighborhood of every pixel to a binary image and generates a label map.
- Parameters
binary_input (Image) –
labeling_destination (Image, optional) –
- Return type
labeling_destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.connected_components_labeling_box(binary_input, labeling_destination)
References
- pyclesperanto_prototype.label_centroids_to_pointlist(labels: Union[ndarray, OCLArray, Image, _OCLImage], pointlist_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, include_background: bool = False) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the centroids of all labels in a label image or image stack.
It writes the resulting coordinates in a pointlist image. Depending on the dimensionality d of the labelmap and the number of labels n, the pointlist image will have n*d pixels.
- Parameters
labels (Image) – input label image
pointlist_destination (Image, optional) – target image of size d*n for a d-dimensional label image with n labels. In case the background should be determined as well, this image needs to be one pixel wider
include_background (bool, optional) – measure the centroid of the background as well
- Return type
pointlist_destination
References
- pyclesperanto_prototype.label_maximum_extension_map(labels: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines for every label the maximum distance of any pixel to the centroid and replaces every label with the that number.
- Parameters
labels (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.label_maximum_extension_ratio_map(labels: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines for every label the extension ratio and replaces every label with the that number.
The extension ratio is the maximum distance of any pixel in the label to the label centroid divided by the average distance of all pixels in the label to the centroid.
- Parameters
labels (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.label_maximum_intensity_map(intensity_image: Union[ndarray, OCLArray, Image, _OCLImage], labels: Union[ndarray, OCLArray, Image, _OCLImage], maximum_intensity_map: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes an image and a corresponding label map, determines the maximum intensity per label and replaces every label with the that number.
This results in a parametric image expressing maximum object intensity.
- Parameters
intensity_image (Image) –
labels (Image) –
mean_intensity_map (Image, optional) –
- Return type
maximum_intensity_map
References
- pyclesperanto_prototype.label_mean_extension_map(labels: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines for every label the mean distance of any pixel to the centroid and replaces every label with the that number.
- Parameters
labels (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.label_mean_intensity_map(source: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes an image and a corresponding label map, determines the mean intensity per label and replaces every label with the that number.
This results in a parametric image expressing mean object intensity.
- Parameters
source (Image) –
label_map (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.label_minimum_intensity_map(intensity_image: Union[ndarray, OCLArray, Image, _OCLImage], labels: Union[ndarray, OCLArray, Image, _OCLImage], minimum_intensity_map: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes an image and a corresponding label map, determines the minimum intensity per label and replaces every label with the that number.
This results in a parametric image expressing minimum object intensity.
- Parameters
intensity_image (Image) –
labels (Image) –
minimum_intensity_map (Image, optional) –
- Return type
minimum_intensity_map
References
- pyclesperanto_prototype.label_nonzero_pixel_count_map(label_map1: Union[ndarray, OCLArray, Image, _OCLImage], label_map2: Union[ndarray, OCLArray, Image, _OCLImage], overlap_count_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes two label maps, and counts for every label in label map 1 how many pixels are not zero in label map 2.
The resulting map is generated from the label map 1 by replacing the labels with the respective count.
- Parameters
label_map1 (Image) –
label_map2 (Image) –
overlap_count_map_destination (Image, optional) –
- Return type
overlap_count_map_destination
- pyclesperanto_prototype.label_nonzero_pixel_count_ratio_map(label_map1: Union[ndarray, OCLArray, Image, _OCLImage], label_map2: Union[ndarray, OCLArray, Image, _OCLImage], overlap_count_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes two label maps, and counts for every label in label map 1 how many pixels are not zero in label map 2. Afterwards, it computes the ratio of nonzero pixels (0..1).
The resulting map is generated from the label map 1 by replacing the labels with the respective ratio.
- Parameters
label_map1 (Image) –
label_map2 (Image) –
overlap_count_map_destination (Image, optional) –
- Return type
overlap_count_map_destination
- pyclesperanto_prototype.label_overlap_count_map(label_map1: Union[ndarray, OCLArray, Image, _OCLImage], label_map2: Union[ndarray, OCLArray, Image, _OCLImage], overlap_count_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes two label maps, and counts for every label in label map 1 how many labels overlap with it in label map 2.
The resulting map is generated from the label map 1 by replacing the labels with the respective count.
- Parameters
label_map1 (Image) –
label_map2 (Image) –
overlap_count_map_destination (Image, optional) –
- Return type
overlap_count_map_destination
- pyclesperanto_prototype.label_pixel_count_map(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines the number of pixels per label and replaces every label with the that number.
This results in a parametric image expressing area or volume.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.label_spots(input_spots: Union[ndarray, OCLArray, Image, _OCLImage], labelled_spots_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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_spots (Image) –
labelled_spots_destination (Image, optional) –
- Return type
labelled_spots_destination
References
- pyclesperanto_prototype.label_standard_deviation_intensity_map(intensity_image: Union[ndarray, OCLArray, Image, _OCLImage], labels: Union[ndarray, OCLArray, Image, _OCLImage], standard_deviation_intensity_map: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes an image and a corresponding label map, determines the standard deviation of the intensity per label and replaces every label with the that number.
This results in a parametric image expressing standard deviation of object intensity.
- Parameters
intensity_image (Image) –
labels (Image) –
standard_deviation_intensity_map (Image, optional) –
- Return type
standard_deviation_intensity_map
References
- pyclesperanto_prototype.label_to_mask(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, constant: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Determines if an image A and a constant b are equal.
<pre>f(a, b) = 1 if a == b; 0 otherwise.</pre>
- Parameters
source (Image) – The image where every pixel is compared to the constant.
destination (Image, optional) – The resulting binary image where pixels will be 1 only if source1
pixel. (and source2 equal in the given) –
constant (float, optional) – The constant where every pixel is compared to.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.equal_constant(source, destination, constant)
References
- pyclesperanto_prototype.labelled_spots_to_pointlist(input_labelled_spots: Union[ndarray, OCLArray, Image, _OCLImage], destination_pointlist: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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_labelled_spots (Image) –
destination_pointlist (Image, optional) –
- Return type
destination_pointlist
References
- pyclesperanto_prototype.laplace_box(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Applies the Laplace operator (Box neighborhood) to an image.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.laplace_box(input, destination)
References
- pyclesperanto_prototype.laplace_diamond(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Applies the Laplace operator (Diamond neighborhood) to an image.
- Parameters
input (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.laplace_diamond(input, destination)
References
- pyclesperanto_prototype.large_hessian_eigenvalue(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the Hessian eigenvalues and returns the large eigenvalue image.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
- pyclesperanto_prototype.local_cross_correlation(source: Union[ndarray, OCLArray, Image, _OCLImage], kernel: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Compute the cross correlation of an image to a given kernel.
- Parameters
source (Image) –
kernel (Image) –
destination (Image, optional) –
- Return type
destination
See also
https
//anomaly.io/understand-auto-cross-correlation-normalized-shift/index.html
- pyclesperanto_prototype.local_maximum_touching_neighbor_count_map(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines which labels touch and replaces every label with the number of touching neighboring labels.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.local_mean_touching_neighbor_count_map(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines which labels touch and replaces every label with the number of touching neighboring labels.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.local_median_touching_neighbor_count_map(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines which labels touch and replaces every label with the number of touching neighboring labels.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.local_minimum_touching_neighbor_count_map(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines which labels touch and replaces every label with the number of touching neighboring labels.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.local_standard_deviation_touching_neighbor_count_map(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines which labels touch and replaces every label with the number of touching neighboring labels.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.local_threshold(source1: Union[ndarray, OCLArray, Image, _OCLImage], source2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines if two images A and B greater pixel wise.
f(a, b) = 1 if a > b; 0 otherwise.
- Parameters
source1 (Image) –
source2 (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.greater(source1, source2, destination)
References
- pyclesperanto_prototype.log(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes base e logarithm of all pixels values.
f(x) = log(x)
Author(s): Peter Haub, Robert Haase
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.logarithm(source, destination)
References
- pyclesperanto_prototype.logarithm(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes base e logarithm of all pixels values.
f(x) = log(x)
Author(s): Peter Haub, Robert Haase
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.logarithm(source, destination)
References
- pyclesperanto_prototype.logical_and(operand1: Union[ndarray, OCLArray, Image, _OCLImage], operand2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
operand1 (Image) – The first binary input image to be processed.
operand2 (Image) – The second binary input image to be processed.
destination (Image, optional) – The output image where results are written into.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.binary_and(operand1, operand2, destination)
References
- pyclesperanto_prototype.logical_not(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) – The binary input image to be inverted.
destination (Image, optional) – The output image where results are written into.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.binary_not(source, destination)
References
- pyclesperanto_prototype.logical_or(operand1: Union[ndarray, OCLArray, Image, _OCLImage], operand2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
operand1 (Image) – The first binary input image to be processed.
operand2 (Image) – The second binary input image to be processed.
destination (Image, optional) – The output image where results are written into.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.binary_or(operand1, operand2, destination)
References
- pyclesperanto_prototype.logical_xor(operand1: Union[ndarray, OCLArray, Image, _OCLImage], operand2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
operand1 (Image) – The first binary input image to be processed.
operand2 (Image) – The second binary input image to be processed.
destination (Image, optional) – The output image where results are written into.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.binary_xor(operand1, operand2, destination)
References
- pyclesperanto_prototype.map_array(source: Union[ndarray, OCLArray, Image, _OCLImage], new_values_vector: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Replaces integer intensities specified in a vector image.
The vector image must be 3D with size (m, 1, 1) where m corresponds to the maximum intensity in the original image. Assuming the vector image contains values (0, 1, 0, 2) means:
All pixels with value 0 (first entry in the vector image) get value 0
All pixels with value 1 get value 1
All pixels with value 2 get value 0
All pixels with value 3 get value 2
- Parameters
source (Image) –
new_values_vector (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.replace_intensities(input, new_values_vector, destination)
References
- pyclesperanto_prototype.mask(source: Union[ndarray, OCLArray, Image, _OCLImage], mask: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
mask (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.mask(source, mask, destination)
References
- pyclesperanto_prototype.mask_label(source: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, label_index: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
label_map (Image) –
destination (Image, optional) –
label_index (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.mask_label(source, label_map, destination, label_index)
References
- pyclesperanto_prototype.masked_voronoi_labeling(binary_source: Union[ndarray, OCLArray, Image, _OCLImage], mask_image: Union[ndarray, OCLArray, Image, _OCLImage], labeling_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
binary_source (Image) –
mask_image (Image) –
labeling_destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.masked_voronoi_labeling(input, destination)
References
- pyclesperanto_prototype.maximum(source1: Union[ndarray, OCLArray, Image, _OCLImage], source2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
source1 (Image) –
source2 (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.maximum_images(source1, source2, destination)
References
- pyclesperanto_prototype.maximum_box(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the local maximum of a pixels cube neighborhood.
The cubes size is specified by its half-width, half-height and half-depth (radius).
- Parameters
source (Image) –
destination (Image, optional) –
radius_x (Number, optional) –
radius_y (Number, optional) –
radius_z (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.maximum_box(source, destination, radius_x, radius_y, radius_z)
References
- pyclesperanto_prototype.maximum_distance_of_n_closest_points(distance_matrix: Union[ndarray, OCLArray, Image, _OCLImage], distance_vector_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the n shortest distances for each column in a distance matrix and puts the maximum of these in a vector.
- Parameters
distance_matrix (Image) –
distance_vector_destination (Image, optional) –
n (int) –
- Return type
distance_vector_destination
- pyclesperanto_prototype.maximum_distance_of_n_shortest_distances(distance_matrix: Union[ndarray, OCLArray, Image, _OCLImage], distance_vector_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the n shortest distances for each column in a distance matrix and puts the maximum of these in a vector.
- Parameters
distance_matrix (Image) –
distance_vector_destination (Image, optional) –
n (int) –
- Return type
distance_vector_destination
- pyclesperanto_prototype.maximum_distance_of_touching_neighbors(distance_matrix: Union[ndarray, OCLArray, Image, _OCLImage], touch_matrix: Union[ndarray, OCLArray, Image, _OCLImage], distancelist_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a touch matrix and a distance matrix to determine the maximum distance of touching neighbors for every object.
- Parameters
distance_matrix (Image) –
touch_matrix (Image) –
distancelist_destination (Image, optional) –
- Return type
average_distancelist_destination
References
- pyclesperanto_prototype.maximum_extension_map(labels: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines for every label the maximum distance of any pixel to the centroid and replaces every label with the that number.
- Parameters
labels (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.maximum_image_and_scalar(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, scalar: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
destination (Image, optional) –
scalar (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.maximum_image_and_scalar(source, destination, scalar)
References
- pyclesperanto_prototype.maximum_images(source1: Union[ndarray, OCLArray, Image, _OCLImage], source2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
source1 (Image) –
source2 (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.maximum_images(source1, source2, destination)
References
- pyclesperanto_prototype.maximum_intensity_map(intensity_image: Union[ndarray, OCLArray, Image, _OCLImage], labels: Union[ndarray, OCLArray, Image, _OCLImage], maximum_intensity_map: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes an image and a corresponding label map, determines the maximum intensity per label and replaces every label with the that number.
This results in a parametric image expressing maximum object intensity.
- Parameters
intensity_image (Image) –
labels (Image) –
mean_intensity_map (Image, optional) –
- Return type
maximum_intensity_map
References
- pyclesperanto_prototype.maximum_of_all_pixels(source: Union[ndarray, OCLArray, Image, _OCLImage]) 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
source (Image) – The image of which the maximum of all pixels or voxels will be determined.
- Return type
float
Examples
>>> import pyclesperanto_prototype as cle >>> cle.maximum_of_all_pixels(source)
References
- pyclesperanto_prototype.maximum_of_distal_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, min_distance: float = 0, max_distance: float = 3.4028235e+38) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the maximum value of neighboring labels. The distance range of the centroids of the neighborhood can be configured.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
min_distance (float, optional) – default : 0
max_distance (float, optional) – default: maximum float value
- Return type
parametric_map_destination
References
- pyclesperanto_prototype.maximum_of_n_most_touching_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1, ignore_touching_background: bool = True) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the maximum value of most touching neighboring labels. The number of most touching neighbors can be configured.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
n (int) – number of most touching neighbors
- Return type
parametric_map_destination
- pyclesperanto_prototype.maximum_of_n_nearest_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the maximum value of neighboring labels. The distance number of nearest neighbors can be configured.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
n (int, optional) – number of nearest neighbors
- Return type
parametric_map_destination
References
- pyclesperanto_prototype.maximum_of_proximal_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, min_distance: float = 0, max_distance: float = 3.4028235e+38) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the maximum value of neighboring labels. The distance range of the centroids of the neighborhood can be configured.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
min_distance (float, optional) – default : 0
max_distance (float, optional) – default: maximum float value
- Return type
parametric_map_destination
References
- pyclesperanto_prototype.maximum_of_touch_portion_within_range_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, minimum_touch_portion: float = 0, maximum_touch_portion: float = 1.1, ignore_touching_background: bool = True) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the maximum value of neighboring labels whose touch portion lies within a specified range. The number of most touching neighbors can be configured. Minimum and maximum of that specified range are excluded.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
minimum_touch_portion (float, optional) –
maximum_touch_portion (float, optional) –
- Return type
parametric_map_destination
- pyclesperanto_prototype.maximum_of_touching_neighbors(values: Union[ndarray, OCLArray, Image, _OCLImage], touch_matrix: Union[ndarray, OCLArray, Image, _OCLImage], maximum_values_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a touch matrix and a vector of values to determine the maximum value among touching neighbors for every object.
- Parameters
values (Image) – A vector of values corresponding to the labels of which the maximum
determined. (should be) –
touch_matrix (Image) – A touch_matrix specifying which labels are taken into account for
relationships. (neighborhood) –
maximum_values_destination (Image, optional) – A the resulting vector of maximum values in the neighborhood.
- Return type
maximum_values_destination
References
- pyclesperanto_prototype.maximum_of_touching_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius: int = 1, ignore_touching_background: bool = True) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the maximum value of neighboring labels. The radius of the neighborhood can be configured: * radius 0: Nothing is replaced * radius 1: direct neighbors are taken into account * radius 2: neighbors and neighbors or neighbors are taken into account * radius n: …
Notes
Values of all pixels in a label each must be identical.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
radius (int, optional) –
ignore_touching_background (bool, optional) –
- Return type
parametric_map_destination
References
- pyclesperanto_prototype.maximum_sphere(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the local maximum of a pixels spherical neighborhood.
The spheres size is specified by its half-width, half-height and half-depth (radius).
- Parameters
source (Image) –
destination (Image, optional) –
radius_x (Number, optional) –
radius_y (Number, optional) –
radius_z (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.maximum_sphere(source, destination, radius_x, radius_y, radius_z)
References
- pyclesperanto_prototype.maximum_x_projection(source: Union[ndarray, OCLArray, Image, _OCLImage], destination_max: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the maximum intensity projection of an image along X.
- Parameters
source (Image) –
destination_max (Image, optional) –
- Return type
destination_max
Examples
>>> import pyclesperanto_prototype as cle >>> cle.maximum_x_projection(source, destination_max)
References
- pyclesperanto_prototype.maximum_y_projection(source: Union[ndarray, OCLArray, Image, _OCLImage], destination_max: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the maximum intensity projection of an image along X.
- Parameters
source (Image) –
destination_max (Image, optional) –
- Return type
destination_max
Examples
>>> import pyclesperanto_prototype as cle >>> cle.maximum_y_projection(source, destination_max)
References
- pyclesperanto_prototype.maximum_z_projection(source: Union[ndarray, OCLArray, Image, _OCLImage], destination_max: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the maximum intensity projection of an image along Z.
- Parameters
source (Image) –
destination_max (Image, optional) –
- Return type
destination_max
Examples
>>> import pyclesperanto_prototype as cle >>> cle.maximum_z_projection(source, destination_max)
References
- pyclesperanto_prototype.mean_box(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the local mean average of a pixels box-shaped neighborhood.
The cubes size is specified by its half-width, half-height and half-depth (radius).
- Parameters
source (Image) –
destination (Image, optional) –
radius_x (Number, optional) –
radius_y (Number, optional) –
radius_z (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.mean_box(source, destination, radius_x, radius_y, radius_z)
References
- pyclesperanto_prototype.mean_extension_map(labels: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines for every label the mean distance of any pixel to the centroid and replaces every label with the that number.
- Parameters
labels (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.mean_intensity_map(source: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes an image and a corresponding label map, determines the mean intensity per label and replaces every label with the that number.
This results in a parametric image expressing mean object intensity.
- Parameters
source (Image) –
label_map (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.mean_of_all_pixels(source: Union[ndarray, OCLArray, Image, _OCLImage]) float
Determines the mean average of all pixels in a given image.
- Parameters
source (Image) – The image of which the mean average of all pixels or voxels will be determined.
- Return type
float
Examples
>>> import pyclesperanto_prototype as cle >>> cle.mean_of_all_pixels(source)
References
- pyclesperanto_prototype.mean_of_distal_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, min_distance: float = 0, max_distance: float = 3.4028235e+38) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the mean value of neighboring labels. The distance range of the centroids of the neighborhood can be configured.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
min_distance (float, optional) – default : 0
max_distance (float, optional) – default: maximum float value
- Return type
parametric_map_destination
References
- pyclesperanto_prototype.mean_of_n_most_touching_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1, ignore_touching_background: bool = True) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the mean value of most touching neighboring labels. The number of most touching neighbors can be configured.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
n (int) – number of most touching neighbors
- Return type
parametric_map_destination
- pyclesperanto_prototype.mean_of_n_nearest_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the mean value of neighboring labels. The distance number of nearest neighbors can be configured.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
n (int, optional) – number of nearest neighbors
- Return type
parametric_map_destination
References
- pyclesperanto_prototype.mean_of_proximal_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, min_distance: float = 0, max_distance: float = 3.4028235e+38) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the mean value of neighboring labels. The distance range of the centroids of the neighborhood can be configured.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
min_distance (float, optional) – default : 0
max_distance (float, optional) – default: maximum float value
- Return type
parametric_map_destination
References
- pyclesperanto_prototype.mean_of_touch_portion_within_range_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, minimum_touch_portion: float = 0, maximum_touch_portion: float = 1.1, ignore_touching_background: bool = True) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the mean value of neighboring labels whose touch portion lies within a specified range. The number of most touching neighbors can be configured. Minimum and maximum of that specified range are excluded.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
minimum_touch_portion (float, optional) –
maximum_touch_portion (float, optional) –
- Return type
parametric_map_destination
- pyclesperanto_prototype.mean_of_touching_neighbors(values: Union[ndarray, OCLArray, Image, _OCLImage], touch_matrix: Union[ndarray, OCLArray, Image, _OCLImage], mean_values_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a touch matrix and a vector of values to determine the mean value among touching neighbors for every object.
- Parameters
values (Image) – A vector of values corresponding to the labels of which the mean
determined. (average should be) –
touch_matrix (Image) – A touch_matrix specifying which labels are taken into account for
relationships. (neighborhood) –
mean_values_destination (Image, optional) – A the resulting vector of mean average values in the neighborhood.
- Return type
mean_values_destination
References
- pyclesperanto_prototype.mean_of_touching_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius: int = 1, ignore_touching_background: bool = True) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the mean value of neighboring labels. The radius of the neighborhood can be configured: * radius 0: Nothing is replaced * radius 1: direct neighbors are averaged * radius 2: neighbors and neighbors or neighbors are averaged * radius n: …
Notes
Values of all pixels in a label each must be identical.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
radius (int, optional) –
ignore_touching_background (bool, optional) –
- Return type
parametric_map_destination
References
- pyclesperanto_prototype.mean_sphere(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the local mean average of a pixels spherical neighborhood.
The spheres size is specified by its half-width, half-height and half-depth (radius).
- Parameters
source (Image) –
destination (Image, optional) –
radius_x (Number, optional) –
radius_y (Number, optional) –
radius_z (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.mean_sphere(source, destination, radius_x, radius_y, radius_z)
References
- pyclesperanto_prototype.mean_squared_error(source1: Union[ndarray, OCLArray, Image, _OCLImage], source2: Union[ndarray, OCLArray, Image, _OCLImage]) 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
source1 (Image) –
source2 (Image) –
- Return type
float
Examples
>>> import pyclesperanto_prototype as cle >>> cle.mean_squared_error(source1, source2)
References
- pyclesperanto_prototype.mean_x_projection(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the mean average intensity projection of an image along X.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.mean_x_projection(source, destination)
References
- pyclesperanto_prototype.mean_y_projection(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the mean average intensity projection of an image along Y.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.mean_y_projection(source, destination)
References
- pyclesperanto_prototype.mean_z_projection(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the mean average intensity projection of an image along Z.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.mean_z_projection(source, destination)
References
- pyclesperanto_prototype.median_box(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the local median of a pixels box shaped neighborhood.
The box is specified by its half-width and half-height (radius). For technical reasons, the area of the box must have less than 1000 pixels.
- Parameters
source (Image) –
destination (Image, optional) –
radius_x (Number, optional) –
radius_y (Number, optional) –
radius_z (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.median_box(source, destination, radius_x, radius_y, radius_z)
References
- pyclesperanto_prototype.median_of_touching_neighbors(values: Union[ndarray, OCLArray, Image, _OCLImage], touch_matrix: Union[ndarray, OCLArray, Image, _OCLImage], median_values_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a touch matrix and a vector of values to determine the median value among touching neighbors for every object.
- Parameters
values (Image) –
touch_matrix (Image) –
median_values_destination (Image, optional) –
- Return type
median_values_destination
References
- pyclesperanto_prototype.median_sphere(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the local median of a pixels sphere shaped neighborhood.
The sphere is specified by its half-width and half-height (radius). For technical reasons, the area of the box must have less than 1000 pixels.
- Parameters
source (Image) –
destination (Image, optional) –
radius_x (Number, optional) –
radius_y (Number, optional) –
radius_z (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.median_box(source, destination, radius_x, radius_y, radius_z)
References
- pyclesperanto_prototype.merge_labels_according_to_touch_matrix(labels: Union[ndarray, OCLArray, Image, _OCLImage], touch_matrix: Union[ndarray, OCLArray, Image, _OCLImage], labels_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Merge labels in a label image as specified by a binary touch matrix.
- Parameters
labels (Image) –
touch_matrix (Image) –
labels_destination (Image, optional) –
- Return type
labels_destination
- pyclesperanto_prototype.merge_labels_with_border_intensity_within_range(image: Union[ndarray, OCLArray, Image, _OCLImage], labels: Union[ndarray, OCLArray, Image, _OCLImage], labels_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, minimum_intensity: float = 0, maximum_intensity: float = 3.4028235e+38)
Takes an image and a label image to determine the mean intensity along borders between labels. Afterwards, it merges labels whose border intensity is within a specified range.
Notes
For technical reasons, only images of integer type are supported. In case images of type float are passed, the results may not be 100% repeatable.
The specified range includes minimum and maximum
- Parameters
image (Image) –
labels (Image) –
labels_destination (Image, optional) –
minimum_intensity (float, optional) –
maximum_intensity (float, optional) –
- Return type
labels_destination
- pyclesperanto_prototype.merge_touching_labels(labels_input: Union[ndarray, OCLArray, Image, _OCLImage], labels_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image, determines which labels are touching, merges them, renumbers them and produces a new label image.
- Parameters
labels_input (Image) –
labels_destination (Image, optional) –
- Returns
labels_destination
- Return type
Image
See also
- pyclesperanto_prototype.minimum(source1: Union[ndarray, OCLArray, Image, _OCLImage], source2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
source1 (Image) –
source2 (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.minimum_images(source1, source2, destination)
References
- pyclesperanto_prototype.minimum_box(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: float = 0, radius_y: float = 0, radius_z: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the local minimum of a pixels cube neighborhood.
The cubes size is specified by its half-width, half-height and half-depth (radius).
- Parameters
source (Image) –
destination (Image, optional) –
radius_x (Number, optional) –
radius_y (Number, optional) –
radius_z (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.minimum_box(source, destination, radius_x, radius_y, radius_z)
References
- pyclesperanto_prototype.minimum_distance_of_touching_neighbors(distance_matrix: Union[ndarray, OCLArray, Image, _OCLImage], touch_matrix: Union[ndarray, OCLArray, Image, _OCLImage], distancelist_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a touch matrix and a distance matrix to determine the minimum distance of touching neighbors for every object.
- Parameters
distance_matrix (Image) –
touch_matrix (Image) –
distancelist_destination (Image, optional) –
- Return type
average_distancelist_destination
References
- pyclesperanto_prototype.minimum_image_and_scalar(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, scalar: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
destination (Image, optional) –
scalar (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.minimum_image_and_scalar(source, destination, scalar)
References
- pyclesperanto_prototype.minimum_images(source1: Union[ndarray, OCLArray, Image, _OCLImage], source2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
source1 (Image) –
source2 (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.minimum_images(source1, source2, destination)
References
- pyclesperanto_prototype.minimum_intensity_map(intensity_image: Union[ndarray, OCLArray, Image, _OCLImage], labels: Union[ndarray, OCLArray, Image, _OCLImage], minimum_intensity_map: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes an image and a corresponding label map, determines the minimum intensity per label and replaces every label with the that number.
This results in a parametric image expressing minimum object intensity.
- Parameters
intensity_image (Image) –
labels (Image) –
minimum_intensity_map (Image, optional) –
- Return type
minimum_intensity_map
References
- pyclesperanto_prototype.minimum_of_all_pixels(source: Union[ndarray, OCLArray, Image, _OCLImage]) 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
source (Image) – The image of which the minimum of all pixels or voxels will be determined.
- Return type
float
Examples
>>> import pyclesperanto_prototype as cle >>> cle.minimum_of_all_pixels(source)
References
- pyclesperanto_prototype.minimum_of_distal_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, min_distance: float = 0, max_distance: float = 3.4028235e+38) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the minimum value of neighboring labels. The distance range of the centroids of the neighborhood can be configured.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
min_distance (float, optional) – default : 0
max_distance (float, optional) – default: maximum float value
- Return type
parametric_map_destination
References
- pyclesperanto_prototype.minimum_of_masked_pixels(source: Union[ndarray, OCLArray, Image, _OCLImage], mask: Union[ndarray, OCLArray, Image, _OCLImage])
Determines the minimum intensity in a masked image.
But only in pixels which have non-zero values in another mask image.
- Parameters
source (Image) –
mask (Image) –
Examples
>>> import pyclesperanto_prototype as cle >>> cle.minimum_of_masked_pixels(source, mask)
References
- pyclesperanto_prototype.minimum_of_n_most_touching_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1, ignore_touching_background: bool = True) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the minimum value of most touching neighboring labels. The number of most touching neighbors can be configured.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
n (int) – number of most touching neighbors
- Return type
parametric_map_destination
- pyclesperanto_prototype.minimum_of_n_nearest_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the minimum value of neighboring labels. The distance number of nearest neighbors can be configured.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
n (int, optional) – number of nearest neighbors
- Return type
parametric_map_destination
References
- pyclesperanto_prototype.minimum_of_proximal_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, min_distance: float = 0, max_distance: float = 3.4028235e+38) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the minimum value of neighboring labels. The distance range of the centroids of the neighborhood can be configured.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
min_distance (float, optional) – default : 0
max_distance (float, optional) – default: maximum float value
- Return type
parametric_map_destination
References
- pyclesperanto_prototype.minimum_of_touch_portion_within_range_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, minimum_touch_portion: float = 0, maximum_touch_portion: float = 1.1, ignore_touching_background: bool = True) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the minimum value of neighboring labels whose touch portion lies within a specified range. The number of most touching neighbors can be configured. Minimum and maximum of that specified range are excluded.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
minimum_touch_portion (float, optional) –
maximum_touch_portion (float, optional) –
- Return type
parametric_map_destination
- pyclesperanto_prototype.minimum_of_touching_neighbors(values: Union[ndarray, OCLArray, Image, _OCLImage], touch_matrix: Union[ndarray, OCLArray, Image, _OCLImage], minimum_values_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a touch matrix and a vector of values to determine the minimum value among touching neighbors for every object.
- Parameters
values (Image) – A vector of values corresponding to the labels of which the minimum
determined. (should be) –
touch_matrix (Image) – A touch_matrix specifying which labels are taken into account for
relationships. (neighborhood) –
minimum_values_destination (Image, optional) – A the resulting vector of minimum values in the neighborhood.
- Return type
minimum_values_destination
References
- pyclesperanto_prototype.minimum_of_touching_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius: int = 1, ignore_touching_background: bool = True) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the minimum value of neighboring labels. The radius of the neighborhood can be configured: * radius 0: Nothing is replaced * radius 1: direct neighbors are taken into account * radius 2: neighbors and neighbors or neighbors are taken into account * radius n: …
Notes
Values of all pixels in a label each must be identical.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
radius (int, optional) –
ignore_touching_background (bool, optional) –
- Return type
parametric_map_destination
References
- pyclesperanto_prototype.minimum_sphere(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the local minimum of a pixels spherical neighborhood.
The spheres size is specified by its half-width, half-height and half-depth (radius).
- Parameters
source (Image) –
destination (Image, optional) –
radius_x (Number, optional) –
radius_y (Number, optional) –
radius_z (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.minimum_sphere(source, destination, radius_x, radius_y, radius_z)
References
- pyclesperanto_prototype.minimum_x_projection(source: Union[ndarray, OCLArray, Image, _OCLImage], destination_min: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the minimum intensity projection of an image along Y.
- Parameters
source (Image) –
destination_min (Image, optional) –
- Return type
destination_min
Examples
>>> import pyclesperanto_prototype as cle >>> cle.minimum_x_projection(source, destination_min)
References
- pyclesperanto_prototype.minimum_y_projection(source: Union[ndarray, OCLArray, Image, _OCLImage], destination_min: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the minimum intensity projection of an image along Y.
- Parameters
source (Image) –
destination_min (Image, optional) –
- Return type
destination_min
Examples
>>> import pyclesperanto_prototype as cle >>> cle.minimum_y_projection(source, destination_min)
References
- pyclesperanto_prototype.minimum_z_projection(source: Union[ndarray, OCLArray, Image, _OCLImage], destination_min: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the minimum intensity projection of an image along Z.
- Parameters
source (Image) –
destination_min (Image, optional) –
- Return type
destination_min
Examples
>>> import pyclesperanto_prototype as cle >>> cle.minimum_z_projection(source, destination_min)
References
- pyclesperanto_prototype.mod(image1: Union[ndarray, OCLArray, Image, _OCLImage], image2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the remainder of a division of pairwise pixel values in two images
- Parameters
image1 (Image) –
image2 (Image) –
destination (Image, optional) –
- Return type
destination
- pyclesperanto_prototype.mode_of_distal_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, min_distance: float = 0, max_distance: float = 3.4028235e+38) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the mode value of neighboring labels. The distance range of the centroids of the neighborhood can be configured.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
min_distance (float, optional) – default : 0
max_distance (float, optional) – default: maximum float value
- Return type
parametric_map_destination
References
- pyclesperanto_prototype.mode_of_n_most_touching_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1, ignore_touching_background: bool = True) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the most popular value of most touching neighboring labels. The number of most touching neighbors can be configured.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
n (int) – number of most touching neighbors
- Return type
parametric_map_destination
- pyclesperanto_prototype.mode_of_n_nearest_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the mode value of neighboring labels. The distance number of nearest neighbors can be configured.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
n (int, optional) – number of nearest neighbors
- Return type
parametric_map_destination
References
- pyclesperanto_prototype.mode_of_proximal_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, min_distance: float = 0, max_distance: float = 3.4028235e+38) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the mode value of neighboring labels. The distance range of the centroids of the neighborhood can be configured.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
min_distance (float, optional) – default : 0
max_distance (float, optional) – default: maximum float value
- Return type
parametric_map_destination
References
- pyclesperanto_prototype.mode_of_touch_portion_within_range_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, minimum_touch_portion: float = 0, maximum_touch_portion: float = 1.1, ignore_touching_background: bool = True) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the most popular value of neighboring labels whose touch portion lies within a specified range. The number of most touching neighbors can be configured. Minimum and maximum of that specified range are excluded.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
minimum_touch_portion (float, optional) –
maximum_touch_portion (float, optional) –
- Return type
parametric_map_destination
- pyclesperanto_prototype.mode_of_touching_neighbors(src_values: Union[ndarray, OCLArray, Image, _OCLImage], touch_matrix: Union[ndarray, OCLArray, Image, _OCLImage], dst_values: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the most popular value of labeled neighboring objects for each object.
- Parameters
src_values (Image) – Vector of values
touch_matrix (Image) – Touch matrix describing neighborhood relationships
dst_values (Image, optional) – Resulting vector of values
- Return type
dst_values
- pyclesperanto_prototype.mode_of_touching_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius: int = 1, ignore_touching_background: bool = True) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the mode value of neighboring labels. The radius of the neighborhood can be configured: * radius 0: Nothing is replaced * radius 1: direct neighbors are taken into account * radius 2: neighbors and neighbors or neighbors are taken into account * radius n: …
Notes
Values of all pixels in a label each must be identical.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
radius (int, optional) –
ignore_touching_background (bool, optional) –
- Return type
parametric_map_destination
References
- pyclesperanto_prototype.modulo_images(image1: Union[ndarray, OCLArray, Image, _OCLImage], image2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the remainder of a division of pairwise pixel values in two images
- Parameters
image1 (Image) –
image2 (Image) –
destination (Image, optional) –
- Return type
destination
- pyclesperanto_prototype.multiply_image_and_coordinate(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, dimension=0) Union[ndarray, OCLArray, Image, _OCLImage]
Multiplies all pixel intensities with the x, y or z coordinate, depending on specified dimension.
- Parameters
source (Image) –
destination (Image, optional) –
dimension (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.multiply_image_and_coordinate(source, destination, dimension)
References
- pyclesperanto_prototype.multiply_image_and_scalar(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, scalar: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Multiplies all pixels value x in a given image X with a constant scalar s.
<pre>f(x, s) = x * s</pre>
- Parameters
source (Image) – The input image to be multiplied with a constant.
destination (Image, optional) – The output image where results are written into.
scalar (float, optional) – The number with which every pixel will be multiplied with.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.multiply_image_and_scalar(source, destination, scalar)
References
- pyclesperanto_prototype.multiply_images(factor1: Union[ndarray, OCLArray, Image, _OCLImage], factor2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Multiplies all pairs of pixel values x and y from two image X and Y.
<pre>f(x, y) = x * y</pre>
- Parameters
factor1 (Image) – The first input image to be multiplied.
factor2 (Image) – The second image to be multiplied.
destination (Image, optional) – The output image where results are written into.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.multiply_images(factor1, factor2, destination)
References
- pyclesperanto_prototype.multiply_matrix(matrix1: Union[ndarray, OCLArray, Image, _OCLImage], matrix2: Union[ndarray, OCLArray, Image, _OCLImage], matrix_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Multiplies two matrices with each other.
Shape of matrix1 should be equal to shape of matrix2 transposed.
- Parameters
matrix1 (Image) –
matrix2 (Image) –
matrix_destination (Image, optional) –
- Return type
matrix_destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.multiply_matrix(matrix1, matrix2, matrix_destination)
References
- pyclesperanto_prototype.n_closest_points(distance_matrix: Union[ndarray, OCLArray, Image, _OCLImage], indexlist_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1, ignore_background: bool = True, ignore_self: bool = True) Union[ndarray, OCLArray, Image, _OCLImage]
Determine the n point indices with shortest distance for all points in a distance matrix.
This corresponds to the n row indices with minimum values for each column of the distance matrix.
- Parameters
distance_matrix (Image) –
indexlist_destination (Image, optional) –
n (Number, optional) –
ignore_background (bool, optional) – The first column and row of the distance matrix will be ignored because they represent the background object.
ignore_self (bool, optional) – The x==y diagonal will be ignored because it represents the distance of the object to itself.
- Return type
indexlist_destination
References
- pyclesperanto_prototype.n_nearest_labels_to_igraph(label_image: Union[ndarray, OCLArray, Image, _OCLImage], n: int = 1)
Takes a label image, determines which n labels are the nearest to each label returns an igraph graph representing labels in range.
- Parameters
label_image (Image) –
n (int, optional) – number of nearest labels
- Return type
igraph Graph
- pyclesperanto_prototype.n_nearest_labels_to_networkx(label_image: Union[ndarray, OCLArray, Image, _OCLImage], n: int = 1)
Takes a label image, determines which n labels are the nearest to each label returns an networkx graph representing labels in range.
- Parameters
label_image (Image) –
n (int, optional) – number of nearest labels
- Return type
networkx Graph
- pyclesperanto_prototype.nan_to_num(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, nan: float = 0, posinf: float = 1.7976931348623157e+308, neginf: float = - 1.7976931348623157e+308) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
destination (Image, optional) –
nan (float, optional) – default 0
posinf (float, optional) – default: a very large number
neginf (float, optional) – default a very small number
- Return type
destination
See also
- pyclesperanto_prototype.neighbors_of_neighbors(touch_matrix: Union[ndarray, OCLArray, Image, _OCLImage], neighbor_matrix_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines neighbors of neigbors from touch matrix and saves the result as a new touch matrix.
- Parameters
touch_matrix (Image) –
neighbor_matrix_destination (Image, optional) –
- Return type
neighbor_matrix_destination
References
- pyclesperanto_prototype.nonzero_maximum_box(source: Union[ndarray, OCLArray, Image, _OCLImage], flag_dst: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.nonzero_maximum_box(input, destination)
References
- pyclesperanto_prototype.nonzero_maximum_diamond(source: Union[ndarray, OCLArray, Image, _OCLImage], flag_dst: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.nonzero_maximum_diamond(input, destination)
References
- pyclesperanto_prototype.nonzero_minimum_box(source: Union[ndarray, OCLArray, Image, _OCLImage], flag_dst: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.nonzero_minimum_box(input, destination)
References
- pyclesperanto_prototype.nonzero_minimum_diamond(source: Union[ndarray, OCLArray, Image, _OCLImage], flag_dst: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.nonzero_minimum_diamond(input, destination)
References
- pyclesperanto_prototype.not_equal(source1: Union[ndarray, OCLArray, Image, _OCLImage], source2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines if two images A and B equal pixel wise.
f(a, b) = 1 if a != b; 0 otherwise.
- Parameters
source1 (Image) – The first image to be compared with.
source2 (Image) – The second image to be compared with the first.
destination (Image, optional) – The resulting binary image where pixels will be 1 only if source1
pixel. (and source2 are not equal in the given) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.not_equal(source1, source2, destination)
References
- pyclesperanto_prototype.not_equal_constant(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, constant: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Determines if two images A and B equal pixel wise.
- sourceImage
The image where every pixel is compared to the constant.
- destinationImage, optional
The resulting binary image where pixels will be 1 only if source1
and source2 equal in the given pixel. constant : float, optional
The constant where every pixel is compared to.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.not_equal_constant(source, destination, constant)
References
- pyclesperanto_prototype.nparray(gpu_array)
Returns an image from GPU memory as numpy compatible array
Deprecated since version 0.6.0: pull behaviour will be changed pyclesperanto_prototype 0.7.0 to do the same as pull_zyx because it’s faster and having both doing different things is confusing.
- Parameters
image (OCLArray) –
- Return type
numpy array
Examples
>>> import pyclesperanto_prototype as cle >>> cle.pull(image)
References
- pyclesperanto_prototype.onlyzero_overwrite_maximum_box(source: Union[ndarray, OCLArray, Image, _OCLImage], flag_dst: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Apply a local maximum filter to an image which only overwrites pixels with value 0.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.onlyzero_overwrite_maximum_box(input, destination)
References
- pyclesperanto_prototype.onlyzero_overwrite_maximum_diamond(source: Union[ndarray, OCLArray, Image, _OCLImage], flag_dst: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Apply a local maximum filter to an image which only overwrites pixels with value 0.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.onlyzero_overwrite_maximum_diamond(input, destination)
References
- pyclesperanto_prototype.opening_box(input_image: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: int = 0, radius_y: int = 0, radius_z: int = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Opening operator, box-shaped
Applies morphological opening to intensity images using a box-shaped footprint. This operator also works with binary images.
- Parameters
input_image (Image) –
destination (Image, optional) –
radius_x (int, optional) –
radius_y (int, optional) –
radius_z (int, optional) –
- Return type
destination
- pyclesperanto_prototype.opening_labels(labels_input: Union[ndarray, OCLArray, Image, _OCLImage], labels_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius: int = 0) Union[ndarray, OCLArray, Image, _OCLImage]
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
labels_input (Image) –
labels_destination (Image, optional) –
radius (int, optional) –
- Returns
labels_destination
- Return type
Image
- pyclesperanto_prototype.opening_sphere(input_image: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Opening operator, sphere-shaped
Applies morphological opening to intensity images using a sphere-shaped footprint. This operator also works with binary images.
- Parameters
input_image (Image) –
destination (Image, optional) –
radius_x (int, optional) –
radius_y (int, optional) –
radius_z (int, optional) –
- Returns
destination
- Return type
Image
- pyclesperanto_prototype.operation(name: str)
Returns a function from the pyclesperanto package
- Parameters
name (str) – name of the operation
- Return type
function
- pyclesperanto_prototype.operations(must_have_categories: Optional[list] = None, must_not_have_categories: Optional[list] = None) dict
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
- pyclesperanto_prototype.paste(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, destination_x: int = 0, destination_y: int = 0, destination_z: int = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Pastes an image into another image at a given position.
- Parameters
source (Image) –
destination (Image, optional) –
destination_x (Number, optional) –
destination_y (Number, optional) –
destination_z (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.paste(source, destination, destination_x, destination_y, destination_z)
References
- pyclesperanto_prototype.pixel_count_map(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines the number of pixels per label and replaces every label with the that number.
This results in a parametric image expressing area or volume.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.plugin_function(function: ~typing.Callable = '__no__default__', output_creator: ~typing.Callable = <function create_like>, categories: list = None, priority: int = 0) Callable
Function decorator to ensure correct types and values of all parameters.
The given input parameters are either of type OCLArray (which the GPU understands) or are converted to this type (see push function). If output parameters of type OCLArray are not set, an empty image is created and handed over.
- Parameters
function (callable) – The function to be executed on the GPU.
output_creator (callable, optional) – A function to create an output OCLArray given an input OCLArray. By default, we create float32 output images of the same shape as input images.
categories (list of str, optional) – A list of category names the function is associated with
priority (int, optional) – can be used in lists of multiple operations to differentiate multiple operations that fulfill the same purpose but better/faster/more general.
- Returns
worker_function – The actual function call that will be executed, magically creating output arguments of the correct type.
- Return type
callable
- pyclesperanto_prototype.point_index_list_to_mesh(pointlist: Union[ndarray, OCLArray, Image, _OCLImage], indexlist: Union[ndarray, OCLArray, Image, _OCLImage], mesh_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Meshes all points in a given point list which are indiced in a corresponding index list.
- Parameters
pointlist (Image) –
indexlist (Image) –
mesh_destination (Image, optional) –
- Return type
mesh_destination
References
- pyclesperanto_prototype.point_index_list_to_touch_matrix(indexlist: Union[ndarray, OCLArray, Image, _OCLImage], matrix_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a list of point indices to generate a touch matrix (a.k.a. adjacency graph matrix) out of it. The list has a dimensionality of m*n for the points 1… m (0 a.k.a. background is not in this list). In the n rows, there are indices to points which should be connected.
- Parameters
indexlist (Image) –
matrix_destination (Image, optional) –
- Return type
matrix_destination
- pyclesperanto_prototype.pointlist_to_labelled_spots(pointlist: Union[ndarray, OCLArray, Image, _OCLImage], spots_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a pointlist with dimensions n times d with n point coordinates in d dimensions and labels corresponding pixels.
- Parameters
pointlist (Image) –
spots_destination (Image, optional) –
- Return type
spots_destination
References
- pyclesperanto_prototype.power(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, exponent: float = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Computes all pixels value x to the power of a given exponent a.
<pre>f(x, a) = x ^ a</pre>
- Parameters
source (Image) –
destination (Image, optional) –
exponent (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.power(source, destination, exponent)
References
- pyclesperanto_prototype.power_images(source: Union[ndarray, OCLArray, Image, _OCLImage], exponent: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Calculates x to the power of y pixel wise of two images X and Y.
- Parameters
source (Image) –
exponent (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.power_images(input, exponent, destination)
References
- pyclesperanto_prototype.prefix_in_x(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, scalar: float = 0)
Takes a matrix or vector and adds a scalar in x-direction.
This is often useful, e.g. if you have a vector of measurements and you need a vector of background 0 and behind measurements.
input: 1, 3, 4 output: 0, 1, 3, 4
- Parameters
source (Image) –
destination (Image, optional) –
scalar (float, optional) –
- Return type
destination
- pyclesperanto_prototype.proximal_labels_to_igraph(label_image: Union[ndarray, OCLArray, Image, _OCLImage], minimum_distance: float = 0, maximum_distance: float = 3.4028235e+38)
Takes a label image, determines which labels are in a given distance range and returns an igraph graph representing labels in range.
- Parameters
label_image (Image) –
minimum_distance (float, optional) –
maximum_distance (float, optional) –
- Return type
igraph Graph
- pyclesperanto_prototype.proximal_labels_to_networkx(label_image: Union[ndarray, OCLArray, Image, _OCLImage], minimum_distance: float = 0, maximum_distance: float = 3.4028235e+38)
Takes a label image, determines which labels are in a given distance range and returns an networkx graph representing labels in range.
- Parameters
label_image (Image) –
minimum_distance (float, optional) –
maximum_distance (float, optional) –
- Return type
networkx Graph
- pyclesperanto_prototype.proximal_neighbor_count(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, min_distance: float = 0, max_distance: float = 3.4028235e+38) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines which labels are within a give distance range and returns the number of those in a vector.
- Parameters
source (Image) –
destination (Image, optional) –
min_distance (float, optional) – default : 0
max_distance (float, optional) – default: maximum float value
- Return type
destination
- pyclesperanto_prototype.proximal_neighbor_count_map(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, min_distance: float = 0, max_distance: float = 3.4028235e+38) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines which labels are within a give distance range and replaces every label with the number of neighboring labels.
- Parameters
source (Image) –
destination (Image, optional) –
min_distance (float, optional) – default : 0
max_distance (float, optional) – default: maximum float value
- Return type
destination
References
- pyclesperanto_prototype.proximal_other_labels_count(label_image: Union[ndarray, OCLArray, Image, _OCLImage], other_label_image: Union[ndarray, OCLArray, Image, _OCLImage], count_vector: Union[ndarray, OCLArray, Image, _OCLImage] = None, maximum_distance: float = 25) Union[ndarray, OCLArray, Image, _OCLImage]
Count number of labels within a given radius in an other label image and returns the result as vector.
Notes
This operation assumes input images are isotropic.
- Parameters
label_image (Image) –
other_label_image (Image) –
count_vector (Image, optional) – vector (num_labels + 1 long) where the values will be written in. The first column (index 0, value 0) corresponds to background.
maximum_distance (Number, optional) – maximum distance in pixels
- Return type
count_vector
- pyclesperanto_prototype.proximal_other_labels_count_map(label_image: Union[ndarray, OCLArray, Image, _OCLImage], other_label_image: Union[ndarray, OCLArray, Image, _OCLImage], count_map: Union[ndarray, OCLArray, Image, _OCLImage] = None, maximum_distance: float = 25) Union[ndarray, OCLArray, Image, _OCLImage]
Count number of labels within a given radius in an other label image and returns the result as parametric map.
- Parameters
label_image (Image) –
other_label_image (Image) –
count_map (Image, optional) – parametric image where the values will be written in.
maximum_distance (Number, optional) – maximum distance in pixels
- Return type
count_map
- pyclesperanto_prototype.pull(gpu_array)
Returns an image from GPU memory as numpy compatible array
Deprecated since version 0.6.0: pull behaviour will be changed pyclesperanto_prototype 0.7.0 to do the same as pull_zyx because it’s faster and having both doing different things is confusing.
- Parameters
image (OCLArray) –
- Return type
numpy array
Examples
>>> import pyclesperanto_prototype as cle >>> cle.pull(image)
References
- pyclesperanto_prototype.pull_zyx(gpu_array)
- pyclesperanto_prototype.push(any_array)
Copies an image to GPU memory and returns its handle
Deprecated since version 0.6.0: push behaviour will be changed pyclesperanto_prototype 0.7.0 to do the same as push_zyx because it’s faster and having both doing different things is confusing.
- Parameters
image (numpy array) –
- Return type
object of type backend.array_type()
Examples
>>> import pyclesperanto_prototype as cle >>> cle.push(image)
References
- pyclesperanto_prototype.push_regionprops(props: Union[dict, RegionProperties], first_row_index: int = 0) Union[ndarray, OCLArray, Image, _OCLImage]
See also
- Parameters
props –
- pyclesperanto_prototype.push_regionprops_column(regionprops: Union[list, dict], column: str) Union[ndarray, OCLArray, Image, _OCLImage]
- pyclesperanto_prototype.push_zyx(any_array)
- pyclesperanto_prototype.radians_to_degrees(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Converts radians to degrees
- pyclesperanto_prototype.radius_to_kernel_size(radius)
- pyclesperanto_prototype.range(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, start_x: int = None, stop_x: int = None, step_x: int = None, start_y: int = None, stop_y: int = None, step_y: int = None, start_z: int = None, stop_z: int = None, step_z: int = None) Union[ndarray, OCLArray, Image, _OCLImage]
Crops an image according to a defined range and step size
- Parameters
source (Image) –
destination (Image, optional) –
start_x (int, optional) –
stop_x (int, optional) –
step_x (int, optional) –
start_y (int, optional) –
stop_y (int, optional) –
step_y (int, optional) –
start_z (int, optional) –
stop_z (int, optional) –
step_z (int, optional) –
- Return type
destination
- pyclesperanto_prototype.read_intensities_from_map(labels: Union[ndarray, OCLArray, Image, _OCLImage], map_image: Union[ndarray, OCLArray, Image, _OCLImage], values_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric image to read parametric values from the labels positions. The read intensity values are stored in a new vector.
Note: This will only work if all labels have number of voxels == 1 or if all pixels in each label have the same value.
- Parameters
labels (Image) –
map_image (Image) –
values_destination (Image, optional) – 1d vector with length == number of labels + 1
- Returns
vector of intensity values with 0th element corresponding to background and subsequent entries corresponding to the intensity in the given labeled object
- Return type
values_destination, Image
- pyclesperanto_prototype.read_intensities_from_positions(pointlist: Union[ndarray, OCLArray, Image, _OCLImage], intensity_image: Union[ndarray, OCLArray, Image, _OCLImage], values_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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.
- Parameters
pointlist (Image) –
intensity_image (Image) –
values_destination (Image, optional) –
- Return type
values_destination
- pyclesperanto_prototype.reciprocal(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes 1/x for every pixel value
This function is supposed to work similarly to its counter part in numpy [1]
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.reduce_labels_to_centroids(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map and reduces all labels to their center spots. Label IDs stay and background will be zero.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
See also
- pyclesperanto_prototype.reduce_labels_to_label_edges(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map and reduces all labels to their edges. Label IDs stay and background will be zero.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
See also
- pyclesperanto_prototype.reduce_stack(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, reduction_factor: int = 2, offset: int = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Reduces the number of slices in a stack by a given factor. With the offset you have control which slices stay: * With factor 3 and offset 0, slices 0, 3, 6,… are kept. * With factor 4 and offset 1, slices 1, 5, 9,… are kept.
- Parameters
source (Image) –
destination (Image, optional) –
reduction_factor (Number, optional) –
offset (Number, optional) –
- Return type
destination
References
- pyclesperanto_prototype.regionprops(labelmap: Union[ndarray, OCLArray, Image, _OCLImage], intensity_image: Union[ndarray, OCLArray, Image, _OCLImage] = None, cache: bool = True, extra_properties=[]) Union[ndarray, OCLArray, Image, _OCLImage]
Convert the intensity image and the corresponding label image to numpy arrays (via pull) and calls scikit-image regionprops [1]. Hence, this operation runs on the CPU. A faster, GPU-accelerated function with limited measurements is available as statistics_of_labelled_pixels [2].
Note: the parameter order is different compared to statistics_of_labeled_pixels
- Parameters
labelmap (Image) –
intensity_image (Image) –
extra_properties (list) –
- Return type
scikit-image regionprops
References
- pyclesperanto_prototype.relabel_sequential(source: Union[ndarray, OCLArray, Image, _OCLImage], output: Union[ndarray, OCLArray, Image, _OCLImage] = None, blocksize: int = 4096) Union[ndarray, OCLArray, Image, _OCLImage]
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
labeling_input (Image) –
labeling_destination (Image, optional) –
blocksize (int, optional) – Renumbering is done in blocks for performance reasons. Change the blocksize to adapt to your data and hardware
- Return type
labeling_destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.relabel_sequential(labeling_input, labeling_destination)
References
- pyclesperanto_prototype.remainder(image1: Union[ndarray, OCLArray, Image, _OCLImage], image2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the remainder of a division of pairwise pixel values in two images
- Parameters
image1 (Image) –
image2 (Image) –
destination (Image, optional) –
- Return type
destination
- pyclesperanto_prototype.replace_intensities(source: Union[ndarray, OCLArray, Image, _OCLImage], new_values_vector: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Replaces integer intensities specified in a vector image.
The vector image must be 3D with size (m, 1, 1) where m corresponds to the maximum intensity in the original image. Assuming the vector image contains values (0, 1, 0, 2) means:
All pixels with value 0 (first entry in the vector image) get value 0
All pixels with value 1 get value 1
All pixels with value 2 get value 0
All pixels with value 3 get value 2
- Parameters
source (Image) –
new_values_vector (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.replace_intensities(input, new_values_vector, destination)
References
- pyclesperanto_prototype.replace_intensity(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, value_to_replace: float = 0, value_replacement: float = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Replaces a specific intensity in an image with a given new value.
- Parameters
source (Image) –
destination (Image, optional) –
value_to_replace (Number, optional) –
value_replacement (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.replace_intensity(input, destination, value_to_replace, value_replacement)
References
- pyclesperanto_prototype.resample(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, factor_x: float = 1, factor_y: float = 1, factor_z: float = 1, linear_interpolation: bool = False) Union[ndarray, OCLArray, Image, _OCLImage]
Resamples an image with given size factors using an affine transform.
- Parameters
source (Image) –
destination (Image, optional) –
factor_x (Number, optional) –
factor_y (Number, optional) –
factor_z (Number, optional) –
linear_interpolation (Boolean, optional) –
- Return type
destination
References
- pyclesperanto_prototype.rigid_transform(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, translate_x: float = 0, translate_y: float = 0, translate_z: float = 0, angle_around_x_in_degrees: float = 0, angle_around_y_in_degrees: float = 0, angle_around_z_in_degrees: float = 0, rotate_around_center: bool = True, linear_interpolation: bool = False, auto_size: bool = False) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) – image to be transformed
destination (Image, optional) – target image
translate_x (float, optional) – translation along x axis in pixels
translate_y (float, optional) – translation along y axis in pixels
translate_z (float, optional) – translation along z axis in pixels
angle_around_x_in_degrees (float, optional) – rotation around x axis in radians
angle_around_y_in_degrees (float, optional) – rotation around y axis in radians
angle_around_z_in_degrees (float, optional) – rotation around z axis in radians
rotate_around_center (bool, optional) – if True: rotate image around center (default) if False: rotate image around origin
linear_interpolation (bool, optional) – If true, bi-/tri-linear interpolation will be applied, if hardware allows. If false, nearest-neighbor interpolation wille be applied.
auto_size (bool, optional) – Automatically determines the size of the output image depending on the rotation angles. If set to True, the rotate_around_center setting is not relevant. The applied transform may have an additional translation vector that was not explicitly provided. This also means that any given translation vector will be neglected. Note: auto_size will be ignored if destination is not None. For more details see [1].
- Return type
destination
See also
- pyclesperanto_prototype.rotate(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, angle_around_x_in_degrees: float = 0, angle_around_y_in_degrees: float = 0, angle_around_z_in_degrees: float = 0, rotate_around_center: bool = True, linear_interpolation: bool = False, auto_size: bool = False) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) – image to be translated
destination (Image, optional) – target image
angle_around_x_in_degrees (float, optional) – rotation around x axis in degrees
angle_around_y_in_degrees (float, optional) – rotation around y axis in degrees
angle_around_z_in_degrees (float, optional) – rotation around z axis in degrees
rotate_around_center (bool, optional) – if True: rotate image around center if False: rotate image around origin
linear_interpolation (bool, optional) – If true, bi-/tri-linear interpolation will be applied, if hardware supports it. If false, nearest-neighbor interpolation wille be applied.
auto_size (bool, optional) – Automatically determines the size of the output image depending on the rotation angles. If set to True, the rotate_around_center setting is not relevant. Note: auto_size will be ignored if destination is not None. For more details see [1].
- Return type
destination
See also
- pyclesperanto_prototype.scale(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, factor_x: float = 1, factor_y: float = 1, factor_z: float = 1, centered: bool = True, linear_interpolation: bool = False, auto_size: bool = False) Union[ndarray, OCLArray, Image, _OCLImage]
Scale the image by given factors.
- Parameters
source (Image) – image to be translated
destination (Image, optional) – target image
factor_x (float, optional) – scaling along x
factor_y (float, optional) – scaling along y
factor_z (float, optional) – scaling along z
centered (bool, optional) – If true, the image will be scaled to the center of the image. If false, the image will be scaled to the origin of the coordinate system.
linear_interpolation (bool, optional) – If true, bi-/tri-linear interplation will be applied. If false, nearest-neighbor interpolation wille be applied.
auto_size (bool, optional) – Automatically determines the size of the output image depending on the rotation angles. If set to True, the centered setting is not relevant. Note: auto_size will be ignored if destination is not None. For more details see [1].
- Return type
destination
See also
- pyclesperanto_prototype.search_operation_names(name)
- pyclesperanto_prototype.select_device(name: Optional[str] = None, dev_type: Optional[str] = None, score_key=None) Device
Set current GPU device based on optional parameters.
- Parameters
name (str, optional) – First device that contains
name
will be returned, defaults to Nonedev_type (str, optional) – {‘cpu’, ‘gpu’, or None}, defaults to None
score_key (callable, optional) – scoring function, accepts device and returns int, defaults to None
- Returns
The current GPU instance.
- Return type
GPU
- pyclesperanto_prototype.set(source: Union[ndarray, OCLArray, Image, _OCLImage], scalar: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Sets all pixel values x of a given image X to a constant value v.
<pre>f(x) = v</pre>
- Parameters
source (Image) –
value (Number, optional) –
Examples
>>> import pyclesperanto_prototype as cle >>> cle.set(source, value)
References
- pyclesperanto_prototype.set_column(source: Union[ndarray, OCLArray, Image, _OCLImage], column_index: int = 0, value: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Sets all pixel values x of a given column in X to a constant value v.
- Parameters
source (Image) –
column_index (Number, optional) –
value (Number, optional) –
Examples
>>> import pyclesperanto_prototype as cle >>> cle.set_column(source, column_index, value)
References
- pyclesperanto_prototype.set_device_scoring_key(func: Callable[[Device], int]) None
- pyclesperanto_prototype.set_image_borders(destination: Union[ndarray, OCLArray, Image, _OCLImage], value: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Sets all pixel values at the image border to a given value.
- Parameters
destination (Image) –
value (Number, optional) –
Examples
>>> import pyclesperanto_prototype as cle >>> cle.set_image_borders(destination, value)
References
- pyclesperanto_prototype.set_non_zero_pixels_to_pixel_index(source: Union[ndarray, OCLArray, Image, _OCLImage], output: Union[ndarray, OCLArray, Image, _OCLImage] = None, offset: float = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Replaces all 0 value pixels in an image with the index of a pixel.
- Parameters
source (Image) –
output (Image, optional) –
offset (int, optional) –
- pyclesperanto_prototype.set_nonzero_pixels_to_pixelindex(source: Union[ndarray, OCLArray, Image, _OCLImage], output: Union[ndarray, OCLArray, Image, _OCLImage] = None, offset: float = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Replaces all 0 value pixels in an image with the index of a pixel.
- Parameters
source (Image) –
output (Image, optional) –
offset (int, optional) –
- pyclesperanto_prototype.set_plane(source: Union[ndarray, OCLArray, Image, _OCLImage], plane_index: int = 0, value: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Sets all pixel values x of a given plane in X to a constant value v.
- Parameters
source (Image) –
plane_index (Number, optional) –
value (Number, optional) –
Examples
>>> import pyclesperanto_prototype as cle >>> cle.set_plane(source, plane_index, value)
References
- pyclesperanto_prototype.set_ramp_x(source: Union[ndarray, OCLArray, Image, _OCLImage]) Union[ndarray, OCLArray, Image, _OCLImage]
Sets all pixel values to their X coordinate
- Parameters
source (Image) –
Examples
>>> import pyclesperanto_prototype as cle >>> cle.set_ramp_x(source)
References
- pyclesperanto_prototype.set_ramp_y(source: Union[ndarray, OCLArray, Image, _OCLImage]) Union[ndarray, OCLArray, Image, _OCLImage]
Sets all pixel values to their Y coordinate
- Parameters
source (Image) –
Examples
>>> import pyclesperanto_prototype as cle >>> cle.set_ramp_y(source)
References
- pyclesperanto_prototype.set_ramp_z(source: Union[ndarray, OCLArray, Image, _OCLImage]) Union[ndarray, OCLArray, Image, _OCLImage]
Sets all pixel values to their Z coordinate
- Parameters
source (Image) –
Examples
>>> import pyclesperanto_prototype as cle >>> cle.set_ramp_z(source)
References
- pyclesperanto_prototype.set_row(source: Union[ndarray, OCLArray, Image, _OCLImage], row_index: int = 0, value: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Sets all pixel values x of a given row in X to a constant value v.
- Parameters
source (Image) –
row_index (Number, optional) –
value (Number, optional) –
Examples
>>> import pyclesperanto_prototype as cle >>> cle.set_row(source, row_index, value)
References
- pyclesperanto_prototype.set_wait_for_kernel_finish(wait_for_kernel_finish: Optional[bool] = None)
- pyclesperanto_prototype.set_where_x_equals_y(source: Union[ndarray, OCLArray, Image, _OCLImage], value: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
value (Number, optional) –
References
- pyclesperanto_prototype.set_where_x_greater_than_y(source: Union[ndarray, OCLArray, Image, _OCLImage], value: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
value (Number, optional) –
References
- pyclesperanto_prototype.set_where_x_smaller_than_y(source: Union[ndarray, OCLArray, Image, _OCLImage], value: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
value (Number, optional) –
References
- pyclesperanto_prototype.sigma_to_kernel_size(sigma)
- pyclesperanto_prototype.sign(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
destination (Image, optional) –
- Return type
destination
See also
- pyclesperanto_prototype.small_hessian_eigenvalue(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the Hessian eigenvalues and returns the small eigenvalue image.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
- pyclesperanto_prototype.smaller(source1: Union[ndarray, OCLArray, Image, _OCLImage], source2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines if two images A and B smaller pixel wise.
f(a, b) = 1 if a < b; 0 otherwise.
- Parameters
source1 (Image) –
source2 (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.smaller(source1, source2, destination)
References
- pyclesperanto_prototype.smaller_constant(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, constant: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Determines if two images A and B smaller pixel wise.
f(a, b) = 1 if a < b; 0 otherwise.
- Parameters
source (Image) –
destination (Image, optional) –
constant (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.smaller_constant(source, destination, constant)
References
- pyclesperanto_prototype.smaller_or_equal(source1: Union[ndarray, OCLArray, Image, _OCLImage], source2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines if two images A and B smaller or equal pixel wise.
f(a, b) = 1 if a <= b; 0 otherwise.
- Parameters
source1 (Image) –
source2 (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.smaller_or_equal(source1, source2, destination)
References
- pyclesperanto_prototype.smaller_or_equal_constant(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, constant: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Determines if two images A and B smaller or equal pixel wise.
f(a, b) = 1 if a <= b; 0 otherwise.
- Parameters
source (Image) –
destination (Image, optional) –
constant (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.smaller_or_equal_constant(source, destination, constant)
References
- pyclesperanto_prototype.smooth_labels(labels_input: Union[ndarray, OCLArray, Image, _OCLImage], labels_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius: int = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Apply a morphological opening operation to a label image and afterwards fills gaps between the labels using voronoi-labeling. Finally, the result label image is masked so that all background pixels remain background pixels.
Note: It is recommended to process isotropic label images.
- Parameters
labels_input (Image) –
labels_destination (Image, optional) –
radius (int, optional) –
- Returns
labels_destination
- Return type
Image
- pyclesperanto_prototype.sobel(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Convolve the image with the Sobel kernel.
Author(s): Ruth Whelan-Jeans, Robert Haase
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.sobel(source, destination)
References
- pyclesperanto_prototype.sorensen_dice_coefficient(source1: Union[ndarray, OCLArray, Image, _OCLImage], source2: Union[ndarray, OCLArray, Image, _OCLImage]) float
Determines the overlap of two binary images using the Sorensen-Dice coefficent.
A value of 0 suggests no overlap, 1 means perfect overlap. The Sorensen-Dice coefficient is saved in the colum ‘Sorensen_Dice_coefficient’. Note that the Sorensen-Dice coefficient s can be calculated from the Jaccard index j using this formula: <pre>s = f(j) = 2 j / (j + 1)</pre>
- Parameters
source1 (Image) –
source2 (Image) –
- Return type
float
Examples
>>> import pyclesperanto_prototype as cle >>> cle.sorensen_dice_coefficient(source1, source2)
References
- pyclesperanto_prototype.spots_to_pointlist(input_spots: Union[ndarray, OCLArray, Image, _OCLImage], destination_pointlist: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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_spots (Image) –
destination_pointlist (Image, optional) –
- Return type
destination_pointlist
References
- pyclesperanto_prototype.sqrt(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the square root of each pixel.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
- pyclesperanto_prototype.square(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Return the element-wise square of the input.
This function is supposed to be similar to its counterpart in numpy [1]
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.square_root(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the square root of each pixel.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
- pyclesperanto_prototype.squared_difference(source1: Union[ndarray, OCLArray, Image, _OCLImage], source2: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the squared difference pixel by pixel between two images.
- Parameters
source1 (Image) –
source2 (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.squared_difference(source1, source2, destination)
References
- pyclesperanto_prototype.standard_deviation_box(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the local standard deviation of a pixels box neighborhood. The box size is specified by its half-width, half-height and half-depth (radius). If 2D images are given, radius_z will be ignored.
- Parameters
source (Image) –
destination (Image, optional) –
radius_x (int, optional) –
radius_y (int, optional) –
radius_z (int, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.standard_deviation_box(source, destination, 10, 10, 10)
References
- pyclesperanto_prototype.standard_deviation_intensity_map(intensity_image: Union[ndarray, OCLArray, Image, _OCLImage], labels: Union[ndarray, OCLArray, Image, _OCLImage], standard_deviation_intensity_map: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes an image and a corresponding label map, determines the standard deviation of the intensity per label and replaces every label with the that number.
This results in a parametric image expressing standard deviation of object intensity.
- Parameters
intensity_image (Image) –
labels (Image) –
standard_deviation_intensity_map (Image, optional) –
- Return type
standard_deviation_intensity_map
References
- pyclesperanto_prototype.standard_deviation_of_distal_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, min_distance: float = 0, max_distance: float = 3.4028235e+38) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the standard deviation value of neighboring labels. The distance range of the centroids of the neighborhood can be configured.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
min_distance (float, optional) – default : 0
max_distance (float, optional) – default: maximum float value
- Return type
parametric_map_destination
References
- pyclesperanto_prototype.standard_deviation_of_n_most_touching_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1, ignore_touching_background: bool = True) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the standard_deviation value of most touching neighboring labels. The number of most touching neighbors can be configured.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
n (int) – number of most touching neighbors
- Return type
parametric_map_destination
- pyclesperanto_prototype.standard_deviation_of_n_nearest_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, n: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the standard_deviation value of neighboring labels. The number of nearest neighbors can be configured.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
n (int) – number of nearest neighbors
- Return type
parametric_map_destination
References
- pyclesperanto_prototype.standard_deviation_of_proximal_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, min_distance: float = 0, max_distance: float = 3.4028235e+38) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the standard deviation value of neighboring labels. The distance range of the centroids of the neighborhood can be configured.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
min_distance (float, optional) – default : 0
max_distance (float, optional) – default: maximum float value
- Return type
parametric_map_destination
References
- pyclesperanto_prototype.standard_deviation_of_touch_portion_within_range_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, minimum_touch_portion: float = 0, maximum_touch_portion: float = 1.1, ignore_touching_background: bool = True) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the standard_deviation of neighboring labels whose touch portion lies within a specified range. The number of most touching neighbors can be configured. Minimum and maximum of that specified range are excluded.
Notes
Values of all pixels in a label each must be identical.
This operation assumes input images are isotropic.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
minimum_touch_portion (float, optional) –
maximum_touch_portion (float, optional) –
- Return type
parametric_map_destination
- pyclesperanto_prototype.standard_deviation_of_touching_neighbors(values: Union[ndarray, OCLArray, Image, _OCLImage], touch_matrix: Union[ndarray, OCLArray, Image, _OCLImage], standard_deviation_values_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a touch matrix and a vector of values to determine the standard deviation value among touching neighbors for every object.
- Parameters
values (Image) –
touch_matrix (Image) –
standard_deviation_values_destination (Image, optional) –
- Return type
standard_deviation_values_destination
References
- pyclesperanto_prototype.standard_deviation_of_touching_neighbors_map(parametric_map: Union[ndarray, OCLArray, Image, _OCLImage], label_map: Union[ndarray, OCLArray, Image, _OCLImage], parametric_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius: int = 1, ignore_touching_background: bool = True) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label image and a parametric intensity image and will replace each labels value in the parametric image by the standard deviation value of neighboring labels. The radius of the neighborhood can be configured: * radius 0: Nothing is replaced * radius 1: direct neighbors are taken into account * radius 2: neighbors and neighbors or neighbors are taken into account * radius n: …
Notes
Values of all pixels in a label each must be identical.
- Parameters
parametric_map (Image) –
label_map (Image) –
parametric_map_destination (Image, optional) –
radius (int, optional) –
ignore_touching_background (bool, optional) –
- Return type
parametric_map_destination
References
- pyclesperanto_prototype.standard_deviation_sphere(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the local standard deviation of a pixels sphere neighborhood. The box size is specified by its half-width, half-height and half-depth (radius). If 2D images are given, radius_z will be ignored.
- Parameters
source (Image) –
destination (Image, optional) –
radius_x (int, optional) –
radius_y (int, optional) –
radius_z (int, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.standard_deviation_sphere(source, destination, 10, 10, 10)
References
- pyclesperanto_prototype.standard_deviation_touch_portion(labels: Union[ndarray, OCLArray, Image, _OCLImage], std_touch_portion_vector_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Measure touch portion of all labels to each other and determine the standard deviation of the touch portion for each label and write it into a vector.
Notes
This operation assumes input images are isotropic.
- Parameters
labels (Image) –
std_touch_portion_vector_destination (Image, optional) –
- Return type
std_touch_portion_map_destination
- pyclesperanto_prototype.standard_deviation_touch_portion_map(labels: Union[ndarray, OCLArray, Image, _OCLImage], std_touch_portion_map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Measure touch portion of all labels to each other and determine the standard deviation of the touch portion for each label and write it into a map.
Notes
This operation assumes input images are isotropic.
- Parameters
labels (Image) –
std_touch_portion_map_destination (Image, optional) –
- Return type
std_touch_portion_map_destination
- pyclesperanto_prototype.standard_deviation_z_projection(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the standard deviation intensity projection of an image stack along Z.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.standard_deviation_z_projection(source, destination)
References
- pyclesperanto_prototype.statistics_of_background_and_labelled_pixels(source: Union[ndarray, OCLArray, Image, _OCLImage] = None, labelmap: Union[ndarray, OCLArray, Image, _OCLImage] = None)
Determines bounding box, area (in pixels/voxels), min, max and mean intensity of background and labelled objects in a label map and corresponding pixels in the original image.
Instead of a label map, you can also use a binary image as a binary image is a label map with just one label.
This method is executed on the CPU and not on the GPU/OpenCL device.
- Parameters
source (Image) –
labelmap (Image) –
- Return type
Dictionary of measurements
References
- pyclesperanto_prototype.statistics_of_image(image: Union[ndarray, OCLArray, Image, _OCLImage])
Determines image size (bounding box), area (in pixels/voxels), min, max, mean and standard deviation of the intensity of all pixels in the original image.
This method is executed on the CPU and not on the GPU/OpenCL device. Under the hood, it uses skimage.measure.regionprops [2] and thus, offers the same output. Additionally, standard_deviation_intensity is stored in the regionprops object.
- Parameters
image –
- Return type
regionprops of the whole image
References
- pyclesperanto_prototype.statistics_of_labelled_neighbors(label_image: Union[ndarray, OCLArray, Image, _OCLImage], proximal_distances=(10, 20, 40, 80, 160), nearest_neighbor_ns=(1, 2, 3, 4, 5, 6, 7, 8, 10, 20))
Determine statistics of labeled objects such as average/min/mas neighbor distances, number of neighbors in a given radius, touch portion etc.
Notes
This operation assumes input images are isotropic.
- Parameters
label_image (Image) –
proximal_distances (list of float, optional) – will determine statistics for neighbors within specified distances
nearest_neighbor_ns (list of int, optional) – will determine statistics of specified n nearest neighbors
- Return type
pandas.DataFrame
- pyclesperanto_prototype.statistics_of_labelled_pixels(intensity_image: Union[ndarray, OCLArray, Image, _OCLImage] = None, label_image: Union[ndarray, OCLArray, Image, _OCLImage] = None)
Determines bounding box, area (in pixels/voxels), min, max, mean, standard deviation of the intensity and some shape descriptors of labelled objects in a label map and corresponding pixels in the original image.
Instead of a label map, you can also use a binary image as a binary image is a label map with just one label.
Note: the parameter order is different compared to regionprops.
- Parameters
input (Image) –
labelmap (Image) –
References
- pyclesperanto_prototype.sub_stack(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, start_z: int = 0, end_z: int = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Crops multiple Z-slices of a 3D stack into a new 3D stack.
- Parameters
input (Image) –
destination (Image, optional) –
start_z (Number, optional) –
end_z (Number, optional) –
- Return type
destination
References
- pyclesperanto_prototype.subtract_gaussian_background(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, sigma_x: float = 2, sigma_y: float = 2, sigma_z: float = 2) Union[ndarray, OCLArray, Image, _OCLImage]
Applies Gaussian blur to the input image and subtracts the result from the original.
- Parameters
source (Image) –
destination (Image, optional) –
sigma_x (Number, optional) –
sigma_y (Number, optional) –
sigma_z (Number, optional) –
- Return type
destination
References
..[1] https://clij.github.io/clij2-docs/reference_subtractGaussianBackground
- pyclesperanto_prototype.subtract_image_from_scalar(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, scalar: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Subtracts one image X from a scalar s pixel wise.
<pre>f(x, s) = s - x</pre>
- Parameters
source (Image) –
destination (Image, optional) –
scalar (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.subtract_image_from_scalar(input, destination, scalar)
References
- pyclesperanto_prototype.subtract_images(subtrahend: Union[ndarray, OCLArray, Image, _OCLImage], minuend: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Subtracts one image X from another image Y pixel wise.
<pre>f(x, y) = x - y</pre>
- Parameters
subtrahend (Image) –
minuend (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.subtract_images(subtrahend, minuend, destination)
References
- pyclesperanto_prototype.subtract_labels(labels_input1: Union[ndarray, OCLArray, Image, _OCLImage], labels_input2: Union[ndarray, OCLArray, Image, _OCLImage], labels_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Combines two label images by removing all labels of a given label image which also exist in another. Labels do not have to fit perfectly, if a single pixel overlaps, the label will be removed.
- Parameters
labels_input1 (Image) – label image to add labels to
labels_input2 (Image) – label image to add labels from
labels_destination (Image, optional) – result
- Return type
labels_destination
- pyclesperanto_prototype.sum_of_all_pixels(source: Union[ndarray, OCLArray, Image, _OCLImage]) 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
source (Image) – The image of which all pixels or voxels will be summed.
- Return type
float
Examples
>>> import pyclesperanto_prototype as cle >>> cle.sum_of_all_pixels(source)
References
- pyclesperanto_prototype.sum_reduction_x(src: Union[ndarray, OCLArray, Image, _OCLImage], dst: Union[ndarray, OCLArray, Image, _OCLImage] = None, blocksize: int = 256) Union[ndarray, OCLArray, Image, _OCLImage]
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
src (Image) –
dst (Image, optional) –
blocksize (int, optional) –
- pyclesperanto_prototype.sum_x_projection(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the sum intensity projection of an image along Z.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.sum_x_projection(source, destination)
References
- pyclesperanto_prototype.sum_y_projection(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the sum intensity projection of an image along Z.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.sum_y_projection(source, destination)
References
- pyclesperanto_prototype.sum_z_projection(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines the sum intensity projection of an image along Z.
- Parameters
source (Image) –
destination_sum (Image, optional) –
- Return type
destination_sum
Examples
>>> import pyclesperanto_prototype as cle >>> cle.sum_z_projection(source, destination_sum)
References
- pyclesperanto_prototype.symmetric_maximum_matrix(source_matrix: Union[ndarray, OCLArray, Image, _OCLImage], destination_matrix: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes matrix (which might be asymmetric) and makes a symmetrical matrix out of it by taking the maximum value of m(x,y) and m(y,x) and storing it in both entries.
- Parameters
source_matrix (Image) –
destination_matrix (Image, optional) –
- Return type
destination_matrix
- pyclesperanto_prototype.symmetric_mean_matrix(source_matrix: Union[ndarray, OCLArray, Image, _OCLImage], destination_matrix: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes matrix (which might be asymmetric) and makes a symmetrical matrix out of it by taking the mean value of m(x,y) and m(y,x) and storing it in both entries.
- Parameters
source_matrix (Image) –
destination_matrix (Image, optional) –
- Return type
destination_matrix
- pyclesperanto_prototype.symmetric_minimum_matrix(source_matrix: Union[ndarray, OCLArray, Image, _OCLImage], destination_matrix: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes matrix (which might be asymmetric) and makes a symmetrical matrix out of it by taking the minimum value of m(x,y) and m(y,x) and storing it in both entries.
- Parameters
source_matrix (Image) –
destination_matrix (Image, optional) –
- Return type
destination_matrix
- pyclesperanto_prototype.symmetric_sum_matrix(source_matrix: Union[ndarray, OCLArray, Image, _OCLImage], destination_matrix: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes matrix (which might be asymmetric) and makes a symmetrical matrix out of it by taking the sum value of m(x,y) and m(y,x) and storing it in both entries.
- Parameters
source_matrix (Image) –
destination_matrix (Image, optional) –
- Return type
destination_matrix
- pyclesperanto_prototype.threshold(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, constant: float = 0) Union[ndarray, OCLArray, Image, _OCLImage]
Determines if two images A and B greater pixel wise.
f(a, b) = 1 if a > b; 0 otherwise.
- Parameters
source (Image) –
destination (Image, optional) –
constant (Number, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.greater_constant(source, destination, constant)
References
- pyclesperanto_prototype.threshold_otsu(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.threshold_otsu(input, destination)
References
- pyclesperanto_prototype.to_igraph(adjacency_matrix: Union[ndarray, OCLArray, Image, _OCLImage], centroids: Optional[Union[ndarray, OCLArray, Image, _OCLImage]] = None)
Converts a given adjacency matrix to a iGraph [1] graph data structure.
Note: the given centroids typically have one entry less than the adjacency matrix is wide, because those matrices contain a first row and column representing background. When exporting the networkx graph, that first column will be ignored.
- Parameters
adjacency_matrix (Image) – m*m touch-matrix, proximal-neighbor-matrix or n-nearest-neighbor-matrix
centroids (Image, optional) – d*(m-1) matrix, position list of centroids
- Return type
iGraph graph
See also
- pyclesperanto_prototype.to_networkx(adjacency_matrix: Union[ndarray, OCLArray, Image, _OCLImage], centroids: Optional[Union[ndarray, OCLArray, Image, _OCLImage]] = None)
Converts a given adjacency matrix to a networkx [1] graph data structure.
Note: the given centroids typically have one entry less than the adjacency matrix is wide, because those matrices contain a first row and column representing background. When exporting the igraph graph, that first column will be ignored.
- Parameters
adjacency_matrix (Image) – m*m touch-matrix, proximal-neighbor-matrix or n-nearest-neighbor-matrix
centroids (Image, optional) – d*(m-1) matrix, position list of centroids
- Return type
networkx graph
See also
- pyclesperanto_prototype.top_hat_box(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Applies a top-hat filter for background subtraction to the input image.
- Parameters
source (Image) – The input image where the background is subtracted from.
destination (Image, optional) – The output image where results are written into.
radius_x (Image, optional) – Radius of the background determination region in X.
radius_y (Image, optional) – Radius of the background determination region in Y.
radius_z (Image, optional) – Radius of the background determination region in Z.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.top_hat_box(input, destination, radiusX, radiusY, radiusZ)
References
- pyclesperanto_prototype.top_hat_sphere(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Applies a top-hat filter for background subtraction to the input image.
- Parameters
source (Image) – The input image where the background is subtracted from.
destination (Image, optional) – The output image where results are written into.
radius_x (Image, optional) – Radius of the background determination region in X.
radius_y (Image, optional) – Radius of the background determination region in Y.
radius_z (Image, optional) – Radius of the background determination region in Z.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.top_hat_sphere(input, destination, radiusX, radiusY, radiusZ)
References
- pyclesperanto_prototype.touch_matrix_to_adjacency_matrix(touch_matrix: Union[ndarray, OCLArray, Image, _OCLImage], adjacency_matrix_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, self_adjacent: bool = True) Union[ndarray, OCLArray, Image, _OCLImage]
Takes touch matrix (which is typically just half-filled) and makes a symmetrical adjacency matrix out of it.
Furthermore, one can define if an object is adjacent to itself (default: True).
- Parameters
touch_matrix (Image) –
adjacency_matrix_destination (Image, optional) –
self_adjacent (bool, optional) – Default: true
- Return type
adjacency_matrix_destination
References
- pyclesperanto_prototype.touch_matrix_to_mesh(pointlist: Union[ndarray, OCLArray, Image, _OCLImage], touch_matrix: Union[ndarray, OCLArray, Image, _OCLImage], mesh_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a pointlist with dimensions n*d with n point coordinates in d dimensions and a touch matrix of size n*n to draw lines from all points to points if the corresponding pixel in the touch matrix is 1.
- Parameters
pointlist (Image) – n*d matrix representing n coordinates with d dimensions.
touch_matrix (Image) – A 2D binary matrix with 1 in pixels (i,j) where label i touches
j. (label) –
mesh_destination (Image, optional) – The output image where results are written into.
- Return type
mesh_destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.touch_matrix_to_mesh(pointlist, touch_matrix, mesh_destination)
References
- pyclesperanto_prototype.touch_portion_within_range_neighbor_count(labels: Union[ndarray, OCLArray, Image, _OCLImage], count_vector_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, minimum_touch_portion: float = 0, maximum_touch_portion: float = 1.1) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines which labels are touch within a given portion range and returns the number of those in a vector.
Notes
This operation assumes input images are isotropic.
- Parameters
labels (Image) –
count_vector_destination (Image, optional) –
minimum_touch_portion (float, optional) –
maximum_touch_portion (float, optional) –
- Return type
destination
- pyclesperanto_prototype.touch_portion_within_range_neighbor_count_map(labels: Union[ndarray, OCLArray, Image, _OCLImage], map_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, minimum_touch_portion: float = 0, maximum_touch_portion: float = 1.1) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines which labels are touching within a given portion range and replaces every label with the number of neighboring labels.
Notes
This operation assumes input images are isotropic.
- Parameters
labels (Image) –
map_destination (Image, optional) –
minimum_touch_portion (float, optional) –
maximum_touch_portion (float, optional) –
- Return type
destination
- pyclesperanto_prototype.touching_labels_to_igraph(label_image: Union[ndarray, OCLArray, Image, _OCLImage])
Takes a label image, determines which labels are touching each other and returns an igraph graph representing labels in range.
- Parameters
label_image (Image) –
- Return type
igraph Graph
- pyclesperanto_prototype.touching_labels_to_networkx(label_image: Union[ndarray, OCLArray, Image, _OCLImage])
Takes a label image, determines which labels are touching each other and returns an networkx graph representing labels in range.
- Parameters
label_image (Image) –
- Return type
networkx Graph
- pyclesperanto_prototype.touching_neighbor_count_map(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Takes a label map, determines which labels touch and replaces every label with the number of touching neighboring labels.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.translate(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, translate_x: float = 0, translate_y: float = 0, translate_z: float = 0, linear_interpolation: bool = False) Union[ndarray, OCLArray, Image, _OCLImage]
Translate the image by a given vector.
- Parameters
source (Image) – image to be translated
destination (Image, optional) – target image
translate_x (float, optional) – translation along x axis in pixels
translate_y (float, optional) – translation along y axis in pixels
translate_z (float, optional) – translation along z axis in pixels
linear_interpolation (bool, optional) – If true, bi-/tri-linear interplation will be applied. If false, nearest-neighbor interpolation wille be applied.
- Return type
destination
- pyclesperanto_prototype.transpose_xy(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Transpose X and Y axes of an image.
- Parameters
source (Image) – The input image.
destination (Image, optional) – The output image where results are written into.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.transpose_xy(input, destination)
References
- pyclesperanto_prototype.transpose_xz(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Transpose X and Z axes of an image.
- Parameters
source (Image) – The input image.
destination (Image, optional) – The output image where results are written into.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.transpose_xz(input, destination)
References
- pyclesperanto_prototype.transpose_yz(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Transpose Y and Z axes of an image.
- Parameters
source (Image) – The input image.
destination (Image, optional) – The output image where results are written into.
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.transpose_yz(input, destination)
References
- pyclesperanto_prototype.undefined_to_zero(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Copies all pixels instead those which are not a number (NaN) or infinity (inf), which are replaced by 0.
- Parameters
source (Image) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.undefined_to_zero(source, destination)
References
- pyclesperanto_prototype.variance_box(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the local variance of a pixels box neighborhood.
- The box size is specified by
its half-width, half-height and half-depth (radius). If 2D images are given, radius_z will be ignored.
source : Image destination : Image, optional radius_x : int, optional radius_y : int, optional radius_z : int, optional
destination
>>> import pyclesperanto_prototype as cle >>> cle.variance_box(source, destination, 10, 10, 10)
- pyclesperanto_prototype.variance_sphere(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1) Union[ndarray, OCLArray, Image, _OCLImage]
Computes the local variance of a pixels sphere neighborhood. The sphere size is specified by its half-width, half-height and half-depth (radius). If 2D images are given, radius_z will be ignored.
- Parameters
source (Image) –
destination (Image, optional) –
radius_x (int, optional) –
radius_y (int, optional) –
radius_z (int, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.variance_sphere(source, destination, 10, 10, 10)
References
- pyclesperanto_prototype.voronoi_labeling(binary_source: Union[ndarray, OCLArray, Image, _OCLImage], labeling_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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) –
destination (Image, optional) –
- Return type
destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.voronoi_labeling(input, destination)
References
- pyclesperanto_prototype.voronoi_otsu_labeling(source: Union[ndarray, OCLArray, Image, _OCLImage], label_image_destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, spot_sigma: float = 2, outline_sigma: float = 2) Union[ndarray, OCLArray, Image, _OCLImage]
Labels objects directly from grey-value images.
The two sigma parameters allow tuning the segmentation result. Under the hood, this filter applies two Gaussian blurs, spot detection, Otsu-thresholding [2] and Voronoi-labeling [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
source (Image) – Input grey-value image
label_image_destination (Image, optional) – Output image
spot_sigma (float, optional) – controls how close detected cells can be
outline_sigma (float, optional) – controls how precise segmented objects are outlined.
- Return type
label_image_destination
Examples
>>> import pyclesperanto_prototype as cle >>> cle.voronoi_otsu_labeling(source, label_image_destination, 10, 2)
References
- pyclesperanto_prototype.write_values_to_positions(positions_and_values: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
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
positions_and_values (Image) –
destination (Image, optional) –
- Return type
destination
References
- pyclesperanto_prototype.z_position_of_maximum_z_projection(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines a Z-position of the maximum intensity along Z and writes it into the resulting image.
If there are multiple z-slices with the same value, the smallest Z will be chosen.
- Parameters
source (Image) – Input image stack
destination (Image, optional) – altitude map
- Return type
destination
See also
- pyclesperanto_prototype.z_position_of_minimum_z_projection(source: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Determines a Z-position of the minimum intensity along Z and writes it into the resulting image.
If there are multiple z-slices with the same value, the smallest Z will be chosen.
- Parameters
source (Image) – Input image stack
destination (Image, optional) – altitude map
- Return type
destination
See also
- pyclesperanto_prototype.z_position_projection(source_stack: Union[ndarray, OCLArray, Image, _OCLImage], z_position: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None) Union[ndarray, OCLArray, Image, _OCLImage]
Project a defined Z-slice of a 3D stack into a 2D image.
Which Z-slice is defined as the z_position image, which represents an altitude map.
- Parameters
source_stack (Image) – Input image stack
z_position (Image) – altitude map
destination (Image, optional) – Projected image
- Return type
destination
See also
- pyclesperanto_prototype.z_position_range_projection(source_stack: Union[ndarray, OCLArray, Image, _OCLImage], z_position: Union[ndarray, OCLArray, Image, _OCLImage], destination: Union[ndarray, OCLArray, Image, _OCLImage] = None, start_z: int = - 5, end_z: int = 5) Union[ndarray, OCLArray, Image, _OCLImage]
Project multiple Z-slices of a 3D stack into a new 3D stack. Which Z-slice is defined as the z_position image, which represents an altitude map. The two additional numbers define the range relative to the given z-position.
- Parameters
source_stack (Image) – Input image stack
z_position (Image) – altitude map
destination (Image, optional) – Projected image
start_z (int, optional) –
end_z (int, optional) –
- Return type
destination
See also