Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to [email protected] #29

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,578 changes: 4,578 additions & 0 deletions pyclesperanto/_tier1.py

Large diffs are not rendered by default.

1,542 changes: 1,542 additions & 0 deletions pyclesperanto/_tier2.py

Large diffs are not rendered by default.

515 changes: 515 additions & 0 deletions pyclesperanto/_tier3.py

Large diffs are not rendered by default.

169 changes: 169 additions & 0 deletions pyclesperanto/_tier4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
#
# This code is auto-generated from CLIc 'cle::tier4.hpp' file, do not edit manually.
#

import importlib
import warnings
from typing import Optional

import numpy as np

from ._array import Image
from ._core import Device
from ._decorators import plugin_function

clic = importlib.import_module('._pyclesperanto', package='pyclesperanto')

@plugin_function
def label_bounding_box(
input_image: Image,
label_id: int,
device: Optional[Device] =None
) -> list:
"""Determines the bounding box of the specified label from a label image. The
positions are returned in an array of 6 values as follows: minX, minY, minZ,
maxX, maxY, maxZ.

Parameters
----------
input_image: Image

label_id: int

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

Returns
-------
list

References
----------
[1] https://clij.github.io/clij2-docs/reference_boundingBox
"""

return clic._label_bounding_box(device, input_image, int(label_id))

@plugin_function(category=["in assistant", "combine", "bia-bob-suggestion"])
def mean_squared_error(
input_image0: Image,
input_image1: Image,
device: Optional[Device] =None
) -> float:
"""Determines the mean squared error (MSE) between two images. The MSE will be
stored in a new row of ImageJs Results table in the column 'MSE'.

Parameters
----------
input_image0: Image

input_image1: Image

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

Returns
-------
float

References
----------
[1] https://clij.github.io/clij2-docs/reference_meanSquaredError
"""

return clic._mean_squared_error(device, input_image0, input_image1)

@plugin_function
def spots_to_pointlist(
input_image: Image,
output_image: Optional[Image] =None,
device: Optional[Device] =None
) -> Image:
"""Transforms a spots image as resulting from maximum/minimum detection in an image
where every column contains d pixels (with d = dimensionality of the original
image) with the coordinates of the maxima/minima.

Parameters
----------
input_image: Image

output_image: Optional[Image] (= None)

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

Returns
-------
Image

References
----------
[1] https://clij.github.io/clij2-docs/reference_spotsToPointList
"""

return clic._spots_to_pointlist(device, input_image, output_image)

@plugin_function(category=["label processing", "in assistant", "bia-bob-suggestion"])
def relabel_sequential(
input_image: Image,
output_image: Optional[Image] =None,
blocksize: int =4096,
device: Optional[Device] =None
) -> Image:
"""Analyses a label map and if there are gaps in the indexing (e.g. label 5 is not
present) all subsequent labels will be relabelled. Thus, afterwards number of
labels and maximum label index are equal. This operation is mostly performed on
the CPU.

Parameters
----------
input_image: Image

output_image: Optional[Image] (= None)

blocksize: int (= 4096)
Renumbering is done in blocks for performance reasons.
device: Optional[Device] (= None)
Device to perform the operation on.

Returns
-------
Image

References
----------
[1] https://clij.github.io/clij2-docs/reference_closeIndexGapsInLabelMap
"""

return clic._relabel_sequential(device, input_image, output_image, int(blocksize))

@plugin_function(category=["binarize", "in assistant", "bia-bob-suggestion"])
def threshold_otsu(
input_image: Image,
output_image: Optional[Image] =None,
device: Optional[Device] =None
) -> Image:
"""Binarizes an image using Otsu's threshold method [3] implemented in
scikit-image[2] using a histogram determined on the GPU to create binary images.

Parameters
----------
input_image: Image

output_image: Optional[Image] (= None)

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

Returns
-------
Image

References
----------
[1] https://clij.github.io/clij2-docs/reference_thresholdOtsu
[2] https://scikit-image.org/docs/dev/api/skimage.filters.html#skimage.filters.threshold_otsu
[3] https://ieeexplore.ieee.org/document/4310076
"""

return clic._threshold_otsu(device, input_image, output_image)
106 changes: 106 additions & 0 deletions pyclesperanto/_tier5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#
# This code is auto-generated from CLIc 'cle::tier5.hpp' file, do not edit manually.
#

import importlib
import warnings
from typing import Optional

import numpy as np

from ._array import Image
from ._core import Device
from ._decorators import plugin_function

clic = importlib.import_module('._pyclesperanto', package='pyclesperanto')

@plugin_function(category=["combine"])
def array_equal(
input_image0: Image,
input_image1: Image,
device: Optional[Device] =None
) -> bool:
"""Compares if all pixels of two images are identical. If shape of the images or
any pixel are different, returns False. True otherwise This function is supposed
to work similarly like its counterpart in numpy [1].

Parameters
----------
input_image0: Image

input_image1: Image

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

Returns
-------
bool

References
----------
[1] https://numpy.org/doc/stable/reference/generated/numpy.array_equal.html
"""

return clic._array_equal(device, input_image0, input_image1)

@plugin_function(category=["label processing", "combine labels", "in assistant", "bia-bob-suggestion"])
def combine_labels(
input_image0: Image,
input_image1: Image,
output_image: Optional[Image] =None,
device: Optional[Device] =None
) -> Image:
"""Combines two label images by adding labels of a given label image to another.
Labels in the second image overwrite labels in the first passed image.
Afterwards, labels are relabeled sequentially.

Parameters
----------
input_image0: Image
label image to add labels to.
input_image1: Image
label image to add labels from.
output_image: Optional[Image] (= None)
Output label image.
device: Optional[Device] (= None)
Device to perform the operation on.

Returns
-------
Image
"""

return clic._combine_labels(device, input_image0, input_image1, output_image)

@plugin_function(category=["label", "in assistant", "bia-bob-suggestion"])
def connected_components_labeling(
input_image: Image,
output_image: Optional[Image] =None,
connectivity: str ='box',
device: Optional[Device] =None
) -> Image:
"""Performs connected components analysis inspecting the box neighborhood of every
pixel to a binary image and generates a label map.

Parameters
----------
input_image: Image
Binary image to label.
output_image: Optional[Image] (= None)
Output label image.
connectivity: str (= 'box')
Defines pixel neighborhood relationship, "box" or "sphere".
device: Optional[Device] (= None)
Device to perform the operation on.

Returns
-------
Image

References
----------
[1] https://clij.github.io/clij2-docs/reference_connectedComponentsLabelingBox
"""

return clic._connected_components_labeling(device, input_image, output_image, str(connectivity))
Loading