From 177ea86f7f342038eb8f0ec15d143dcd62d60791 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Wed, 15 May 2024 15:04:57 +0200 Subject: [PATCH 01/16] add workflow for precommit --- .github/workflows/pre-commit.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000..2b11178b --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,14 @@ +name: pre-commit + +on: + pull_request: + push: + branches: [main] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.1 From 07e28ad216d9647092ba313ca5b310ebc4284478 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Wed, 15 May 2024 17:28:45 +0200 Subject: [PATCH 02/16] remove workflow and use pre-commit.ci --- .github/workflows/pre-commit.yml | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml deleted file mode 100644 index 2b11178b..00000000 --- a/.github/workflows/pre-commit.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: pre-commit - -on: - pull_request: - push: - branches: [main] - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 - - uses: pre-commit/action@v3.0.1 From 5245188c6c27d0492ac953fb3c0f245faac3d7c1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 15 May 2024 15:29:07 +0000 Subject: [PATCH 03/16] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../ISSUE_TEMPLATE/prototype-related-issue.md | 2 +- docs/source/_static/debug.js | 2 +- docs/source/_templates/layout.html | 2 +- docs/source/api.rst | 2 +- docs/source/conf.py | 88 +- docs/source/index.rst | 4 +- docs/source/install.rst | 4 +- docs/source/usage.rst | 6 +- pyclesperanto/_operators.py | 1 + pyclesperanto/_tier1.py | 2062 ++++++----------- pyclesperanto/_tier2.py | 632 ++--- pyclesperanto/_tier3.py | 192 +- pyclesperanto/_tier4.py | 77 +- pyclesperanto/_tier5.py | 53 +- pyclesperanto/_tier6.py | 71 +- pyclesperanto/_tier7.py | 117 +- pyclesperanto/_tier8.py | 28 +- src/wrapper/tier1_.cpp | 280 +-- src/wrapper/tier2_.cpp | 92 +- src/wrapper/tier3_.cpp | 30 +- src/wrapper/tier4_.cpp | 12 +- src/wrapper/tier5_.cpp | 8 +- src/wrapper/tier6_.cpp | 12 +- src/wrapper/tier7_.cpp | 22 +- src/wrapper/tier8_.cpp | 6 +- tests/test_affine_transform.py | 43 +- tests/test_bounding_box.py | 55 +- tests/test_connected_components_labeling.py | 1 - tests/test_eroded_otsu_labeling.py | 60 +- tests/test_gauss_otsu_labeling.py | 54 +- tests/test_label_bounding_box.py | 25 +- tests/test_multiply_matrix.py | 5 +- tests/test_reduce_labels_to_label_edges.py | 50 +- tests/test_smooth_labels.py | 60 +- 34 files changed, 1561 insertions(+), 2597 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/prototype-related-issue.md b/.github/ISSUE_TEMPLATE/prototype-related-issue.md index 030dab2c..cac67247 100644 --- a/.github/ISSUE_TEMPLATE/prototype-related-issue.md +++ b/.github/ISSUE_TEMPLATE/prototype-related-issue.md @@ -16,7 +16,7 @@ assignees: '' **Describe the bug** A clear and concise description of what the bug is. What were you trying to do and what happened. -It can be from a parameter or function name discreptency. to a change of results, or a full crash. +It can be from a parameter or function name discreptency. to a change of results, or a full crash. **To Reproduce** Steps to reproduce the behavior, ideally a notebook ready to run, with test data, at minima a code snippet. diff --git a/docs/source/_static/debug.js b/docs/source/_static/debug.js index 1945a604..9a751802 100644 --- a/docs/source/_static/debug.js +++ b/docs/source/_static/debug.js @@ -4,4 +4,4 @@ $(function () { $("[data-toggle='rst-debug-badge']").on("click", function () { $("[data-toggle='rst-versions']").toggleClass("rst-badge"); }); -}) \ No newline at end of file +}) diff --git a/docs/source/_templates/layout.html b/docs/source/_templates/layout.html index bcced04c..b825bc9b 100644 --- a/docs/source/_templates/layout.html +++ b/docs/source/_templates/layout.html @@ -52,4 +52,4 @@ {%- endif %} -{%- endblock %} \ No newline at end of file +{%- endblock %} diff --git a/docs/source/api.rst b/docs/source/api.rst index 4597a66f..a78b89af 100644 --- a/docs/source/api.rst +++ b/docs/source/api.rst @@ -70,7 +70,7 @@ tier3 :undoc-members: tier4 ------- +------ .. automodule:: pyclesperanto._tier4 :members: diff --git a/docs/source/conf.py b/docs/source/conf.py index 7f5421e6..edfad055 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -8,25 +8,26 @@ import re from sphinx.locale import _ + sys.path.insert(0, os.path.abspath("../../")) # Open the CMakeCache.txt file and search for the project version -with open('../../pyclesperanto/_version.py', 'r') as f: +with open("../../pyclesperanto/_version.py", "r") as f: for line in f: - if 'VERSION_CODE' in line: - start = line.find('=') + 1 - end = line.find('\n', start) - release = ".".join(line[start:end].strip().split(', ')) + if "VERSION_CODE" in line: + start = line.find("=") + 1 + end = line.find("\n", start) + release = ".".join(line[start:end].strip().split(", ")) break # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information -project = u"py-clEsperanto" -slug = re.sub(r'\W+', '-', project.lower()) -author = u'Stephane Rigaud' -copyright = f'2024, {author}' -language = 'en' +project = "py-clEsperanto" +slug = re.sub(r"\W+", "-", project.lower()) +author = "Stephane Rigaud" +copyright = f"2024, {author}" +language = "en" version = release # -- General configuration --------------------------------------------------- @@ -39,9 +40,9 @@ "sphinx.ext.mathjax", # Print mathematical expressions "nbsphinx", # link notebooks "sphinx.ext.autosummary", # Make module lists in table - 'sphinx.ext.intersphinx', - 'sphinx.ext.viewcode', - 'sphinx_rtd_theme', + "sphinx.ext.intersphinx", + "sphinx.ext.viewcode", + "sphinx_rtd_theme", ] templates_path = ["_templates"] @@ -51,31 +52,28 @@ add_module_names = False modindex_common_prefix = ["pyclesperanto."] gettext_compact = False -master_doc = 'index' -suppress_warnings = ['image.nonlocal_uri'] -pygments_style = 'default' +master_doc = "index" +suppress_warnings = ["image.nonlocal_uri"] +pygments_style = "default" # -- Options for HTML output ------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output html_theme = "sphinx_rtd_theme" # 'alabaster' html_theme_options = { - 'logo_only': False, - 'navigation_depth': 5, - 'display_version': True, - 'collapse_navigation': False, + "logo_only": False, + "navigation_depth": 5, + "display_version": True, + "collapse_navigation": False, } html_context = {} -if not 'READTHEDOCS' in os.environ: - html_static_path = ['_static/'] - html_js_files = ['debug.js'] +if not "READTHEDOCS" in os.environ: + html_static_path = ["_static/"] + html_js_files = ["debug.js"] # Add fake versions for local QA of the menu - html_context['test_versions'] = list(map( - lambda x: str(x / 10), - range(1, 100) - )) + html_context["test_versions"] = list(map(lambda x: str(x / 10), range(1, 100))) # html_logo = "demo/static/logo-wordmark-light.svg" html_show_sourcelink = True @@ -83,18 +81,16 @@ htmlhelp_basename = slug latex_documents = [ - ('index', '{0}.tex'.format(slug), project, author, 'manual'), + ("index", "{0}.tex".format(slug), project, author, "manual"), ] -man_pages = [ - ('index', slug, project, [author], 1) -] +man_pages = [("index", slug, project, [author], 1)] texinfo_documents = [ - ('index', slug, project, author, slug, project, 'Miscellaneous'), + ("index", slug, project, author, slug, project, "Miscellaneous"), ] -html_static_path = ['_static'] +html_static_path = ["_static"] # Extensions to theme docs def setup(app): @@ -102,23 +98,23 @@ def setup(app): from sphinx.util.docfields import Field app.add_object_type( - 'confval', - 'confval', - objname='configuration value', - indextemplate='pair: %s; configuration value', + "confval", + "confval", + objname="configuration value", + indextemplate="pair: %s; configuration value", doc_field_types=[ PyField( - 'type', - label=_('Type'), + "type", + label=_("Type"), has_arg=False, - names=('type',), - bodyrolename='class' + names=("type",), + bodyrolename="class", ), Field( - 'default', - label=_('Default'), + "default", + label=_("Default"), has_arg=False, - names=('default',), + names=("default",), ), - ] - ) \ No newline at end of file + ], + ) diff --git a/docs/source/index.rst b/docs/source/index.rst index 520c9a73..1ccc6a8a 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -18,7 +18,7 @@ You will find here a first draft of the API for reference and documentation purp .. toctree:: :caption: User Guide :maxdepth: 1 - + install usage api @@ -28,4 +28,4 @@ You will find here a first draft of the API for reference and documentation purp :caption: Developper Guide :maxdepth: 1 - contribute \ No newline at end of file + contribute diff --git a/docs/source/install.rst b/docs/source/install.rst index 104b10d8..ee867c64 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -25,7 +25,7 @@ or via conda: mamba create --name myenv mamba activate myenv -.. note:: +.. note:: It is often require to also install an additional package to use pyClesperanto, especially on MacOS or Linux: @@ -81,4 +81,4 @@ However, any modification of the source code will require you to re-install the .. warning:: - If using an install from source, do not import the package from the source directory as it will not work properly. + If using an install from source, do not import the package from the source directory as it will not work properly. diff --git a/docs/source/usage.rst b/docs/source/usage.rst index 86de6903..9bc48132 100644 --- a/docs/source/usage.rst +++ b/docs/source/usage.rst @@ -33,8 +33,8 @@ Memory transfer =============== It is a good practice to consider the GPU as another computer. Its memory is separated from your computer (host) memory, hence you need to transfer your data to the device memory in order to process it. -Going both ways, you will need to transfer it back to your computer (host) memory when you are done running GPU operations so that you can read the results. In pyclesperanto this is managed by the -functions ``push``, ``pull``, and ``create``. ``push`` and ``pull`` are used to transfer data from the host to the GPU and vice versa. ``create`` is used to allocate an empty space on the GPU which will be +Going both ways, you will need to transfer it back to your computer (host) memory when you are done running GPU operations so that you can read the results. In pyclesperanto this is managed by the +functions ``push``, ``pull``, and ``create``. ``push`` and ``pull`` are used to transfer data from the host to the GPU and vice versa. ``create`` is used to allocate an empty space on the GPU which will be then use, for example to store a result. @@ -77,7 +77,7 @@ The ``push`` will create a memory space on the GPU like ``create`` but will also The data pushed will keep the same data type as the array. Hence, if you push a ``uint8`` array, the data will be stored as ``uint8`` on the GPU. The array will then use 4 times less memory than if it was stored as ``float32``. This is a good practice to keep in mind when working with GPUs as their -memory is limited. +memory is limited. .. warning:: Python natively manage only 2 type of scalar, ``float`` and ``int``, correspondint to ``float64``, also known as ``double`` and ``int64``. However, ``double`` type diff --git a/pyclesperanto/_operators.py b/pyclesperanto/_operators.py index 32c80486..f3e1be17 100644 --- a/pyclesperanto/_operators.py +++ b/pyclesperanto/_operators.py @@ -332,6 +332,7 @@ def __ipow__(x1, x2): def __iter__(self): """Iterate over the first dimension of the array.""" + class MyIterator: def __init__(self, image): self.image = image diff --git a/pyclesperanto/_tier1.py b/pyclesperanto/_tier1.py index 2ffebfbe..a66430e5 100644 --- a/pyclesperanto/_tier1.py +++ b/pyclesperanto/_tier1.py @@ -10,11 +10,9 @@ import warnings -@plugin_function(category=['filter', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["filter", "in assistant", "bia-bob-suggestion"]) def absolute( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Computes the absolute value of every individual pixel x in a given image.
f(x) = |x| 
@@ -31,7 +29,7 @@ def absolute( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_absolute @@ -39,23 +37,17 @@ def absolute( from ._pyclesperanto import _absolute as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['combine', 'in assistant']) +@plugin_function(category=["combine", "in assistant"]) def add_images_weighted( input_image0: Image, input_image1: Image, output_image: Image = None, factor0: float = 1, factor1: float = 1, - device: Device = None + device: Device = None, ) -> Image: """Calculates the sum of pairs of pixels x and y from images X and Y weighted with factors a and b.
f(x, y, a, b) = x * a + y * b
@@ -78,7 +70,7 @@ def add_images_weighted( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_addImagesWeighted @@ -86,24 +78,22 @@ def add_images_weighted( from ._pyclesperanto import _add_images_weighted as op - return op( device=device, src0=input_image0, src1=input_image1, dst=output_image, factor0=float(factor0), - factor1=float(factor1) + factor1=float(factor1), ) - -@plugin_function(category=['filter', 'in assistant']) +@plugin_function(category=["filter", "in assistant"]) def add_image_and_scalar( input_image: Image, output_image: Image = None, scalar: float = 1, - device: Device = None + device: Device = None, ) -> Image: """Adds a scalar value s to all pixels x of a given image X.
f(x, s) = x +
     s
@@ -122,7 +112,7 @@ def add_image_and_scalar( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_addImageAndScalar @@ -130,22 +120,24 @@ def add_image_and_scalar( from ._pyclesperanto import _add_image_and_scalar as op - - return op( - device=device, - src=input_image, - dst=output_image, - scalar=float(scalar) - ) - + return op(device=device, src=input_image, dst=output_image, scalar=float(scalar)) -@plugin_function(category=['combine', 'binary processing', 'in assistant', 'combine labels', 'label processing', 'bia-bob-suggestion']) +@plugin_function( + category=[ + "combine", + "binary processing", + "in assistant", + "combine labels", + "label processing", + "bia-bob-suggestion", + ] +) def binary_and( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Computes a binary image (containing pixel values 0 and 1) from two images X and Y by connecting pairs of pixels x and y with the binary AND operator &. All @@ -166,7 +158,7 @@ def binary_and( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_binaryAnd @@ -174,21 +166,19 @@ def binary_and( from ._pyclesperanto import _binary_and as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) -@plugin_function(category=['binary processing', 'label processing', 'in assistant', 'bia-bob-suggestion']) +@plugin_function( + category=[ + "binary processing", + "label processing", + "in assistant", + "bia-bob-suggestion", + ] +) def binary_edge_detection( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Determines pixels/voxels which are on the surface of binary objects and sets only them to 1 in the destination image. All other pixels are set to 0. @@ -205,7 +195,7 @@ def binary_edge_detection( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_binaryEdgeDetection @@ -213,20 +203,20 @@ def binary_edge_detection( from ._pyclesperanto import _binary_edge_detection as op - - return op( - device=device, - src=input_image, - dst=output_image - ) + return op(device=device, src=input_image, dst=output_image) - -@plugin_function(category=['binary processing', 'filter', 'label processing', 'in assistant', 'bia-bob-suggestion']) +@plugin_function( + category=[ + "binary processing", + "filter", + "label processing", + "in assistant", + "bia-bob-suggestion", + ] +) def binary_not( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Computes a binary image (containing pixel values 0 and 1) from an image X by negating its pixel values x using the binary NOT operator ! All pixel values @@ -244,7 +234,7 @@ def binary_not( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_binaryNot @@ -252,21 +242,24 @@ def binary_not( from ._pyclesperanto import _binary_not as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['combine', 'binary processing', 'in assistant', 'combine labels', 'label processing', 'bia-bob-suggestion']) +@plugin_function( + category=[ + "combine", + "binary processing", + "in assistant", + "combine labels", + "label processing", + "bia-bob-suggestion", + ] +) def binary_or( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Computes a binary image (containing pixel values 0 and 1) from two images X and Y by connecting pairs of pixels x and y with the binary OR operator |. All pixel @@ -287,7 +280,7 @@ def binary_or( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_binaryOr @@ -295,22 +288,24 @@ def binary_or( from ._pyclesperanto import _binary_or as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) -@plugin_function(category=['combine', 'binary processing', 'in assistant', 'combine labels', 'label processing', 'bia-bob-suggestion']) +@plugin_function( + category=[ + "combine", + "binary processing", + "in assistant", + "combine labels", + "label processing", + "bia-bob-suggestion", + ] +) def binary_subtract( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Subtracts one binary image from another. @@ -328,7 +323,7 @@ def binary_subtract( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_binarySubtract @@ -336,22 +331,24 @@ def binary_subtract( from ._pyclesperanto import _binary_subtract as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) -@plugin_function(category=['combine', 'binary processing', 'in assistant', 'combine labels', 'label processing', 'bia-bob-suggestion']) +@plugin_function( + category=[ + "combine", + "binary processing", + "in assistant", + "combine labels", + "label processing", + "bia-bob-suggestion", + ] +) def binary_xor( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Computes a binary image (containing pixel values 0 and 1) from two images X and Y by connecting pairs of pixels x and y with the binary operators AND &, OR | @@ -372,7 +369,7 @@ def binary_xor( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_binaryXOr @@ -380,14 +377,7 @@ def binary_xor( from ._pyclesperanto import _binary_xor as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) @plugin_function @@ -396,7 +386,7 @@ def block_enumerate( input_image1: Image, output_image: Image = None, blocksize: int = 256, - device: Device = None + device: Device = None, ) -> Image: """Enumerates pixels with value 1 in a onedimensional image For example handing over the image [0, 1, 1, 0, 1, 0, 1, 1] would be processed to an image [0, 1, 2, @@ -421,28 +411,26 @@ def block_enumerate( Returns ------- Image - + """ from ._pyclesperanto import _block_enumerate as op - return op( device=device, src0=input_image0, src1=input_image1, dst=output_image, - blocksize=int(blocksize) + blocksize=int(blocksize), ) - -@plugin_function(category=['filter', 'combine', 'in assistant']) +@plugin_function(category=["filter", "combine", "in assistant"]) def convolve( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Convolve the image with a given kernel image. It is recommended that the kernel image has an odd size in X, Y and Z. @@ -461,7 +449,7 @@ def convolve( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_convolve @@ -469,21 +457,12 @@ def convolve( from ._pyclesperanto import _convolve as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) @plugin_function def copy( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Copies an image.
f(x) = x
@@ -499,7 +478,7 @@ def copy( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_copy @@ -507,13 +486,7 @@ def copy( from ._pyclesperanto import _copy as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) @plugin_function @@ -521,7 +494,7 @@ def copy_slice( input_image: Image, output_image: Image = None, slice: int = 0, - device: Device = None + device: Device = None, ) -> Image: """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 @@ -543,7 +516,7 @@ def copy_slice( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_copySlice @@ -551,14 +524,7 @@ def copy_slice( from ._pyclesperanto import _copy_slice as op - - return op( - device=device, - src=input_image, - dst=output_image, - slice=int(slice) - ) - + return op(device=device, src=input_image, dst=output_image, slice=int(slice)) @plugin_function @@ -566,7 +532,7 @@ def copy_horizontal_slice( input_image: Image, output_image: Image = None, slice: int = 0, - device: Device = None + device: Device = None, ) -> Image: """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 @@ -585,7 +551,7 @@ def copy_horizontal_slice( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_copySlice @@ -593,14 +559,7 @@ def copy_horizontal_slice( from ._pyclesperanto import _copy_horizontal_slice as op - - return op( - device=device, - src=input_image, - dst=output_image, - slice=int(slice) - ) - + return op(device=device, src=input_image, dst=output_image, slice=int(slice)) @plugin_function @@ -608,7 +567,7 @@ def copy_vertical_slice( input_image: Image, output_image: Image = None, slice: int = 0, - device: Device = None + device: Device = None, ) -> Image: """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 @@ -627,7 +586,7 @@ def copy_vertical_slice( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_copySlice @@ -635,14 +594,7 @@ def copy_vertical_slice( from ._pyclesperanto import _copy_vertical_slice as op - - return op( - device=device, - src=input_image, - dst=output_image, - slice=int(slice) - ) - + return op(device=device, src=input_image, dst=output_image, slice=int(slice)) @plugin_function @@ -655,7 +607,7 @@ def crop( width: int = 1, height: int = 1, depth: int = 1, - device: Device = None + device: Device = None, ) -> Image: """Crops a given substack out of a given image stack. Note: If the destination image preexists already, it will be overwritten and keep it's dimensions. @@ -684,7 +636,7 @@ def crop( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_crop3D @@ -692,7 +644,6 @@ def crop( from ._pyclesperanto import _crop as op - return op( device=device, src=input_image, @@ -702,16 +653,13 @@ def crop( start_z=int(start_z), width=int(width), height=int(height), - depth=int(depth) + depth=int(depth), ) - -@plugin_function(category=['filter', 'in assistant']) +@plugin_function(category=["filter", "in assistant"]) def cubic_root( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Computes the cubic root of each pixel. @@ -727,25 +675,19 @@ def cubic_root( Returns ------- Image - + """ from ._pyclesperanto import _cubic_root as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['binarize', 'label processing', 'in assistant', 'bia-bob-suggestion']) +@plugin_function( + category=["binarize", "label processing", "in assistant", "bia-bob-suggestion"] +) def detect_label_edges( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Takes a labelmap and returns an image where all pixels on label edges are set to 1 and all other pixels to 0. @@ -762,7 +704,7 @@ def detect_label_edges( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_detectLabelEdges @@ -770,20 +712,12 @@ def detect_label_edges( from ._pyclesperanto import _detect_label_edges as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['binary processing']) +@plugin_function(category=["binary processing"]) def dilate_box( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Computes a binary image with pixel values 0 and 1 containing the binary dilation of a given input image. The dilation takes the Mooreneighborhood (8 pixels in 2D @@ -804,7 +738,7 @@ def dilate_box( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_dilateBox @@ -812,20 +746,16 @@ def dilate_box( from ._pyclesperanto import _dilate_box as op - warnings.warn("dilate_box : This function is deprecated. Consider using dilate() instead.", DeprecationWarning) - return op( - device=device, - src=input_image, - dst=output_image + warnings.warn( + "dilate_box : This function is deprecated. Consider using dilate() instead.", + DeprecationWarning, ) + return op(device=device, src=input_image, dst=output_image) - -@plugin_function(category=['binary processing', 'bia-bob-suggestion']) +@plugin_function(category=["binary processing", "bia-bob-suggestion"]) def dilate_sphere( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Computes a binary image with pixel values 0 and 1 containing the binary dilation of a given input image. The dilation takes the vonNeumannneighborhood (4 pixels @@ -844,7 +774,7 @@ def dilate_sphere( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_dilateSphere @@ -852,21 +782,19 @@ def dilate_sphere( from ._pyclesperanto import _dilate_sphere as op - warnings.warn("dilate_sphere : This function is deprecated. Consider using dilate() instead.", DeprecationWarning) - return op( - device=device, - src=input_image, - dst=output_image + warnings.warn( + "dilate_sphere : This function is deprecated. Consider using dilate() instead.", + DeprecationWarning, ) + return op(device=device, src=input_image, dst=output_image) - -@plugin_function(category=['binary processing', 'bia-bob-suggestion']) +@plugin_function(category=["binary processing", "bia-bob-suggestion"]) def dilate( input_image: Image, output_image: Image = None, connectivity: str = "box", - device: Device = None + device: Device = None, ) -> Image: """Computes a binary image with pixel values 0 and 1 containing the binary dilation of a given input image. The dilation apply the Mooreneighborhood (8 pixels in 2D @@ -888,31 +816,26 @@ def dilate( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_dilateBox - [2] https://clij.github.io/clij2-docs/reference_dilateSphere + [2] https://clij.github.io/clij2-docs/reference_dilateSphere """ from ._pyclesperanto import _dilate as op - return op( - device=device, - src=input_image, - dst=output_image, - connectivity=connectivity + device=device, src=input_image, dst=output_image, connectivity=connectivity ) - -@plugin_function(category=['combine', 'in assistant']) +@plugin_function(category=["combine", "in assistant"]) def divide_images( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Divides two images X and Y by each other pixel wise.
f(x, y) = x / y
@@ -930,7 +853,7 @@ def divide_images( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_divideImages @@ -938,22 +861,15 @@ def divide_images( from ._pyclesperanto import _divide_images as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) -@plugin_function(category=['filter', 'in assistant']) +@plugin_function(category=["filter", "in assistant"]) def divide_scalar_by_image( input_image: Image, output_image: Image = None, scalar: float = 0, - device: Device = None + device: Device = None, ) -> Image: """Divides a scalar by an image pixel by pixel.
f(x, s) = s / x
@@ -970,27 +886,20 @@ def divide_scalar_by_image( Returns ------- Image - + """ from ._pyclesperanto import _divide_scalar_by_image as op - - return op( - device=device, - src=input_image, - dst=output_image, - scalar=float(scalar) - ) - + return op(device=device, src=input_image, dst=output_image, scalar=float(scalar)) -@plugin_function(category=['combine', 'binarize', 'in assistant']) +@plugin_function(category=["combine", "binarize", "in assistant"]) def equal( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Determines if two images A and B equal pixel wise.
f(a, b) = 1 if a == b; 0
     otherwise.
@@ -1009,7 +918,7 @@ def equal( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_equal @@ -1017,22 +926,15 @@ def equal( from ._pyclesperanto import _equal as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) -@plugin_function(category=['binarize', 'in assistant']) +@plugin_function(category=["binarize", "in assistant"]) def equal_constant( input_image: Image, output_image: Image = None, scalar: float = 0, - device: Device = None + device: Device = None, ) -> Image: """Determines if an image A and a constant b are equal.
f(a, b) = 1 if a == b;
     0 otherwise.
@@ -1051,7 +953,7 @@ def equal_constant( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_equalConstant @@ -1059,21 +961,12 @@ def equal_constant( from ._pyclesperanto import _equal_constant as op - - return op( - device=device, - src=input_image, - dst=output_image, - scalar=float(scalar) - ) - + return op(device=device, src=input_image, dst=output_image, scalar=float(scalar)) -@plugin_function(category=['binary processing']) +@plugin_function(category=["binary processing"]) def erode_box( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Computes a binary image with pixel values 0 and 1 containing the binary erosion of a given input image. The erosion takes the Mooreneighborhood (8 pixels in 2D @@ -1094,7 +987,7 @@ def erode_box( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_erodeBox @@ -1102,20 +995,16 @@ def erode_box( from ._pyclesperanto import _erode_box as op - warnings.warn("erode_box : This function is deprecated. Consider using erode() instead.", DeprecationWarning) - return op( - device=device, - src=input_image, - dst=output_image + warnings.warn( + "erode_box : This function is deprecated. Consider using erode() instead.", + DeprecationWarning, ) + return op(device=device, src=input_image, dst=output_image) - -@plugin_function(category=['binary processing', 'bia-bob-suggestion']) +@plugin_function(category=["binary processing", "bia-bob-suggestion"]) def erode_sphere( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Computes a binary image with pixel values 0 and 1 containing the binary erosion of a given input image. The erosion takes the vonNeumannneighborhood (4 pixels @@ -1134,7 +1023,7 @@ def erode_sphere( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_erodeSphere @@ -1142,21 +1031,19 @@ def erode_sphere( from ._pyclesperanto import _erode_sphere as op - warnings.warn("erode_sphere : This function is deprecated. Consider using erode() instead.", DeprecationWarning) - return op( - device=device, - src=input_image, - dst=output_image + warnings.warn( + "erode_sphere : This function is deprecated. Consider using erode() instead.", + DeprecationWarning, ) + return op(device=device, src=input_image, dst=output_image) - -@plugin_function(category=['binary processing', 'bia-bob-suggestion']) +@plugin_function(category=["binary processing", "bia-bob-suggestion"]) def erode( input_image: Image, output_image: Image = None, connectivity: str = "box", - device: Device = None + device: Device = None, ) -> Image: """Computes a binary image with pixel values 0 and 1 containing the binary erosion of a given input image. The erosion apply the Mooreneighborhood (8 pixels in 2D @@ -1178,30 +1065,23 @@ def erode( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_erodeBox - [2] https://clij.github.io/clij2-docs/reference_erodeSphere + [2] https://clij.github.io/clij2-docs/reference_erodeSphere """ from ._pyclesperanto import _erode as op - return op( - device=device, - src=input_image, - dst=output_image, - connectivity=connectivity + device=device, src=input_image, dst=output_image, connectivity=connectivity ) - -@plugin_function(category=['filter', 'in assistant']) +@plugin_function(category=["filter", "in assistant"]) def exponential( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Computes base exponential of all pixels values. f(x) = exp(x) Author(s): Peter Haub, Robert Haase @@ -1218,7 +1098,7 @@ def exponential( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_exponential @@ -1226,13 +1106,7 @@ def exponential( from ._pyclesperanto import _exponential as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) @plugin_function @@ -1242,7 +1116,7 @@ def flip( flip_x: bool = True, flip_y: bool = True, flip_z: bool = True, - device: Device = None + device: Device = None, ) -> Image: """Flips an image in X, Y and/or Z direction depending on boolean flags. @@ -1264,7 +1138,7 @@ def flip( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_flip3D @@ -1272,26 +1146,24 @@ def flip( from ._pyclesperanto import _flip as op - return op( device=device, src=input_image, dst=output_image, flip_x=bool(flip_x), flip_y=bool(flip_y), - flip_z=bool(flip_z) + flip_z=bool(flip_z), ) - -@plugin_function(category=['filter', 'denoise', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["filter", "denoise", "in assistant", "bia-bob-suggestion"]) def gaussian_blur( input_image: Image, output_image: Image = None, sigma_x: float = 0, sigma_y: float = 0, sigma_z: float = 0, - device: Device = None + device: Device = None, ) -> Image: """Computes the Gaussian blurred image of an image given sigma values in X, Y and Z. Thus, the filter kernel can have nonisotropic shape. The implementation is @@ -1315,7 +1187,7 @@ def gaussian_blur( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_gaussianBlur3D @@ -1323,24 +1195,22 @@ def gaussian_blur( from ._pyclesperanto import _gaussian_blur as op - return op( device=device, src=input_image, dst=output_image, sigma_x=float(sigma_x), sigma_y=float(sigma_y), - sigma_z=float(sigma_z) + sigma_z=float(sigma_z), ) - -@plugin_function(category=['bia-bob-suggestion']) +@plugin_function(category=["bia-bob-suggestion"]) def generate_distance_matrix( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Computes the distance between all point coordinates given in two point lists. Takes two images containing pointlists (dimensionality n * d, n: number of @@ -1366,7 +1236,7 @@ def generate_distance_matrix( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_generateDistanceMatrix @@ -1374,21 +1244,12 @@ def generate_distance_matrix( from ._pyclesperanto import _generate_distance_matrix as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) -@plugin_function(category=['filter', 'edge detection', 'in assistant']) +@plugin_function(category=["filter", "edge detection", "in assistant"]) def gradient_x( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Computes the gradient of gray values along X. Assuming a, b and c are three adjacent pixels in X direction. In the target image will be saved as:
b' =
@@ -1406,7 +1267,7 @@ def gradient_x(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_gradientX
@@ -1414,20 +1275,12 @@ def gradient_x(
 
     from ._pyclesperanto import _gradient_x as op
 
-    
-    return op(
-        device=device,
-        src=input_image,
-        dst=output_image
-    )
-
+    return op(device=device, src=input_image, dst=output_image)
 
 
-@plugin_function(category=['filter', 'edge detection', 'in assistant'])
+@plugin_function(category=["filter", "edge detection", "in assistant"])
 def gradient_y(
-    input_image: Image,
-    output_image: Image = None,
-    device: Device = None
+    input_image: Image, output_image: Image = None, device: Device = None
 ) -> Image:
     """Computes the gradient of gray values along Y. Assuming a, b and c are three
     adjacent pixels in Y direction. In the target image will be saved as: 
b' =
@@ -1445,7 +1298,7 @@ def gradient_y(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_gradientY
@@ -1453,20 +1306,12 @@ def gradient_y(
 
     from ._pyclesperanto import _gradient_y as op
 
-    
-    return op(
-        device=device,
-        src=input_image,
-        dst=output_image
-    )
-
+    return op(device=device, src=input_image, dst=output_image)
 
 
-@plugin_function(category=['filter', 'edge detection', 'in assistant'])
+@plugin_function(category=["filter", "edge detection", "in assistant"])
 def gradient_z(
-    input_image: Image,
-    output_image: Image = None,
-    device: Device = None
+    input_image: Image, output_image: Image = None, device: Device = None
 ) -> Image:
     """Computes the gradient of gray values along Z. Assuming a, b and c are three
     adjacent pixels in Z direction. In the target image will be saved as: 
b' =
@@ -1484,7 +1329,7 @@ def gradient_z(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_gradientZ
@@ -1492,21 +1337,15 @@ def gradient_z(
 
     from ._pyclesperanto import _gradient_z as op
 
-    
-    return op(
-        device=device,
-        src=input_image,
-        dst=output_image
-    )
+    return op(device=device, src=input_image, dst=output_image)
 
 
-
-@plugin_function(category=['combine', 'binarize', 'in assistant'])
+@plugin_function(category=["combine", "binarize", "in assistant"])
 def greater(
     input_image0: Image,
     input_image1: Image,
     output_image: Image = None,
-    device: Device = None
+    device: Device = None,
 ) -> Image:
     """Determines if two images A and B greater pixel wise. f(a, b) = 1 if a > b; 0
     otherwise.
@@ -1525,7 +1364,7 @@ def greater(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_greater
@@ -1533,22 +1372,15 @@ def greater(
 
     from ._pyclesperanto import _greater as op
 
-    
-    return op(
-        device=device,
-        src0=input_image0,
-        src1=input_image1,
-        dst=output_image
-    )
-
+    return op(device=device, src0=input_image0, src1=input_image1, dst=output_image)
 
 
-@plugin_function(category=['binarize', 'in assistant'])
+@plugin_function(category=["binarize", "in assistant"])
 def greater_constant(
     input_image: Image,
     output_image: Image = None,
     scalar: float = 0,
-    device: Device = None
+    device: Device = None,
 ) -> Image:
     """Determines if two images A and B greater pixel wise. f(a, b) = 1 if a > b; 0
     otherwise.
@@ -1566,7 +1398,7 @@ def greater_constant(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_greaterConstant
@@ -1574,22 +1406,15 @@ def greater_constant(
 
     from ._pyclesperanto import _greater_constant as op
 
-    
-    return op(
-        device=device,
-        src=input_image,
-        dst=output_image,
-        scalar=float(scalar)
-    )
-
+    return op(device=device, src=input_image, dst=output_image, scalar=float(scalar))
 
 
-@plugin_function(category=['combine', 'binarize', 'in assistant'])
+@plugin_function(category=["combine", "binarize", "in assistant"])
 def greater_or_equal(
     input_image0: Image,
     input_image1: Image,
     output_image: Image = None,
-    device: Device = None
+    device: Device = None,
 ) -> Image:
     """Determines if two images A and B greater or equal pixel wise. f(a, b) = 1 if a
     >= b; 0 otherwise.
@@ -1608,7 +1433,7 @@ def greater_or_equal(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_greaterOrEqual
@@ -1616,22 +1441,15 @@ def greater_or_equal(
 
     from ._pyclesperanto import _greater_or_equal as op
 
-    
-    return op(
-        device=device,
-        src0=input_image0,
-        src1=input_image1,
-        dst=output_image
-    )
-
+    return op(device=device, src0=input_image0, src1=input_image1, dst=output_image)
 
 
-@plugin_function(category=['binarize', 'in assistant'])
+@plugin_function(category=["binarize", "in assistant"])
 def greater_or_equal_constant(
     input_image: Image,
     output_image: Image = None,
     scalar: float = 0,
-    device: Device = None
+    device: Device = None,
 ) -> Image:
     """Determines if two images A and B greater or equal pixel wise. f(a, b) = 1 if a
     >= b; 0 otherwise.
@@ -1650,7 +1468,7 @@ def greater_or_equal_constant(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_greaterOrEqualConstant
@@ -1658,14 +1476,7 @@ def greater_or_equal_constant(
 
     from ._pyclesperanto import _greater_or_equal_constant as op
 
-    
-    return op(
-        device=device,
-        src=input_image,
-        dst=output_image,
-        scalar=float(scalar)
-    )
-
+    return op(device=device, src=input_image, dst=output_image, scalar=float(scalar))
 
 
 @plugin_function
@@ -1674,7 +1485,7 @@ def hessian_eigenvalues(
     small_eigenvalue: Image = None,
     middle_eigenvalue: Image = None,
     large_eigenvalue: Image = None,
-    device: Device = None
+    device: Device = None,
 ) -> list:
     """Computes the eigenvalues of the hessian matrix of a 2d or 3d image. Hessian
     matrix or 2D images: [Ixx, Ixy] [Ixy, Iyy] Hessian matrix for 3D images: [Ixx,
@@ -1702,27 +1513,25 @@ def hessian_eigenvalues(
     Returns
     -------
     list
-    
+
     """
 
     from ._pyclesperanto import _hessian_eigenvalues as op
 
-    
     return op(
         device=device,
         src=input_image,
         small_eigenvalue=small_eigenvalue,
         middle_eigenvalue=middle_eigenvalue,
-        large_eigenvalue=large_eigenvalue
+        large_eigenvalue=large_eigenvalue,
     )
 
 
-
-@plugin_function(category=['filter', 'edge detection', 'in assistant', 'bia-bob-suggestion'])
+@plugin_function(
+    category=["filter", "edge detection", "in assistant", "bia-bob-suggestion"]
+)
 def laplace_box(
-    input_image: Image,
-    output_image: Image = None,
-    device: Device = None
+    input_image: Image, output_image: Image = None, device: Device = None
 ) -> Image:
     """Applies the Laplace operator (Box neighborhood) to an image.
 
@@ -1738,7 +1547,7 @@ def laplace_box(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_laplaceBox
@@ -1746,20 +1555,16 @@ def laplace_box(
 
     from ._pyclesperanto import _laplace_box as op
 
-    warnings.warn("laplace_box : This function is deprecated. Consider using laplace() instead.", DeprecationWarning)
-    return op(
-        device=device,
-        src=input_image,
-        dst=output_image
+    warnings.warn(
+        "laplace_box : This function is deprecated. Consider using laplace() instead.",
+        DeprecationWarning,
     )
+    return op(device=device, src=input_image, dst=output_image)
 
 
-
-@plugin_function(category=['filter', 'edge detection', 'bia-bob-suggestion'])
+@plugin_function(category=["filter", "edge detection", "bia-bob-suggestion"])
 def laplace_diamond(
-    input_image: Image,
-    output_image: Image = None,
-    device: Device = None
+    input_image: Image, output_image: Image = None, device: Device = None
 ) -> Image:
     """Applies the Laplace operator (Diamond neighborhood) to an image.
 
@@ -1775,7 +1580,7 @@ def laplace_diamond(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_laplaceDiamond
@@ -1783,21 +1588,19 @@ def laplace_diamond(
 
     from ._pyclesperanto import _laplace_diamond as op
 
-    warnings.warn("laplace_diamond : This function is deprecated. Consider using laplace() instead.", DeprecationWarning)
-    return op(
-        device=device,
-        src=input_image,
-        dst=output_image
+    warnings.warn(
+        "laplace_diamond : This function is deprecated. Consider using laplace() instead.",
+        DeprecationWarning,
     )
+    return op(device=device, src=input_image, dst=output_image)
 
 
-
-@plugin_function(category=['filter', 'edge detection', 'bia-bob-suggestion'])
+@plugin_function(category=["filter", "edge detection", "bia-bob-suggestion"])
 def laplace(
     input_image: Image,
     output_image: Image = None,
     connectivity: str = "box",
-    device: Device = None
+    device: Device = None,
 ) -> Image:
     """Applies the Laplace operator with a "box" or a "sphere" neighborhood to an
     image.
@@ -1816,7 +1619,7 @@ def laplace(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_laplaceDiamond
@@ -1824,22 +1627,17 @@ def laplace(
 
     from ._pyclesperanto import _laplace as op
 
-    
     return op(
-        device=device,
-        src=input_image,
-        dst=output_image,
-        connectivity=connectivity
+        device=device, src=input_image, dst=output_image, connectivity=connectivity
     )
 
 
-
-@plugin_function(category=['filter', 'combine', 'in assistant'])
+@plugin_function(category=["filter", "combine", "in assistant"])
 def local_cross_correlation(
     input_image0: Image,
     input_image1: Image,
     output_image: Image = None,
-    device: Device = None
+    device: Device = None,
 ) -> Image:
     """Compute the cross correlation of an image to a given kernel.
 
@@ -1857,26 +1655,17 @@ def local_cross_correlation(
     Returns
     -------
     Image
-    
+
     """
 
     from ._pyclesperanto import _local_cross_correlation as op
 
-    
-    return op(
-        device=device,
-        src0=input_image0,
-        src1=input_image1,
-        dst=output_image
-    )
-
+    return op(device=device, src0=input_image0, src1=input_image1, dst=output_image)
 
 
-@plugin_function(category=['filter', 'in assistant'])
+@plugin_function(category=["filter", "in assistant"])
 def logarithm(
-    input_image: Image,
-    output_image: Image = None,
-    device: Device = None
+    input_image: Image, output_image: Image = None, device: Device = None
 ) -> Image:
     """Computes base e logarithm of all pixels values. f(x) = log(x) Author(s): Peter
     Haub, Robert Haase
@@ -1893,7 +1682,7 @@ def logarithm(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_logarithm
@@ -1901,21 +1690,12 @@ def logarithm(
 
     from ._pyclesperanto import _logarithm as op
 
-    
-    return op(
-        device=device,
-        src=input_image,
-        dst=output_image
-    )
-
+    return op(device=device, src=input_image, dst=output_image)
 
 
-@plugin_function(category=['bia-bob-suggestion'])
+@plugin_function(category=["bia-bob-suggestion"])
 def mask(
-    input_image: Image,
-    mask: Image,
-    output_image: Image = None,
-    device: Device = None
+    input_image: Image, mask: Image, output_image: Image = None, device: Device = None
 ) -> Image:
     """Computes a masked image by applying a binary mask to an image. All pixel values
     x of image X will be copied to the destination image in case pixel value m at
@@ -1936,7 +1716,7 @@ def mask(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_mask
@@ -1944,23 +1724,16 @@ def mask(
 
     from ._pyclesperanto import _mask as op
 
-    
-    return op(
-        device=device,
-        src=input_image,
-        mask=mask,
-        dst=output_image
-    )
-
+    return op(device=device, src=input_image, mask=mask, dst=output_image)
 
 
-@plugin_function(category=['bia-bob-suggestion'])
+@plugin_function(category=["bia-bob-suggestion"])
 def mask_label(
     input_image0: Image,
     input_image1: Image,
     output_image: Image = None,
     label: float = 1,
-    device: Device = None
+    device: Device = None,
 ) -> Image:
     """Computes a masked image by applying a label mask to an image. All pixel values x
     of image X will be copied to the destination image in case pixel value m at the
@@ -1983,7 +1756,7 @@ def mask_label(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_maskLabel
@@ -1991,23 +1764,21 @@ def mask_label(
 
     from ._pyclesperanto import _mask_label as op
 
-    
     return op(
         device=device,
         src0=input_image0,
         src1=input_image1,
         dst=output_image,
-        label=float(label)
+        label=float(label),
     )
 
 
-
-@plugin_function(category=['filter', 'in assistant', 'bia-bob-suggestion'])
+@plugin_function(category=["filter", "in assistant", "bia-bob-suggestion"])
 def maximum_image_and_scalar(
     input_image: Image,
     output_image: Image = None,
     scalar: float = 0,
-    device: Device = None
+    device: Device = None,
 ) -> Image:
     """Computes the maximum of a constant scalar s and each pixel value x in a given
     image X. 
f(x, s) = max(x, s)
@@ -2026,7 +1797,7 @@ def maximum_image_and_scalar( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_maximumImageAndScalar @@ -2034,22 +1805,15 @@ def maximum_image_and_scalar( from ._pyclesperanto import _maximum_image_and_scalar as op - - return op( - device=device, - src=input_image, - dst=output_image, - scalar=float(scalar) - ) - + return op(device=device, src=input_image, dst=output_image, scalar=float(scalar)) -@plugin_function(category=['combine', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["combine", "in assistant", "bia-bob-suggestion"]) def maximum_images( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Computes the maximum of a pair of pixel values x, y from two given images X and Y.
f(x, y) = max(x, y)
@@ -2068,7 +1832,7 @@ def maximum_images( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_maximumImages @@ -2076,24 +1840,17 @@ def maximum_images( from ._pyclesperanto import _maximum_images as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) -@plugin_function(category=['filter', 'in assistant']) +@plugin_function(category=["filter", "in assistant"]) def maximum_box( input_image: Image, output_image: Image = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, - device: Device = None + device: Device = None, ) -> Image: """Computes the local maximum of a pixels cube neighborhood. The cubes size is specified by its halfwidth, halfheight and halfdepth (radius). @@ -2116,7 +1873,7 @@ def maximum_box( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_maximum3DBox @@ -2124,19 +1881,21 @@ def maximum_box( from ._pyclesperanto import _maximum_box as op - warnings.warn("maximum_box : This function is deprecated. Consider using maximum() instead.", DeprecationWarning) + warnings.warn( + "maximum_box : This function is deprecated. Consider using maximum() instead.", + DeprecationWarning, + ) return op( device=device, src=input_image, dst=output_image, radius_x=int(radius_x), radius_y=int(radius_y), - radius_z=int(radius_z) + radius_z=int(radius_z), ) - -@plugin_function(category=['filter', 'in assistant']) +@plugin_function(category=["filter", "in assistant"]) def maximum( input_image: Image, output_image: Image = None, @@ -2144,7 +1903,7 @@ def maximum( radius_y: int = 0, radius_z: int = 0, connectivity: str = "box", - device: Device = None + device: Device = None, ) -> Image: """Computes the local maximum of a pixels neighborhood (box or sphere). The neighborhood size is specified by its halfwidth, halfheight and halfdepth @@ -2170,16 +1929,15 @@ def maximum( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_maximum3DBox - [2] https://clij.github.io/clij2-docs/reference_maximum3DSphere + [2] https://clij.github.io/clij2-docs/reference_maximum3DSphere """ from ._pyclesperanto import _maximum as op - return op( device=device, src=input_image, @@ -2187,16 +1945,13 @@ def maximum( radius_x=int(radius_x), radius_y=int(radius_y), radius_z=int(radius_z), - connectivity=connectivity + connectivity=connectivity, ) - -@plugin_function(category=['projection']) +@plugin_function(category=["projection"]) def maximum_x_projection( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Determines the maximum intensity projection of an image along X. @@ -2212,7 +1967,7 @@ def maximum_x_projection( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_maximumXProjection @@ -2220,20 +1975,12 @@ def maximum_x_projection( from ._pyclesperanto import _maximum_x_projection as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['projection']) +@plugin_function(category=["projection"]) def maximum_y_projection( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Determines the maximum intensity projection of an image along X. @@ -2249,7 +1996,7 @@ def maximum_y_projection( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_maximumYProjection @@ -2257,20 +2004,12 @@ def maximum_y_projection( from ._pyclesperanto import _maximum_y_projection as op - - return op( - device=device, - src=input_image, - dst=output_image - ) + return op(device=device, src=input_image, dst=output_image) - -@plugin_function(category=['projection', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["projection", "in assistant", "bia-bob-suggestion"]) def maximum_z_projection( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Determines the maximum intensity projection of an image along Z. @@ -2286,7 +2025,7 @@ def maximum_z_projection( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_maximumZProjection @@ -2294,23 +2033,17 @@ def maximum_z_projection( from ._pyclesperanto import _maximum_z_projection as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['filter', 'denoise', 'in assistant']) +@plugin_function(category=["filter", "denoise", "in assistant"]) def mean_box( input_image: Image, output_image: Image = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, - device: Device = None + device: Device = None, ) -> Image: """Computes the local mean average of a pixels boxshaped neighborhood. The cubes size is specified by its halfwidth, halfheight and halfdepth (radius). @@ -2333,7 +2066,7 @@ def mean_box( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_mean3DBox @@ -2341,26 +2074,28 @@ def mean_box( from ._pyclesperanto import _mean_box as op - warnings.warn("mean_box : This function is deprecated. Consider using mean() instead.", DeprecationWarning) + warnings.warn( + "mean_box : This function is deprecated. Consider using mean() instead.", + DeprecationWarning, + ) return op( device=device, src=input_image, dst=output_image, radius_x=int(radius_x), radius_y=int(radius_y), - radius_z=int(radius_z) + radius_z=int(radius_z), ) - -@plugin_function(category=['filter', 'denoise', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["filter", "denoise", "in assistant", "bia-bob-suggestion"]) def mean_sphere( input_image: Image, output_image: Image = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, - device: Device = None + device: Device = None, ) -> Image: """Computes the local mean average of a pixels spherical neighborhood. The spheres size is specified by its halfwidth, halfheight and halfdepth (radius). @@ -2383,7 +2118,7 @@ def mean_sphere( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_mean3DSphere @@ -2391,19 +2126,21 @@ def mean_sphere( from ._pyclesperanto import _mean_sphere as op - warnings.warn("mean_sphere : This function is deprecated. Consider using mean() instead.", DeprecationWarning) + warnings.warn( + "mean_sphere : This function is deprecated. Consider using mean() instead.", + DeprecationWarning, + ) return op( device=device, src=input_image, dst=output_image, radius_x=int(radius_x), radius_y=int(radius_y), - radius_z=int(radius_z) + radius_z=int(radius_z), ) - -@plugin_function(category=['filter', 'denoise', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["filter", "denoise", "in assistant", "bia-bob-suggestion"]) def mean( input_image: Image, output_image: Image = None, @@ -2411,7 +2148,7 @@ def mean( radius_y: int = 1, radius_z: int = 1, connectivity: str = "box", - device: Device = None + device: Device = None, ) -> Image: """Computes the local mean average of a pixels neighborhood defined as a boxshaped or a sphereshaped. The shape size is specified by its halfwidth, halfheight and @@ -2437,7 +2174,7 @@ def mean( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_mean3DSphere @@ -2445,7 +2182,6 @@ def mean( from ._pyclesperanto import _mean as op - return op( device=device, src=input_image, @@ -2453,16 +2189,13 @@ def mean( radius_x=int(radius_x), radius_y=int(radius_y), radius_z=int(radius_z), - connectivity=connectivity + connectivity=connectivity, ) - -@plugin_function(category=['projection']) +@plugin_function(category=["projection"]) def mean_x_projection( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Determines the mean average intensity projection of an image along X. @@ -2478,7 +2211,7 @@ def mean_x_projection( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_meanXProjection @@ -2486,20 +2219,12 @@ def mean_x_projection( from ._pyclesperanto import _mean_x_projection as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['projection']) +@plugin_function(category=["projection"]) def mean_y_projection( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Determines the mean average intensity projection of an image along Y. @@ -2515,7 +2240,7 @@ def mean_y_projection( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_meanYProjection @@ -2523,20 +2248,12 @@ def mean_y_projection( from ._pyclesperanto import _mean_y_projection as op - - return op( - device=device, - src=input_image, - dst=output_image - ) + return op(device=device, src=input_image, dst=output_image) - -@plugin_function(category=['projection', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["projection", "in assistant", "bia-bob-suggestion"]) def mean_z_projection( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Determines the mean average intensity projection of an image along Z. @@ -2552,7 +2269,7 @@ def mean_z_projection( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_meanZProjection @@ -2560,23 +2277,17 @@ def mean_z_projection( from ._pyclesperanto import _mean_z_projection as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['filter', 'denoise', 'in assistant']) +@plugin_function(category=["filter", "denoise", "in assistant"]) def median_box( input_image: Image, output_image: Image = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, - device: Device = None + device: Device = None, ) -> Image: """Computes the local median of a pixels box shaped neighborhood. The box is specified by its halfwidth and halfheight (radius). For technical reasons, the @@ -2600,7 +2311,7 @@ def median_box( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_median3DBox @@ -2608,26 +2319,28 @@ def median_box( from ._pyclesperanto import _median_box as op - warnings.warn("median_box : This function is deprecated. Consider using median() instead.", DeprecationWarning) + warnings.warn( + "median_box : This function is deprecated. Consider using median() instead.", + DeprecationWarning, + ) return op( device=device, src=input_image, dst=output_image, radius_x=int(radius_x), radius_y=int(radius_y), - radius_z=int(radius_z) + radius_z=int(radius_z), ) - -@plugin_function(category=['filter', 'denoise', 'in assistant']) +@plugin_function(category=["filter", "denoise", "in assistant"]) def median_sphere( input_image: Image, output_image: Image = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, - device: Device = None + device: Device = None, ) -> Image: """Computes the local median of a pixels sphere shaped neighborhood. The sphere is specified by its halfwidth and halfheight (radius). For technical reasons, the @@ -2651,7 +2364,7 @@ def median_sphere( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_median3DSphere @@ -2659,19 +2372,21 @@ def median_sphere( from ._pyclesperanto import _median_sphere as op - warnings.warn("median_sphere : This function is deprecated. Consider using median() instead.", DeprecationWarning) + warnings.warn( + "median_sphere : This function is deprecated. Consider using median() instead.", + DeprecationWarning, + ) return op( device=device, src=input_image, dst=output_image, radius_x=int(radius_x), radius_y=int(radius_y), - radius_z=int(radius_z) + radius_z=int(radius_z), ) - -@plugin_function(category=['filter', 'denoise', 'in assistant']) +@plugin_function(category=["filter", "denoise", "in assistant"]) def median( input_image: Image, output_image: Image = None, @@ -2679,7 +2394,7 @@ def median( radius_y: int = 1, radius_z: int = 1, connectivity: str = "box", - device: Device = None + device: Device = None, ) -> Image: """Computes the local median of a pixels neighborhood. The neighborhood is defined as a box or a sphere shape. Its size is specified by its halfwidth, halfheight, @@ -2706,7 +2421,7 @@ def median( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_median3DSphere @@ -2714,7 +2429,6 @@ def median( from ._pyclesperanto import _median as op - return op( device=device, src=input_image, @@ -2722,19 +2436,18 @@ def median( radius_x=int(radius_x), radius_y=int(radius_y), radius_z=int(radius_z), - connectivity=connectivity + connectivity=connectivity, ) - -@plugin_function(category=['filter', 'in assistant']) +@plugin_function(category=["filter", "in assistant"]) def minimum_box( input_image: Image, output_image: Image = None, radius_x: int = 0, radius_y: int = 0, radius_z: int = 0, - device: Device = None + device: Device = None, ) -> Image: """Computes the local minimum of a pixels cube neighborhood. The cubes size is specified by its halfwidth, halfheight and halfdepth (radius). @@ -2757,7 +2470,7 @@ def minimum_box( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_minimum3DBox @@ -2765,19 +2478,21 @@ def minimum_box( from ._pyclesperanto import _minimum_box as op - warnings.warn("minimum_box : This function is deprecated. Consider using minimum() instead.", DeprecationWarning) + warnings.warn( + "minimum_box : This function is deprecated. Consider using minimum() instead.", + DeprecationWarning, + ) return op( device=device, src=input_image, dst=output_image, radius_x=int(radius_x), radius_y=int(radius_y), - radius_z=int(radius_z) + radius_z=int(radius_z), ) - -@plugin_function(category=['filter', 'in assistant']) +@plugin_function(category=["filter", "in assistant"]) def minimum( input_image: Image, output_image: Image = None, @@ -2785,7 +2500,7 @@ def minimum( radius_y: int = 0, radius_z: int = 0, connectivity: str = "box", - device: Device = None + device: Device = None, ) -> Image: """Computes the local minimum of a pixels cube neighborhood. The cubes size is specified by its halfwidth, halfheight and halfdepth (radius). @@ -2810,16 +2525,15 @@ def minimum( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_minimum3DBox - [2] https://clij.github.io/clij2-docs/reference_minimum3DSphere + [2] https://clij.github.io/clij2-docs/reference_minimum3DSphere """ from ._pyclesperanto import _minimum as op - return op( device=device, src=input_image, @@ -2827,17 +2541,16 @@ def minimum( radius_x=int(radius_x), radius_y=int(radius_y), radius_z=int(radius_z), - connectivity=connectivity + connectivity=connectivity, ) - -@plugin_function(category=['filter', 'in assistant']) +@plugin_function(category=["filter", "in assistant"]) def minimum_image_and_scalar( input_image: Image, output_image: Image = None, scalar: float = 0, - device: Device = None + device: Device = None, ) -> Image: """Computes the minimum of a constant scalar s and each pixel value x in a given image X.
f(x, s) = min(x, s)
@@ -2856,7 +2569,7 @@ def minimum_image_and_scalar( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_minimumImageAndScalar @@ -2864,22 +2577,15 @@ def minimum_image_and_scalar( from ._pyclesperanto import _minimum_image_and_scalar as op - - return op( - device=device, - src=input_image, - dst=output_image, - scalar=float(scalar) - ) - + return op(device=device, src=input_image, dst=output_image, scalar=float(scalar)) -@plugin_function(category=['combine', 'in assistant']) +@plugin_function(category=["combine", "in assistant"]) def minimum_images( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Computes the minimum of a pair of pixel values x, y from two given images X and Y.
f(x, y) = min(x, y)
@@ -2898,7 +2604,7 @@ def minimum_images( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_minimumImages @@ -2906,21 +2612,12 @@ def minimum_images( from ._pyclesperanto import _minimum_images as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) -@plugin_function(category=['projection']) +@plugin_function(category=["projection"]) def minimum_x_projection( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Determines the minimum intensity projection of an image along Y. @@ -2936,7 +2633,7 @@ def minimum_x_projection( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_minimumXProjection @@ -2944,20 +2641,12 @@ def minimum_x_projection( from ._pyclesperanto import _minimum_x_projection as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['projection']) +@plugin_function(category=["projection"]) def minimum_y_projection( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Determines the minimum intensity projection of an image along Y. @@ -2973,7 +2662,7 @@ def minimum_y_projection( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_minimumYProjection @@ -2981,20 +2670,12 @@ def minimum_y_projection( from ._pyclesperanto import _minimum_y_projection as op - - return op( - device=device, - src=input_image, - dst=output_image - ) + return op(device=device, src=input_image, dst=output_image) - -@plugin_function(category=['projection', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["projection", "in assistant", "bia-bob-suggestion"]) def minimum_z_projection( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Determines the minimum intensity projection of an image along Z. @@ -3010,7 +2691,7 @@ def minimum_z_projection( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_minimumZProjection @@ -3018,23 +2699,17 @@ def minimum_z_projection( from ._pyclesperanto import _minimum_z_projection as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['label processing', 'in assistant']) +@plugin_function(category=["label processing", "in assistant"]) def mode_box( input_image: Image, output_image: Image = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, - device: Device = None + device: Device = None, ) -> Image: """Computes the local mode of a pixels box shaped neighborhood. This can be used to postprocess and locally correct semantic segmentation results. The box is @@ -3060,31 +2735,33 @@ def mode_box( Returns ------- Image - + """ from ._pyclesperanto import _mode_box as op - warnings.warn("mode_box : This function is deprecated. Consider using mode() instead.", DeprecationWarning) + warnings.warn( + "mode_box : This function is deprecated. Consider using mode() instead.", + DeprecationWarning, + ) return op( device=device, src=input_image, dst=output_image, radius_x=int(radius_x), radius_y=int(radius_y), - radius_z=int(radius_z) + radius_z=int(radius_z), ) - -@plugin_function(category=['label processing', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["label processing", "in assistant", "bia-bob-suggestion"]) def mode_sphere( input_image: Image, output_image: Image = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, - device: Device = None + device: Device = None, ) -> Image: """Computes the local mode of a pixels sphere shaped neighborhood. This can be used to postprocess and locally correct semantic segmentation results. The sphere is @@ -3110,24 +2787,26 @@ def mode_sphere( Returns ------- Image - + """ from ._pyclesperanto import _mode_sphere as op - warnings.warn("mode_sphere : This function is deprecated. Consider using mode() instead.", DeprecationWarning) + warnings.warn( + "mode_sphere : This function is deprecated. Consider using mode() instead.", + DeprecationWarning, + ) return op( device=device, src=input_image, dst=output_image, radius_x=int(radius_x), radius_y=int(radius_y), - radius_z=int(radius_z) + radius_z=int(radius_z), ) - -@plugin_function(category=['label processing', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["label processing", "in assistant", "bia-bob-suggestion"]) def mode( input_image: Image, output_image: Image = None, @@ -3135,7 +2814,7 @@ def mode( radius_y: int = 1, radius_z: int = 1, connectivity: str = "box", - device: Device = None + device: Device = None, ) -> Image: """Computes the local mode of a pixels neighborhood. This neighborhood can be shaped as a box or a sphere. This can be used to postprocess and locally correct @@ -3164,12 +2843,11 @@ def mode( Returns ------- Image - + """ from ._pyclesperanto import _mode as op - return op( device=device, src=input_image, @@ -3177,17 +2855,16 @@ def mode( radius_x=int(radius_x), radius_y=int(radius_y), radius_z=int(radius_z), - connectivity=connectivity + connectivity=connectivity, ) - -@plugin_function(category=['combine', 'bia-bob-suggestion']) +@plugin_function(category=["combine", "bia-bob-suggestion"]) def modulo_images( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Computes the remainder of a division of pairwise pixel values in two images @@ -3205,19 +2882,12 @@ def modulo_images( Returns ------- Image - + """ from ._pyclesperanto import _modulo_images as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) @plugin_function @@ -3225,7 +2895,7 @@ def multiply_image_and_position( input_image: Image, output_image: Image = None, dimension: int = 0, - device: Device = None + device: Device = None, ) -> Image: """Multiplies all pixel intensities with the x, y or z coordinate, depending on specified dimension. @@ -3244,7 +2914,7 @@ def multiply_image_and_position( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_multiplyImageAndCoordinate @@ -3252,22 +2922,17 @@ def multiply_image_and_position( from ._pyclesperanto import _multiply_image_and_position as op - return op( - device=device, - src=input_image, - dst=output_image, - dimension=int(dimension) + device=device, src=input_image, dst=output_image, dimension=int(dimension) ) - -@plugin_function(category=['filter', 'in assistant']) +@plugin_function(category=["filter", "in assistant"]) def multiply_image_and_scalar( input_image: Image, output_image: Image = None, scalar: float = 0, - device: Device = None + device: Device = None, ) -> Image: """Multiplies all pixels value x in a given image X with a constant scalar s.
f(x, s) = x * s
@@ -3286,7 +2951,7 @@ def multiply_image_and_scalar( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_multiplyImageAndScalar @@ -3294,22 +2959,15 @@ def multiply_image_and_scalar( from ._pyclesperanto import _multiply_image_and_scalar as op - - return op( - device=device, - src=input_image, - dst=output_image, - scalar=float(scalar) - ) + return op(device=device, src=input_image, dst=output_image, scalar=float(scalar)) - -@plugin_function(category=['combine', 'in assistant']) +@plugin_function(category=["combine", "in assistant"]) def multiply_images( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Multiplies all pairs of pixel values x and y from two image X and Y.
f(x,
     y) = x * y
@@ -3328,7 +2986,7 @@ def multiply_images( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_multiplyImages @@ -3336,14 +2994,7 @@ def multiply_images( from ._pyclesperanto import _multiply_images as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) @plugin_function @@ -3351,9 +3002,9 @@ def nan_to_num( input_image: Image, output_image: Image = None, nan: float = 0, - posinf: float = np.nan_to_num(float('inf')), - neginf: float = np.nan_to_num(float('-inf')), - device: Device = None + posinf: float = np.nan_to_num(float("inf")), + neginf: float = np.nan_to_num(float("-inf")), + device: Device = None, ) -> Image: """Copies all pixels instead those which are not a number (NaN), or positive/negative infinity which are replaced by a defined new value, default 0. @@ -3379,7 +3030,7 @@ def nan_to_num( Returns ------- Image - + References ---------- [1] https://numpy.org/doc/stable/reference/generated/numpy.nan_to_num.html @@ -3387,24 +3038,22 @@ def nan_to_num( from ._pyclesperanto import _nan_to_num as op - return op( device=device, src=input_image, dst=output_image, nan=float(nan), posinf=float(posinf), - neginf=float(neginf) + neginf=float(neginf), ) - @plugin_function def nonzero_maximum_box( input_image: Image, output_image0: Image, output_image1: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Apply a maximum filter (box shape) to the input image. The radius is fixed to 1 and pixels with value 0 are ignored. Note: Pixels with 0 value in the input @@ -3425,7 +3074,7 @@ def nonzero_maximum_box( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_nonzeroMaximumBox @@ -3433,14 +3082,11 @@ def nonzero_maximum_box( from ._pyclesperanto import _nonzero_maximum_box as op - warnings.warn("nonzero_maximum_box : This function is deprecated. Consider using nonzero_maximum() instead.", DeprecationWarning) - return op( - device=device, - src=input_image, - dst0=output_image0, - dst1=output_image1 + warnings.warn( + "nonzero_maximum_box : This function is deprecated. Consider using nonzero_maximum() instead.", + DeprecationWarning, ) - + return op(device=device, src=input_image, dst0=output_image0, dst1=output_image1) @plugin_function @@ -3448,7 +3094,7 @@ def nonzero_maximum_diamond( input_image: Image, output_image0: Image, output_image1: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Apply a maximum filter (diamond shape) to the input image. The radius is fixed to 1 and pixels with value 0 are ignored. Note: Pixels with 0 value in the input @@ -3469,7 +3115,7 @@ def nonzero_maximum_diamond( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_nonzeroMaximumDiamond @@ -3477,14 +3123,11 @@ def nonzero_maximum_diamond( from ._pyclesperanto import _nonzero_maximum_diamond as op - warnings.warn("nonzero_maximum_diamond : This function is deprecated. Consider using nonzero_maximum() instead.", DeprecationWarning) - return op( - device=device, - src=input_image, - dst0=output_image0, - dst1=output_image1 + warnings.warn( + "nonzero_maximum_diamond : This function is deprecated. Consider using nonzero_maximum() instead.", + DeprecationWarning, ) - + return op(device=device, src=input_image, dst0=output_image0, dst1=output_image1) @plugin_function @@ -3493,7 +3136,7 @@ def nonzero_maximum( output_image0: Image, output_image1: Image = None, connectivity: str = "box", - device: Device = None + device: Device = None, ) -> Image: """Apply a maximum filter of a neighborhood to the input image. The neighborhood shape can be a box or a sphere. The size is fixed to 1 and pixels with value 0 @@ -3517,32 +3160,30 @@ def nonzero_maximum( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_nonzeroMaximumBox - [2] https://clij.github.io/clij2-docs/reference_nonzeroMaximumDiamond + [2] https://clij.github.io/clij2-docs/reference_nonzeroMaximumDiamond """ from ._pyclesperanto import _nonzero_maximum as op - return op( device=device, src=input_image, dst0=output_image0, dst1=output_image1, - connectivity=connectivity + connectivity=connectivity, ) - @plugin_function def nonzero_minimum_box( input_image: Image, output_image0: Image, output_image1: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Apply a minimum filter (box shape) to the input image. The radius is fixed to 1 and pixels with value 0 are ignored. Note: Pixels with 0 value in the input @@ -3563,7 +3204,7 @@ def nonzero_minimum_box( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_nonzeroMinimumBox @@ -3571,14 +3212,11 @@ def nonzero_minimum_box( from ._pyclesperanto import _nonzero_minimum_box as op - warnings.warn("nonzero_minimum_box : This function is deprecated. Consider using nonzero_minimum() instead.", DeprecationWarning) - return op( - device=device, - src=input_image, - dst0=output_image0, - dst1=output_image1 + warnings.warn( + "nonzero_minimum_box : This function is deprecated. Consider using nonzero_minimum() instead.", + DeprecationWarning, ) - + return op(device=device, src=input_image, dst0=output_image0, dst1=output_image1) @plugin_function @@ -3586,7 +3224,7 @@ def nonzero_minimum_diamond( input_image: Image, output_image0: Image, output_image1: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Apply a minimum filter (diamond shape) to the input image. The radius is fixed to 1 and pixels with value 0 are ignored.Note: Pixels with 0 value in the input @@ -3607,7 +3245,7 @@ def nonzero_minimum_diamond( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_nonzeroMinimumDiamond @@ -3615,14 +3253,11 @@ def nonzero_minimum_diamond( from ._pyclesperanto import _nonzero_minimum_diamond as op - warnings.warn("nonzero_minimum_diamond : This function is deprecated. Consider using nonzero_minimum() instead.", DeprecationWarning) - return op( - device=device, - src=input_image, - dst0=output_image0, - dst1=output_image1 + warnings.warn( + "nonzero_minimum_diamond : This function is deprecated. Consider using nonzero_minimum() instead.", + DeprecationWarning, ) - + return op(device=device, src=input_image, dst0=output_image0, dst1=output_image1) @plugin_function @@ -3631,7 +3266,7 @@ def nonzero_minimum( output_image0: Image, output_image1: Image = None, connectivity: str = "box", - device: Device = None + device: Device = None, ) -> Image: """Apply a minimum filter of a neighborhood to the input image. The neighborhood shape can be a box or a sphere. The radius is fixed to 1 and pixels with value 0 @@ -3655,32 +3290,30 @@ def nonzero_minimum( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_nonzeroMinimumBox - [2] https://clij.github.io/clij2-docs/reference_nonzeroMinimumDiamond + [2] https://clij.github.io/clij2-docs/reference_nonzeroMinimumDiamond """ from ._pyclesperanto import _nonzero_minimum as op - return op( device=device, src=input_image, dst0=output_image0, dst1=output_image1, - connectivity=connectivity + connectivity=connectivity, ) - -@plugin_function(category=['combine', 'binarize', 'in assistant']) +@plugin_function(category=["combine", "binarize", "in assistant"]) def not_equal( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Determines if two images A and B equal pixel wise. f(a, b) = 1 if a != b; 0 otherwise. @@ -3699,7 +3332,7 @@ def not_equal( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_notEqual @@ -3707,22 +3340,15 @@ def not_equal( from ._pyclesperanto import _not_equal as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) -@plugin_function(category=['binarize', 'in assistant']) +@plugin_function(category=["binarize", "in assistant"]) def not_equal_constant( input_image: Image, output_image: Image = None, scalar: float = 0, - device: Device = None + device: Device = None, ) -> Image: """Determines if two images A and B equal pixel wise. f(a, b) = 1 if a != b; 0 otherwise. @@ -3741,7 +3367,7 @@ def not_equal_constant( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_notEqualConstant @@ -3749,24 +3375,17 @@ def not_equal_constant( from ._pyclesperanto import _not_equal_constant as op - - return op( - device=device, - src=input_image, - dst=output_image, - scalar=float(scalar) - ) - + return op(device=device, src=input_image, dst=output_image, scalar=float(scalar)) -@plugin_function(category=['combine', 'in assistant']) +@plugin_function(category=["combine", "in assistant"]) def paste( input_image: Image, output_image: Image = None, index_x: int = 0, index_y: int = 0, index_z: int = 0, - device: Device = None + device: Device = None, ) -> Image: """Pastes an image into another image at a given position. @@ -3788,7 +3407,7 @@ def paste( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_paste3D @@ -3796,24 +3415,22 @@ def paste( from ._pyclesperanto import _paste as op - return op( device=device, src=input_image, dst=output_image, index_x=int(index_x), index_y=int(index_y), - index_z=int(index_z) + index_z=int(index_z), ) - @plugin_function def onlyzero_overwrite_maximum_box( input_image: Image, output_image0: Image, output_image1: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Apply a local maximum filter to an image which only overwrites pixels with value 0. @@ -3832,7 +3449,7 @@ def onlyzero_overwrite_maximum_box( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_onlyzeroOverwriteMaximumBox @@ -3840,14 +3457,11 @@ def onlyzero_overwrite_maximum_box( from ._pyclesperanto import _onlyzero_overwrite_maximum_box as op - warnings.warn("onlyzero_overwrite_maximum_box : This function is deprecated. Consider using onlyzero_overwrite_maximum() instead.", DeprecationWarning) - return op( - device=device, - src=input_image, - dst0=output_image0, - dst1=output_image1 + warnings.warn( + "onlyzero_overwrite_maximum_box : This function is deprecated. Consider using onlyzero_overwrite_maximum() instead.", + DeprecationWarning, ) - + return op(device=device, src=input_image, dst0=output_image0, dst1=output_image1) @plugin_function @@ -3855,7 +3469,7 @@ def onlyzero_overwrite_maximum_diamond( input_image: Image, output_image0: Image, output_image1: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Apply a local maximum filter to an image which only overwrites pixels with value 0. @@ -3874,7 +3488,7 @@ def onlyzero_overwrite_maximum_diamond( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_onlyzeroOverwriteMaximumDiamond @@ -3882,14 +3496,11 @@ def onlyzero_overwrite_maximum_diamond( from ._pyclesperanto import _onlyzero_overwrite_maximum_diamond as op - warnings.warn("onlyzero_overwrite_maximum_diamond : This function is deprecated. Consider using onlyzero_overwrite_maximum() instead.", DeprecationWarning) - return op( - device=device, - src=input_image, - dst0=output_image0, - dst1=output_image1 + warnings.warn( + "onlyzero_overwrite_maximum_diamond : This function is deprecated. Consider using onlyzero_overwrite_maximum() instead.", + DeprecationWarning, ) - + return op(device=device, src=input_image, dst0=output_image0, dst1=output_image1) @plugin_function @@ -3898,7 +3509,7 @@ def onlyzero_overwrite_maximum( output_image0: Image, output_image1: Image = None, connectivity: str = "box", - device: Device = None + device: Device = None, ) -> Image: """Apply a local maximum filter to an image which only overwrites pixels with value 0. @@ -3919,32 +3530,30 @@ def onlyzero_overwrite_maximum( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_onlyzeroOverwriteMaximumBox - [2] https://clij.github.io/clij2-docs/reference_onlyzeroOverwriteMaximumDiamond + [2] https://clij.github.io/clij2-docs/reference_onlyzeroOverwriteMaximumDiamond """ from ._pyclesperanto import _onlyzero_overwrite_maximum as op - return op( device=device, src=input_image, dst0=output_image0, dst1=output_image1, - connectivity=connectivity + connectivity=connectivity, ) - -@plugin_function(category=['filter', 'in assistant']) +@plugin_function(category=["filter", "in assistant"]) def power( input_image: Image, output_image: Image = None, scalar: float = 1, - device: Device = None + device: Device = None, ) -> Image: """Computes all pixels value x to the power of a given exponent a.
f(x, a) = x
     ^ a
@@ -3963,7 +3572,7 @@ def power( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_power @@ -3971,22 +3580,15 @@ def power( from ._pyclesperanto import _power as op - - return op( - device=device, - src=input_image, - dst=output_image, - scalar=float(scalar) - ) - + return op(device=device, src=input_image, dst=output_image, scalar=float(scalar)) -@plugin_function(category=['combine', 'in assistant']) +@plugin_function(category=["combine", "in assistant"]) def power_images( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Calculates x to the power of y pixel wise of two images X and Y. @@ -4004,7 +3606,7 @@ def power_images( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_powerImages @@ -4012,17 +3614,10 @@ def power_images( from ._pyclesperanto import _power_images as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) -@plugin_function(category=['transform', 'in assistant']) +@plugin_function(category=["transform", "in assistant"]) def range( input_image: Image, output_image: Image = None, @@ -4035,7 +3630,7 @@ def range( start_z: int = None, stop_z: int = None, step_z: int = None, - device: Device = None + device: Device = None, ) -> Image: """Crops an image according to a defined range and step size. @@ -4069,12 +3664,11 @@ def range( Returns ------- Image - + """ from ._pyclesperanto import _range as op - return op( device=device, src=input_image, @@ -4087,17 +3681,13 @@ def range( step_y=int(step_y), start_z=int(start_z), stop_z=int(stop_z), - step_z=int(step_z) + step_z=int(step_z), ) - -@plugin_function(category=['bia-bob-suggestion']) +@plugin_function(category=["bia-bob-suggestion"]) def read_values_from_positions( - input_image: Image, - list: Image, - output_image: Image = None, - device: Device = None + input_image: Image, list: Image, output_image: Image = None, device: Device = None ) -> Image: """Go to positions in a given image specified by a pointlist and read intensities of those pixels. The intensities are stored in a new vector. The positions are @@ -4117,27 +3707,20 @@ def read_values_from_positions( Returns ------- Image - + """ from ._pyclesperanto import _read_values_from_positions as op - - return op( - device=device, - src=input_image, - list=list, - dst=output_image - ) - + return op(device=device, src=input_image, list=list, dst=output_image) -@plugin_function(category=['bia-bob-suggestion']) +@plugin_function(category=["bia-bob-suggestion"]) def replace_values( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Replaces integer intensities specified in a vector image. The values are passed as a vector of values. The vector index represents the old intensity and the @@ -4157,7 +3740,7 @@ def replace_values( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_replaceIntensities @@ -4165,14 +3748,7 @@ def replace_values( from ._pyclesperanto import _replace_values as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) @plugin_function @@ -4181,7 +3757,7 @@ def replace_value( output_image: Image = None, scalar0: float = 0, scalar1: float = 1, - device: Device = None + device: Device = None, ) -> Image: """Replaces a specific intensity in an image with a given new value. @@ -4201,7 +3777,7 @@ def replace_value( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_replaceIntensity @@ -4209,25 +3785,23 @@ def replace_value( from ._pyclesperanto import _replace_value as op - return op( device=device, src=input_image, dst=output_image, scalar0=float(scalar0), - scalar1=float(scalar1) + scalar1=float(scalar1), ) - -@plugin_function(category=['filter', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["filter", "in assistant", "bia-bob-suggestion"]) def maximum_sphere( input_image: Image, output_image: Image = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 0, - device: Device = None + device: Device = None, ) -> Image: """Computes the local maximum of a pixels spherical neighborhood. The spheres size is specified by its halfwidth, halfheight and halfdepth (radius). @@ -4250,7 +3824,7 @@ def maximum_sphere( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_maximum3DSphere @@ -4258,26 +3832,28 @@ def maximum_sphere( from ._pyclesperanto import _maximum_sphere as op - warnings.warn("maximum_sphere : This function is deprecated. Consider using maximum() instead.", DeprecationWarning) + warnings.warn( + "maximum_sphere : This function is deprecated. Consider using maximum() instead.", + DeprecationWarning, + ) return op( device=device, src=input_image, dst=output_image, radius_x=float(radius_x), radius_y=float(radius_y), - radius_z=float(radius_z) + radius_z=float(radius_z), ) - -@plugin_function(category=['filter', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["filter", "in assistant", "bia-bob-suggestion"]) def minimum_sphere( input_image: Image, output_image: Image = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1, - device: Device = None + device: Device = None, ) -> Image: """Computes the local minimum of a pixels spherical neighborhood. The spheres size is specified by its halfwidth, halfheight and halfdepth (radius). @@ -4300,7 +3876,7 @@ def minimum_sphere( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_minimum3DSphere @@ -4308,24 +3884,26 @@ def minimum_sphere( from ._pyclesperanto import _minimum_sphere as op - warnings.warn("minimum_sphere : This function is deprecated. Consider using minimum() instead.", DeprecationWarning) + warnings.warn( + "minimum_sphere : This function is deprecated. Consider using minimum() instead.", + DeprecationWarning, + ) return op( device=device, src=input_image, dst=output_image, radius_x=float(radius_x), radius_y=float(radius_y), - radius_z=float(radius_z) + radius_z=float(radius_z), ) - @plugin_function def multiply_matrix( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Multiplies two matrices with each other. Shape of matrix1 should be equal to shape of matrix2 transposed. @@ -4344,7 +3922,7 @@ def multiply_matrix( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_multiplyMatrix @@ -4352,21 +3930,12 @@ def multiply_matrix( from ._pyclesperanto import _multiply_matrix as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) -@plugin_function(category=['filter', 'in assistant']) +@plugin_function(category=["filter", "in assistant"]) def reciprocal( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Computes 1/x for every pixel value This function is supposed to work similarly to its counter part in numpy [1] @@ -4383,7 +3952,7 @@ def reciprocal( Returns ------- Image - + References ---------- [1] https://numpy.org/doc/stable/reference/generated/numpy.reciprocal.html @@ -4391,21 +3960,11 @@ def reciprocal( from ._pyclesperanto import _reciprocal as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) @plugin_function -def set( - input_image: Image, - scalar: float = 0, - device: Device = None -) -> Image: +def set(input_image: Image, scalar: float = 0, device: Device = None) -> Image: """Sets all pixel values x of a given image X to a constant value v.
f(x) =
     v
@@ -4421,7 +3980,7 @@ def set( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_set @@ -4429,21 +3988,12 @@ def set( from ._pyclesperanto import _set as op - - return op( - device=device, - src=input_image, - scalar=float(scalar) - ) - + return op(device=device, src=input_image, scalar=float(scalar)) @plugin_function def set_column( - input_image: Image, - column: int = 0, - value: float = 0, - device: Device = None + input_image: Image, column: int = 0, value: float = 0, device: Device = None ) -> Image: """Sets all pixel values x of a given column in X to a constant value v. @@ -4461,7 +4011,7 @@ def set_column( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_setColumn @@ -4469,21 +4019,12 @@ def set_column( from ._pyclesperanto import _set_column as op - - return op( - device=device, - src=input_image, - column=int(column), - value=float(value) - ) - + return op(device=device, src=input_image, column=int(column), value=float(value)) @plugin_function def set_image_borders( - input_image: Image, - value: float = 0, - device: Device = None + input_image: Image, value: float = 0, device: Device = None ) -> Image: """Sets all pixel values at the image border to a given value. @@ -4499,7 +4040,7 @@ def set_image_borders( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_setImageBorders @@ -4507,21 +4048,12 @@ def set_image_borders( from ._pyclesperanto import _set_image_borders as op - - return op( - device=device, - src=input_image, - value=float(value) - ) - + return op(device=device, src=input_image, value=float(value)) @plugin_function def set_plane( - input_image: Image, - plane: int = 0, - value: float = 0, - device: Device = None + input_image: Image, plane: int = 0, value: float = 0, device: Device = None ) -> Image: """Sets all pixel values x of a given plane in X to a constant value v. @@ -4539,7 +4071,7 @@ def set_plane( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_setPlane @@ -4547,21 +4079,11 @@ def set_plane( from ._pyclesperanto import _set_plane as op - - return op( - device=device, - src=input_image, - plane=int(plane), - value=float(value) - ) - + return op(device=device, src=input_image, plane=int(plane), value=float(value)) @plugin_function -def set_ramp_x( - input_image: Image, - device: Device = None -) -> Image: +def set_ramp_x(input_image: Image, device: Device = None) -> Image: """Sets all pixel values to their X coordinate. Parameters @@ -4574,7 +4096,7 @@ def set_ramp_x( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_setRampX @@ -4582,19 +4104,11 @@ def set_ramp_x( from ._pyclesperanto import _set_ramp_x as op - - return op( - device=device, - src=input_image - ) - + return op(device=device, src=input_image) @plugin_function -def set_ramp_y( - input_image: Image, - device: Device = None -) -> Image: +def set_ramp_y(input_image: Image, device: Device = None) -> Image: """Sets all pixel values to their Y coordinate. Parameters @@ -4607,7 +4121,7 @@ def set_ramp_y( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_setRampY @@ -4615,19 +4129,11 @@ def set_ramp_y( from ._pyclesperanto import _set_ramp_y as op - - return op( - device=device, - src=input_image - ) - + return op(device=device, src=input_image) @plugin_function -def set_ramp_z( - input_image: Image, - device: Device = None -) -> Image: +def set_ramp_z(input_image: Image, device: Device = None) -> Image: """Sets all pixel values to their Z coordinate. Parameters @@ -4640,7 +4146,7 @@ def set_ramp_z( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_setRampZ @@ -4648,20 +4154,12 @@ def set_ramp_z( from ._pyclesperanto import _set_ramp_z as op - - return op( - device=device, - src=input_image - ) - + return op(device=device, src=input_image) @plugin_function def set_row( - input_image: Image, - row: int = 0, - value: float = 0, - device: Device = None + input_image: Image, row: int = 0, value: float = 0, device: Device = None ) -> Image: """Sets all pixel values x of a given row in X to a constant value v. @@ -4677,7 +4175,7 @@ def set_row( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_setRow @@ -4685,14 +4183,7 @@ def set_row( from ._pyclesperanto import _set_row as op - - return op( - device=device, - src=input_image, - row=int(row), - value=float(value) - ) - + return op(device=device, src=input_image, row=int(row), value=float(value)) @plugin_function @@ -4700,7 +4191,7 @@ def set_nonzero_pixels_to_pixelindex( input_image: Image, output_image: Image = None, offset: int = 1, - device: Device = None + device: Device = None, ) -> Image: """Replaces all 0 value pixels in an image with the index of a pixel. @@ -4718,26 +4209,17 @@ def set_nonzero_pixels_to_pixelindex( Returns ------- Image - + """ from ._pyclesperanto import _set_nonzero_pixels_to_pixelindex as op - - return op( - device=device, - src=input_image, - dst=output_image, - offset=int(offset) - ) - + return op(device=device, src=input_image, dst=output_image, offset=int(offset)) @plugin_function def set_where_x_equals_y( - input_image: Image, - value: float = 0, - device: Device = None + input_image: Image, value: float = 0, device: Device = None ) -> Image: """Sets all pixel values a of a given image A to a constant value v in case its coordinates x == y. Otherwise the pixel is not overwritten. If you want to @@ -4755,7 +4237,7 @@ def set_where_x_equals_y( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_setWhereXequalsY @@ -4763,20 +4245,12 @@ def set_where_x_equals_y( from ._pyclesperanto import _set_where_x_equals_y as op - - return op( - device=device, - src=input_image, - value=float(value) - ) - + return op(device=device, src=input_image, value=float(value)) @plugin_function def set_where_x_greater_than_y( - input_image: Image, - value: float = 0, - device: Device = None + input_image: Image, value: float = 0, device: Device = None ) -> Image: """Sets all pixel values a of a given image A to a constant value v in case its coordinates x > y. Otherwise the pixel is not overwritten. If you want to @@ -4794,7 +4268,7 @@ def set_where_x_greater_than_y( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_setWhereXgreaterThanY @@ -4802,20 +4276,12 @@ def set_where_x_greater_than_y( from ._pyclesperanto import _set_where_x_greater_than_y as op - - return op( - device=device, - src=input_image, - value=float(value) - ) - + return op(device=device, src=input_image, value=float(value)) @plugin_function def set_where_x_smaller_than_y( - input_image: Image, - value: float = 0, - device: Device = None + input_image: Image, value: float = 0, device: Device = None ) -> Image: """Sets all pixel values a of a given image A to a constant value v in case its coordinates x < y. Otherwise the pixel is not overwritten. If you want to @@ -4833,7 +4299,7 @@ def set_where_x_smaller_than_y( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_setWhereXsmallerThanY @@ -4841,20 +4307,12 @@ def set_where_x_smaller_than_y( from ._pyclesperanto import _set_where_x_smaller_than_y as op - - return op( - device=device, - src=input_image, - value=float(value) - ) - + return op(device=device, src=input_image, value=float(value)) @plugin_function def sign( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Extracts the sign of pixels. If a pixel value < 0, resulting pixel value will be 1. If it was > 0, it will be 1. Otherwise it will be 0. This function aims to @@ -4872,26 +4330,20 @@ def sign( Returns ------- Image - + """ from ._pyclesperanto import _sign as op - - return op( - device=device, - src=input_image, - dst=output_image - ) + return op(device=device, src=input_image, dst=output_image) - -@plugin_function(category=['combine', 'binarize', 'in assistant']) +@plugin_function(category=["combine", "binarize", "in assistant"]) def smaller( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Determines if two images A and B smaller pixel wise. f(a, b) = 1 if a < b; 0 otherwise. @@ -4910,7 +4362,7 @@ def smaller( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_smaller @@ -4918,22 +4370,15 @@ def smaller( from ._pyclesperanto import _smaller as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) - -@plugin_function(category=['binarize', 'in assistant']) +@plugin_function(category=["binarize", "in assistant"]) def smaller_constant( input_image: Image, output_image: Image = None, scalar: float = 0, - device: Device = None + device: Device = None, ) -> Image: """Determines if two images A and B smaller pixel wise. f(a, b) = 1 if a < b; 0 otherwise. @@ -4952,7 +4397,7 @@ def smaller_constant( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_smallerConstant @@ -4960,22 +4405,15 @@ def smaller_constant( from ._pyclesperanto import _smaller_constant as op - - return op( - device=device, - src=input_image, - dst=output_image, - scalar=float(scalar) - ) - + return op(device=device, src=input_image, dst=output_image, scalar=float(scalar)) -@plugin_function(category=['combine', 'binarize', 'in assistant']) +@plugin_function(category=["combine", "binarize", "in assistant"]) def smaller_or_equal( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Determines if two images A and B smaller or equal pixel wise. f(a, b) = 1 if a <= b; 0 otherwise. @@ -4994,7 +4432,7 @@ def smaller_or_equal( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_smallerOrEqual @@ -5002,22 +4440,15 @@ def smaller_or_equal( from ._pyclesperanto import _smaller_or_equal as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) -@plugin_function(category=['binarize', 'in assistant']) +@plugin_function(category=["binarize", "in assistant"]) def smaller_or_equal_constant( input_image: Image, output_image: Image = None, scalar: float = 0, - device: Device = None + device: Device = None, ) -> Image: """Determines if two images A and B smaller or equal pixel wise. f(a, b) = 1 if a <= b; 0 otherwise. @@ -5036,7 +4467,7 @@ def smaller_or_equal_constant( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_smallerOrEqualConstant @@ -5044,21 +4475,14 @@ def smaller_or_equal_constant( from ._pyclesperanto import _smaller_or_equal_constant as op - - return op( - device=device, - src=input_image, - dst=output_image, - scalar=float(scalar) - ) - + return op(device=device, src=input_image, dst=output_image, scalar=float(scalar)) -@plugin_function(category=['filter', 'edge detection', 'in assistant', 'bia-bob-suggestion']) +@plugin_function( + category=["filter", "edge detection", "in assistant", "bia-bob-suggestion"] +) def sobel( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Convolve the image with the Sobel kernel. Author(s): Ruth WhelanJeans, Robert Haase @@ -5075,7 +4499,7 @@ def sobel( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_sobel @@ -5083,20 +4507,12 @@ def sobel( from ._pyclesperanto import _sobel as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['filter', 'in assistant']) +@plugin_function(category=["filter", "in assistant"]) def square_root( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Computes the square root of each pixel. @@ -5112,25 +4528,17 @@ def square_root( Returns ------- Image - + """ from ._pyclesperanto import _square_root as op - - return op( - device=device, - src=input_image, - dst=output_image - ) + return op(device=device, src=input_image, dst=output_image) - -@plugin_function(category=['projection', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["projection", "in assistant", "bia-bob-suggestion"]) def std_z_projection( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Determines the standard deviation intensity projection of an image stack along Z. @@ -5147,7 +4555,7 @@ def std_z_projection( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_standardDeviationZProjection @@ -5155,21 +4563,15 @@ def std_z_projection( from ._pyclesperanto import _std_z_projection as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['filter', 'in assistant']) +@plugin_function(category=["filter", "in assistant"]) def subtract_image_from_scalar( input_image: Image, output_image: Image = None, scalar: float = 0, - device: Device = None + device: Device = None, ) -> Image: """Subtracts one image X from a scalar s pixel wise.
f(x, s) = s x
@@ -5187,7 +4589,7 @@ def subtract_image_from_scalar( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_subtractImageFromScalar @@ -5195,14 +4597,7 @@ def subtract_image_from_scalar( from ._pyclesperanto import _subtract_image_from_scalar as op - - return op( - device=device, - src=input_image, - dst=output_image, - scalar=float(scalar) - ) - + return op(device=device, src=input_image, dst=output_image, scalar=float(scalar)) @plugin_function @@ -5210,7 +4605,7 @@ def sum_reduction_x( input_image: Image, output_image: Image = None, blocksize: int = 256, - device: Device = None + device: Device = None, ) -> Image: """Takes an image and reduces it in width by factor blocksize. The new pixels contain the sum of the reduced pixels. For example, given the following image @@ -5230,26 +4625,19 @@ def sum_reduction_x( Returns ------- Image - + """ from ._pyclesperanto import _sum_reduction_x as op - return op( - device=device, - src=input_image, - dst=output_image, - blocksize=int(blocksize) + device=device, src=input_image, dst=output_image, blocksize=int(blocksize) ) - -@plugin_function(category=['projection']) +@plugin_function(category=["projection"]) def sum_x_projection( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Determines the sum intensity projection of an image along Z. @@ -5265,7 +4653,7 @@ def sum_x_projection( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_sumXProjection @@ -5273,20 +4661,12 @@ def sum_x_projection( from ._pyclesperanto import _sum_x_projection as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['projection']) +@plugin_function(category=["projection"]) def sum_y_projection( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Determines the sum intensity projection of an image along Z. @@ -5302,7 +4682,7 @@ def sum_y_projection( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_sumYProjection @@ -5310,20 +4690,12 @@ def sum_y_projection( from ._pyclesperanto import _sum_y_projection as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['projection', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["projection", "in assistant", "bia-bob-suggestion"]) def sum_z_projection( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Determines the sum intensity projection of an image along Z. @@ -5339,7 +4711,7 @@ def sum_z_projection( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_sumZProjection @@ -5347,20 +4719,12 @@ def sum_z_projection( from ._pyclesperanto import _sum_z_projection as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['transform']) +@plugin_function(category=["transform"]) def transpose_xy( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Transpose X and Y axes of an image. @@ -5376,7 +4740,7 @@ def transpose_xy( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_transposeXY @@ -5384,20 +4748,12 @@ def transpose_xy( from ._pyclesperanto import _transpose_xy as op - - return op( - device=device, - src=input_image, - dst=output_image - ) + return op(device=device, src=input_image, dst=output_image) - -@plugin_function(category=['transform']) +@plugin_function(category=["transform"]) def transpose_xz( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Transpose X and Z axes of an image. @@ -5413,7 +4769,7 @@ def transpose_xz( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_transposeXZ @@ -5421,20 +4777,12 @@ def transpose_xz( from ._pyclesperanto import _transpose_xz as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['transform']) +@plugin_function(category=["transform"]) def transpose_yz( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Transpose Y and Z axes of an image. @@ -5450,7 +4798,7 @@ def transpose_yz( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_transposeYZ @@ -5458,20 +4806,12 @@ def transpose_yz( from ._pyclesperanto import _transpose_yz as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) @plugin_function def undefined_to_zero( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Copies all pixels instead those which are not a number (NaN) or infinity (inf), which are replaced by 0. @@ -5488,7 +4828,7 @@ def undefined_to_zero( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_undefinedToZero @@ -5496,23 +4836,17 @@ def undefined_to_zero( from ._pyclesperanto import _undefined_to_zero as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['filter', 'edge detection', 'in assistant']) +@plugin_function(category=["filter", "edge detection", "in assistant"]) def variance_box( input_image: Image, output_image: Image = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, - device: Device = None + device: Device = None, ) -> Image: """Computes the local variance of a pixels box neighborhood. The box size is specified by its halfwidth, halfheight and halfdepth (radius). If 2D images are @@ -5536,7 +4870,7 @@ def variance_box( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_varianceBox @@ -5544,26 +4878,30 @@ def variance_box( from ._pyclesperanto import _variance_box as op - warnings.warn("variance_box : This function is deprecated. Consider using variance() instead.", DeprecationWarning) + warnings.warn( + "variance_box : This function is deprecated. Consider using variance() instead.", + DeprecationWarning, + ) return op( device=device, src=input_image, dst=output_image, radius_x=int(radius_x), radius_y=int(radius_y), - radius_z=int(radius_z) + radius_z=int(radius_z), ) - -@plugin_function(category=['filter', 'edge detection', 'in assistant', 'bia-bob-suggestion']) +@plugin_function( + category=["filter", "edge detection", "in assistant", "bia-bob-suggestion"] +) def variance_sphere( input_image: Image, output_image: Image = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, - device: Device = None + device: Device = None, ) -> Image: """Computes the local variance of a pixels sphere neighborhood. The sphere size is specified by its halfwidth, halfheight and halfdepth (radius). If 2D images are @@ -5587,7 +4925,7 @@ def variance_sphere( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_varianceSphere @@ -5595,19 +4933,21 @@ def variance_sphere( from ._pyclesperanto import _variance_sphere as op - warnings.warn("variance_sphere : This function is deprecated. Consider using variance() instead.", DeprecationWarning) + warnings.warn( + "variance_sphere : This function is deprecated. Consider using variance() instead.", + DeprecationWarning, + ) return op( device=device, src=input_image, dst=output_image, radius_x=int(radius_x), radius_y=int(radius_y), - radius_z=int(radius_z) + radius_z=int(radius_z), ) - -@plugin_function(category=['filter', 'edge detection', 'in assistant']) +@plugin_function(category=["filter", "edge detection", "in assistant"]) def variance( input_image: Image, output_image: Image = None, @@ -5615,7 +4955,7 @@ def variance( radius_y: int = 1, radius_z: int = 1, connectivity: str = "box", - device: Device = None + device: Device = None, ) -> Image: """Computes the local variance of a pixels neighborhood (box or sphere). The neighborhood size is specified by its halfwidth, halfheight and halfdepth @@ -5641,16 +4981,15 @@ def variance( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_varianceBox - [2] https://clij.github.io/clij2-docs/reference_varianceSphere + [2] https://clij.github.io/clij2-docs/reference_varianceSphere """ from ._pyclesperanto import _variance as op - return op( device=device, src=input_image, @@ -5658,16 +4997,13 @@ def variance( radius_x=int(radius_x), radius_y=int(radius_y), radius_z=int(radius_z), - connectivity=connectivity + connectivity=connectivity, ) - @plugin_function def write_values_to_positions( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Takes an image with three/four rows (2D: height = 3; 3D: height = 4): x, y [, z] and v and target image. The value v will be written at position x/y[/z] in the @@ -5685,7 +5021,7 @@ def write_values_to_positions( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_writeValuesToPositions @@ -5693,20 +5029,12 @@ def write_values_to_positions( from ._pyclesperanto import _write_values_to_positions as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['projection', 'in assistant']) +@plugin_function(category=["projection", "in assistant"]) def x_position_of_maximum_x_projection( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Determines an Xposition of the maximum intensity along X and writes it into the resulting image. If there are multiple xslices with the same value, the smallest @@ -5724,25 +5052,17 @@ def x_position_of_maximum_x_projection( Returns ------- Image - + """ from ._pyclesperanto import _x_position_of_maximum_x_projection as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['projection', 'in assistant']) +@plugin_function(category=["projection", "in assistant"]) def x_position_of_minimum_x_projection( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Determines an Xposition of the minimum intensity along X and writes it into the resulting image. If there are multiple xslices with the same value, the smallest @@ -5760,25 +5080,17 @@ def x_position_of_minimum_x_projection( Returns ------- Image - + """ from ._pyclesperanto import _x_position_of_minimum_x_projection as op - - return op( - device=device, - src=input_image, - dst=output_image - ) + return op(device=device, src=input_image, dst=output_image) - -@plugin_function(category=['projection', 'in assistant']) +@plugin_function(category=["projection", "in assistant"]) def y_position_of_maximum_y_projection( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Determines an Yposition of the maximum intensity along Y and writes it into the resulting image. If there are multiple yslices with the same value, the smallest @@ -5796,25 +5108,17 @@ def y_position_of_maximum_y_projection( Returns ------- Image - + """ from ._pyclesperanto import _y_position_of_maximum_y_projection as op - - return op( - device=device, - src=input_image, - dst=output_image - ) + return op(device=device, src=input_image, dst=output_image) - -@plugin_function(category=['projection', 'in assistant']) +@plugin_function(category=["projection", "in assistant"]) def y_position_of_minimum_y_projection( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Determines an Yposition of the minimum intensity along Y and writes it into the resulting image. If there are multiple yslices with the same value, the smallest @@ -5832,25 +5136,17 @@ def y_position_of_minimum_y_projection( Returns ------- Image - + """ from ._pyclesperanto import _y_position_of_minimum_y_projection as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['projection', 'in assistant']) +@plugin_function(category=["projection", "in assistant"]) def z_position_of_maximum_z_projection( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Determines a Zposition of the maximum intensity along Z and writes it into the resulting image. If there are multiple zslices with the same value, the smallest @@ -5868,25 +5164,17 @@ def z_position_of_maximum_z_projection( Returns ------- Image - + """ from ._pyclesperanto import _z_position_of_maximum_z_projection as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['projection', 'in assistant']) +@plugin_function(category=["projection", "in assistant"]) def z_position_of_minimum_z_projection( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Determines a Zposition of the minimum intensity along Z and writes it into the resulting image. If there are multiple zslices with the same value, the smallest @@ -5904,15 +5192,9 @@ def z_position_of_minimum_z_projection( Returns ------- Image - + """ from ._pyclesperanto import _z_position_of_minimum_z_projection as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) diff --git a/pyclesperanto/_tier2.py b/pyclesperanto/_tier2.py index 790561fb..3d9eb520 100644 --- a/pyclesperanto/_tier2.py +++ b/pyclesperanto/_tier2.py @@ -10,12 +10,12 @@ import warnings -@plugin_function(category=['combine', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["combine", "in assistant", "bia-bob-suggestion"]) def absolute_difference( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Determines the absolute difference pixel by pixel between two images.
f(x,
     y) = |x y| 
@@ -34,7 +34,7 @@ def absolute_difference( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_absoluteDifference @@ -42,22 +42,15 @@ def absolute_difference( from ._pyclesperanto import _absolute_difference as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) -@plugin_function(category=['combine', 'in assistant']) +@plugin_function(category=["combine", "in assistant"]) def add_images( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Calculates the sum of pairs of pixels x and y of two images X and Y.
f(x,
     y) = x + y
@@ -76,7 +69,7 @@ def add_images( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_addImages @@ -84,24 +77,17 @@ def add_images( from ._pyclesperanto import _add_images as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) -@plugin_function(category=['filter', 'background removal', 'in assistant']) +@plugin_function(category=["filter", "background removal", "in assistant"]) def bottom_hat_box( input_image: Image, output_image: Image = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, - device: Device = None + device: Device = None, ) -> Image: """Apply a bottomhat filter for background subtraction to the input image. @@ -123,7 +109,7 @@ def bottom_hat_box( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_bottomHatBox @@ -131,26 +117,30 @@ def bottom_hat_box( from ._pyclesperanto import _bottom_hat_box as op - warnings.warn("bottom_hat_box : This method is deprecated. Consider using bottom_hat() instead.", DeprecationWarning) + warnings.warn( + "bottom_hat_box : This method is deprecated. Consider using bottom_hat() instead.", + DeprecationWarning, + ) return op( device=device, src=input_image, dst=output_image, radius_x=int(radius_x), radius_y=int(radius_y), - radius_z=int(radius_z) + radius_z=int(radius_z), ) - -@plugin_function(category=['filter', 'background removal', 'in assistant', 'bia-bob-suggestion']) +@plugin_function( + category=["filter", "background removal", "in assistant", "bia-bob-suggestion"] +) def bottom_hat_sphere( input_image: Image, output_image: Image = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1, - device: Device = None + device: Device = None, ) -> Image: """Applies a bottomhat filter for background subtraction to the input image. @@ -172,7 +162,7 @@ def bottom_hat_sphere( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_bottomHatSphere @@ -180,19 +170,23 @@ def bottom_hat_sphere( from ._pyclesperanto import _bottom_hat_sphere as op - warnings.warn("bottom_hat_sphere : This method is deprecated. Consider using bottom_hat() instead.", DeprecationWarning) + warnings.warn( + "bottom_hat_sphere : This method is deprecated. Consider using bottom_hat() instead.", + DeprecationWarning, + ) return op( device=device, src=input_image, dst=output_image, radius_x=float(radius_x), radius_y=float(radius_y), - radius_z=float(radius_z) + radius_z=float(radius_z), ) - -@plugin_function(category=['filter', 'background removal', 'in assistant', 'bia-bob-suggestion']) +@plugin_function( + category=["filter", "background removal", "in assistant", "bia-bob-suggestion"] +) def bottom_hat( input_image: Image, output_image: Image = None, @@ -200,7 +194,7 @@ def bottom_hat( radius_y: float = 1, radius_z: float = 1, connectivity: str = "box", - device: Device = None + device: Device = None, ) -> Image: """Applies a bottomhat filter for background subtraction to the input image. @@ -224,16 +218,15 @@ def bottom_hat( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_bottomHatBox - [2] https://clij.github.io/clij2-docs/reference_bottomHatSphere + [2] https://clij.github.io/clij2-docs/reference_bottomHatSphere """ from ._pyclesperanto import _bottom_hat as op - return op( device=device, src=input_image, @@ -241,18 +234,17 @@ def bottom_hat( radius_x=float(radius_x), radius_y=float(radius_y), radius_z=float(radius_z), - connectivity=connectivity + connectivity=connectivity, ) - -@plugin_function(category=['combine', 'in assistant']) +@plugin_function(category=["combine", "in assistant"]) def clip( input_image: Image, output_image: Image = None, min_intensity: float = None, max_intensity: float = None, - device: Device = None + device: Device = None, ) -> Image: """Limits the range of values in an image. This function is supposed to work similarly as its counter part in numpy [1]. @@ -273,7 +265,7 @@ def clip( Returns ------- Image - + References ---------- [1] https://numpy.org/doc/stable/reference/generated/numpy.clip.html @@ -281,25 +273,23 @@ def clip( from ._pyclesperanto import _clip as op - return op( device=device, src=input_image, dst=output_image, min_intensity=float(min_intensity), - max_intensity=float(max_intensity) + max_intensity=float(max_intensity), ) - -@plugin_function(category=['filter', 'in assistant']) +@plugin_function(category=["filter", "in assistant"]) def closing_box( input_image: Image, output_image: Image = None, radius_x: int = 0, radius_y: int = 0, radius_z: int = 0, - device: Device = None + device: Device = None, ) -> Image: """Closing operator, boxshaped Applies morphological closing to intensity images using a boxshaped footprint. This operator also works with binary images. @@ -322,31 +312,33 @@ def closing_box( Returns ------- Image - + """ from ._pyclesperanto import _closing_box as op - warnings.warn("closing_box : This method is deprecated. Consider using closing() instead.", DeprecationWarning) + warnings.warn( + "closing_box : This method is deprecated. Consider using closing() instead.", + DeprecationWarning, + ) return op( device=device, src=input_image, dst=output_image, radius_x=int(radius_x), radius_y=int(radius_y), - radius_z=int(radius_z) + radius_z=int(radius_z), ) - -@plugin_function(category=['filter', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["filter", "in assistant", "bia-bob-suggestion"]) def closing_sphere( input_image: Image, output_image: Image = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 0, - device: Device = None + device: Device = None, ) -> Image: """Closing operator, sphereshaped Applies morphological closing to intensity images using a sphereshaped footprint. This operator also works with binary images. @@ -369,24 +361,26 @@ def closing_sphere( Returns ------- Image - + """ from ._pyclesperanto import _closing_sphere as op - warnings.warn("closing_sphere : This method is deprecated. Consider using closing() instead.", DeprecationWarning) + warnings.warn( + "closing_sphere : This method is deprecated. Consider using closing() instead.", + DeprecationWarning, + ) return op( device=device, src=input_image, dst=output_image, radius_x=int(radius_x), radius_y=int(radius_y), - radius_z=int(radius_z) + radius_z=int(radius_z), ) - -@plugin_function(category=['filter', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["filter", "in assistant", "bia-bob-suggestion"]) def closing( input_image: Image, output_image: Image = None, @@ -394,7 +388,7 @@ def closing( radius_y: int = 1, radius_z: int = 0, connectivity: str = "box", - device: Device = None + device: Device = None, ) -> Image: """Closing operator, sphereshaped Applies morphological closing to intensity images using a sphereshaped footprint. This operator also works with binary images. @@ -419,12 +413,11 @@ def closing( Returns ------- Image - + """ from ._pyclesperanto import _closing as op - return op( device=device, src=input_image, @@ -432,17 +425,18 @@ def closing( radius_x=int(radius_x), radius_y=int(radius_y), radius_z=int(radius_z), - connectivity=connectivity + connectivity=connectivity, ) - -@plugin_function(category=['combine', 'transform', 'in assistant', 'bia-bob-suggestion']) +@plugin_function( + category=["combine", "transform", "in assistant", "bia-bob-suggestion"] +) def concatenate_along_x( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Concatenate two images or stacks along the X axis. @@ -460,7 +454,7 @@ def concatenate_along_x( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_combineHorizontally @@ -468,22 +462,17 @@ def concatenate_along_x( from ._pyclesperanto import _concatenate_along_x as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) -@plugin_function(category=['combine', 'transform', 'in assistant', 'bia-bob-suggestion']) +@plugin_function( + category=["combine", "transform", "in assistant", "bia-bob-suggestion"] +) def concatenate_along_y( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Concatenate two images or stacks along the Y axis. @@ -501,7 +490,7 @@ def concatenate_along_y( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_combineVertically @@ -509,22 +498,17 @@ def concatenate_along_y( from ._pyclesperanto import _concatenate_along_y as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) -@plugin_function(category=['combine', 'transform', 'in assistant', 'bia-bob-suggestion']) +@plugin_function( + category=["combine", "transform", "in assistant", "bia-bob-suggestion"] +) def concatenate_along_z( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Concatenate two images or stacks along the Z axis. @@ -542,7 +526,7 @@ def concatenate_along_z( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_concatenateStacks @@ -550,22 +534,15 @@ def concatenate_along_z( from ._pyclesperanto import _concatenate_along_z as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) -@plugin_function(category=['bia-bob-suggestion']) +@plugin_function(category=["bia-bob-suggestion"]) def count_touching_neighbors( input_image: Image, output_image: Image = None, ignore_background: bool = True, - device: Device = None + device: Device = None, ) -> Image: """Takes a touch matrix as input and delivers a vector with number of touching neighbors per label as a vector. Note: Background is considered as something @@ -585,7 +562,7 @@ def count_touching_neighbors( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_countTouchingNeighbors @@ -593,22 +570,20 @@ def count_touching_neighbors( from ._pyclesperanto import _count_touching_neighbors as op - return op( device=device, src=input_image, dst=output_image, - ignore_background=bool(ignore_background) + ignore_background=bool(ignore_background), ) - @plugin_function def crop_border( input_image: Image, output_image: Image = None, border_size: int = 1, - device: Device = None + device: Device = None, ) -> Image: """Crops an image by removing the outer pixels, per default 1. Notes * To make sure the output image has the right size, provide destination_image=None. @@ -627,29 +602,26 @@ def crop_border( Returns ------- Image - + """ from ._pyclesperanto import _crop_border as op - return op( - device=device, - src=input_image, - dst=output_image, - border_size=int(border_size) + device=device, src=input_image, dst=output_image, border_size=int(border_size) ) - -@plugin_function(category=['filter', 'background removal', 'in assistant', 'bia-bob-suggestion']) +@plugin_function( + category=["filter", "background removal", "in assistant", "bia-bob-suggestion"] +) def divide_by_gaussian_background( input_image: Image, output_image: Image = None, sigma_x: float = 2, sigma_y: float = 2, sigma_z: float = 2, - device: Device = None + device: Device = None, ) -> Image: """Applies Gaussian blur to the input image and divides the original by the result. @@ -671,7 +643,7 @@ def divide_by_gaussian_background( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_divideByGaussianBackground @@ -679,23 +651,19 @@ def divide_by_gaussian_background( from ._pyclesperanto import _divide_by_gaussian_background as op - return op( device=device, src=input_image, dst=output_image, sigma_x=float(sigma_x), sigma_y=float(sigma_y), - sigma_z=float(sigma_z) + sigma_z=float(sigma_z), ) - @plugin_function def degrees_to_radians( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Converts radians to degrees. @@ -711,28 +679,22 @@ def degrees_to_radians( Returns ------- Image - + """ from ._pyclesperanto import _degrees_to_radians as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['binarize', 'in assistant']) +@plugin_function(category=["binarize", "in assistant"]) def detect_maxima_box( input_image: Image, output_image: Image = None, radius_x: int = 0, radius_y: int = 0, radius_z: int = 0, - device: Device = None + device: Device = None, ) -> Image: """Detects local maxima in a given square/cubic neighborhood. Pixels in the resulting image are set to 1 if there is no other pixel in a given radius which @@ -756,7 +718,7 @@ def detect_maxima_box( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_detectMaximaBox @@ -764,19 +726,21 @@ def detect_maxima_box( from ._pyclesperanto import _detect_maxima_box as op - warnings.warn("detect_maxima_box : This method is deprecated. Consider using detect_maxima() instead.", DeprecationWarning) + warnings.warn( + "detect_maxima_box : This method is deprecated. Consider using detect_maxima() instead.", + DeprecationWarning, + ) return op( device=device, src=input_image, dst=output_image, radius_x=int(radius_x), radius_y=int(radius_y), - radius_z=int(radius_z) + radius_z=int(radius_z), ) - -@plugin_function(category=['binarize', 'in assistant']) +@plugin_function(category=["binarize", "in assistant"]) def detect_maxima( input_image: Image, output_image: Image = None, @@ -784,7 +748,7 @@ def detect_maxima( radius_y: int = 0, radius_z: int = 0, connectivity: str = "box", - device: Device = None + device: Device = None, ) -> Image: """Detects local maxima in a given square/cubic neighborhood. Pixels in the resulting image are set to 1 if there is no other pixel in a given radius which @@ -810,16 +774,15 @@ def detect_maxima( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_detectMaximaBox - [2] https://clij.github.io/clij2-docs/reference_detectMaximaSphere + [2] https://clij.github.io/clij2-docs/reference_detectMaximaSphere """ from ._pyclesperanto import _detect_maxima as op - return op( device=device, src=input_image, @@ -827,19 +790,18 @@ def detect_maxima( radius_x=int(radius_x), radius_y=int(radius_y), radius_z=int(radius_z), - connectivity=connectivity + connectivity=connectivity, ) - -@plugin_function(category=['binarize', 'in assistant']) +@plugin_function(category=["binarize", "in assistant"]) def detect_minima_box( input_image: Image, output_image: Image = None, radius_x: int = 0, radius_y: int = 0, radius_z: int = 0, - device: Device = None + device: Device = None, ) -> Image: """Detects local maxima in a given square/cubic neighborhood. Pixels in the resulting image are set to 1 if there is no other pixel in a given radius which @@ -863,7 +825,7 @@ def detect_minima_box( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_detectMinimaBox @@ -871,19 +833,21 @@ def detect_minima_box( from ._pyclesperanto import _detect_minima_box as op - warnings.warn("detect_minima_box : This method is deprecated. Consider using detect_minima() instead.", DeprecationWarning) + warnings.warn( + "detect_minima_box : This method is deprecated. Consider using detect_minima() instead.", + DeprecationWarning, + ) return op( device=device, src=input_image, dst=output_image, radius_x=int(radius_x), radius_y=int(radius_y), - radius_z=int(radius_z) + radius_z=int(radius_z), ) - -@plugin_function(category=['binarize', 'in assistant']) +@plugin_function(category=["binarize", "in assistant"]) def detect_minima( input_image: Image, output_image: Image = None, @@ -891,7 +855,7 @@ def detect_minima( radius_y: int = 0, radius_z: int = 0, connectivity: str = "box", - device: Device = None + device: Device = None, ) -> Image: """Detects local maxima in a given square/cubic neighborhood. Pixels in the resulting image are set to 1 if there is no other pixel in a given radius which @@ -917,16 +881,15 @@ def detect_minima( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_detectMinimaBox - [2] https://clij.github.io/clij2-docs/reference_detectMinimaSphere + [2] https://clij.github.io/clij2-docs/reference_detectMinimaSphere """ from ._pyclesperanto import _detect_minima as op - return op( device=device, src=input_image, @@ -934,12 +897,11 @@ def detect_minima( radius_x=int(radius_x), radius_y=int(radius_y), radius_z=int(radius_z), - connectivity=connectivity + connectivity=connectivity, ) - -@plugin_function(category=['filter', 'background removal', 'bia-bob-suggestion']) +@plugin_function(category=["filter", "background removal", "bia-bob-suggestion"]) def difference_of_gaussian( input_image: Image, output_image: Image = None, @@ -949,7 +911,7 @@ def difference_of_gaussian( sigma2_x: float = 2, sigma2_y: float = 2, sigma2_z: float = 2, - device: Device = None + device: Device = None, ) -> Image: """Applies Gaussian blur to the input image twice with different sigma values resulting in two images which are then subtracted from each other. It is @@ -980,7 +942,7 @@ def difference_of_gaussian( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_differenceOfGaussian3D @@ -988,7 +950,6 @@ def difference_of_gaussian( from ._pyclesperanto import _difference_of_gaussian as op - return op( device=device, src=input_image, @@ -998,16 +959,13 @@ def difference_of_gaussian( sigma1_z=float(sigma1_z), sigma2_x=float(sigma2_x), sigma2_y=float(sigma2_y), - sigma2_z=float(sigma2_z) + sigma2_z=float(sigma2_z), ) - -@plugin_function(category=['label processing', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["label processing", "in assistant", "bia-bob-suggestion"]) def extend_labeling_via_voronoi( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Takes a label map image and dilates the regions using a octagon shape until they touch. The resulting label map is written to the output. @@ -1024,7 +982,7 @@ def extend_labeling_via_voronoi( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_extendLabelingViaVoronoi @@ -1032,20 +990,12 @@ def extend_labeling_via_voronoi( from ._pyclesperanto import _extend_labeling_via_voronoi as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['filter']) +@plugin_function(category=["filter"]) def invert( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Computes the negative value of all pixels in a given image. It is recommended to convert images to 32bit float before applying this operation.
f(x) =
@@ -1063,7 +1013,7 @@ def invert(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_invert
@@ -1071,20 +1021,12 @@ def invert(
 
     from ._pyclesperanto import _invert as op
 
-    
-    return op(
-        device=device,
-        src=input_image,
-        dst=output_image
-    )
+    return op(device=device, src=input_image, dst=output_image)
 
 
-
-@plugin_function(category=['label', 'in assistant', 'bia-bob-suggestion'])
+@plugin_function(category=["label", "in assistant", "bia-bob-suggestion"])
 def label_spots(
-    input_image: Image,
-    output_image: Image = None,
-    device: Device = None
+    input_image: Image, output_image: Image = None, device: Device = None
 ) -> Image:
     """Transforms a binary image with single pixles set to 1 to a labelled spots image.
     Transforms a spots image as resulting from maximum/minimum detection in an image
@@ -1102,7 +1044,7 @@ def label_spots(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_labelSpots
@@ -1110,20 +1052,12 @@ def label_spots(
 
     from ._pyclesperanto import _label_spots as op
 
-    
-    return op(
-        device=device,
-        src=input_image,
-        dst=output_image
-    )
-
+    return op(device=device, src=input_image, dst=output_image)
 
 
-@plugin_function(category=['filter', 'in assistant'])
+@plugin_function(category=["filter", "in assistant"])
 def large_hessian_eigenvalue(
-    input_image: Image,
-    output_image: Image = None,
-    device: Device = None
+    input_image: Image, output_image: Image = None, device: Device = None
 ) -> Image:
     """Determines the Hessian eigenvalues and returns the large eigenvalue image.
 
@@ -1139,25 +1073,16 @@ def large_hessian_eigenvalue(
     Returns
     -------
     Image
-    
+
     """
 
     from ._pyclesperanto import _large_hessian_eigenvalue as op
 
-    
-    return op(
-        device=device,
-        src=input_image,
-        dst=output_image
-    )
-
+    return op(device=device, src=input_image, dst=output_image)
 
 
 @plugin_function
-def maximum_of_all_pixels(
-    input_image: Image,
-    device: Device = None
-) -> float:
+def maximum_of_all_pixels(input_image: Image, device: Device = None) -> float:
     """Determines the maximum of all pixels in a given image. It will be stored in a
     new row of ImageJs Results table in the column 'Max'.
 
@@ -1171,7 +1096,7 @@ def maximum_of_all_pixels(
     Returns
     -------
     float
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_maximumOfAllPixels
@@ -1179,19 +1104,11 @@ def maximum_of_all_pixels(
 
     from ._pyclesperanto import _maximum_of_all_pixels as op
 
-    
-    return op(
-        device=device,
-        src=input_image
-    )
-
+    return op(device=device, src=input_image)
 
 
 @plugin_function
-def minimum_of_all_pixels(
-    input_image: Image,
-    device: Device = None
-) -> float:
+def minimum_of_all_pixels(input_image: Image, device: Device = None) -> float:
     """Determines the minimum of all pixels in a given image. It will be stored in a
     new row of ImageJs Results table in the column 'Min'.
 
@@ -1205,7 +1122,7 @@ def minimum_of_all_pixels(
     Returns
     -------
     float
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_minimumOfAllPixels
@@ -1213,19 +1130,12 @@ def minimum_of_all_pixels(
 
     from ._pyclesperanto import _minimum_of_all_pixels as op
 
-    
-    return op(
-        device=device,
-        src=input_image
-    )
-
+    return op(device=device, src=input_image)
 
 
 @plugin_function
 def minimum_of_masked_pixels(
-    input_image: Image,
-    mask: Image,
-    device: Device = None
+    input_image: Image, mask: Image, device: Device = None
 ) -> float:
     """Determines the minimum intensity in a masked image. But only in pixels which
     have nonzero values in another mask image.
@@ -1242,7 +1152,7 @@ def minimum_of_masked_pixels(
     Returns
     -------
     float
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_minimumOfMaskedPixels
@@ -1250,23 +1160,17 @@ def minimum_of_masked_pixels(
 
     from ._pyclesperanto import _minimum_of_masked_pixels as op
 
-    
-    return op(
-        device=device,
-        src=input_image,
-        mask=mask
-    )
-
+    return op(device=device, src=input_image, mask=mask)
 
 
-@plugin_function(category=['filter', 'in assistant'])
+@plugin_function(category=["filter", "in assistant"])
 def opening_box(
     input_image: Image,
     output_image: Image = None,
     radius_x: int = 0,
     radius_y: int = 0,
     radius_z: int = 0,
-    device: Device = None
+    device: Device = None,
 ) -> Image:
     """Opening operator, boxshaped Applies morphological opening to intensity images
     using a boxshaped footprint. This operator also works with binary images.
@@ -1289,31 +1193,33 @@ def opening_box(
     Returns
     -------
     Image
-    
+
     """
 
     from ._pyclesperanto import _opening_box as op
 
-    warnings.warn("opening_box : This method is deprecated. Consider using opening() instead.", DeprecationWarning)
+    warnings.warn(
+        "opening_box : This method is deprecated. Consider using opening() instead.",
+        DeprecationWarning,
+    )
     return op(
         device=device,
         src=input_image,
         dst=output_image,
         radius_x=int(radius_x),
         radius_y=int(radius_y),
-        radius_z=int(radius_z)
+        radius_z=int(radius_z),
     )
 
 
-
-@plugin_function(category=['filter', 'in assistant', 'bia-bob-suggestion'])
+@plugin_function(category=["filter", "in assistant", "bia-bob-suggestion"])
 def opening_sphere(
     input_image: Image,
     output_image: Image = None,
     radius_x: float = 1,
     radius_y: float = 1,
     radius_z: float = 0,
-    device: Device = None
+    device: Device = None,
 ) -> Image:
     """Opening operator, sphereshaped Applies morphological opening to intensity images
     using a sphereshaped footprint. This operator also works with binary images.
@@ -1336,24 +1242,26 @@ def opening_sphere(
     Returns
     -------
     Image
-    
+
     """
 
     from ._pyclesperanto import _opening_sphere as op
 
-    warnings.warn("opening_sphere : This method is deprecated. Consider using opening() instead.", DeprecationWarning)
+    warnings.warn(
+        "opening_sphere : This method is deprecated. Consider using opening() instead.",
+        DeprecationWarning,
+    )
     return op(
         device=device,
         src=input_image,
         dst=output_image,
         radius_x=float(radius_x),
         radius_y=float(radius_y),
-        radius_z=float(radius_z)
+        radius_z=float(radius_z),
     )
 
 
-
-@plugin_function(category=['filter', 'in assistant', 'bia-bob-suggestion'])
+@plugin_function(category=["filter", "in assistant", "bia-bob-suggestion"])
 def opening(
     input_image: Image,
     output_image: Image = None,
@@ -1361,7 +1269,7 @@ def opening(
     radius_y: float = 1,
     radius_z: float = 0,
     connectivity: str = "box",
-    device: Device = None
+    device: Device = None,
 ) -> Image:
     """Opening operator, sphereshaped Applies morphological opening to intensity images
     using a sphereshaped footprint. This operator also works with binary images.
@@ -1386,12 +1294,11 @@ def opening(
     Returns
     -------
     Image
-    
+
     """
 
     from ._pyclesperanto import _opening as op
 
-    
     return op(
         device=device,
         src=input_image,
@@ -1399,16 +1306,13 @@ def opening(
         radius_x=float(radius_x),
         radius_y=float(radius_y),
         radius_z=float(radius_z),
-        connectivity=connectivity
+        connectivity=connectivity,
     )
 
 
-
 @plugin_function
 def radians_to_degrees(
-    input_image: Image,
-    output_image: Image = None,
-    device: Device = None
+    input_image: Image, output_image: Image = None, device: Device = None
 ) -> Image:
     """Converts radians to degrees
 
@@ -1424,25 +1328,17 @@ def radians_to_degrees(
     Returns
     -------
     Image
-    
+
     """
 
     from ._pyclesperanto import _radians_to_degrees as op
 
-    
-    return op(
-        device=device,
-        src=input_image,
-        dst=output_image
-    )
+    return op(device=device, src=input_image, dst=output_image)
 
 
-
-@plugin_function(category=['label processing', 'in assistant', 'bia-bob-suggestion'])
+@plugin_function(category=["label processing", "in assistant", "bia-bob-suggestion"])
 def reduce_labels_to_label_edges(
-    input_image: Image,
-    output_image: Image = None,
-    device: Device = None
+    input_image: Image, output_image: Image = None, device: Device = None
 ) -> Image:
     """Takes a label map and reduces all labels to their edges. Label IDs stay and
     background will be zero.
@@ -1459,7 +1355,7 @@ def reduce_labels_to_label_edges(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_reduceLabelsToLabelEdges
@@ -1467,20 +1363,12 @@ def reduce_labels_to_label_edges(
 
     from ._pyclesperanto import _reduce_labels_to_label_edges as op
 
-    
-    return op(
-        device=device,
-        src=input_image,
-        dst=output_image
-    )
-
+    return op(device=device, src=input_image, dst=output_image)
 
 
-@plugin_function(category=['filter', 'in assistant'])
+@plugin_function(category=["filter", "in assistant"])
 def small_hessian_eigenvalue(
-    input_image: Image,
-    output_image: Image = None,
-    device: Device = None
+    input_image: Image, output_image: Image = None, device: Device = None
 ) -> Image:
     """Determines the Hessian eigenvalues and returns the small eigenvalue image.
 
@@ -1496,25 +1384,17 @@ def small_hessian_eigenvalue(
     Returns
     -------
     Image
-    
+
     """
 
     from ._pyclesperanto import _small_hessian_eigenvalue as op
 
-    
-    return op(
-        device=device,
-        src=input_image,
-        dst=output_image
-    )
-
+    return op(device=device, src=input_image, dst=output_image)
 
 
-@plugin_function(category=['filter'])
+@plugin_function(category=["filter"])
 def square(
-    input_image: Image,
-    output_image: Image = None,
-    device: Device = None
+    input_image: Image, output_image: Image = None, device: Device = None
 ) -> Image:
     """Return the elementwise square of the input. This function is supposed to be
     similar to its counterpart in numpy [1]
@@ -1531,7 +1411,7 @@ def square(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://numpy.org/doc/stable/reference/generated/numpy.square.html
@@ -1539,21 +1419,15 @@ def square(
 
     from ._pyclesperanto import _square as op
 
-    
-    return op(
-        device=device,
-        src=input_image,
-        dst=output_image
-    )
-
+    return op(device=device, src=input_image, dst=output_image)
 
 
-@plugin_function(category=['combine', 'in assistant', 'bia-bob-suggestion'])
+@plugin_function(category=["combine", "in assistant", "bia-bob-suggestion"])
 def squared_difference(
     input_image0: Image,
     input_image1: Image,
     output_image: Image = None,
-    device: Device = None
+    device: Device = None,
 ) -> Image:
     """Determines the squared difference pixel by pixel between two images.
 
@@ -1571,7 +1445,7 @@ def squared_difference(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_squaredDifference
@@ -1579,24 +1453,17 @@ def squared_difference(
 
     from ._pyclesperanto import _squared_difference as op
 
-    
-    return op(
-        device=device,
-        src0=input_image0,
-        src1=input_image1,
-        dst=output_image
-    )
-
+    return op(device=device, src0=input_image0, src1=input_image1, dst=output_image)
 
 
-@plugin_function(category=['filter', 'edge detection', 'in assistant'])
+@plugin_function(category=["filter", "edge detection", "in assistant"])
 def standard_deviation_box(
     input_image: Image,
     output_image: Image = None,
     radius_x: int = 1,
     radius_y: int = 1,
     radius_z: int = 1,
-    device: Device = None
+    device: Device = None,
 ) -> Image:
     """Computes the local standard deviation of a pixels box neighborhood. The box size
     is specified by its halfwidth, halfheight and halfdepth (radius). If 2D images
@@ -1620,7 +1487,7 @@ def standard_deviation_box(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_standardDeviationBox
@@ -1628,26 +1495,30 @@ def standard_deviation_box(
 
     from ._pyclesperanto import _standard_deviation_box as op
 
-    warnings.warn("standard_deviation_box : This method is deprecated. Consider using standard_deviation() instead.", DeprecationWarning)
+    warnings.warn(
+        "standard_deviation_box : This method is deprecated. Consider using standard_deviation() instead.",
+        DeprecationWarning,
+    )
     return op(
         device=device,
         src=input_image,
         dst=output_image,
         radius_x=int(radius_x),
         radius_y=int(radius_y),
-        radius_z=int(radius_z)
+        radius_z=int(radius_z),
     )
 
 
-
-@plugin_function(category=['filter', 'edge detection', 'in assistant', 'bia-bob-suggestion'])
+@plugin_function(
+    category=["filter", "edge detection", "in assistant", "bia-bob-suggestion"]
+)
 def standard_deviation_sphere(
     input_image: Image,
     output_image: Image = None,
     radius_x: int = 1,
     radius_y: int = 1,
     radius_z: int = 1,
-    device: Device = None
+    device: Device = None,
 ) -> Image:
     """Computes the local standard deviation of a pixels sphere neighborhood. The box
     size is specified by its halfwidth, halfheight and halfdepth (radius). If 2D
@@ -1671,7 +1542,7 @@ def standard_deviation_sphere(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_standardDeviationSphere
@@ -1679,19 +1550,23 @@ def standard_deviation_sphere(
 
     from ._pyclesperanto import _standard_deviation_sphere as op
 
-    warnings.warn("standard_deviation_sphere : This method is deprecated. Consider using standard_deviation() instead.", DeprecationWarning)
+    warnings.warn(
+        "standard_deviation_sphere : This method is deprecated. Consider using standard_deviation() instead.",
+        DeprecationWarning,
+    )
     return op(
         device=device,
         src=input_image,
         dst=output_image,
         radius_x=int(radius_x),
         radius_y=int(radius_y),
-        radius_z=int(radius_z)
+        radius_z=int(radius_z),
     )
 
 
-
-@plugin_function(category=['filter', 'edge detection', 'in assistant', 'bia-bob-suggestion'])
+@plugin_function(
+    category=["filter", "edge detection", "in assistant", "bia-bob-suggestion"]
+)
 def standard_deviation(
     input_image: Image,
     output_image: Image = None,
@@ -1699,7 +1574,7 @@ def standard_deviation(
     radius_y: int = 1,
     radius_z: int = 1,
     connectivity: str = "box",
-    device: Device = None
+    device: Device = None,
 ) -> Image:
     """Computes the local standard deviation of a pixels sphere neighborhood. The box
     size is specified by its halfwidth, halfheight and halfdepth (radius). If 2D
@@ -1725,16 +1600,15 @@ def standard_deviation(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_standardDeviationBox
-	[2] https://clij.github.io/clij2-docs/reference_standardDeviationSphere
+        [2] https://clij.github.io/clij2-docs/reference_standardDeviationSphere
     """
 
     from ._pyclesperanto import _standard_deviation as op
 
-    
     return op(
         device=device,
         src=input_image,
@@ -1742,19 +1616,20 @@ def standard_deviation(
         radius_x=int(radius_x),
         radius_y=int(radius_y),
         radius_z=int(radius_z),
-        connectivity=connectivity
+        connectivity=connectivity,
     )
 
 
-
-@plugin_function(category=['filter', 'background removal', 'in assistant', 'bia-bob-suggestion'])
+@plugin_function(
+    category=["filter", "background removal", "in assistant", "bia-bob-suggestion"]
+)
 def subtract_gaussian_background(
     input_image: Image,
     output_image: Image = None,
     sigma_x: float = 2,
     sigma_y: float = 2,
     sigma_z: float = 2,
-    device: Device = None
+    device: Device = None,
 ) -> Image:
     """Applies Gaussian blur to the input image and subtracts the result from the
     original.
@@ -1777,7 +1652,7 @@ def subtract_gaussian_background(
     Returns
     -------
     Image
-    
+
     References
     ----------
     [1] https://clij.github.io/clij2-docs/reference_subtractGaussianBackground
@@ -1785,24 +1660,22 @@ def subtract_gaussian_background(
 
     from ._pyclesperanto import _subtract_gaussian_background as op
 
-    
     return op(
         device=device,
         src=input_image,
         dst=output_image,
         sigma_x=float(sigma_x),
         sigma_y=float(sigma_y),
-        sigma_z=float(sigma_z)
+        sigma_z=float(sigma_z),
     )
 
 
-
-@plugin_function(category=['combine', 'in assistant'])
+@plugin_function(category=["combine", "in assistant"])
 def subtract_images(
     input_image0: Image,
     input_image1: Image,
     output_image: Image = None,
-    device: Device = None
+    device: Device = None,
 ) -> Image:
     """Subtracts one image X from another image Y pixel wise. 
f(x, y) = x y
@@ -1820,7 +1693,7 @@ def subtract_images( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_subtractImages @@ -1828,21 +1701,11 @@ def subtract_images( from ._pyclesperanto import _subtract_images as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) @plugin_function -def sum_of_all_pixels( - input_image: Image = None, - device: Device = None -) -> float: +def sum_of_all_pixels(input_image: Image = None, device: Device = None) -> float: """Determines the sum of all pixels in a given image. It will be stored in a new row of ImageJs Results table in the column 'Sum'. @@ -1856,7 +1719,7 @@ def sum_of_all_pixels( Returns ------- float - + References ---------- [1] https://clij.github.io/clij2-docs/reference_sumOfAllPixels @@ -1864,22 +1727,17 @@ def sum_of_all_pixels( from ._pyclesperanto import _sum_of_all_pixels as op - - return op( - device=device, - src=input_image - ) - + return op(device=device, src=input_image) -@plugin_function(category=['filter', 'background removal', 'in assistant']) +@plugin_function(category=["filter", "background removal", "in assistant"]) def top_hat_box( input_image: Image, output_image: Image = None, radius_x: int = 1, radius_y: int = 1, radius_z: int = 1, - device: Device = None + device: Device = None, ) -> Image: """Applies a tophat filter for background subtraction to the input image. @@ -1901,7 +1759,7 @@ def top_hat_box( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_topHatBox @@ -1909,26 +1767,30 @@ def top_hat_box( from ._pyclesperanto import _top_hat_box as op - warnings.warn("top_hat_box : This method is deprecated. Consider using top_hat() instead.", DeprecationWarning) + warnings.warn( + "top_hat_box : This method is deprecated. Consider using top_hat() instead.", + DeprecationWarning, + ) return op( device=device, src=input_image, dst=output_image, radius_x=int(radius_x), radius_y=int(radius_y), - radius_z=int(radius_z) + radius_z=int(radius_z), ) - -@plugin_function(category=['filter', 'background removal', 'in assistant', 'bia-bob-suggestion']) +@plugin_function( + category=["filter", "background removal", "in assistant", "bia-bob-suggestion"] +) def top_hat_sphere( input_image: Image, output_image: Image = None, radius_x: float = 1, radius_y: float = 1, radius_z: float = 1, - device: Device = None + device: Device = None, ) -> Image: """Applies a tophat filter for background subtraction to the input image. @@ -1950,7 +1812,7 @@ def top_hat_sphere( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_topHatSphere @@ -1958,19 +1820,23 @@ def top_hat_sphere( from ._pyclesperanto import _top_hat_sphere as op - warnings.warn("top_hat_sphere : This method is deprecated. Consider using top_hat() instead.", DeprecationWarning) + warnings.warn( + "top_hat_sphere : This method is deprecated. Consider using top_hat() instead.", + DeprecationWarning, + ) return op( device=device, src=input_image, dst=output_image, radius_x=float(radius_x), radius_y=float(radius_y), - radius_z=float(radius_z) + radius_z=float(radius_z), ) - -@plugin_function(category=['filter', 'background removal', 'in assistant', 'bia-bob-suggestion']) +@plugin_function( + category=["filter", "background removal", "in assistant", "bia-bob-suggestion"] +) def top_hat( input_image: Image, output_image: Image = None, @@ -1978,7 +1844,7 @@ def top_hat( radius_y: float = 1, radius_z: float = 1, connectivity: str = "box", - device: Device = None + device: Device = None, ) -> Image: """Applies a tophat filter for background subtraction to the input image. @@ -2002,16 +1868,15 @@ def top_hat( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_topHatBox - [2] https://clij.github.io/clij2-docs/reference_topHatSphere + [2] https://clij.github.io/clij2-docs/reference_topHatSphere """ from ._pyclesperanto import _top_hat as op - return op( device=device, src=input_image, @@ -2019,6 +1884,5 @@ def top_hat( radius_x=float(radius_x), radius_y=float(radius_y), radius_z=float(radius_z), - connectivity=connectivity + connectivity=connectivity, ) - diff --git a/pyclesperanto/_tier3.py b/pyclesperanto/_tier3.py index 6c813c0b..b37f05fd 100644 --- a/pyclesperanto/_tier3.py +++ b/pyclesperanto/_tier3.py @@ -11,10 +11,7 @@ @plugin_function -def bounding_box( - input_image: Image, - device: Device = None -) -> list: +def bounding_box(input_image: Image, device: Device = None) -> list: """Determines the bounding box of all nonzero pixels in a binary image. The positions are returned in an array of 6 values as follows: minX, minY, minZ, maxX, maxY, maxZ. @@ -28,7 +25,7 @@ def bounding_box( Returns ------- list - + References ---------- [1] https://clij.github.io/clij2-docs/reference_boundingBox @@ -36,19 +33,11 @@ def bounding_box( from ._pyclesperanto import _bounding_box as op - - return op( - device=device, - src=input_image - ) - + return op(device=device, src=input_image) @plugin_function -def center_of_mass( - input_image: Image, - device: Device = None -) -> list: +def center_of_mass(input_image: Image, device: Device = None) -> list: """Determines the center of mass of an image or image stack. It writes the result in the results table in the columns MassX, MassY and MassZ. @@ -61,7 +50,7 @@ def center_of_mass( Returns ------- list - + References ---------- [1] https://clij.github.io/clij2-docs/reference_centerOfMass @@ -69,20 +58,12 @@ def center_of_mass( from ._pyclesperanto import _center_of_mass as op - - return op( - device=device, - src=input_image - ) - + return op(device=device, src=input_image) @plugin_function def exclude_labels( - input_image: Image, - list: Image, - output_image: Image = None, - device: Device = None + input_image: Image, list: Image, output_image: Image = None, device: Device = None ) -> Image: """This operation removes labels from a labelmap and renumbers the remaining labels. Hand over a binary flag list vector starting with a flag for the @@ -101,7 +82,7 @@ def exclude_labels( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_excludeLabels @@ -109,24 +90,17 @@ def exclude_labels( from ._pyclesperanto import _exclude_labels as op - - return op( - device=device, - src=input_image, - list=list, - dst=output_image - ) - + return op(device=device, src=input_image, list=list, dst=output_image) -@plugin_function(category=['label processing', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["label processing", "in assistant", "bia-bob-suggestion"]) def exclude_labels_on_edges( input_image: Image, output_image: Image = None, exclude_x: bool = True, exclude_y: bool = True, exclude_z: bool = True, - device: Device = None + device: Device = None, ) -> Image: """Removes all labels from a label map which touch the edges of the image. Remaining label elements are renumbered afterwards. @@ -147,7 +121,7 @@ def exclude_labels_on_edges( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_excludeLabelsOnEdges @@ -155,23 +129,19 @@ def exclude_labels_on_edges( from ._pyclesperanto import _exclude_labels_on_edges as op - return op( device=device, src=input_image, dst=output_image, exclude_x=bool(exclude_x), exclude_y=bool(exclude_y), - exclude_z=bool(exclude_z) + exclude_z=bool(exclude_z), ) - @plugin_function def flag_existing_labels( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Given a label map this function will generate a binary vector where all pixels are set to 1 if label with given xcoordinate in the vector exists. For example a @@ -190,26 +160,20 @@ def flag_existing_labels( Returns ------- Image - + """ from ._pyclesperanto import _flag_existing_labels as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['filter', 'in assistant']) +@plugin_function(category=["filter", "in assistant"]) def gamma_correction( input_image: Image, output_image: Image = None, gamma: float = 1, - device: Device = None + device: Device = None, ) -> Image: """Applies a gamma correction to an image. Therefore, all pixels x of the Image X are normalized and the power to gamma g is computed, before normlization is @@ -226,7 +190,7 @@ def gamma_correction( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_gammaCorrection @@ -234,14 +198,7 @@ def gamma_correction( from ._pyclesperanto import _gamma_correction as op - - return op( - device=device, - src=input_image, - dst=output_image, - gamma=float(gamma) - ) - + return op(device=device, src=input_image, dst=output_image, gamma=float(gamma)) @plugin_function @@ -249,7 +206,7 @@ def generate_binary_overlap_matrix( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: Device = None, ) -> Image: """Takes two labelmaps with n and m labels and generates a (n+1)*(m+1) matrix where all pixels are set to 0 exept those where labels overlap between the label maps. @@ -267,7 +224,7 @@ def generate_binary_overlap_matrix( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_generateBinaryOverlapMatrix @@ -275,21 +232,12 @@ def generate_binary_overlap_matrix( from ._pyclesperanto import _generate_binary_overlap_matrix as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) -@plugin_function(category=['bia-bob-suggestion']) +@plugin_function(category=["bia-bob-suggestion"]) def generate_touch_matrix( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Takes a labelmap with n labels and generates a (n+1)*(n+1) matrix where all pixels are set to 0 exept those where labels are touching. Only half of the @@ -307,7 +255,7 @@ def generate_touch_matrix( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_generateTouchMatrix @@ -315,13 +263,7 @@ def generate_touch_matrix( from ._pyclesperanto import _generate_touch_matrix as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) @plugin_function @@ -331,7 +273,7 @@ def histogram( nbins: int = 256, min: float = None, max: float = None, - device: Device = None + device: Device = None, ) -> Image: """Determines the histogram of a given image. The histogram image is of dimensions number_of_bins/1/1; a 3D image with height=1 and depth=1. Histogram bins contain @@ -363,7 +305,7 @@ def histogram( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_histogram @@ -371,23 +313,19 @@ def histogram( from ._pyclesperanto import _histogram as op - return op( device=device, src=input_image, dst=output_image, nbins=int(nbins), min=float(min), - max=float(max) + max=float(max), ) - @plugin_function def jaccard_index( - input_image0: Image, - input_image1: Image, - device: Device = None + input_image0: Image, input_image1: Image, device: Device = None ) -> float: """Determines the overlap of two binary images using the Jaccard index. A value of 0 suggests no overlap, 1 means perfect overlap. The resulting Jaccard index is @@ -405,7 +343,7 @@ def jaccard_index( Returns ------- float - + References ---------- [1] https://clij.github.io/clij2-docs/reference_jaccardIndex @@ -413,20 +351,12 @@ def jaccard_index( from ._pyclesperanto import _jaccard_index as op - - return op( - device=device, - src0=input_image0, - src1=input_image1 - ) - + return op(device=device, src0=input_image0, src1=input_image1) -@plugin_function(category=['bia-bob-suggestion']) +@plugin_function(category=["bia-bob-suggestion"]) def labelled_spots_to_pointlist( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Generates a coordinate list of points in a labelled spot image. Transforms a labelmap of spots (single pixels with values 1, 2,..., n for n spots) as @@ -444,7 +374,7 @@ def labelled_spots_to_pointlist( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_labelledSpotsToPointList @@ -452,20 +382,11 @@ def labelled_spots_to_pointlist( from ._pyclesperanto import _labelled_spots_to_pointlist as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) @plugin_function -def maximum_position( - input_image: Image, - device: Device = None -) -> list: +def maximum_position(input_image: Image, device: Device = None) -> list: """Determines the position of the maximum of all pixels in a given image. Parameters @@ -478,24 +399,16 @@ def maximum_position( Returns ------- list - + """ from ._pyclesperanto import _maximum_position as op - - return op( - device=device, - src=input_image - ) - + return op(device=device, src=input_image) @plugin_function -def mean_of_all_pixels( - input_image: Image, - device: Device = None -) -> float: +def mean_of_all_pixels(input_image: Image, device: Device = None) -> float: """Determines the mean average of all pixels in a given image. Parameters @@ -508,7 +421,7 @@ def mean_of_all_pixels( Returns ------- float - + References ---------- [1] https://clij.github.io/clij2-docs/reference_meanOfAllPixels @@ -516,19 +429,11 @@ def mean_of_all_pixels( from ._pyclesperanto import _mean_of_all_pixels as op - - return op( - device=device, - src=input_image - ) - + return op(device=device, src=input_image) @plugin_function -def minimum_position( - input_image: Image, - device: Device = None -) -> list: +def minimum_position(input_image: Image, device: Device = None) -> list: """Determines the position of the minimum of all pixels in a given image. Parameters @@ -541,14 +446,9 @@ def minimum_position( Returns ------- list - + """ from ._pyclesperanto import _minimum_position as op - - return op( - device=device, - src=input_image - ) - + return op(device=device, src=input_image) diff --git a/pyclesperanto/_tier4.py b/pyclesperanto/_tier4.py index 8563cc3c..e62e98af 100644 --- a/pyclesperanto/_tier4.py +++ b/pyclesperanto/_tier4.py @@ -12,9 +12,7 @@ @plugin_function def label_bounding_box( - input_image: Image, - label_id: int, - device: Device = None + input_image: Image, label_id: int, device: 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, @@ -30,7 +28,7 @@ def label_bounding_box( Returns ------- list - + References ---------- [1] https://clij.github.io/clij2-docs/reference_boundingBox @@ -38,20 +36,12 @@ def label_bounding_box( from ._pyclesperanto import _label_bounding_box as op - - return op( - device=device, - src=input_image, - label_id=int(label_id) - ) - + return op(device=device, src=input_image, label_id=int(label_id)) -@plugin_function(category=['in assistant', 'combine', 'bia-bob-suggestion']) +@plugin_function(category=["in assistant", "combine", "bia-bob-suggestion"]) def mean_squared_error( - input_image0: Image, - input_image1: Image, - device: Device = None + input_image0: Image, input_image1: Image, device: 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'. @@ -66,7 +56,7 @@ def mean_squared_error( Returns ------- float - + References ---------- [1] https://clij.github.io/clij2-docs/reference_meanSquaredError @@ -74,20 +64,12 @@ def mean_squared_error( from ._pyclesperanto import _mean_squared_error as op - - return op( - device=device, - src0=input_image0, - src1=input_image1 - ) - + return op(device=device, src0=input_image0, src1=input_image1) @plugin_function def spots_to_pointlist( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: 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 @@ -103,7 +85,7 @@ def spots_to_pointlist( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_spotsToPointList @@ -111,21 +93,15 @@ def spots_to_pointlist( from ._pyclesperanto import _spots_to_pointlist as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) -@plugin_function(category=['label processing', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["label processing", "in assistant", "bia-bob-suggestion"]) def relabel_sequential( input_image: Image, output_image: Image = None, blocksize: int = 4096, - device: Device = None + device: 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 @@ -144,7 +120,7 @@ def relabel_sequential( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_closeIndexGapsInLabelMap @@ -152,21 +128,14 @@ def relabel_sequential( from ._pyclesperanto import _relabel_sequential as op - return op( - device=device, - src=input_image, - dst=output_image, - blocksize=int(blocksize) + device=device, src=input_image, dst=output_image, blocksize=int(blocksize) ) - -@plugin_function(category=['binarize', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["binarize", "in assistant", "bia-bob-suggestion"]) def threshold_otsu( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: 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. @@ -181,20 +150,14 @@ def threshold_otsu( 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 + [2] https://scikit-image.org/docs/dev/api/skimage.filters.html#skimage.filters.threshold_otsu + [3] https://ieeexplore.ieee.org/document/4310076 """ from ._pyclesperanto import _threshold_otsu as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) diff --git a/pyclesperanto/_tier5.py b/pyclesperanto/_tier5.py index e6b53698..6786b31e 100644 --- a/pyclesperanto/_tier5.py +++ b/pyclesperanto/_tier5.py @@ -10,11 +10,9 @@ import warnings -@plugin_function(category=['combine']) +@plugin_function(category=["combine"]) def array_equal( - input_image0: Image, - input_image1: Image, - device: Device = None + input_image0: Image, input_image1: Image, device: 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 @@ -30,7 +28,7 @@ def array_equal( Returns ------- bool - + References ---------- [1] https://numpy.org/doc/stable/reference/generated/numpy.array_equal.html @@ -38,21 +36,22 @@ def array_equal( from ._pyclesperanto import _array_equal as op - - return op( - device=device, - src0=input_image0, - src1=input_image1 - ) + return op(device=device, src0=input_image0, src1=input_image1) - -@plugin_function(category=['label processing', 'combine labels', 'in assistant', 'bia-bob-suggestion']) +@plugin_function( + category=[ + "label processing", + "combine labels", + "in assistant", + "bia-bob-suggestion", + ] +) def combine_labels( input_image0: Image, input_image1: Image, output_image: Image = None, - device: Device = None + device: 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. @@ -72,27 +71,20 @@ def combine_labels( Returns ------- Image - + """ from ._pyclesperanto import _combine_labels as op - - return op( - device=device, - src0=input_image0, - src1=input_image1, - dst=output_image - ) - + return op(device=device, src0=input_image0, src1=input_image1, dst=output_image) -@plugin_function(category=['label', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["label", "in assistant", "bia-bob-suggestion"]) def connected_components_labeling( input_image: Image, output_image: Image = None, - connectivity: str = 'box', - device: Device = None + connectivity: str = "box", + device: Device = None, ) -> Image: """Performs connected components analysis inspecting the box neighborhood of every pixel to a binary image and generates a label map. @@ -111,7 +103,7 @@ def connected_components_labeling( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_connectedComponentsLabelingBox @@ -119,11 +111,6 @@ def connected_components_labeling( from ._pyclesperanto import _connected_components_labeling as op - return op( - device=device, - src=input_image, - dst=output_image, - connectivity=connectivity + device=device, src=input_image, dst=output_image, connectivity=connectivity ) - diff --git a/pyclesperanto/_tier6.py b/pyclesperanto/_tier6.py index a1d1bb46..09424071 100644 --- a/pyclesperanto/_tier6.py +++ b/pyclesperanto/_tier6.py @@ -10,12 +10,12 @@ import warnings -@plugin_function(category=['label processing', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["label processing", "in assistant", "bia-bob-suggestion"]) def dilate_labels( input_image: Image, output_image: Image = None, radius: int = 2, - device: Device = None + device: Device = None, ) -> Image: """Dilates labels to a larger size. No label overwrites another label. Similar to the implementation in scikitimage [2] and MorpholibJ[3] Notes * This operation @@ -34,28 +34,21 @@ def dilate_labels( Returns ------- Image - + """ from ._pyclesperanto import _dilate_labels as op - - return op( - device=device, - src=input_image, - dst=output_image, - radius=int(radius) - ) - + return op(device=device, src=input_image, dst=output_image, radius=int(radius)) -@plugin_function(category=['label processing', 'in assistant']) +@plugin_function(category=["label processing", "in assistant"]) def erode_labels( input_image: Image, output_image: Image = None, radius: int = 1, relabel: bool = False, - device: Device = None + device: Device = None, ) -> Image: """Erodes labels to a smaller size. Note: Depending on the label image and the radius, labels may disappear and labels may split into multiple islands. Thus, @@ -76,28 +69,26 @@ def erode_labels( Returns ------- Image - + """ from ._pyclesperanto import _erode_labels as op - return op( device=device, src=input_image, dst=output_image, radius=int(radius), - relabel=bool(relabel) + relabel=bool(relabel), ) - -@plugin_function(category=['label', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["label", "in assistant", "bia-bob-suggestion"]) def gauss_otsu_labeling( input_image0: Image, output_image: Image = None, outline_sigma: float = 0, - device: Device = None + device: Device = None, ) -> Image: """Labels objects directly from grey-value images. The outline_sigma parameter allows tuning the segmentation result. Under the hood, this filter applies a @@ -119,31 +110,26 @@ def gauss_otsu_labeling( Returns ------- Image - + References ---------- [1] https://ieeexplore.ieee.org/document/4310076 - [2] https://en.wikipedia.org/wiki/Connected-component_labeling + [2] https://en.wikipedia.org/wiki/Connected-component_labeling """ from ._pyclesperanto import _gauss_otsu_labeling as op - return op( device=device, src0=input_image0, dst=output_image, - outline_sigma=float(outline_sigma) + outline_sigma=float(outline_sigma), ) - -@plugin_function(category=['label', 'bia-bob-suggestion']) +@plugin_function(category=["label", "bia-bob-suggestion"]) def masked_voronoi_labeling( - input_image: Image, - mask: Image, - output_image: Image = None, - device: Device = None + input_image: Image, mask: Image, output_image: Image = None, device: Device = None ) -> Image: """Takes a binary image, labels connected components and dilates the regions using a octagon shape until they touch. The region growing is limited to a masked @@ -160,7 +146,7 @@ def masked_voronoi_labeling( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_maskedVoronoiLabeling @@ -168,21 +154,12 @@ def masked_voronoi_labeling( from ._pyclesperanto import _masked_voronoi_labeling as op - - return op( - device=device, - src=input_image, - mask=mask, - dst=output_image - ) - + return op(device=device, src=input_image, mask=mask, dst=output_image) -@plugin_function(category=['label', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["label", "in assistant", "bia-bob-suggestion"]) def voronoi_labeling( - input_image: Image, - output_image: Image = None, - device: Device = None + input_image: Image, output_image: Image = None, device: Device = None ) -> Image: """Takes a binary image, labels connected components and dilates the regions using a octagon shape until they touch. The resulting label map is written to the @@ -198,7 +175,7 @@ def voronoi_labeling( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_voronoiLabeling @@ -206,10 +183,4 @@ def voronoi_labeling( from ._pyclesperanto import _voronoi_labeling as op - - return op( - device=device, - src=input_image, - dst=output_image - ) - + return op(device=device, src=input_image, dst=output_image) diff --git a/pyclesperanto/_tier7.py b/pyclesperanto/_tier7.py index c3461bb6..54032b91 100644 --- a/pyclesperanto/_tier7.py +++ b/pyclesperanto/_tier7.py @@ -17,7 +17,7 @@ def affine_transform( transform_matrix: list = None, interpolate: bool = False, resize: bool = False, - device: Device = None + device: Device = None, ) -> Image: """Apply an affine transformation matrix to an array and return the result. The transformation matrix must be 3x3 or 4x4 stored as a 1D array. The matrix @@ -42,30 +42,28 @@ def affine_transform( Returns ------- Image - + """ from ._pyclesperanto import _affine_transform as op - return op( device=device, src=input_image, dst=output_image, transform_matrix=transform_matrix, interpolate=bool(interpolate), - resize=bool(resize) + resize=bool(resize), ) - -@plugin_function(category=['label', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["label", "in assistant", "bia-bob-suggestion"]) def eroded_otsu_labeling( input_image: Image, output_image: Image = None, number_of_erosions: int = 5, outline_sigma: float = 2, - device: Device = None + device: Device = None, ) -> Image: """Segments and labels an image using blurring, Otsu-thresholding, binary erosion and masked Voronoi-labeling. After bluring and Otsu-thresholding the image, @@ -93,27 +91,25 @@ def eroded_otsu_labeling( Returns ------- Image - + References ---------- [1] https://github.com/biovoxxel/bv3dbox (BV_LabelSplitter.java#L83) - [2] https://zenodo.org/badge/latestdoi/434949702 + [2] https://zenodo.org/badge/latestdoi/434949702 """ from ._pyclesperanto import _eroded_otsu_labeling as op - return op( device=device, src=input_image, dst=output_image, number_of_erosions=int(number_of_erosions), - outline_sigma=float(outline_sigma) + outline_sigma=float(outline_sigma), ) - -@plugin_function(category=['transform', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["transform", "in assistant", "bia-bob-suggestion"]) def rigid_transform( input_image: Image, output_image: Image = None, @@ -126,7 +122,7 @@ def rigid_transform( centered: bool = True, interpolate: bool = False, resize: bool = False, - device: Device = None + device: Device = None, ) -> Image: """Translate the image by a given vector and rotate it by given angles. Angles are given in degrees. To convert radians to degrees, use this formula: @@ -162,12 +158,11 @@ def rigid_transform( Returns ------- Image - + """ from ._pyclesperanto import _rigid_transform as op - return op( device=device, src=input_image, @@ -180,12 +175,11 @@ def rigid_transform( angle_z=float(angle_z), centered=bool(centered), interpolate=bool(interpolate), - resize=bool(resize) + resize=bool(resize), ) - -@plugin_function(category=['transform', 'in assistant']) +@plugin_function(category=["transform", "in assistant"]) def rotate( input_image: Image, output_image: Image = None, @@ -195,7 +189,7 @@ def rotate( centered: bool = True, interpolate: bool = False, resize: bool = False, - device: Device = None + device: Device = None, ) -> Image: """Rotate the image by given angles. Angles are given in degrees. To convert radians to degrees, use this formula: angle_in_degrees = angle_in_radians / @@ -225,12 +219,11 @@ def rotate( Returns ------- Image - + """ from ._pyclesperanto import _rotate as op - return op( device=device, src=input_image, @@ -240,12 +233,11 @@ def rotate( angle_z=float(angle_z), centered=bool(centered), interpolate=bool(interpolate), - resize=bool(resize) + resize=bool(resize), ) - -@plugin_function(category=['transform', 'in assistant']) +@plugin_function(category=["transform", "in assistant"]) def scale( input_image: Image, output_image: Image = None, @@ -255,7 +247,7 @@ def scale( centered: bool = True, interpolate: bool = False, resize: bool = False, - device: Device = None + device: Device = None, ) -> Image: """Scale the image by given factors. @@ -283,12 +275,11 @@ def scale( Returns ------- Image - + """ from ._pyclesperanto import _scale as op - return op( device=device, src=input_image, @@ -298,12 +289,11 @@ def scale( factor_z=float(factor_z), centered=bool(centered), interpolate=bool(interpolate), - resize=bool(resize) + resize=bool(resize), ) - -@plugin_function(category=['transform', 'in assistant']) +@plugin_function(category=["transform", "in assistant"]) def translate( input_image: Image, output_image: Image = None, @@ -311,7 +301,7 @@ def translate( translate_y: float = 0, translate_z: float = 0, interpolate: bool = False, - device: Device = None + device: Device = None, ) -> Image: """Translate the image by a given vector. @@ -335,12 +325,11 @@ def translate( Returns ------- Image - + """ from ._pyclesperanto import _translate as op - return op( device=device, src=input_image, @@ -348,17 +337,16 @@ def translate( translate_x=float(translate_x), translate_y=float(translate_y), translate_z=float(translate_z), - interpolate=bool(interpolate) + interpolate=bool(interpolate), ) - -@plugin_function(category=['label processing', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["label processing", "in assistant", "bia-bob-suggestion"]) def closing_labels( input_image: Image, output_image: Image = None, radius: int = 0, - device: Device = None + device: Device = None, ) -> Image: """Apply a morphological closing operation to a label image. The operation consists of iterative dilation and erosion of the labels. With every iteration, box and @@ -380,19 +368,12 @@ def closing_labels( Returns ------- Image - + """ from ._pyclesperanto import _closing_labels as op - - return op( - device=device, - src=input_image, - dst=output_image, - radius=int(radius) - ) - + return op(device=device, src=input_image, dst=output_image, radius=int(radius)) @plugin_function @@ -400,7 +381,7 @@ def erode_connected_labels( input_image: Image, output_image: Image = None, radius: int = 1, - device: Device = None + device: Device = None, ) -> Image: """Erodes labels to a smaller size. Note: Depending on the label image and the radius, labels may disappear and labels may split into multiple islands. Thus, @@ -418,27 +399,20 @@ def erode_connected_labels( Returns ------- Image - + """ from ._pyclesperanto import _erode_connected_labels as op - - return op( - device=device, - src=input_image, - dst=output_image, - radius=int(radius) - ) - + return op(device=device, src=input_image, dst=output_image, radius=int(radius)) -@plugin_function(category=['label processing', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["label processing", "in assistant", "bia-bob-suggestion"]) def opening_labels( input_image: Image, output_image: Image = None, radius: int = 0, - device: Device = None + device: Device = None, ) -> Image: """Apply a morphological opening operation to a label image. The operation consists of iterative erosion and dilation of the labels. With every iteration, box and @@ -460,28 +434,21 @@ def opening_labels( Returns ------- Image - + """ from ._pyclesperanto import _opening_labels as op - - return op( - device=device, - src=input_image, - dst=output_image, - radius=int(radius) - ) - + return op(device=device, src=input_image, dst=output_image, radius=int(radius)) -@plugin_function(category=['label', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["label", "in assistant", "bia-bob-suggestion"]) def voronoi_otsu_labeling( input_image: Image, output_image: Image = None, spot_sigma: float = 2, outline_sigma: float = 2, - device: Device = None + device: Device = None, ) -> Image: """Labels objects directly from greyvalue images. The two sigma parameters allow tuning the segmentation result. Under the hood, this filter applies two Gaussian @@ -506,22 +473,20 @@ def voronoi_otsu_labeling( Returns ------- Image - + References ---------- [1] https://clij.github.io/clij2-docs/reference_voronoiOtsuLabeling - [2] https://ieeexplore.ieee.org/document/4310076 - [3] https://en.wikipedia.org/wiki/Voronoi_diagram + [2] https://ieeexplore.ieee.org/document/4310076 + [3] https://en.wikipedia.org/wiki/Voronoi_diagram """ from ._pyclesperanto import _voronoi_otsu_labeling as op - return op( device=device, src=input_image, dst=output_image, spot_sigma=float(spot_sigma), - outline_sigma=float(outline_sigma) + outline_sigma=float(outline_sigma), ) - diff --git a/pyclesperanto/_tier8.py b/pyclesperanto/_tier8.py index d3a889bb..53833d56 100644 --- a/pyclesperanto/_tier8.py +++ b/pyclesperanto/_tier8.py @@ -10,12 +10,12 @@ import warnings -@plugin_function(category=['label processing', 'in assistant', 'bia-bob-suggestion']) +@plugin_function(category=["label processing", "in assistant", "bia-bob-suggestion"]) def smooth_labels( input_image: Image, output_image: Image = None, radius: int = 0, - device: Device = None + device: Device = None, ) -> Image: """Apply a morphological opening operation to a label image and afterwards fills gaps between the labels using voronoi-labeling. Finally, the result label @@ -36,19 +36,12 @@ def smooth_labels( Returns ------- Image - + """ from ._pyclesperanto import _smooth_labels as op - - return op( - device=device, - src=input_image, - dst=output_image, - radius=int(radius) - ) - + return op(device=device, src=input_image, dst=output_image, radius=int(radius)) @plugin_function @@ -56,7 +49,7 @@ def smooth_connected_labels( input_image: Image, output_image: Image = None, radius: int = 0, - device: Device = None + device: Device = None, ) -> Image: """Apply a morphological erosion and dilation of the label image with respect to the connectivity of the labels. Note: It is recommended to process isotropic @@ -76,16 +69,9 @@ def smooth_connected_labels( Returns ------- Image - + """ from ._pyclesperanto import _smooth_connected_labels as op - - return op( - device=device, - src=input_image, - dst=output_image, - radius=int(radius) - ) - + return op(device=device, src=input_image, dst=output_image, radius=int(radius)) diff --git a/src/wrapper/tier1_.cpp b/src/wrapper/tier1_.cpp index 675b20df..4aed3478 100644 --- a/src/wrapper/tier1_.cpp +++ b/src/wrapper/tier1_.cpp @@ -1,7 +1,7 @@ // this code is auto-generated by the script 'pyclesperanto_autogen_tier_script.ipynb'. // Do not edit manually. Instead, edit the script and run it again. - + #include "pycle_wrapper.hpp" #include "tier1.hpp" @@ -9,697 +9,697 @@ namespace py = pybind11; auto tier1_(py::module &m) -> void { - + m.def("_absolute", &cle::tier1::absolute_func, "Call absolute from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_add_images_weighted", &cle::tier1::add_images_weighted_func, "Call add_images_weighted from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst"), py::arg("factor0"), py::arg("factor1")); - + m.def("_add_image_and_scalar", &cle::tier1::add_image_and_scalar_func, "Call add_image_and_scalar from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("scalar")); - + m.def("_binary_and", &cle::tier1::binary_and_func, "Call binary_and from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_binary_edge_detection", &cle::tier1::binary_edge_detection_func, "Call binary_edge_detection from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_binary_not", &cle::tier1::binary_not_func, "Call binary_not from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_binary_or", &cle::tier1::binary_or_func, "Call binary_or from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_binary_subtract", &cle::tier1::binary_subtract_func, "Call binary_subtract from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_binary_xor", &cle::tier1::binary_xor_func, "Call binary_xor from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_block_enumerate", &cle::tier1::block_enumerate_func, "Call block_enumerate from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst"), py::arg("blocksize")); - + m.def("_convolve", &cle::tier1::convolve_func, "Call convolve from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_copy", &cle::tier1::copy_func, "Call copy from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_copy_slice", &cle::tier1::copy_slice_func, "Call copy_slice from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("slice")); - + m.def("_copy_horizontal_slice", &cle::tier1::copy_horizontal_slice_func, "Call copy_horizontal_slice from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("slice")); - + m.def("_copy_vertical_slice", &cle::tier1::copy_vertical_slice_func, "Call copy_vertical_slice from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("slice")); - + m.def("_crop", &cle::tier1::crop_func, "Call crop from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("start_x"), py::arg("start_y"), py::arg("start_z"), py::arg("width"), py::arg("height"), py::arg("depth")); - + m.def("_cubic_root", &cle::tier1::cubic_root_func, "Call cubic_root from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_detect_label_edges", &cle::tier1::detect_label_edges_func, "Call detect_label_edges from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_dilate_box", &cle::tier1::dilate_box_func, "Call dilate_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_dilate_sphere", &cle::tier1::dilate_sphere_func, "Call dilate_sphere from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_dilate", &cle::tier1::dilate_func, "Call dilate from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("connectivity")); - + m.def("_divide_images", &cle::tier1::divide_images_func, "Call divide_images from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_divide_scalar_by_image", &cle::tier1::divide_scalar_by_image_func, "Call divide_scalar_by_image from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("scalar")); - + m.def("_equal", &cle::tier1::equal_func, "Call equal from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_equal_constant", &cle::tier1::equal_constant_func, "Call equal_constant from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("scalar")); - + m.def("_erode_box", &cle::tier1::erode_box_func, "Call erode_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_erode_sphere", &cle::tier1::erode_sphere_func, "Call erode_sphere from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_erode", &cle::tier1::erode_func, "Call erode from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("connectivity")); - + m.def("_exponential", &cle::tier1::exponential_func, "Call exponential from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_flip", &cle::tier1::flip_func, "Call flip from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("flip_x"), py::arg("flip_y"), py::arg("flip_z")); - + m.def("_gaussian_blur", &cle::tier1::gaussian_blur_func, "Call gaussian_blur from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("sigma_x"), py::arg("sigma_y"), py::arg("sigma_z")); - + m.def("_generate_distance_matrix", &cle::tier1::generate_distance_matrix_func, "Call generate_distance_matrix from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_gradient_x", &cle::tier1::gradient_x_func, "Call gradient_x from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_gradient_y", &cle::tier1::gradient_y_func, "Call gradient_y from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_gradient_z", &cle::tier1::gradient_z_func, "Call gradient_z from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_greater", &cle::tier1::greater_func, "Call greater from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_greater_constant", &cle::tier1::greater_constant_func, "Call greater_constant from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("scalar")); - + m.def("_greater_or_equal", &cle::tier1::greater_or_equal_func, "Call greater_or_equal from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_greater_or_equal_constant", &cle::tier1::greater_or_equal_constant_func, "Call greater_or_equal_constant from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("scalar")); - + m.def("_hessian_eigenvalues", &cle::tier1::hessian_eigenvalues_func, "Call hessian_eigenvalues from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("small_eigenvalue"), py::arg("middle_eigenvalue"), py::arg("large_eigenvalue")); - + m.def("_laplace_box", &cle::tier1::laplace_box_func, "Call laplace_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_laplace_diamond", &cle::tier1::laplace_diamond_func, "Call laplace_diamond from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_laplace", &cle::tier1::laplace_func, "Call laplace from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("connectivity")); - + m.def("_local_cross_correlation", &cle::tier1::local_cross_correlation_func, "Call local_cross_correlation from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_logarithm", &cle::tier1::logarithm_func, "Call logarithm from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_mask", &cle::tier1::mask_func, "Call mask from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("mask"), py::arg("dst")); - + m.def("_mask_label", &cle::tier1::mask_label_func, "Call mask_label from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst"), py::arg("label")); - + m.def("_maximum_image_and_scalar", &cle::tier1::maximum_image_and_scalar_func, "Call maximum_image_and_scalar from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("scalar")); - + m.def("_maximum_images", &cle::tier1::maximum_images_func, "Call maximum_images from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_maximum_box", &cle::tier1::maximum_box_func, "Call maximum_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_maximum", &cle::tier1::maximum_func, "Call maximum from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z"), py::arg("connectivity")); - + m.def("_maximum_x_projection", &cle::tier1::maximum_x_projection_func, "Call maximum_x_projection from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_maximum_y_projection", &cle::tier1::maximum_y_projection_func, "Call maximum_y_projection from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_maximum_z_projection", &cle::tier1::maximum_z_projection_func, "Call maximum_z_projection from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_mean_box", &cle::tier1::mean_box_func, "Call mean_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_mean_sphere", &cle::tier1::mean_sphere_func, "Call mean_sphere from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_mean", &cle::tier1::mean_func, "Call mean from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z"), py::arg("connectivity")); - + m.def("_mean_x_projection", &cle::tier1::mean_x_projection_func, "Call mean_x_projection from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_mean_y_projection", &cle::tier1::mean_y_projection_func, "Call mean_y_projection from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_mean_z_projection", &cle::tier1::mean_z_projection_func, "Call mean_z_projection from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_median_box", &cle::tier1::median_box_func, "Call median_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_median_sphere", &cle::tier1::median_sphere_func, "Call median_sphere from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_median", &cle::tier1::median_func, "Call median from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z"), py::arg("connectivity")); - + m.def("_minimum_box", &cle::tier1::minimum_box_func, "Call minimum_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_minimum", &cle::tier1::minimum_func, "Call minimum from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z"), py::arg("connectivity")); - + m.def("_minimum_image_and_scalar", &cle::tier1::minimum_image_and_scalar_func, "Call minimum_image_and_scalar from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("scalar")); - + m.def("_minimum_images", &cle::tier1::minimum_images_func, "Call minimum_images from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_minimum_x_projection", &cle::tier1::minimum_x_projection_func, "Call minimum_x_projection from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_minimum_y_projection", &cle::tier1::minimum_y_projection_func, "Call minimum_y_projection from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_minimum_z_projection", &cle::tier1::minimum_z_projection_func, "Call minimum_z_projection from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_mode_box", &cle::tier1::mode_box_func, "Call mode_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_mode_sphere", &cle::tier1::mode_sphere_func, "Call mode_sphere from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_mode", &cle::tier1::mode_func, "Call mode from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z"), py::arg("connectivity")); - + m.def("_modulo_images", &cle::tier1::modulo_images_func, "Call modulo_images from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_multiply_image_and_position", &cle::tier1::multiply_image_and_position_func, "Call multiply_image_and_position from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("dimension")); - + m.def("_multiply_image_and_scalar", &cle::tier1::multiply_image_and_scalar_func, "Call multiply_image_and_scalar from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("scalar")); - + m.def("_multiply_images", &cle::tier1::multiply_images_func, "Call multiply_images from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_nan_to_num", &cle::tier1::nan_to_num_func, "Call nan_to_num from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("nan"), py::arg("posinf"), py::arg("neginf")); - + m.def("_nonzero_maximum_box", &cle::tier1::nonzero_maximum_box_func, "Call nonzero_maximum_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst0"), py::arg("dst1")); - + m.def("_nonzero_maximum_diamond", &cle::tier1::nonzero_maximum_diamond_func, "Call nonzero_maximum_diamond from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst0"), py::arg("dst1")); - + m.def("_nonzero_maximum", &cle::tier1::nonzero_maximum_func, "Call nonzero_maximum from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst0"), py::arg("dst1"), py::arg("connectivity")); - + m.def("_nonzero_minimum_box", &cle::tier1::nonzero_minimum_box_func, "Call nonzero_minimum_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst0"), py::arg("dst1")); - + m.def("_nonzero_minimum_diamond", &cle::tier1::nonzero_minimum_diamond_func, "Call nonzero_minimum_diamond from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst0"), py::arg("dst1")); - + m.def("_nonzero_minimum", &cle::tier1::nonzero_minimum_func, "Call nonzero_minimum from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst0"), py::arg("dst1"), py::arg("connectivity")); - + m.def("_not_equal", &cle::tier1::not_equal_func, "Call not_equal from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_not_equal_constant", &cle::tier1::not_equal_constant_func, "Call not_equal_constant from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("scalar")); - + m.def("_paste", &cle::tier1::paste_func, "Call paste from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("index_x"), py::arg("index_y"), py::arg("index_z")); - + m.def("_onlyzero_overwrite_maximum_box", &cle::tier1::onlyzero_overwrite_maximum_box_func, "Call onlyzero_overwrite_maximum_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst0"), py::arg("dst1")); - + m.def("_onlyzero_overwrite_maximum_diamond", &cle::tier1::onlyzero_overwrite_maximum_diamond_func, "Call onlyzero_overwrite_maximum_diamond from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst0"), py::arg("dst1")); - + m.def("_onlyzero_overwrite_maximum", &cle::tier1::onlyzero_overwrite_maximum_func, "Call onlyzero_overwrite_maximum from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst0"), py::arg("dst1"), py::arg("connectivity")); - + m.def("_power", &cle::tier1::power_func, "Call power from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("scalar")); - + m.def("_power_images", &cle::tier1::power_images_func, "Call power_images from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_range", &cle::tier1::range_func, "Call range from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("start_x"), py::arg("stop_x"), py::arg("step_x"), py::arg("start_y"), py::arg("stop_y"), py::arg("step_y"), py::arg("start_z"), py::arg("stop_z"), py::arg("step_z")); - + m.def("_read_values_from_positions", &cle::tier1::read_values_from_positions_func, "Call read_values_from_positions from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("list"), py::arg("dst")); - + m.def("_replace_values", &cle::tier1::replace_values_func, "Call replace_values from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_replace_value", &cle::tier1::replace_value_func, "Call replace_value from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("scalar0"), py::arg("scalar1")); - + m.def("_maximum_sphere", &cle::tier1::maximum_sphere_func, "Call maximum_sphere from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_minimum_sphere", &cle::tier1::minimum_sphere_func, "Call minimum_sphere from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_multiply_matrix", &cle::tier1::multiply_matrix_func, "Call multiply_matrix from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_reciprocal", &cle::tier1::reciprocal_func, "Call reciprocal from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_set", &cle::tier1::set_func, "Call set from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("scalar")); - + m.def("_set_column", &cle::tier1::set_column_func, "Call set_column from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("column"), py::arg("value")); - + m.def("_set_image_borders", &cle::tier1::set_image_borders_func, "Call set_image_borders from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("value")); - + m.def("_set_plane", &cle::tier1::set_plane_func, "Call set_plane from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("plane"), py::arg("value")); - + m.def("_set_ramp_x", &cle::tier1::set_ramp_x_func, "Call set_ramp_x from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src")); - + m.def("_set_ramp_y", &cle::tier1::set_ramp_y_func, "Call set_ramp_y from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src")); - + m.def("_set_ramp_z", &cle::tier1::set_ramp_z_func, "Call set_ramp_z from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src")); - + m.def("_set_row", &cle::tier1::set_row_func, "Call set_row from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("row"), py::arg("value")); - + m.def("_set_nonzero_pixels_to_pixelindex", &cle::tier1::set_nonzero_pixels_to_pixelindex_func, "Call set_nonzero_pixels_to_pixelindex from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("offset")); - + m.def("_set_where_x_equals_y", &cle::tier1::set_where_x_equals_y_func, "Call set_where_x_equals_y from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("value")); - + m.def("_set_where_x_greater_than_y", &cle::tier1::set_where_x_greater_than_y_func, "Call set_where_x_greater_than_y from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("value")); - + m.def("_set_where_x_smaller_than_y", &cle::tier1::set_where_x_smaller_than_y_func, "Call set_where_x_smaller_than_y from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("value")); - + m.def("_sign", &cle::tier1::sign_func, "Call sign from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_smaller", &cle::tier1::smaller_func, "Call smaller from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_smaller_constant", &cle::tier1::smaller_constant_func, "Call smaller_constant from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("scalar")); - + m.def("_smaller_or_equal", &cle::tier1::smaller_or_equal_func, "Call smaller_or_equal from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_smaller_or_equal_constant", &cle::tier1::smaller_or_equal_constant_func, "Call smaller_or_equal_constant from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("scalar")); - + m.def("_sobel", &cle::tier1::sobel_func, "Call sobel from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_square_root", &cle::tier1::square_root_func, "Call square_root from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_std_z_projection", &cle::tier1::std_z_projection_func, "Call std_z_projection from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_subtract_image_from_scalar", &cle::tier1::subtract_image_from_scalar_func, "Call subtract_image_from_scalar from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("scalar")); - + m.def("_sum_reduction_x", &cle::tier1::sum_reduction_x_func, "Call sum_reduction_x from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("blocksize")); - + m.def("_sum_x_projection", &cle::tier1::sum_x_projection_func, "Call sum_x_projection from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_sum_y_projection", &cle::tier1::sum_y_projection_func, "Call sum_y_projection from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_sum_z_projection", &cle::tier1::sum_z_projection_func, "Call sum_z_projection from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_transpose_xy", &cle::tier1::transpose_xy_func, "Call transpose_xy from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_transpose_xz", &cle::tier1::transpose_xz_func, "Call transpose_xz from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_transpose_yz", &cle::tier1::transpose_yz_func, "Call transpose_yz from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_undefined_to_zero", &cle::tier1::undefined_to_zero_func, "Call undefined_to_zero from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_variance_box", &cle::tier1::variance_box_func, "Call variance_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_variance_sphere", &cle::tier1::variance_sphere_func, "Call variance_sphere from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_variance", &cle::tier1::variance_func, "Call variance from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z"), py::arg("connectivity")); - + m.def("_write_values_to_positions", &cle::tier1::write_values_to_positions_func, "Call write_values_to_positions from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_x_position_of_maximum_x_projection", &cle::tier1::x_position_of_maximum_x_projection_func, "Call x_position_of_maximum_x_projection from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_x_position_of_minimum_x_projection", &cle::tier1::x_position_of_minimum_x_projection_func, "Call x_position_of_minimum_x_projection from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_y_position_of_maximum_y_projection", &cle::tier1::y_position_of_maximum_y_projection_func, "Call y_position_of_maximum_y_projection from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_y_position_of_minimum_y_projection", &cle::tier1::y_position_of_minimum_y_projection_func, "Call y_position_of_minimum_y_projection from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_z_position_of_maximum_z_projection", &cle::tier1::z_position_of_maximum_z_projection_func, "Call z_position_of_maximum_z_projection from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_z_position_of_minimum_z_projection", &cle::tier1::z_position_of_minimum_z_projection_func, "Call z_position_of_minimum_z_projection from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); diff --git a/src/wrapper/tier2_.cpp b/src/wrapper/tier2_.cpp index 12e09e57..c3702531 100644 --- a/src/wrapper/tier2_.cpp +++ b/src/wrapper/tier2_.cpp @@ -1,7 +1,7 @@ // this code is auto-generated by the script 'pyclesperanto_autogen_tier_script.ipynb'. // Do not edit manually. Instead, edit the script and run it again. - + #include "pycle_wrapper.hpp" #include "tier2.hpp" @@ -9,227 +9,227 @@ namespace py = pybind11; auto tier2_(py::module &m) -> void { - + m.def("_absolute_difference", &cle::tier2::absolute_difference_func, "Call absolute_difference from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_add_images", &cle::tier2::add_images_func, "Call add_images from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_bottom_hat_box", &cle::tier2::bottom_hat_box_func, "Call bottom_hat_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_bottom_hat_sphere", &cle::tier2::bottom_hat_sphere_func, "Call bottom_hat_sphere from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_bottom_hat", &cle::tier2::bottom_hat_func, "Call bottom_hat from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z"), py::arg("connectivity")); - + m.def("_clip", &cle::tier2::clip_func, "Call clip from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("min_intensity"), py::arg("max_intensity")); - + m.def("_closing_box", &cle::tier2::closing_box_func, "Call closing_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_closing_sphere", &cle::tier2::closing_sphere_func, "Call closing_sphere from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_closing", &cle::tier2::closing_func, "Call closing from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z"), py::arg("connectivity")); - + m.def("_concatenate_along_x", &cle::tier2::concatenate_along_x_func, "Call concatenate_along_x from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_concatenate_along_y", &cle::tier2::concatenate_along_y_func, "Call concatenate_along_y from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_concatenate_along_z", &cle::tier2::concatenate_along_z_func, "Call concatenate_along_z from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_count_touching_neighbors", &cle::tier2::count_touching_neighbors_func, "Call count_touching_neighbors from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("ignore_background")); - + m.def("_crop_border", &cle::tier2::crop_border_func, "Call crop_border from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("border_size")); - + m.def("_divide_by_gaussian_background", &cle::tier2::divide_by_gaussian_background_func, "Call divide_by_gaussian_background from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("sigma_x"), py::arg("sigma_y"), py::arg("sigma_z")); - + m.def("_degrees_to_radians", &cle::tier2::degrees_to_radians_func, "Call degrees_to_radians from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_detect_maxima_box", &cle::tier2::detect_maxima_box_func, "Call detect_maxima_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_detect_maxima", &cle::tier2::detect_maxima_func, "Call detect_maxima from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z"), py::arg("connectivity")); - + m.def("_detect_minima_box", &cle::tier2::detect_minima_box_func, "Call detect_minima_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_detect_minima", &cle::tier2::detect_minima_func, "Call detect_minima from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z"), py::arg("connectivity")); - + m.def("_difference_of_gaussian", &cle::tier2::difference_of_gaussian_func, "Call difference_of_gaussian from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("sigma1_x"), py::arg("sigma1_y"), py::arg("sigma1_z"), py::arg("sigma2_x"), py::arg("sigma2_y"), py::arg("sigma2_z")); - + m.def("_extend_labeling_via_voronoi", &cle::tier2::extend_labeling_via_voronoi_func, "Call extend_labeling_via_voronoi from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_invert", &cle::tier2::invert_func, "Call invert from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_label_spots", &cle::tier2::label_spots_func, "Call label_spots from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_large_hessian_eigenvalue", &cle::tier2::large_hessian_eigenvalue_func, "Call large_hessian_eigenvalue from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_maximum_of_all_pixels", &cle::tier2::maximum_of_all_pixels_func, "Call maximum_of_all_pixels from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src")); - + m.def("_minimum_of_all_pixels", &cle::tier2::minimum_of_all_pixels_func, "Call minimum_of_all_pixels from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src")); - + m.def("_minimum_of_masked_pixels", &cle::tier2::minimum_of_masked_pixels_func, "Call minimum_of_masked_pixels from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("mask")); - + m.def("_opening_box", &cle::tier2::opening_box_func, "Call opening_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_opening_sphere", &cle::tier2::opening_sphere_func, "Call opening_sphere from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_opening", &cle::tier2::opening_func, "Call opening from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z"), py::arg("connectivity")); - + m.def("_radians_to_degrees", &cle::tier2::radians_to_degrees_func, "Call radians_to_degrees from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_reduce_labels_to_label_edges", &cle::tier2::reduce_labels_to_label_edges_func, "Call reduce_labels_to_label_edges from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_small_hessian_eigenvalue", &cle::tier2::small_hessian_eigenvalue_func, "Call small_hessian_eigenvalue from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_square", &cle::tier2::square_func, "Call square from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_squared_difference", &cle::tier2::squared_difference_func, "Call squared_difference from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_standard_deviation_box", &cle::tier2::standard_deviation_box_func, "Call standard_deviation_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_standard_deviation_sphere", &cle::tier2::standard_deviation_sphere_func, "Call standard_deviation_sphere from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_standard_deviation", &cle::tier2::standard_deviation_func, "Call standard_deviation from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z"), py::arg("connectivity")); - + m.def("_subtract_gaussian_background", &cle::tier2::subtract_gaussian_background_func, "Call subtract_gaussian_background from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("sigma_x"), py::arg("sigma_y"), py::arg("sigma_z")); - + m.def("_subtract_images", &cle::tier2::subtract_images_func, "Call subtract_images from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_sum_of_all_pixels", &cle::tier2::sum_of_all_pixels_func, "Call sum_of_all_pixels from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src")); - + m.def("_top_hat_box", &cle::tier2::top_hat_box_func, "Call top_hat_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_top_hat_sphere", &cle::tier2::top_hat_sphere_func, "Call top_hat_sphere from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z")); - + m.def("_top_hat", &cle::tier2::top_hat_func, "Call top_hat from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius_x"), py::arg("radius_y"), py::arg("radius_z"), py::arg("connectivity")); diff --git a/src/wrapper/tier3_.cpp b/src/wrapper/tier3_.cpp index 37cc1550..94f51951 100644 --- a/src/wrapper/tier3_.cpp +++ b/src/wrapper/tier3_.cpp @@ -1,7 +1,7 @@ // this code is auto-generated by the script 'pyclesperanto_autogen_tier_script.ipynb'. // Do not edit manually. Instead, edit the script and run it again. - + #include "pycle_wrapper.hpp" #include "tier3.hpp" @@ -9,72 +9,72 @@ namespace py = pybind11; auto tier3_(py::module &m) -> void { - + m.def("_bounding_box", &cle::tier3::bounding_box_func, "Call bounding_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src")); - + m.def("_center_of_mass", &cle::tier3::center_of_mass_func, "Call center_of_mass from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src")); - + m.def("_exclude_labels", &cle::tier3::exclude_labels_func, "Call exclude_labels from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("list"), py::arg("dst")); - + m.def("_exclude_labels_on_edges", &cle::tier3::exclude_labels_on_edges_func, "Call exclude_labels_on_edges from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("exclude_x"), py::arg("exclude_y"), py::arg("exclude_z")); - + m.def("_flag_existing_labels", &cle::tier3::flag_existing_labels_func, "Call flag_existing_labels from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_gamma_correction", &cle::tier3::gamma_correction_func, "Call gamma_correction from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("gamma")); - + m.def("_generate_binary_overlap_matrix", &cle::tier3::generate_binary_overlap_matrix_func, "Call generate_binary_overlap_matrix from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_generate_touch_matrix", &cle::tier3::generate_touch_matrix_func, "Call generate_touch_matrix from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_histogram", &cle::tier3::histogram_func, "Call histogram from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("nbins"), py::arg("min"), py::arg("max")); - + m.def("_jaccard_index", &cle::tier3::jaccard_index_func, "Call jaccard_index from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1")); - + m.def("_labelled_spots_to_pointlist", &cle::tier3::labelled_spots_to_pointlist_func, "Call labelled_spots_to_pointlist from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_maximum_position", &cle::tier3::maximum_position_func, "Call maximum_position from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src")); - + m.def("_mean_of_all_pixels", &cle::tier3::mean_of_all_pixels_func, "Call mean_of_all_pixels from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src")); - + m.def("_minimum_position", &cle::tier3::minimum_position_func, "Call minimum_position from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src")); diff --git a/src/wrapper/tier4_.cpp b/src/wrapper/tier4_.cpp index 05ce3a0b..dceafb61 100644 --- a/src/wrapper/tier4_.cpp +++ b/src/wrapper/tier4_.cpp @@ -1,7 +1,7 @@ // this code is auto-generated by the script 'pyclesperanto_autogen_tier_script.ipynb'. // Do not edit manually. Instead, edit the script and run it again. - + #include "pycle_wrapper.hpp" #include "tier4.hpp" @@ -9,27 +9,27 @@ namespace py = pybind11; auto tier4_(py::module &m) -> void { - + m.def("_label_bounding_box", &cle::tier4::label_bounding_box_func, "Call label_bounding_box from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("label_id")); - + m.def("_mean_squared_error", &cle::tier4::mean_squared_error_func, "Call mean_squared_error from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1")); - + m.def("_spots_to_pointlist", &cle::tier4::spots_to_pointlist_func, "Call spots_to_pointlist from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); - + m.def("_relabel_sequential", &cle::tier4::relabel_sequential_func, "Call relabel_sequential from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("blocksize")); - + m.def("_threshold_otsu", &cle::tier4::threshold_otsu_func, "Call threshold_otsu from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); diff --git a/src/wrapper/tier5_.cpp b/src/wrapper/tier5_.cpp index 932d1615..0b681813 100644 --- a/src/wrapper/tier5_.cpp +++ b/src/wrapper/tier5_.cpp @@ -1,7 +1,7 @@ // this code is auto-generated by the script 'pyclesperanto_autogen_tier_script.ipynb'. // Do not edit manually. Instead, edit the script and run it again. - + #include "pycle_wrapper.hpp" #include "tier5.hpp" @@ -9,17 +9,17 @@ namespace py = pybind11; auto tier5_(py::module &m) -> void { - + m.def("_array_equal", &cle::tier5::array_equal_func, "Call array_equal from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1")); - + m.def("_combine_labels", &cle::tier5::combine_labels_func, "Call combine_labels from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("src1"), py::arg("dst")); - + m.def("_connected_components_labeling", &cle::tier5::connected_components_labeling_func, "Call connected_components_labeling from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("connectivity")); diff --git a/src/wrapper/tier6_.cpp b/src/wrapper/tier6_.cpp index ef412952..6a4f1940 100644 --- a/src/wrapper/tier6_.cpp +++ b/src/wrapper/tier6_.cpp @@ -1,7 +1,7 @@ // this code is auto-generated by the script 'pyclesperanto_autogen_tier_script.ipynb'. // Do not edit manually. Instead, edit the script and run it again. - + #include "pycle_wrapper.hpp" #include "tier6.hpp" @@ -9,27 +9,27 @@ namespace py = pybind11; auto tier6_(py::module &m) -> void { - + m.def("_dilate_labels", &cle::tier6::dilate_labels_func, "Call dilate_labels from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius")); - + m.def("_erode_labels", &cle::tier6::erode_labels_func, "Call erode_labels from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius"), py::arg("relabel")); - + m.def("_gauss_otsu_labeling", &cle::tier6::gauss_otsu_labeling_func, "Call gauss_otsu_labeling from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src0"), py::arg("dst"), py::arg("outline_sigma")); - + m.def("_masked_voronoi_labeling", &cle::tier6::masked_voronoi_labeling_func, "Call masked_voronoi_labeling from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("mask"), py::arg("dst")); - + m.def("_voronoi_labeling", &cle::tier6::voronoi_labeling_func, "Call voronoi_labeling from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst")); diff --git a/src/wrapper/tier7_.cpp b/src/wrapper/tier7_.cpp index 5a78d005..02c3899e 100644 --- a/src/wrapper/tier7_.cpp +++ b/src/wrapper/tier7_.cpp @@ -1,7 +1,7 @@ // this code is auto-generated by the script 'pyclesperanto_autogen_tier_script.ipynb'. // Do not edit manually. Instead, edit the script and run it again. - + #include "pycle_wrapper.hpp" #include "tier7.hpp" @@ -9,52 +9,52 @@ namespace py = pybind11; auto tier7_(py::module &m) -> void { - + m.def("_affine_transform", &cle::tier7::affine_transform_func, "Call affine_transform from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("transform_matrix"), py::arg("interpolate"), py::arg("resize")); - + m.def("_eroded_otsu_labeling", &cle::tier7::eroded_otsu_labeling_func, "Call eroded_otsu_labeling from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("number_of_erosions"), py::arg("outline_sigma")); - + m.def("_rigid_transform", &cle::tier7::rigid_transform_func, "Call rigid_transform from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("translate_x"), py::arg("translate_y"), py::arg("translate_z"), py::arg("angle_x"), py::arg("angle_y"), py::arg("angle_z"), py::arg("centered"), py::arg("interpolate"), py::arg("resize")); - + m.def("_rotate", &cle::tier7::rotate_func, "Call rotate from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("angle_x"), py::arg("angle_y"), py::arg("angle_z"), py::arg("centered"), py::arg("interpolate"), py::arg("resize")); - + m.def("_scale", &cle::tier7::scale_func, "Call scale from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("factor_x"), py::arg("factor_y"), py::arg("factor_z"), py::arg("centered"), py::arg("interpolate"), py::arg("resize")); - + m.def("_translate", &cle::tier7::translate_func, "Call translate from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("translate_x"), py::arg("translate_y"), py::arg("translate_z"), py::arg("interpolate")); - + m.def("_closing_labels", &cle::tier7::closing_labels_func, "Call closing_labels from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius")); - + m.def("_erode_connected_labels", &cle::tier7::erode_connected_labels_func, "Call erode_connected_labels from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius")); - + m.def("_opening_labels", &cle::tier7::opening_labels_func, "Call opening_labels from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius")); - + m.def("_voronoi_otsu_labeling", &cle::tier7::voronoi_otsu_labeling_func, "Call voronoi_otsu_labeling from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("spot_sigma"), py::arg("outline_sigma")); diff --git a/src/wrapper/tier8_.cpp b/src/wrapper/tier8_.cpp index e9a2e7bd..23d1d35b 100644 --- a/src/wrapper/tier8_.cpp +++ b/src/wrapper/tier8_.cpp @@ -1,7 +1,7 @@ // this code is auto-generated by the script 'pyclesperanto_autogen_tier_script.ipynb'. // Do not edit manually. Instead, edit the script and run it again. - + #include "pycle_wrapper.hpp" #include "tier8.hpp" @@ -9,12 +9,12 @@ namespace py = pybind11; auto tier8_(py::module &m) -> void { - + m.def("_smooth_labels", &cle::tier8::smooth_labels_func, "Call smooth_labels from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius")); - + m.def("_smooth_connected_labels", &cle::tier8::smooth_connected_labels_func, "Call smooth_connected_labels from C++.", py::return_value_policy::take_ownership, py::arg("device"), py::arg("src"), py::arg("dst"), py::arg("radius")); diff --git a/tests/test_affine_transform.py b/tests/test_affine_transform.py index a0d30398..e1101c19 100644 --- a/tests/test_affine_transform.py +++ b/tests/test_affine_transform.py @@ -1,22 +1,35 @@ import pyclesperanto as cle import numpy as np + def test_affine_transform_translate(): - source = cle.push(np.asarray([[ - [0, 0, 0, 0, 0], - [0, 0, 0, 0, 0], - [0, 0, 1, 1, 0], - [0, 0, 0, 0, 0], - [0, 0, 0, 0, 0], - ]])) + source = cle.push( + np.asarray( + [ + [ + [0, 0, 0, 0, 0], + [0, 0, 0, 0, 0], + [0, 0, 1, 1, 0], + [0, 0, 0, 0, 0], + [0, 0, 0, 0, 0], + ] + ] + ) + ) - reference = cle.push(np.asarray([[ - [0, 0, 0, 0, 0], - [0, 1, 1, 0, 0], - [0, 0, 0, 0, 0], - [0, 0, 0, 0, 0], - [0, 0, 0, 0, 0], - ]])) + reference = cle.push( + np.asarray( + [ + [ + [0, 0, 0, 0, 0], + [0, 1, 1, 0, 0], + [0, 0, 0, 0, 0], + [0, 0, 0, 0, 0], + [0, 0, 0, 0, 0], + ] + ] + ) + ) transform = [1, 0, -1, 0, 1, -1, 0, 0, 1] result = cle.affine_transform(source, transform_matrix=transform) @@ -27,4 +40,4 @@ def test_affine_transform_translate(): print(a) print(b) - assert (np.array_equal(a, b)) + assert np.array_equal(a, b) diff --git a/tests/test_bounding_box.py b/tests/test_bounding_box.py index 2d485fed..e220d5a0 100644 --- a/tests/test_bounding_box.py +++ b/tests/test_bounding_box.py @@ -1,15 +1,20 @@ import pyclesperanto as cle import numpy as np + def test_bounding_box_2d(): - test = cle.push(np.asarray([ - [0, 0, 0, 0, 0], - [0, 1, 1, 0, 0], - [0, 1, 1, 0, 0], - [0, 0, 0, 0, 0], - [0, 0, 0, 0, 0] - ])) + test = cle.push( + np.asarray( + [ + [0, 0, 0, 0, 0], + [0, 1, 1, 0, 0], + [0, 1, 1, 0, 0], + [0, 0, 0, 0, 0], + [0, 0, 0, 0, 0], + ] + ) + ) bb = cle.bounding_box(test) print(bb) @@ -20,21 +25,29 @@ def test_bounding_box_2d(): assert bb[4] == 2 assert bb[3] == 2 + def test_bounding_box_3d(): - test = cle.push(np.asarray([[ - [0, 0, 0, 0, 0], - [0, 1, 1, 0, 0], - [0, 1, 1, 0, 0], - [0, 0, 0, 0, 0], - [0, 0, 0, 0, 0] - ],[ - [0, 0, 0, 0, 0], - [0, 1, 1, 0, 0], - [0, 1, 1, 0, 0], - [0, 0, 0, 0, 0], - [0, 0, 0, 0, 0] - ]])) + test = cle.push( + np.asarray( + [ + [ + [0, 0, 0, 0, 0], + [0, 1, 1, 0, 0], + [0, 1, 1, 0, 0], + [0, 0, 0, 0, 0], + [0, 0, 0, 0, 0], + ], + [ + [0, 0, 0, 0, 0], + [0, 1, 1, 0, 0], + [0, 1, 1, 0, 0], + [0, 0, 0, 0, 0], + [0, 0, 0, 0, 0], + ], + ] + ) + ) bb = cle.bounding_box(test) print(bb) @@ -45,4 +58,4 @@ def test_bounding_box_3d(): assert bb[5] == 1 assert bb[4] == 2 - assert bb[3] == 2 \ No newline at end of file + assert bb[3] == 2 diff --git a/tests/test_connected_components_labeling.py b/tests/test_connected_components_labeling.py index 547f57f6..8864175a 100644 --- a/tests/test_connected_components_labeling.py +++ b/tests/test_connected_components_labeling.py @@ -21,7 +21,6 @@ def test_connected_components_labeling_box(): assert np.array_equal(a, b) - def test_connected_components_labeling_sphere(): gpu_input = cle.push(np.asarray([[0, 1, 0, 1], [0, 1, 0, 0], [1, 0, 0, 1]])) diff --git a/tests/test_eroded_otsu_labeling.py b/tests/test_eroded_otsu_labeling.py index bb6772e9..d685ad57 100644 --- a/tests/test_eroded_otsu_labeling.py +++ b/tests/test_eroded_otsu_labeling.py @@ -1,34 +1,40 @@ import pyclesperanto as cle import numpy as np -def test_eroded_otsu_labeling(): - - gpu_input = cle.push(np.asarray([ - - [0, 0, 5, 5, 0, 0], - [0, 5, 8, 9, 1, 0], - [0, 5, 7, 6, 1, 1], - [0, 0, 0, 5, 5, 1], - [0, 0, 0, 5, 5, 1], - [0, 0, 5, 5, 5, 1], - [0, 0, 5, 5, 5, 0], - - ])) - - gpu_reference = cle.push(np.asarray([ - - [0, 0, 1, 1, 0, 0], - [0, 1, 1, 1, 1, 0], - [0, 1, 1, 1, 1, 0], - [0, 0, 1, 1, 1, 0], - [0, 0, 0, 2, 2, 0], - [0, 0, 2, 2, 2, 0], - [0, 0, 2, 2, 2, 0], - - ])) +def test_eroded_otsu_labeling(): - gpu_output = cle.eroded_otsu_labeling(gpu_input, number_of_erosions=1, outline_sigma=1) + gpu_input = cle.push( + np.asarray( + [ + [0, 0, 5, 5, 0, 0], + [0, 5, 8, 9, 1, 0], + [0, 5, 7, 6, 1, 1], + [0, 0, 0, 5, 5, 1], + [0, 0, 0, 5, 5, 1], + [0, 0, 5, 5, 5, 1], + [0, 0, 5, 5, 5, 0], + ] + ) + ) + + gpu_reference = cle.push( + np.asarray( + [ + [0, 0, 1, 1, 0, 0], + [0, 1, 1, 1, 1, 0], + [0, 1, 1, 1, 1, 0], + [0, 0, 1, 1, 1, 0], + [0, 0, 0, 2, 2, 0], + [0, 0, 2, 2, 2, 0], + [0, 0, 2, 2, 2, 0], + ] + ) + ) + + gpu_output = cle.eroded_otsu_labeling( + gpu_input, number_of_erosions=1, outline_sigma=1 + ) a = cle.pull(gpu_output) b = cle.pull(gpu_reference) @@ -36,4 +42,4 @@ def test_eroded_otsu_labeling(): print(a) print(b) - assert (np.array_equal(a, b)) + assert np.array_equal(a, b) diff --git a/tests/test_gauss_otsu_labeling.py b/tests/test_gauss_otsu_labeling.py index d72d427b..bce2a79b 100644 --- a/tests/test_gauss_otsu_labeling.py +++ b/tests/test_gauss_otsu_labeling.py @@ -1,32 +1,36 @@ import pyclesperanto as cle import numpy as np -def test_gauss_otsu_labeling(): - - gpu_input = cle.push(np.asarray([ - - [0, 0, 1, 1, 0, 0], - [0, 1, 8, 9, 1, 0], - [0, 1, 1, 0, 0, 0], - [0, 0, 0, 0, 0, 0], - [0, 0, 0, 1, 1, 0], - [0, 0, 1, 8, 7, 1], - [0, 0, 1, 1, 1, 0], - - ])) +def test_gauss_otsu_labeling(): - gpu_reference = cle.push(np.asarray([ - - [0, 0, 1, 1, 0, 0], - [0, 1, 1, 1, 1, 0], - [0, 1, 1, 1, 0, 0], - [0, 0, 0, 0, 0, 0], - [0, 0, 0, 2, 2, 0], - [0, 0, 2, 2, 2, 2], - [0, 0, 2, 2, 2, 0], - - ])) + gpu_input = cle.push( + np.asarray( + [ + [0, 0, 1, 1, 0, 0], + [0, 1, 8, 9, 1, 0], + [0, 1, 1, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 1, 1, 0], + [0, 0, 1, 8, 7, 1], + [0, 0, 1, 1, 1, 0], + ] + ) + ) + + gpu_reference = cle.push( + np.asarray( + [ + [0, 0, 1, 1, 0, 0], + [0, 1, 1, 1, 1, 0], + [0, 1, 1, 1, 0, 0], + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 2, 2, 0], + [0, 0, 2, 2, 2, 2], + [0, 0, 2, 2, 2, 0], + ] + ) + ) gpu_output = cle.gauss_otsu_labeling(gpu_input, outline_sigma=1) @@ -36,4 +40,4 @@ def test_gauss_otsu_labeling(): print(a) print(b) - assert (np.array_equal(a, b)) + assert np.array_equal(a, b) diff --git a/tests/test_label_bounding_box.py b/tests/test_label_bounding_box.py index 5b66727b..b00fb121 100644 --- a/tests/test_label_bounding_box.py +++ b/tests/test_label_bounding_box.py @@ -1,17 +1,22 @@ import pyclesperanto as cle import numpy as np + def test_label_bounding_box_2d(): - test = cle.push(np.asarray([ - [0, 0, 0, 0, 0, 0, 0], - [0, 1, 1, 0, 0, 0, 0], - [0, 1, 1, 0, 0, 0, 0], - [0, 0, 0, 0, 2, 2, 0], - [0, 0, 0, 0, 2, 2, 0], - [0, 0, 0, 0, 0, 0, 0], - [0, 0, 0, 0, 0, 0, 0] - ])) + test = cle.push( + np.asarray( + [ + [0, 0, 0, 0, 0, 0, 0], + [0, 1, 1, 0, 0, 0, 0], + [0, 1, 1, 0, 0, 0, 0], + [0, 0, 0, 0, 2, 2, 0], + [0, 0, 0, 0, 2, 2, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + ] + ) + ) bb = cle.label_bounding_box(test, label_id=1) print(bb) @@ -20,4 +25,4 @@ def test_label_bounding_box_2d(): assert bb[0] == 1 assert bb[4] == 2 - assert bb[3] == 2 \ No newline at end of file + assert bb[3] == 2 diff --git a/tests/test_multiply_matrix.py b/tests/test_multiply_matrix.py index b2a2c1a2..92ad7202 100644 --- a/tests/test_multiply_matrix.py +++ b/tests/test_multiply_matrix.py @@ -5,7 +5,6 @@ cle.select_device("TX") - # @pytest.mark.parametrize("shape", 2 ** np.arange(9, 11), ids=lambda x: f"{x}x{x}") # @pytest.mark.parametrize("target", ["cpu", "gpu"]) # def test_multiply_matrix(shape, benchmark, target): @@ -29,8 +28,8 @@ # make a test for matrix multiplication def test_multiply_matrix(): - matrix_a = np.random.rand(3,3).astype("float32") - matrix_b = np.random.rand(3,3).astype("float32") + matrix_a = np.random.rand(3, 3).astype("float32") + matrix_b = np.random.rand(3, 3).astype("float32") valid = np.dot(matrix_a, matrix_b) matrix_c = cle.multiply_matrix(matrix_a, matrix_b) diff --git a/tests/test_reduce_labels_to_label_edges.py b/tests/test_reduce_labels_to_label_edges.py index b79b0fdf..bc557ce1 100644 --- a/tests/test_reduce_labels_to_label_edges.py +++ b/tests/test_reduce_labels_to_label_edges.py @@ -1,28 +1,33 @@ import pyclesperanto as cle import numpy as np -def test_reduce_labels_to_label_edges(): - test = np.asarray([ - [0, 0, 0, 0, 0, 0, 0, 0], - [0,0,0,0, 1,1,1,0], - [0,0,2,0, 1,1,1,0], - [0,0,0,0, 1,1,1,0], - [0,3,3,3, 4,4,4,0], - [0,3,3,3, 4,4,4,0], - [0,3,3,3, 4,4,4,0], - [0,0,0,0, 0,0,0,0], - ]) - reference = np.asarray([ - [0, 0, 0, 0, 0, 0, 0, 0], - [0,0,0,0, 1,1,1,0], - [0,0,2,0, 1,0,1,0], - [0,0,0,0, 1,1,1,0], - [0,3,3,3, 4,4,4,0], - [0,3,0,3, 4,0,4,0], - [0,3,3,3, 4,4,4,0], - [0,0,0,0, 0,0,0,0] - ]) +def test_reduce_labels_to_label_edges(): + test = np.asarray( + [ + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 1, 1, 0], + [0, 0, 2, 0, 1, 1, 1, 0], + [0, 0, 0, 0, 1, 1, 1, 0], + [0, 3, 3, 3, 4, 4, 4, 0], + [0, 3, 3, 3, 4, 4, 4, 0], + [0, 3, 3, 3, 4, 4, 4, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + ] + ) + + reference = np.asarray( + [ + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 1, 1, 0], + [0, 0, 2, 0, 1, 0, 1, 0], + [0, 0, 0, 0, 1, 1, 1, 0], + [0, 3, 3, 3, 4, 4, 4, 0], + [0, 3, 0, 3, 4, 0, 4, 0], + [0, 3, 3, 3, 4, 4, 4, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + ] + ) result = cle.reduce_labels_to_label_edges(test) @@ -30,6 +35,3 @@ def test_reduce_labels_to_label_edges(): print(reference) assert np.allclose(reference, result) - - - diff --git a/tests/test_smooth_labels.py b/tests/test_smooth_labels.py index 8742ba34..63da454e 100644 --- a/tests/test_smooth_labels.py +++ b/tests/test_smooth_labels.py @@ -1,31 +1,40 @@ import pyclesperanto as cle import numpy as np + def test_smooth_labels_2d(): - - gpu_input = cle.push(np.asarray([ - [1, 1, 1, 1, 2, 2, 2, 2], - [1, 1, 1, 1, 2, 2, 2, 2], - [1, 1, 1, 1, 2, 2, 2, 2], - [1, 1, 1, 2, 2, 2, 2, 2], - [1, 1, 1, 1, 2, 2, 2, 2], - [1, 1, 1, 1, 2, 2, 2, 2], - [1, 1, 1, 1, 1, 2, 2, 2], - [1, 1, 1, 1, 2, 2, 2, 2], - [1, 1, 1, 1, 2, 2, 2, 2], - ])) - - gpu_reference = cle.push(np.asarray([ - [1, 1, 1, 1, 2, 2, 2, 2], - [1, 1, 1, 1, 2, 2, 2, 2], - [1, 1, 1, 1, 2, 2, 2, 2], - [1, 1, 1, 1, 2, 2, 2, 2], - [1, 1, 1, 1, 2, 2, 2, 2], - [1, 1, 1, 1, 2, 2, 2, 2], - [1, 1, 1, 1, 2, 2, 2, 2], - [1, 1, 1, 1, 2, 2, 2, 2], - [1, 1, 1, 1, 2, 2, 2, 2], - ])) + + gpu_input = cle.push( + np.asarray( + [ + [1, 1, 1, 1, 2, 2, 2, 2], + [1, 1, 1, 1, 2, 2, 2, 2], + [1, 1, 1, 1, 2, 2, 2, 2], + [1, 1, 1, 2, 2, 2, 2, 2], + [1, 1, 1, 1, 2, 2, 2, 2], + [1, 1, 1, 1, 2, 2, 2, 2], + [1, 1, 1, 1, 1, 2, 2, 2], + [1, 1, 1, 1, 2, 2, 2, 2], + [1, 1, 1, 1, 2, 2, 2, 2], + ] + ) + ) + + gpu_reference = cle.push( + np.asarray( + [ + [1, 1, 1, 1, 2, 2, 2, 2], + [1, 1, 1, 1, 2, 2, 2, 2], + [1, 1, 1, 1, 2, 2, 2, 2], + [1, 1, 1, 1, 2, 2, 2, 2], + [1, 1, 1, 1, 2, 2, 2, 2], + [1, 1, 1, 1, 2, 2, 2, 2], + [1, 1, 1, 1, 2, 2, 2, 2], + [1, 1, 1, 1, 2, 2, 2, 2], + [1, 1, 1, 1, 2, 2, 2, 2], + ] + ) + ) gpu_output = cle.smooth_labels(gpu_input, radius=3) @@ -35,5 +44,4 @@ def test_smooth_labels_2d(): print(a) print(b) - assert (np.array_equal(a, b)) - + assert np.array_equal(a, b) From 57cc7a538afc9b01cc8b3d6f77bfec854dd1eb71 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Thu, 16 May 2024 11:19:59 +0200 Subject: [PATCH 04/16] Flake8 fix --- docs/source/conf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index edfad055..791875d8 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -68,7 +68,7 @@ } html_context = {} -if not "READTHEDOCS" in os.environ: +if "READTHEDOCS" not in os.environ: html_static_path = ["_static/"] html_js_files = ["debug.js"] @@ -92,6 +92,7 @@ html_static_path = ["_static"] + # Extensions to theme docs def setup(app): from sphinx.domains.python import PyField From 6a9c7fc75fff9caeb824347b4eb15f89163a0053 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Thu, 16 May 2024 13:42:19 +0200 Subject: [PATCH 05/16] update flake and pre-commit --- .flake8 | 14 ++++++++------ .pre-commit-config.yaml | 30 ++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/.flake8 b/.flake8 index f7429425..dbfe4404 100644 --- a/.flake8 +++ b/.flake8 @@ -1,9 +1,11 @@ [flake8] -# Ignore error codes that may conflict with Black -ignore = E203, E231, E501, W503, F401, F403 - -# Enable line length of 88, matching Black's default +ignore = E203, E231, W503 max-line-length = 88 - -# Exclude some directories and files from linting (customize as needed) exclude = .git, .venv, __pycache__, .eggs, *.egg, build, dist + +# Ignore F401 and F403 only for __init__.py files +per-file-ignores = + */__init__.py: F401, F403 + +# Warn if the complexity of a function exceeds 10 +max-complexity = 10 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 669edb92..a56f1b31 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,21 +4,43 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v3.2.0 hooks: + - id: check-toml + - id: check-yaml - id: trailing-whitespace - id: end-of-file-fixer - id: check-added-large-files - - id: check-toml - id: check-case-conflict + - id: check-merge-conflict + - id: check-symlinks - id: mixed-line-ending + - id: name-tests-test - # black - code formatting +# black - code formatting - repo: https://github.com/psf/black rev: 22.8.0 hooks: - id: black - # flake8 - linting +# isort - import sorting +- repo: https://github.com/pycqa/isort + rev: 5.12.0 + hooks: + - id: isort + +# flake8 - linting - repo: https://github.com/pycqa/flake8 rev: 5.0.4 hooks: - - id: flake8 + - id: flake8 + +# mypy - static type checking +- repo: https://github.com/pre-commit/mirrors-mypy + rev: v0.910 + hooks: + - id: mypy + +# pydocstyle - docstring style checking +- repo: https://github.com/pycqa/pydocstyle + rev: 6.1.1 + hooks: + - id: pydocstyle From 3dd8e38796d4ab06346d96366720d9ba97e7f005 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 16 May 2024 11:42:59 +0000 Subject: [PATCH 06/16] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/source/conf.py | 2 +- pyclesperanto/__init__.py | 25 ++++----------- pyclesperanto/_array.py | 11 ++++--- pyclesperanto/_core.py | 5 +-- pyclesperanto/_decorators.py | 9 +++--- pyclesperanto/_functionalities.py | 11 ++++--- pyclesperanto/_interroperability.py | 17 ++++------ pyclesperanto/_memory.py | 6 ++-- pyclesperanto/_operators.py | 32 +++++++++---------- pyclesperanto/_tier1.py | 8 +++-- pyclesperanto/_tier2.py | 8 +++-- pyclesperanto/_tier3.py | 8 +++-- pyclesperanto/_tier4.py | 8 +++-- pyclesperanto/_tier5.py | 8 +++-- pyclesperanto/_tier6.py | 8 +++-- pyclesperanto/_tier7.py | 8 +++-- pyclesperanto/_tier8.py | 8 +++-- tests/test_absolute.py | 3 +- tests/test_absolute_difference.py | 3 +- tests/test_add_image_and_scalar.py | 3 +- tests/test_add_images.py | 3 +- tests/test_add_images_weighted.py | 3 +- tests/test_affine_transform.py | 3 +- tests/test_array_device.py | 3 +- tests/test_array_equal.py | 3 +- tests/test_array_operators.py | 3 +- tests/test_binary_and.py | 3 +- tests/test_binary_edge_detection.py | 3 +- tests/test_binary_not.py | 3 +- tests/test_binary_or.py | 3 +- tests/test_binary_subtract.py | 3 +- tests/test_binary_xor.py | 3 +- tests/test_block_enumerate.py | 3 +- tests/test_bottom_hat_box.py | 3 +- tests/test_bottom_hat_sphere.py | 3 +- tests/test_bounding_box.py | 3 +- tests/test_clip.py | 3 +- tests/test_closing_box.py | 3 +- tests/test_closing_labels.py | 3 +- tests/test_closing_sphere.py | 3 +- tests/test_concatenate.py | 3 +- tests/test_connected_components_labeling.py | 3 +- tests/test_convolve.py | 3 +- tests/test_copy.py | 3 +- tests/test_count_touching_neighbors.py | 3 +- tests/test_create.py | 1 + tests/test_crop.py | 3 +- tests/test_crop_border.py | 3 +- tests/test_cubic_root.py | 3 +- tests/test_dask_compatibility.py | 3 +- tests/test_degrees_to_radians.py | 3 +- tests/test_detect_label_edges.py | 3 +- tests/test_detect_maxima_box.py | 3 +- tests/test_detect_minima_box.py | 3 +- tests/test_difference_of_gaussian.py | 3 +- tests/test_dilate_box.py | 3 +- tests/test_dilate_sphere.py | 3 +- tests/test_divide_images.py | 3 +- tests/test_divide_scalar_by_image.py | 3 +- tests/test_ellipsis.py | 3 +- tests/test_equal.py | 3 +- tests/test_equal_constant.py | 3 +- tests/test_erode_box.py | 3 +- tests/test_erode_labels.py | 3 +- tests/test_erode_sphere.py | 3 +- tests/test_eroded_otsu_labeling.py | 3 +- tests/test_exclude_labels.py | 3 +- tests/test_exclude_labels_on_edges.py | 3 +- tests/test_execute.py | 3 +- tests/test_exponential.py | 3 +- tests/test_extend_labeling_via_voronoi.py | 3 +- tests/test_extended_getitem.py | 3 +- tests/test_extended_setitem.py | 1 + tests/test_flag_existing_labels.py | 3 +- tests/test_flip.py | 3 +- tests/test_gamma_correction.py | 3 +- tests/test_gauss_otsu_labeling.py | 3 +- tests/test_gaussian_blur.py | 3 +- tests/test_generate_binary_overlap_matrix.py | 3 +- tests/test_generate_distance_matrix.py | 3 +- tests/test_gpu_switch.py | 1 + tests/test_gradient_x.py | 3 +- tests/test_gradient_y.py | 3 +- tests/test_gradient_z.py | 3 +- tests/test_greater.py | 3 +- tests/test_greater_constant.py | 3 +- tests/test_greater_or_equal.py | 3 +- tests/test_greater_or_equal_constant.py | 3 +- tests/test_hessian_eigenvalues.py | 3 +- tests/test_histogram.py | 3 +- tests/test_image.py | 2 +- tests/test_imshow.py | 6 ++-- tests/test_indexing.py | 3 +- tests/test_invert.py | 3 +- tests/test_iterator.py | 3 +- tests/test_jaccard_index.py | 3 +- tests/test_label_bounding_box.py | 3 +- tests/test_labelled_spots_to_pointlist.py | 3 +- tests/test_laplace_box.py | 3 +- tests/test_laplace_sphere.py | 3 +- tests/test_large_hessian_eigenvalue.py | 3 +- tests/test_local_cross_correlation.py | 3 +- tests/test_logarithm.py | 3 +- tests/test_mask.py | 3 +- tests/test_mask_label.py | 3 +- tests/test_masked_voronoi_labeling.py | 3 +- tests/test_maximum_box.py | 3 +- tests/test_maximum_image_and_scalar.py | 3 +- tests/test_maximum_images.py | 3 +- tests/test_maximum_of_all_pixels.py | 3 +- tests/test_maximum_sphere.py | 3 +- tests/test_maximum_x_projection.py | 3 +- tests/test_maximum_y_projection.py | 3 +- tests/test_maximum_z_projection.py | 3 +- tests/test_mean_box.py | 3 +- tests/test_mean_of_all_pixels.py | 3 +- tests/test_mean_sphere.py | 3 +- tests/test_mean_squared_error.py | 3 +- tests/test_mean_x_projection.py | 3 +- tests/test_mean_y_projection.py | 3 +- tests/test_mean_z_projection.py | 3 +- tests/test_median_box.py | 3 +- tests/test_median_sphere.py | 3 +- tests/test_minimum_box.py | 3 +- tests/test_minimum_image_and_scalar.py | 3 +- tests/test_minimum_images.py | 3 +- tests/test_minimum_of_all_pixels.py | 3 +- tests/test_minimum_of_masked_pixels.py | 3 +- tests/test_minimum_x_projection.py | 3 +- tests/test_minimum_y_projection.py | 3 +- tests/test_minimum_z_projection.py | 3 +- tests/test_modulo_images.py | 3 +- tests/test_morpho_on_label.py | 3 +- tests/test_multiply_image_and_scalar.py | 3 +- tests/test_multiply_images.py | 3 +- tests/test_multiply_matrix.py | 3 +- tests/test_nan_to_num.py | 1 + tests/test_nonzero_maximum_box.py | 3 +- tests/test_nonzero_maximum_sphere.py | 3 +- tests/test_nonzero_minimum_box.py | 3 +- tests/test_nonzero_minimum_sphere.py | 3 +- tests/test_not_equal.py | 3 +- tests/test_not_equal_constant.py | 3 +- tests/test_np_asarray.py | 3 +- tests/test_onlyzero_overwrite_maximum_box.py | 3 +- ...test_onlyzero_overwrite_maximum_diamond.py | 3 +- tests/test_opening_box.py | 3 +- tests/test_opening_labels.py | 3 +- tests/test_opening_sphere.py | 3 +- tests/test_operability.py | 3 +- tests/test_operators.py | 1 + tests/test_paste.py | 3 +- tests/test_power.py | 3 +- tests/test_power_images.py | 3 +- tests/test_push.py | 1 + tests/test_radians_to_degrees.py | 3 +- tests/test_range.py | 1 + tests/test_reciprocal.py | 3 +- tests/test_reduce_labels_to_label_edges.py | 3 +- tests/test_reduction.py | 3 +- tests/test_relabel_sequential.py | 3 +- tests/test_replace_intensities.py | 3 +- tests/test_replace_intensity.py | 3 +- tests/test_set.py | 3 +- tests/test_set_column.py | 3 +- tests/test_set_image_borders.py | 3 +- .../test_set_nonzero_pixels_to_pixelindex.py | 3 +- tests/test_set_plane.py | 3 +- tests/test_set_ramp_x.py | 3 +- tests/test_set_ramp_y.py | 3 +- tests/test_set_ramp_z.py | 3 +- tests/test_set_row.py | 3 +- tests/test_set_where_x_equals_y.py | 3 +- tests/test_set_where_x_greater_than_y.py | 3 +- tests/test_set_where_x_smaller_than_y.py | 3 +- tests/test_setitem.py | 1 + tests/test_sign.py | 3 +- tests/test_small_hessian_eigenvalue.py | 3 +- tests/test_smaller.py | 3 +- tests/test_smaller_constant.py | 3 +- tests/test_smaller_or_equal.py | 3 +- tests/test_smaller_or_equal_constant.py | 3 +- tests/test_smooth_labels.py | 3 +- tests/test_sobel.py | 3 +- tests/test_spots_to_pointlist.py | 3 +- tests/test_square.py | 3 +- tests/test_square_root.py | 3 +- tests/test_squared_difference.py | 3 +- tests/test_standard_deviation_box.py | 3 +- tests/test_standard_deviation_sphere.py | 3 +- tests/test_subtract_gaussian_background.py | 3 +- tests/test_subtract_image_from_scalar.py | 3 +- tests/test_subtract_images.py | 1 + tests/test_sum_of_all_pixels.py | 3 +- tests/test_sum_reduction.py | 3 +- tests/test_sum_x_projection.py | 3 +- tests/test_sum_y_projection.py | 3 +- tests/test_sum_z_projection.py | 3 +- tests/test_t.py | 3 +- tests/test_threshold_otsu.py | 3 +- tests/test_top_hat_box.py | 3 +- tests/test_top_hat_sphere.py | 3 +- tests/test_transform.py | 3 +- tests/test_transpose_xy.py | 3 +- tests/test_transpose_xz.py | 3 +- tests/test_transpose_yz.py | 3 +- tests/test_undefined_to_zero.py | 1 + tests/test_variance_box.py | 3 +- tests/test_variance_sphere.py | 3 +- tests/test_voronoi_labeling.py | 3 +- tests/test_voronoi_otsu_labeling.py | 3 +- 211 files changed, 471 insertions(+), 275 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 791875d8..f856f9e1 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -4,8 +4,8 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html import os -import sys import re +import sys from sphinx.locale import _ diff --git a/pyclesperanto/__init__.py b/pyclesperanto/__init__.py index 2c11ebb5..f76205e4 100644 --- a/pyclesperanto/__init__.py +++ b/pyclesperanto/__init__.py @@ -1,18 +1,10 @@ -from ._core import ( - gpu_info, - select_backend, - select_device, - get_device, - wait_for_kernel_to_finish, - list_available_devices, - list_available_backends, - default_initialisation, - Device, -) from ._array import Array, Image, is_image -from ._memory import create, create_like, push, pull -from ._functionalities import imshow, list_operations, execute, native_execute - +from ._core import (Device, default_initialisation, get_device, gpu_info, + list_available_backends, list_available_devices, + select_backend, select_device, wait_for_kernel_to_finish) +from ._functionalities import execute, imshow, list_operations, native_execute +from ._interroperability import * +from ._memory import create, create_like, pull, push from ._tier1 import * from ._tier2 import * from ._tier3 import * @@ -21,11 +13,8 @@ from ._tier6 import * from ._tier7 import * from ._tier8 import * -from ._interroperability import * - -from ._version import VERSION as __version__ from ._version import CLIC_VERSION as __clic_version__ from ._version import COMMON_ALIAS as __common_alias__ - +from ._version import VERSION as __version__ default_initialisation() diff --git a/pyclesperanto/_array.py b/pyclesperanto/_array.py index aa11d202..f51cdb2f 100644 --- a/pyclesperanto/_array.py +++ b/pyclesperanto/_array.py @@ -1,11 +1,12 @@ -from ._pyclesperanto import _Array as Array -from ._core import Device, get_device -from ._utils import _assert_supported_dtype -from . import _operators - from typing import Union + import numpy as np +from . import _operators +from ._core import Device, get_device +from ._pyclesperanto import _Array as Array +from ._utils import _assert_supported_dtype + def _prepare_array(arr) -> np.ndarray: """Converts a given array to a numpy array with C memory layout. diff --git a/pyclesperanto/_core.py b/pyclesperanto/_core.py index b48b90d6..95951a79 100644 --- a/pyclesperanto/_core.py +++ b/pyclesperanto/_core.py @@ -1,9 +1,10 @@ +import warnings from typing import Optional, Union + import numpy as np -import warnings -from ._pyclesperanto import _Device as Device from ._pyclesperanto import _BackendManager as BackendManager +from ._pyclesperanto import _Device as Device class _current_device: diff --git a/pyclesperanto/_decorators.py b/pyclesperanto/_decorators.py index 2fbb386d..2e32c58c 100644 --- a/pyclesperanto/_decorators.py +++ b/pyclesperanto/_decorators.py @@ -1,11 +1,12 @@ -from typing import Callable, Optional +import inspect from functools import wraps +from typing import Callable, Optional + from toolz import curry -import inspect -from ._memory import push -from ._array import is_image, Image +from ._array import Image, is_image from ._core import Device +from ._memory import push @curry diff --git a/pyclesperanto/_functionalities.py b/pyclesperanto/_functionalities.py index f346c30b..ab39bda2 100644 --- a/pyclesperanto/_functionalities.py +++ b/pyclesperanto/_functionalities.py @@ -1,12 +1,13 @@ from os import path -from typing import Optional, Union from pathlib import Path +from typing import Optional, Union + import numpy as np -from ._pyclesperanto import _execute, _native_execute from ._array import Array, Image -from ._memory import pull from ._core import Device, get_device +from ._memory import pull +from ._pyclesperanto import _execute, _native_execute def execute( @@ -215,8 +216,7 @@ def imshow( if labels: if not hasattr(imshow, "labels_cmap"): from matplotlib.colors import ListedColormap - from numpy.random import MT19937 - from numpy.random import RandomState, SeedSequence + from numpy.random import MT19937, RandomState, SeedSequence rs = RandomState(MT19937(SeedSequence(3))) lut = rs.rand(65537, 3) @@ -288,6 +288,7 @@ def operations( result = {} from inspect import getmembers, isfunction + import pyclesperanto as cle # retrieve all operations and cache the result for later reuse diff --git a/pyclesperanto/_interroperability.py b/pyclesperanto/_interroperability.py index 3087b039..f36a4cd4 100644 --- a/pyclesperanto/_interroperability.py +++ b/pyclesperanto/_interroperability.py @@ -9,22 +9,17 @@ # Deprecated aliases # -from ._array import Image +import numpy as np +from ._array import Image # pyclesperanto_prototype aliases +from ._core import gpu_info as cl_info from ._core import list_available_devices as available_device_names from ._core import wait_for_kernel_to_finish as set_wait_for_kernel_to_finish -from ._core import gpu_info as cl_info - - -# scikit-image aliases -from ._tier5 import connected_components_labeling as label - - # numpy operations aliases from ._memory import push as asarray - -import numpy as np +# scikit-image aliases +from ._tier5 import connected_components_labeling as label def clip(a, a_min, a_max, out=None): @@ -89,8 +84,8 @@ def power(x1, x2, out=None): def fabs(x, out=None): - from ._tier1 import absolute from ._memory import create + from ._tier1 import absolute x = asarray(x) if out: diff --git a/pyclesperanto/_memory.py b/pyclesperanto/_memory.py index 39d5f64d..dc637be2 100644 --- a/pyclesperanto/_memory.py +++ b/pyclesperanto/_memory.py @@ -1,11 +1,11 @@ import warnings +from typing import Optional, Tuple + +import numpy as np from ._array import Array, Image from ._core import Device, get_device -import numpy as np -from typing import Tuple, Optional - def create( dim, diff --git a/pyclesperanto/_operators.py b/pyclesperanto/_operators.py index f3e1be17..b9f691ba 100644 --- a/pyclesperanto/_operators.py +++ b/pyclesperanto/_operators.py @@ -1,10 +1,10 @@ -import numpy as np from typing import Optional, Union -from ._array import Array +import numpy as np -from ._utils import _compute_range, _process_ellipsis_into_slice, _trim_index_to_shape -from ._utils import _assert_supported_dtype +from ._array import Array +from ._utils import (_assert_supported_dtype, _compute_range, + _process_ellipsis_into_slice, _trim_index_to_shape) cl_buffer_datatype_dict = { bool: "bool", @@ -38,8 +38,8 @@ def _astype(self, dtype: type): if dtype == self.dtype: return self - from ._tier1 import copy from ._memory import create_like + from ._tier1 import copy result = create_like(self, dtype=dtype) copy(input_image=self, output_image=result) @@ -48,10 +48,9 @@ def _astype(self, dtype: type): def _max(self, axis: Optional[int] = None, out=None): """Return the maximum value in the Array, or along an axis if specified.""" + from ._tier1 import (maximum_x_projection, maximum_y_projection, + maximum_z_projection) from ._tier2 import maximum_of_all_pixels - from ._tier1 import maximum_x_projection - from ._tier1 import maximum_y_projection - from ._tier1 import maximum_z_projection if axis == 0: result = maximum_z_projection(self) @@ -73,10 +72,9 @@ def _max(self, axis: Optional[int] = None, out=None): def _min(self, axis: Optional[int] = None, out=None): """Return the minimum value in the Array, or along an axis if specified.""" + from ._tier1 import (minimum_x_projection, minimum_y_projection, + minimum_z_projection) from ._tier2 import minimum_of_all_pixels - from ._tier1 import minimum_x_projection - from ._tier1 import minimum_y_projection - from ._tier1 import minimum_z_projection if axis == 0: result = minimum_z_projection(self) @@ -96,10 +94,8 @@ def _min(self, axis: Optional[int] = None, out=None): def _sum(self, axis: Optional[int] = None, out=None): """Return the sum of the Array, or along an axis if specified.""" + from ._tier1 import sum_x_projection, sum_y_projection, sum_z_projection from ._tier2 import sum_of_all_pixels - from ._tier1 import sum_x_projection - from ._tier1 import sum_y_projection - from ._tier1 import sum_z_projection if axis == 0: result = sum_z_projection(self) @@ -438,8 +434,8 @@ def __getitem__(self, index): # if result is an Array, and one of the dimension is equal to 1 if result.shape != tuple(dst_shape): - from ._tier1 import transpose_xy, transpose_yz from ._memory import create + from ._tier1 import transpose_xy, transpose_yz tmp = create( dst_shape, @@ -589,9 +585,10 @@ def __plt_to_png__(self): ------- In memory binary stream containing a PNG matplotlib image. """ - import matplotlib.pyplot as plt from io import BytesIO + import matplotlib.pyplot as plt + with BytesIO() as file_obj: plt.savefig(file_obj, format="png") plt.close() # supress plot output @@ -613,8 +610,9 @@ def __repr_html__(self): ------- HTML text with the image and some properties. """ - import numpy as np import matplotlib.pyplot as plt + import numpy as np + from ._functionalities import imshow size_in_pixels = np.prod(self.size) diff --git a/pyclesperanto/_tier1.py b/pyclesperanto/_tier1.py index a66430e5..c3cac936 100644 --- a/pyclesperanto/_tier1.py +++ b/pyclesperanto/_tier1.py @@ -3,11 +3,13 @@ # Do not edit manually. # -from ._core import Device +import warnings + +import numpy as np + from ._array import Image +from ._core import Device from ._decorators import plugin_function -import numpy as np -import warnings @plugin_function(category=["filter", "in assistant", "bia-bob-suggestion"]) diff --git a/pyclesperanto/_tier2.py b/pyclesperanto/_tier2.py index 3d9eb520..11eee649 100644 --- a/pyclesperanto/_tier2.py +++ b/pyclesperanto/_tier2.py @@ -3,11 +3,13 @@ # Do not edit manually. # -from ._core import Device +import warnings + +import numpy as np + from ._array import Image +from ._core import Device from ._decorators import plugin_function -import numpy as np -import warnings @plugin_function(category=["combine", "in assistant", "bia-bob-suggestion"]) diff --git a/pyclesperanto/_tier3.py b/pyclesperanto/_tier3.py index b37f05fd..58c5619a 100644 --- a/pyclesperanto/_tier3.py +++ b/pyclesperanto/_tier3.py @@ -3,11 +3,13 @@ # Do not edit manually. # -from ._core import Device +import warnings + +import numpy as np + from ._array import Image +from ._core import Device from ._decorators import plugin_function -import numpy as np -import warnings @plugin_function diff --git a/pyclesperanto/_tier4.py b/pyclesperanto/_tier4.py index e62e98af..5063e7e7 100644 --- a/pyclesperanto/_tier4.py +++ b/pyclesperanto/_tier4.py @@ -3,11 +3,13 @@ # Do not edit manually. # -from ._core import Device +import warnings + +import numpy as np + from ._array import Image +from ._core import Device from ._decorators import plugin_function -import numpy as np -import warnings @plugin_function diff --git a/pyclesperanto/_tier5.py b/pyclesperanto/_tier5.py index 6786b31e..df465472 100644 --- a/pyclesperanto/_tier5.py +++ b/pyclesperanto/_tier5.py @@ -3,11 +3,13 @@ # Do not edit manually. # -from ._core import Device +import warnings + +import numpy as np + from ._array import Image +from ._core import Device from ._decorators import plugin_function -import numpy as np -import warnings @plugin_function(category=["combine"]) diff --git a/pyclesperanto/_tier6.py b/pyclesperanto/_tier6.py index 09424071..de8bbc7c 100644 --- a/pyclesperanto/_tier6.py +++ b/pyclesperanto/_tier6.py @@ -3,11 +3,13 @@ # Do not edit manually. # -from ._core import Device +import warnings + +import numpy as np + from ._array import Image +from ._core import Device from ._decorators import plugin_function -import numpy as np -import warnings @plugin_function(category=["label processing", "in assistant", "bia-bob-suggestion"]) diff --git a/pyclesperanto/_tier7.py b/pyclesperanto/_tier7.py index 54032b91..49f08323 100644 --- a/pyclesperanto/_tier7.py +++ b/pyclesperanto/_tier7.py @@ -3,11 +3,13 @@ # Do not edit manually. # -from ._core import Device +import warnings + +import numpy as np + from ._array import Image +from ._core import Device from ._decorators import plugin_function -import numpy as np -import warnings @plugin_function diff --git a/pyclesperanto/_tier8.py b/pyclesperanto/_tier8.py index 53833d56..c6014caa 100644 --- a/pyclesperanto/_tier8.py +++ b/pyclesperanto/_tier8.py @@ -3,11 +3,13 @@ # Do not edit manually. # -from ._core import Device +import warnings + +import numpy as np + from ._array import Image +from ._core import Device from ._decorators import plugin_function -import numpy as np -import warnings @plugin_function(category=["label processing", "in assistant", "bia-bob-suggestion"]) diff --git a/tests/test_absolute.py b/tests/test_absolute.py index da5f1b36..bcbdaaa4 100644 --- a/tests/test_absolute.py +++ b/tests/test_absolute.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_absolute_difference.py b/tests/test_absolute_difference.py index cae25598..1d6f868c 100644 --- a/tests/test_absolute_difference.py +++ b/tests/test_absolute_difference.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_add_image_and_scalar.py b/tests/test_add_image_and_scalar.py index 647574e1..2fc844ca 100644 --- a/tests/test_add_image_and_scalar.py +++ b/tests/test_add_image_and_scalar.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_add_images.py b/tests/test_add_images.py index 29034156..8f4f8199 100755 --- a/tests/test_add_images.py +++ b/tests/test_add_images.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") input1 = np.asarray([1, 2, 3]) diff --git a/tests/test_add_images_weighted.py b/tests/test_add_images_weighted.py index 71976951..dc70f024 100644 --- a/tests/test_add_images_weighted.py +++ b/tests/test_add_images_weighted.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_affine_transform.py b/tests/test_affine_transform.py index e1101c19..10d40c90 100644 --- a/tests/test_affine_transform.py +++ b/tests/test_affine_transform.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + def test_affine_transform_translate(): source = cle.push( diff --git a/tests/test_array_device.py b/tests/test_array_device.py index 4f165f97..230a00a8 100644 --- a/tests/test_array_device.py +++ b/tests/test_array_device.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + def test_zeros_arrays(): gpu_arr = cle.Array.zeros((10, 10)) diff --git a/tests/test_array_equal.py b/tests/test_array_equal.py index 4db9b023..9e97c55a 100644 --- a/tests/test_array_equal.py +++ b/tests/test_array_equal.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_array_operators.py b/tests/test_array_operators.py index 163d5fd3..8e433c7d 100644 --- a/tests/test_array_operators.py +++ b/tests/test_array_operators.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") arr1 = cle.push(np.asarray([1, 2, 3, 4, 5])) diff --git a/tests/test_binary_and.py b/tests/test_binary_and.py index 640240db..d4670317 100644 --- a/tests/test_binary_and.py +++ b/tests/test_binary_and.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_binary_edge_detection.py b/tests/test_binary_edge_detection.py index c2e8bb07..8dce5b7a 100644 --- a/tests/test_binary_edge_detection.py +++ b/tests/test_binary_edge_detection.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_binary_not.py b/tests/test_binary_not.py index 302a9d01..6ea5f0d5 100644 --- a/tests/test_binary_not.py +++ b/tests/test_binary_not.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_binary_or.py b/tests/test_binary_or.py index dfc46bd1..a283998d 100644 --- a/tests/test_binary_or.py +++ b/tests/test_binary_or.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_binary_subtract.py b/tests/test_binary_subtract.py index cef902b3..03883b2a 100644 --- a/tests/test_binary_subtract.py +++ b/tests/test_binary_subtract.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_binary_xor.py b/tests/test_binary_xor.py index 4c148b6e..f2046d7e 100644 --- a/tests/test_binary_xor.py +++ b/tests/test_binary_xor.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_block_enumerate.py b/tests/test_block_enumerate.py index 7f75e466..9d28dbba 100644 --- a/tests/test_block_enumerate.py +++ b/tests/test_block_enumerate.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") source = np.asarray([0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0]) diff --git a/tests/test_bottom_hat_box.py b/tests/test_bottom_hat_box.py index 381576d5..ae335b0f 100644 --- a/tests/test_bottom_hat_box.py +++ b/tests/test_bottom_hat_box.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_bottom_hat_sphere.py b/tests/test_bottom_hat_sphere.py index a58d014f..5ddd0857 100644 --- a/tests/test_bottom_hat_sphere.py +++ b/tests/test_bottom_hat_sphere.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_bounding_box.py b/tests/test_bounding_box.py index e220d5a0..f03cce61 100644 --- a/tests/test_bounding_box.py +++ b/tests/test_bounding_box.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + def test_bounding_box_2d(): diff --git a/tests/test_clip.py b/tests/test_clip.py index 9dd950e9..6b05ee09 100644 --- a/tests/test_clip.py +++ b/tests/test_clip.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_closing_box.py b/tests/test_closing_box.py index 9dcb8393..b2f65e48 100644 --- a/tests/test_closing_box.py +++ b/tests/test_closing_box.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_closing_labels.py b/tests/test_closing_labels.py index f94608f5..48e4288f 100644 --- a/tests/test_closing_labels.py +++ b/tests/test_closing_labels.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_closing_sphere.py b/tests/test_closing_sphere.py index 063469f5..2d396d6a 100644 --- a/tests/test_closing_sphere.py +++ b/tests/test_closing_sphere.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_concatenate.py b/tests/test_concatenate.py index 51230a37..72fdc304 100644 --- a/tests/test_concatenate.py +++ b/tests/test_concatenate.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + def test_concate_along_x(): test1 = cle.push(np.asarray([[1, 1], [1, 1]])) diff --git a/tests/test_connected_components_labeling.py b/tests/test_connected_components_labeling.py index 8864175a..96aad143 100644 --- a/tests/test_connected_components_labeling.py +++ b/tests/test_connected_components_labeling.py @@ -1,6 +1,7 @@ +import numpy as np from skimage.io import imread + import pyclesperanto as cle -import numpy as np cle.select_device("TX") diff --git a/tests/test_convolve.py b/tests/test_convolve.py index c3360fb8..df5b9334 100644 --- a/tests/test_convolve.py +++ b/tests/test_convolve.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_copy.py b/tests/test_copy.py index 28f96cef..92b024fd 100644 --- a/tests/test_copy.py +++ b/tests/test_copy.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_count_touching_neighbors.py b/tests/test_count_touching_neighbors.py index 76f52030..bff95e56 100644 --- a/tests/test_count_touching_neighbors.py +++ b/tests/test_count_touching_neighbors.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_create.py b/tests/test_create.py index 3bc8cf26..515b31bc 100644 --- a/tests/test_create.py +++ b/tests/test_create.py @@ -1,4 +1,5 @@ import numpy as np + import pyclesperanto as cle cle.select_device("TX") diff --git a/tests/test_crop.py b/tests/test_crop.py index 0e32eae4..2ff29eb6 100644 --- a/tests/test_crop.py +++ b/tests/test_crop.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_crop_border.py b/tests/test_crop_border.py index d1457514..f1d91eb5 100644 --- a/tests/test_crop_border.py +++ b/tests/test_crop_border.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_cubic_root.py b/tests/test_cubic_root.py index a9aca9a2..0361e13d 100644 --- a/tests/test_cubic_root.py +++ b/tests/test_cubic_root.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_dask_compatibility.py b/tests/test_dask_compatibility.py index a4a7bb64..e251c92a 100644 --- a/tests/test_dask_compatibility.py +++ b/tests/test_dask_compatibility.py @@ -1,7 +1,8 @@ -import pyclesperanto as cle import numpy as np import pytest +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_degrees_to_radians.py b/tests/test_degrees_to_radians.py index 9310aeba..6bf44b4e 100644 --- a/tests/test_degrees_to_radians.py +++ b/tests/test_degrees_to_radians.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_detect_label_edges.py b/tests/test_detect_label_edges.py index 7329ec3b..815afc0d 100644 --- a/tests/test_detect_label_edges.py +++ b/tests/test_detect_label_edges.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_detect_maxima_box.py b/tests/test_detect_maxima_box.py index 27ab7e2f..603e1c35 100644 --- a/tests/test_detect_maxima_box.py +++ b/tests/test_detect_maxima_box.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_detect_minima_box.py b/tests/test_detect_minima_box.py index 680da709..e2241aa1 100644 --- a/tests/test_detect_minima_box.py +++ b/tests/test_detect_minima_box.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_difference_of_gaussian.py b/tests/test_difference_of_gaussian.py index c265c92c..ea3ce0f9 100644 --- a/tests/test_difference_of_gaussian.py +++ b/tests/test_difference_of_gaussian.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_dilate_box.py b/tests/test_dilate_box.py index 719b892b..2896b526 100644 --- a/tests/test_dilate_box.py +++ b/tests/test_dilate_box.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_dilate_sphere.py b/tests/test_dilate_sphere.py index 83ecb8ab..979b7b44 100644 --- a/tests/test_dilate_sphere.py +++ b/tests/test_dilate_sphere.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_divide_images.py b/tests/test_divide_images.py index 11d25f73..5e73c2e7 100644 --- a/tests/test_divide_images.py +++ b/tests/test_divide_images.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_divide_scalar_by_image.py b/tests/test_divide_scalar_by_image.py index 4141f0ab..0cbf6691 100644 --- a/tests/test_divide_scalar_by_image.py +++ b/tests/test_divide_scalar_by_image.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_ellipsis.py b/tests/test_ellipsis.py index c48ab727..8123778e 100644 --- a/tests/test_ellipsis.py +++ b/tests/test_ellipsis.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_equal.py b/tests/test_equal.py index c408d03c..7ef7c455 100644 --- a/tests/test_equal.py +++ b/tests/test_equal.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_equal_constant.py b/tests/test_equal_constant.py index d5f0b02e..76d1fe6e 100644 --- a/tests/test_equal_constant.py +++ b/tests/test_equal_constant.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_erode_box.py b/tests/test_erode_box.py index ca5195e4..90d0cc26 100644 --- a/tests/test_erode_box.py +++ b/tests/test_erode_box.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_erode_labels.py b/tests/test_erode_labels.py index ad3fe099..5322ee01 100644 --- a/tests/test_erode_labels.py +++ b/tests/test_erode_labels.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_erode_sphere.py b/tests/test_erode_sphere.py index 3907c466..24a585a0 100644 --- a/tests/test_erode_sphere.py +++ b/tests/test_erode_sphere.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_eroded_otsu_labeling.py b/tests/test_eroded_otsu_labeling.py index d685ad57..ac505ef4 100644 --- a/tests/test_eroded_otsu_labeling.py +++ b/tests/test_eroded_otsu_labeling.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + def test_eroded_otsu_labeling(): diff --git a/tests/test_exclude_labels.py b/tests/test_exclude_labels.py index f93834d1..0906afa7 100644 --- a/tests/test_exclude_labels.py +++ b/tests/test_exclude_labels.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_exclude_labels_on_edges.py b/tests/test_exclude_labels_on_edges.py index 63310ac1..702b1831 100644 --- a/tests/test_exclude_labels_on_edges.py +++ b/tests/test_exclude_labels_on_edges.py @@ -1,7 +1,8 @@ -import pyclesperanto as cle import numpy as np from skimage.io import imread +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_execute.py b/tests/test_execute.py index 73118841..8f4d9851 100644 --- a/tests/test_execute.py +++ b/tests/test_execute.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + absolute_ocl = """ __constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST; diff --git a/tests/test_exponential.py b/tests/test_exponential.py index d4902ed5..ec6a6682 100644 --- a/tests/test_exponential.py +++ b/tests/test_exponential.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_extend_labeling_via_voronoi.py b/tests/test_extend_labeling_via_voronoi.py index 4ad69b4f..11aad11b 100644 --- a/tests/test_extend_labeling_via_voronoi.py +++ b/tests/test_extend_labeling_via_voronoi.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_extended_getitem.py b/tests/test_extended_getitem.py index 5f4c2452..0c781f43 100644 --- a/tests/test_extended_getitem.py +++ b/tests/test_extended_getitem.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_extended_setitem.py b/tests/test_extended_setitem.py index e79fd80e..55a9c1ae 100644 --- a/tests/test_extended_setitem.py +++ b/tests/test_extended_setitem.py @@ -1,4 +1,5 @@ import numpy as np + import pyclesperanto as cle cle.select_device("TX") diff --git a/tests/test_flag_existing_labels.py b/tests/test_flag_existing_labels.py index 3e6c40e9..5e86b56e 100644 --- a/tests/test_flag_existing_labels.py +++ b/tests/test_flag_existing_labels.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_flip.py b/tests/test_flip.py index 489a9027..89f823f4 100644 --- a/tests/test_flip.py +++ b/tests/test_flip.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_gamma_correction.py b/tests/test_gamma_correction.py index 067d912a..93410f7a 100644 --- a/tests/test_gamma_correction.py +++ b/tests/test_gamma_correction.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_gauss_otsu_labeling.py b/tests/test_gauss_otsu_labeling.py index bce2a79b..0eb78d26 100644 --- a/tests/test_gauss_otsu_labeling.py +++ b/tests/test_gauss_otsu_labeling.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + def test_gauss_otsu_labeling(): diff --git a/tests/test_gaussian_blur.py b/tests/test_gaussian_blur.py index b8449c5d..61190a5b 100644 --- a/tests/test_gaussian_blur.py +++ b/tests/test_gaussian_blur.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_generate_binary_overlap_matrix.py b/tests/test_generate_binary_overlap_matrix.py index b9fdda37..db5e41a3 100644 --- a/tests/test_generate_binary_overlap_matrix.py +++ b/tests/test_generate_binary_overlap_matrix.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_generate_distance_matrix.py b/tests/test_generate_distance_matrix.py index df0a27ef..76c37943 100644 --- a/tests/test_generate_distance_matrix.py +++ b/tests/test_generate_distance_matrix.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_gpu_switch.py b/tests/test_gpu_switch.py index 867ae39b..9d8d22cb 100644 --- a/tests/test_gpu_switch.py +++ b/tests/test_gpu_switch.py @@ -1,4 +1,5 @@ import numpy as np + import pyclesperanto as cle cle.select_device("TX") diff --git a/tests/test_gradient_x.py b/tests/test_gradient_x.py index 7d4acf8c..c99b2aae 100644 --- a/tests/test_gradient_x.py +++ b/tests/test_gradient_x.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_gradient_y.py b/tests/test_gradient_y.py index 96900ebf..e87d2011 100644 --- a/tests/test_gradient_y.py +++ b/tests/test_gradient_y.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_gradient_z.py b/tests/test_gradient_z.py index 1a5e4cab..10bc6902 100644 --- a/tests/test_gradient_z.py +++ b/tests/test_gradient_z.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_greater.py b/tests/test_greater.py index cf8c9edd..0e4569b4 100644 --- a/tests/test_greater.py +++ b/tests/test_greater.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_greater_constant.py b/tests/test_greater_constant.py index 0fd99f34..6cddec44 100644 --- a/tests/test_greater_constant.py +++ b/tests/test_greater_constant.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_greater_or_equal.py b/tests/test_greater_or_equal.py index 63d4649c..a98f5769 100644 --- a/tests/test_greater_or_equal.py +++ b/tests/test_greater_or_equal.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_greater_or_equal_constant.py b/tests/test_greater_or_equal_constant.py index ebed3435..db670ae9 100644 --- a/tests/test_greater_or_equal_constant.py +++ b/tests/test_greater_or_equal_constant.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_hessian_eigenvalues.py b/tests/test_hessian_eigenvalues.py index c4f0d64c..8ae88e36 100644 --- a/tests/test_hessian_eigenvalues.py +++ b/tests/test_hessian_eigenvalues.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_histogram.py b/tests/test_histogram.py index 07a9927d..9f368b47 100644 --- a/tests/test_histogram.py +++ b/tests/test_histogram.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_image.py b/tests/test_image.py index 7410795a..c8de321b 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -1,5 +1,5 @@ -import pytest import numpy as np +import pytest import pyclesperanto as cle diff --git a/tests/test_imshow.py b/tests/test_imshow.py index 6a8a1e19..51e22fdc 100644 --- a/tests/test_imshow.py +++ b/tests/test_imshow.py @@ -1,7 +1,9 @@ +from unittest.mock import patch + import matplotlib.pyplot as plt -import pyclesperanto as cle import numpy as np -from unittest.mock import patch + +import pyclesperanto as cle @patch("matplotlib.pyplot.show") diff --git a/tests/test_indexing.py b/tests/test_indexing.py index cf6e58c3..17e4c135 100644 --- a/tests/test_indexing.py +++ b/tests/test_indexing.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_invert.py b/tests/test_invert.py index 9c64cd0d..69b8b804 100644 --- a/tests/test_invert.py +++ b/tests/test_invert.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_iterator.py b/tests/test_iterator.py index d1e6070c..42bcf283 100644 --- a/tests/test_iterator.py +++ b/tests/test_iterator.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_jaccard_index.py b/tests/test_jaccard_index.py index 7dfbcf10..264a520c 100644 --- a/tests/test_jaccard_index.py +++ b/tests/test_jaccard_index.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_label_bounding_box.py b/tests/test_label_bounding_box.py index b00fb121..43a95b8b 100644 --- a/tests/test_label_bounding_box.py +++ b/tests/test_label_bounding_box.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + def test_label_bounding_box_2d(): diff --git a/tests/test_labelled_spots_to_pointlist.py b/tests/test_labelled_spots_to_pointlist.py index eb571139..17e905d0 100644 --- a/tests/test_labelled_spots_to_pointlist.py +++ b/tests/test_labelled_spots_to_pointlist.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_laplace_box.py b/tests/test_laplace_box.py index eb613cd5..4f4f4c8e 100644 --- a/tests/test_laplace_box.py +++ b/tests/test_laplace_box.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_laplace_sphere.py b/tests/test_laplace_sphere.py index e6f8dad2..2759cac9 100644 --- a/tests/test_laplace_sphere.py +++ b/tests/test_laplace_sphere.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_large_hessian_eigenvalue.py b/tests/test_large_hessian_eigenvalue.py index 9ef12ca3..439d4aab 100644 --- a/tests/test_large_hessian_eigenvalue.py +++ b/tests/test_large_hessian_eigenvalue.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_local_cross_correlation.py b/tests/test_local_cross_correlation.py index 7e3e6893..0e3ef941 100644 --- a/tests/test_local_cross_correlation.py +++ b/tests/test_local_cross_correlation.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_logarithm.py b/tests/test_logarithm.py index 348902c3..a480f0fa 100644 --- a/tests/test_logarithm.py +++ b/tests/test_logarithm.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_mask.py b/tests/test_mask.py index 4d967967..2a297930 100644 --- a/tests/test_mask.py +++ b/tests/test_mask.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_mask_label.py b/tests/test_mask_label.py index 9516b2ce..4482982e 100644 --- a/tests/test_mask_label.py +++ b/tests/test_mask_label.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_masked_voronoi_labeling.py b/tests/test_masked_voronoi_labeling.py index 960c387d..5920a144 100644 --- a/tests/test_masked_voronoi_labeling.py +++ b/tests/test_masked_voronoi_labeling.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_maximum_box.py b/tests/test_maximum_box.py index f67870c6..c6026bbd 100644 --- a/tests/test_maximum_box.py +++ b/tests/test_maximum_box.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_maximum_image_and_scalar.py b/tests/test_maximum_image_and_scalar.py index 3aa6ed58..ffee596d 100644 --- a/tests/test_maximum_image_and_scalar.py +++ b/tests/test_maximum_image_and_scalar.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_maximum_images.py b/tests/test_maximum_images.py index 3722d972..6bc84d61 100644 --- a/tests/test_maximum_images.py +++ b/tests/test_maximum_images.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_maximum_of_all_pixels.py b/tests/test_maximum_of_all_pixels.py index a9cb85ec..d753b27a 100644 --- a/tests/test_maximum_of_all_pixels.py +++ b/tests/test_maximum_of_all_pixels.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_maximum_sphere.py b/tests/test_maximum_sphere.py index b6a29ee1..d805610a 100644 --- a/tests/test_maximum_sphere.py +++ b/tests/test_maximum_sphere.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_maximum_x_projection.py b/tests/test_maximum_x_projection.py index 9a3de0a4..79c9a8de 100644 --- a/tests/test_maximum_x_projection.py +++ b/tests/test_maximum_x_projection.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_maximum_y_projection.py b/tests/test_maximum_y_projection.py index 83a8aa1b..9d7606ec 100644 --- a/tests/test_maximum_y_projection.py +++ b/tests/test_maximum_y_projection.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_maximum_z_projection.py b/tests/test_maximum_z_projection.py index df089977..b781cb78 100644 --- a/tests/test_maximum_z_projection.py +++ b/tests/test_maximum_z_projection.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") test1 = cle.push( diff --git a/tests/test_mean_box.py b/tests/test_mean_box.py index 1809b690..7ff05547 100644 --- a/tests/test_mean_box.py +++ b/tests/test_mean_box.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_mean_of_all_pixels.py b/tests/test_mean_of_all_pixels.py index dcdf8668..3f9fc609 100644 --- a/tests/test_mean_of_all_pixels.py +++ b/tests/test_mean_of_all_pixels.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_mean_sphere.py b/tests/test_mean_sphere.py index 5916c011..88fa9d61 100644 --- a/tests/test_mean_sphere.py +++ b/tests/test_mean_sphere.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_mean_squared_error.py b/tests/test_mean_squared_error.py index 00375107..bb2278d7 100644 --- a/tests/test_mean_squared_error.py +++ b/tests/test_mean_squared_error.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_mean_x_projection.py b/tests/test_mean_x_projection.py index 8a1576dc..33fef83e 100644 --- a/tests/test_mean_x_projection.py +++ b/tests/test_mean_x_projection.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_mean_y_projection.py b/tests/test_mean_y_projection.py index 702c624d..d1e8a93d 100644 --- a/tests/test_mean_y_projection.py +++ b/tests/test_mean_y_projection.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_mean_z_projection.py b/tests/test_mean_z_projection.py index 44bdf5f2..2d7ba0c4 100644 --- a/tests/test_mean_z_projection.py +++ b/tests/test_mean_z_projection.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_median_box.py b/tests/test_median_box.py index 3763369a..1f4fc976 100644 --- a/tests/test_median_box.py +++ b/tests/test_median_box.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_median_sphere.py b/tests/test_median_sphere.py index 971e7aa8..b96e0959 100644 --- a/tests/test_median_sphere.py +++ b/tests/test_median_sphere.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_minimum_box.py b/tests/test_minimum_box.py index fc8f65e3..cb7fbb26 100644 --- a/tests/test_minimum_box.py +++ b/tests/test_minimum_box.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_minimum_image_and_scalar.py b/tests/test_minimum_image_and_scalar.py index ae8b413a..d992e913 100644 --- a/tests/test_minimum_image_and_scalar.py +++ b/tests/test_minimum_image_and_scalar.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_minimum_images.py b/tests/test_minimum_images.py index 5e88efb3..32451135 100644 --- a/tests/test_minimum_images.py +++ b/tests/test_minimum_images.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_minimum_of_all_pixels.py b/tests/test_minimum_of_all_pixels.py index 53365e97..ee69063c 100644 --- a/tests/test_minimum_of_all_pixels.py +++ b/tests/test_minimum_of_all_pixels.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_minimum_of_masked_pixels.py b/tests/test_minimum_of_masked_pixels.py index 3125727b..d8b1ca3e 100644 --- a/tests/test_minimum_of_masked_pixels.py +++ b/tests/test_minimum_of_masked_pixels.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_minimum_x_projection.py b/tests/test_minimum_x_projection.py index f2caf664..6e71011f 100644 --- a/tests/test_minimum_x_projection.py +++ b/tests/test_minimum_x_projection.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_minimum_y_projection.py b/tests/test_minimum_y_projection.py index 9d5bb28d..3b4b5a3a 100644 --- a/tests/test_minimum_y_projection.py +++ b/tests/test_minimum_y_projection.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_minimum_z_projection.py b/tests/test_minimum_z_projection.py index 2732c340..b6621ec4 100644 --- a/tests/test_minimum_z_projection.py +++ b/tests/test_minimum_z_projection.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_modulo_images.py b/tests/test_modulo_images.py index 3db2dfcf..162b751c 100644 --- a/tests/test_modulo_images.py +++ b/tests/test_modulo_images.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_morpho_on_label.py b/tests/test_morpho_on_label.py index e2b73809..42ad56f3 100644 --- a/tests/test_morpho_on_label.py +++ b/tests/test_morpho_on_label.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + def test_erode_connected_labels_2d(): diff --git a/tests/test_multiply_image_and_scalar.py b/tests/test_multiply_image_and_scalar.py index b94d9e09..b92d1696 100644 --- a/tests/test_multiply_image_and_scalar.py +++ b/tests/test_multiply_image_and_scalar.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_multiply_images.py b/tests/test_multiply_images.py index 2816089c..c87496d9 100644 --- a/tests/test_multiply_images.py +++ b/tests/test_multiply_images.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_multiply_matrix.py b/tests/test_multiply_matrix.py index 92ad7202..1916f978 100644 --- a/tests/test_multiply_matrix.py +++ b/tests/test_multiply_matrix.py @@ -1,5 +1,6 @@ -import pytest import numpy as np +import pytest + import pyclesperanto as cle cle.select_device("TX") diff --git a/tests/test_nan_to_num.py b/tests/test_nan_to_num.py index 12096707..b98c8d77 100644 --- a/tests/test_nan_to_num.py +++ b/tests/test_nan_to_num.py @@ -1,4 +1,5 @@ import numpy as np + import pyclesperanto as cle cle.select_device("TX") diff --git a/tests/test_nonzero_maximum_box.py b/tests/test_nonzero_maximum_box.py index 0312afbe..e25023e0 100644 --- a/tests/test_nonzero_maximum_box.py +++ b/tests/test_nonzero_maximum_box.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_nonzero_maximum_sphere.py b/tests/test_nonzero_maximum_sphere.py index 6b3147ef..51893770 100644 --- a/tests/test_nonzero_maximum_sphere.py +++ b/tests/test_nonzero_maximum_sphere.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_nonzero_minimum_box.py b/tests/test_nonzero_minimum_box.py index 349fa85f..7c8d9354 100644 --- a/tests/test_nonzero_minimum_box.py +++ b/tests/test_nonzero_minimum_box.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_nonzero_minimum_sphere.py b/tests/test_nonzero_minimum_sphere.py index eee88e08..a0cdcf76 100644 --- a/tests/test_nonzero_minimum_sphere.py +++ b/tests/test_nonzero_minimum_sphere.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_not_equal.py b/tests/test_not_equal.py index cb63eff1..44e78fdd 100644 --- a/tests/test_not_equal.py +++ b/tests/test_not_equal.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_not_equal_constant.py b/tests/test_not_equal_constant.py index 2591a774..def70048 100644 --- a/tests/test_not_equal_constant.py +++ b/tests/test_not_equal_constant.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_np_asarray.py b/tests/test_np_asarray.py index 7e3964cc..c875537d 100644 --- a/tests/test_np_asarray.py +++ b/tests/test_np_asarray.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_onlyzero_overwrite_maximum_box.py b/tests/test_onlyzero_overwrite_maximum_box.py index 8f6d4fd5..954d7108 100644 --- a/tests/test_onlyzero_overwrite_maximum_box.py +++ b/tests/test_onlyzero_overwrite_maximum_box.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_onlyzero_overwrite_maximum_diamond.py b/tests/test_onlyzero_overwrite_maximum_diamond.py index ce8b37de..204e2bf2 100644 --- a/tests/test_onlyzero_overwrite_maximum_diamond.py +++ b/tests/test_onlyzero_overwrite_maximum_diamond.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_opening_box.py b/tests/test_opening_box.py index cec93512..9130af75 100644 --- a/tests/test_opening_box.py +++ b/tests/test_opening_box.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_opening_labels.py b/tests/test_opening_labels.py index c0489592..62c2177c 100644 --- a/tests/test_opening_labels.py +++ b/tests/test_opening_labels.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_opening_sphere.py b/tests/test_opening_sphere.py index 9f951dab..ae53bb56 100644 --- a/tests/test_opening_sphere.py +++ b/tests/test_opening_sphere.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_operability.py b/tests/test_operability.py index 7de8ea5a..c7e16c77 100644 --- a/tests/test_operability.py +++ b/tests/test_operability.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + def test_mod(): a = np.array([1, 2, 3, 4, 5]).astype(float) diff --git a/tests/test_operators.py b/tests/test_operators.py index ce7d4b8d..c87289f2 100644 --- a/tests/test_operators.py +++ b/tests/test_operators.py @@ -1,4 +1,5 @@ import numpy as np + import pyclesperanto as cle cle.select_device("TX") diff --git a/tests/test_paste.py b/tests/test_paste.py index 964ac0a5..c2d2a4cf 100644 --- a/tests/test_paste.py +++ b/tests/test_paste.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_power.py b/tests/test_power.py index 12439281..04223f7c 100644 --- a/tests/test_power.py +++ b/tests/test_power.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_power_images.py b/tests/test_power_images.py index 477df9c7..18babfa0 100644 --- a/tests/test_power_images.py +++ b/tests/test_power_images.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_push.py b/tests/test_push.py index 2aaefe08..c343df00 100644 --- a/tests/test_push.py +++ b/tests/test_push.py @@ -1,4 +1,5 @@ import numpy as np + import pyclesperanto as cle cle.select_device("TX") diff --git a/tests/test_radians_to_degrees.py b/tests/test_radians_to_degrees.py index 7b2034a5..4df48fe3 100644 --- a/tests/test_radians_to_degrees.py +++ b/tests/test_radians_to_degrees.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_range.py b/tests/test_range.py index 1c022ce5..8ad0128d 100644 --- a/tests/test_range.py +++ b/tests/test_range.py @@ -1,4 +1,5 @@ import numpy as np + import pyclesperanto as cle cle.select_device("TX") diff --git a/tests/test_reciprocal.py b/tests/test_reciprocal.py index f0178c89..ff9f2ea6 100644 --- a/tests/test_reciprocal.py +++ b/tests/test_reciprocal.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_reduce_labels_to_label_edges.py b/tests/test_reduce_labels_to_label_edges.py index bc557ce1..fdce1c8d 100644 --- a/tests/test_reduce_labels_to_label_edges.py +++ b/tests/test_reduce_labels_to_label_edges.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + def test_reduce_labels_to_label_edges(): test = np.asarray( diff --git a/tests/test_reduction.py b/tests/test_reduction.py index 32d20d5f..989325dc 100644 --- a/tests/test_reduction.py +++ b/tests/test_reduction.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_relabel_sequential.py b/tests/test_relabel_sequential.py index 68374e12..9125afc5 100644 --- a/tests/test_relabel_sequential.py +++ b/tests/test_relabel_sequential.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_replace_intensities.py b/tests/test_replace_intensities.py index 0300091b..04f403bf 100644 --- a/tests/test_replace_intensities.py +++ b/tests/test_replace_intensities.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_replace_intensity.py b/tests/test_replace_intensity.py index 7c9365a7..4ed0cc4c 100644 --- a/tests/test_replace_intensity.py +++ b/tests/test_replace_intensity.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_set.py b/tests/test_set.py index 4f56a978..e87d2449 100644 --- a/tests/test_set.py +++ b/tests/test_set.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_set_column.py b/tests/test_set_column.py index 34712637..99fa4cd8 100644 --- a/tests/test_set_column.py +++ b/tests/test_set_column.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_set_image_borders.py b/tests/test_set_image_borders.py index b744a301..81750b52 100644 --- a/tests/test_set_image_borders.py +++ b/tests/test_set_image_borders.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_set_nonzero_pixels_to_pixelindex.py b/tests/test_set_nonzero_pixels_to_pixelindex.py index f75c47b4..7903e624 100644 --- a/tests/test_set_nonzero_pixels_to_pixelindex.py +++ b/tests/test_set_nonzero_pixels_to_pixelindex.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_set_plane.py b/tests/test_set_plane.py index 85743c68..6a62faa6 100644 --- a/tests/test_set_plane.py +++ b/tests/test_set_plane.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_set_ramp_x.py b/tests/test_set_ramp_x.py index 4f95e4e9..1e93de03 100644 --- a/tests/test_set_ramp_x.py +++ b/tests/test_set_ramp_x.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_set_ramp_y.py b/tests/test_set_ramp_y.py index 461854a4..8e080024 100644 --- a/tests/test_set_ramp_y.py +++ b/tests/test_set_ramp_y.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_set_ramp_z.py b/tests/test_set_ramp_z.py index e262a58a..8c2bffaa 100644 --- a/tests/test_set_ramp_z.py +++ b/tests/test_set_ramp_z.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_set_row.py b/tests/test_set_row.py index 3be5fe19..3f573d65 100644 --- a/tests/test_set_row.py +++ b/tests/test_set_row.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_set_where_x_equals_y.py b/tests/test_set_where_x_equals_y.py index 20041e98..f6645fc2 100644 --- a/tests/test_set_where_x_equals_y.py +++ b/tests/test_set_where_x_equals_y.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_set_where_x_greater_than_y.py b/tests/test_set_where_x_greater_than_y.py index e4b3ee13..e170cef0 100644 --- a/tests/test_set_where_x_greater_than_y.py +++ b/tests/test_set_where_x_greater_than_y.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_set_where_x_smaller_than_y.py b/tests/test_set_where_x_smaller_than_y.py index 3fcf411c..489fea11 100644 --- a/tests/test_set_where_x_smaller_than_y.py +++ b/tests/test_set_where_x_smaller_than_y.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_setitem.py b/tests/test_setitem.py index cd36bb73..3bee5dd8 100644 --- a/tests/test_setitem.py +++ b/tests/test_setitem.py @@ -1,4 +1,5 @@ import numpy as np + import pyclesperanto as cle cle.select_device("TX") diff --git a/tests/test_sign.py b/tests/test_sign.py index 21fe5140..e70b5fe5 100644 --- a/tests/test_sign.py +++ b/tests/test_sign.py @@ -1,5 +1,6 @@ -import pytest import numpy as np +import pytest + import pyclesperanto as cle cle.select_device("TX") diff --git a/tests/test_small_hessian_eigenvalue.py b/tests/test_small_hessian_eigenvalue.py index ad144c4e..57ac1338 100644 --- a/tests/test_small_hessian_eigenvalue.py +++ b/tests/test_small_hessian_eigenvalue.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_smaller.py b/tests/test_smaller.py index c137e482..f9351116 100644 --- a/tests/test_smaller.py +++ b/tests/test_smaller.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_smaller_constant.py b/tests/test_smaller_constant.py index 7c795a94..9223cfba 100644 --- a/tests/test_smaller_constant.py +++ b/tests/test_smaller_constant.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_smaller_or_equal.py b/tests/test_smaller_or_equal.py index 7e4d318f..3ebadf53 100644 --- a/tests/test_smaller_or_equal.py +++ b/tests/test_smaller_or_equal.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_smaller_or_equal_constant.py b/tests/test_smaller_or_equal_constant.py index 2d62eb5d..5adb365b 100644 --- a/tests/test_smaller_or_equal_constant.py +++ b/tests/test_smaller_or_equal_constant.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_smooth_labels.py b/tests/test_smooth_labels.py index 63da454e..9eecec68 100644 --- a/tests/test_smooth_labels.py +++ b/tests/test_smooth_labels.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + def test_smooth_labels_2d(): diff --git a/tests/test_sobel.py b/tests/test_sobel.py index 160991d0..817cea9b 100644 --- a/tests/test_sobel.py +++ b/tests/test_sobel.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_spots_to_pointlist.py b/tests/test_spots_to_pointlist.py index bcdd7205..ee7b8d9e 100644 --- a/tests/test_spots_to_pointlist.py +++ b/tests/test_spots_to_pointlist.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_square.py b/tests/test_square.py index 287ebea6..416159bd 100644 --- a/tests/test_square.py +++ b/tests/test_square.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_square_root.py b/tests/test_square_root.py index 9c1f9a76..48299a42 100644 --- a/tests/test_square_root.py +++ b/tests/test_square_root.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_squared_difference.py b/tests/test_squared_difference.py index 9f4ca105..27ef723c 100644 --- a/tests/test_squared_difference.py +++ b/tests/test_squared_difference.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_standard_deviation_box.py b/tests/test_standard_deviation_box.py index 4076e8c9..5c1bb7a2 100644 --- a/tests/test_standard_deviation_box.py +++ b/tests/test_standard_deviation_box.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_standard_deviation_sphere.py b/tests/test_standard_deviation_sphere.py index 49ead4e0..748f6f2d 100644 --- a/tests/test_standard_deviation_sphere.py +++ b/tests/test_standard_deviation_sphere.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_subtract_gaussian_background.py b/tests/test_subtract_gaussian_background.py index 11e4c6f6..3a896baf 100644 --- a/tests/test_subtract_gaussian_background.py +++ b/tests/test_subtract_gaussian_background.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_subtract_image_from_scalar.py b/tests/test_subtract_image_from_scalar.py index af32ac29..494c2860 100644 --- a/tests/test_subtract_image_from_scalar.py +++ b/tests/test_subtract_image_from_scalar.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_subtract_images.py b/tests/test_subtract_images.py index 164b9ac9..a76181ac 100644 --- a/tests/test_subtract_images.py +++ b/tests/test_subtract_images.py @@ -1,4 +1,5 @@ import numpy as np + import pyclesperanto as cle cle.select_device("TX") diff --git a/tests/test_sum_of_all_pixels.py b/tests/test_sum_of_all_pixels.py index 75f23d50..86f5ea2c 100644 --- a/tests/test_sum_of_all_pixels.py +++ b/tests/test_sum_of_all_pixels.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_sum_reduction.py b/tests/test_sum_reduction.py index 1784dbc6..1b733e63 100644 --- a/tests/test_sum_reduction.py +++ b/tests/test_sum_reduction.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") source = np.asarray([0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0]) diff --git a/tests/test_sum_x_projection.py b/tests/test_sum_x_projection.py index 5385a768..ca56f67f 100644 --- a/tests/test_sum_x_projection.py +++ b/tests/test_sum_x_projection.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_sum_y_projection.py b/tests/test_sum_y_projection.py index f6e25e7c..08911ab0 100644 --- a/tests/test_sum_y_projection.py +++ b/tests/test_sum_y_projection.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_sum_z_projection.py b/tests/test_sum_z_projection.py index e97e97e2..d05b06f0 100644 --- a/tests/test_sum_z_projection.py +++ b/tests/test_sum_z_projection.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_t.py b/tests/test_t.py index 79d3c72b..a70eb68a 100644 --- a/tests/test_t.py +++ b/tests/test_t.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_threshold_otsu.py b/tests/test_threshold_otsu.py index d21fdcea..79c9606d 100644 --- a/tests/test_threshold_otsu.py +++ b/tests/test_threshold_otsu.py @@ -1,8 +1,9 @@ import numpy as np -import pyclesperanto as cle from skimage.data import camera from skimage.filters import threshold_otsu +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_top_hat_box.py b/tests/test_top_hat_box.py index 8b034911..0fe04580 100644 --- a/tests/test_top_hat_box.py +++ b/tests/test_top_hat_box.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_top_hat_sphere.py b/tests/test_top_hat_sphere.py index c37a4220..1812e264 100644 --- a/tests/test_top_hat_sphere.py +++ b/tests/test_top_hat_sphere.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_transform.py b/tests/test_transform.py index 4fd8bdb3..f81d3d6e 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + def test_rotate(): source = cle.push( diff --git a/tests/test_transpose_xy.py b/tests/test_transpose_xy.py index 83e26c56..ffc11605 100644 --- a/tests/test_transpose_xy.py +++ b/tests/test_transpose_xy.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_transpose_xz.py b/tests/test_transpose_xz.py index 58e6cacd..c985bfde 100644 --- a/tests/test_transpose_xz.py +++ b/tests/test_transpose_xz.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_transpose_yz.py b/tests/test_transpose_yz.py index d25b8cba..d4fe5a90 100644 --- a/tests/test_transpose_yz.py +++ b/tests/test_transpose_yz.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_undefined_to_zero.py b/tests/test_undefined_to_zero.py index 6cd02dfb..2219d75d 100644 --- a/tests/test_undefined_to_zero.py +++ b/tests/test_undefined_to_zero.py @@ -1,4 +1,5 @@ import numpy as np + import pyclesperanto as cle cle.select_device("TX") diff --git a/tests/test_variance_box.py b/tests/test_variance_box.py index 0d8c3628..b4bce81c 100644 --- a/tests/test_variance_box.py +++ b/tests/test_variance_box.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_variance_sphere.py b/tests/test_variance_sphere.py index 821ac2dd..e632c0cd 100644 --- a/tests/test_variance_sphere.py +++ b/tests/test_variance_sphere.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_voronoi_labeling.py b/tests/test_voronoi_labeling.py index 05b2def7..d5c4248a 100644 --- a/tests/test_voronoi_labeling.py +++ b/tests/test_voronoi_labeling.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") diff --git a/tests/test_voronoi_otsu_labeling.py b/tests/test_voronoi_otsu_labeling.py index 181e5c8d..ccad6f11 100644 --- a/tests/test_voronoi_otsu_labeling.py +++ b/tests/test_voronoi_otsu_labeling.py @@ -1,6 +1,7 @@ -import pyclesperanto as cle import numpy as np +import pyclesperanto as cle + cle.select_device("TX") From 8affd8f33da056a6a9c72a62785cae5e8849ce56 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Thu, 16 May 2024 13:51:02 +0200 Subject: [PATCH 07/16] rm test name check --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a56f1b31..88cd73bc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,7 +13,6 @@ repos: - id: check-merge-conflict - id: check-symlinks - id: mixed-line-ending - - id: name-tests-test # black - code formatting - repo: https://github.com/psf/black From 56ca8f19f5ea9049bdf4524a802bd72c4ce4547a Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Thu, 16 May 2024 13:51:15 +0200 Subject: [PATCH 08/16] runn wheel only if build was ok --- .github/workflows/wheels.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 3c387457..720b3e8b 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -2,6 +2,10 @@ name: Deploy # Build on every branch push, tag push, and pull request change: on: + workflow_run: + workflows: ["Build"] + types: + - completed push: branches: [main] paths-ignore: From 38520f9241a3166acae167234fb75a8c0c2c45b9 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Thu, 16 May 2024 13:57:11 +0200 Subject: [PATCH 09/16] remove workflow check --- .github/workflows/wheels.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 720b3e8b..3c387457 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -2,10 +2,6 @@ name: Deploy # Build on every branch push, tag push, and pull request change: on: - workflow_run: - workflows: ["Build"] - types: - - completed push: branches: [main] paths-ignore: From 1cb6e113de4142c50b96521c6b4124acf15ac4de Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Thu, 16 May 2024 13:57:19 +0200 Subject: [PATCH 10/16] try to make all happy --- .flake8 | 2 +- pyproject.toml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.flake8 b/.flake8 index dbfe4404..dba3834f 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,5 @@ [flake8] -ignore = E203, E231, W503 +ignore = E203, E266, E501, W503 max-line-length = 88 exclude = .git, .venv, __pycache__, .eggs, *.egg, build, dist diff --git a/pyproject.toml b/pyproject.toml index 240fed92..a94a3afe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,3 +74,6 @@ skip = ["cp27-*", "pp*", "*-win32"] [tool.cibuildwheel.macos] environment = { MACOSX_DEPLOYMENT_TARGET = '10.14' } skip = ["cp27-*", "pp*", "*_universal2"] + +[tool.isort] +profile = "black" From 18fce51d00281c7b5915de3b2b1d5bcf9e0bf5ab Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 16 May 2024 11:57:41 +0000 Subject: [PATCH 11/16] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyclesperanto/__init__.py | 14 +++++++++++--- pyclesperanto/_interroperability.py | 3 +++ pyclesperanto/_operators.py | 14 ++++++++------ 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/pyclesperanto/__init__.py b/pyclesperanto/__init__.py index f76205e4..ba2ff738 100644 --- a/pyclesperanto/__init__.py +++ b/pyclesperanto/__init__.py @@ -1,7 +1,15 @@ from ._array import Array, Image, is_image -from ._core import (Device, default_initialisation, get_device, gpu_info, - list_available_backends, list_available_devices, - select_backend, select_device, wait_for_kernel_to_finish) +from ._core import ( + Device, + default_initialisation, + get_device, + gpu_info, + list_available_backends, + list_available_devices, + select_backend, + select_device, + wait_for_kernel_to_finish, +) from ._functionalities import execute, imshow, list_operations, native_execute from ._interroperability import * from ._memory import create, create_like, pull, push diff --git a/pyclesperanto/_interroperability.py b/pyclesperanto/_interroperability.py index f36a4cd4..45e0489e 100644 --- a/pyclesperanto/_interroperability.py +++ b/pyclesperanto/_interroperability.py @@ -12,12 +12,15 @@ import numpy as np from ._array import Image + # pyclesperanto_prototype aliases from ._core import gpu_info as cl_info from ._core import list_available_devices as available_device_names from ._core import wait_for_kernel_to_finish as set_wait_for_kernel_to_finish + # numpy operations aliases from ._memory import push as asarray + # scikit-image aliases from ._tier5 import connected_components_labeling as label diff --git a/pyclesperanto/_operators.py b/pyclesperanto/_operators.py index b9f691ba..472d5541 100644 --- a/pyclesperanto/_operators.py +++ b/pyclesperanto/_operators.py @@ -3,8 +3,12 @@ import numpy as np from ._array import Array -from ._utils import (_assert_supported_dtype, _compute_range, - _process_ellipsis_into_slice, _trim_index_to_shape) +from ._utils import ( + _assert_supported_dtype, + _compute_range, + _process_ellipsis_into_slice, + _trim_index_to_shape, +) cl_buffer_datatype_dict = { bool: "bool", @@ -48,8 +52,7 @@ def _astype(self, dtype: type): def _max(self, axis: Optional[int] = None, out=None): """Return the maximum value in the Array, or along an axis if specified.""" - from ._tier1 import (maximum_x_projection, maximum_y_projection, - maximum_z_projection) + from ._tier1 import maximum_x_projection, maximum_y_projection, maximum_z_projection from ._tier2 import maximum_of_all_pixels if axis == 0: @@ -72,8 +75,7 @@ def _max(self, axis: Optional[int] = None, out=None): def _min(self, axis: Optional[int] = None, out=None): """Return the minimum value in the Array, or along an axis if specified.""" - from ._tier1 import (minimum_x_projection, minimum_y_projection, - minimum_z_projection) + from ._tier1 import minimum_x_projection, minimum_y_projection, minimum_z_projection from ._tier2 import minimum_of_all_pixels if axis == 0: From 8a5c39577a29f0114f27ce8758d1d51805b921b7 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Thu, 16 May 2024 15:03:09 +0200 Subject: [PATCH 12/16] update pre-commit --- .pre-commit-config.yaml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 88cd73bc..adabc9bf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,15 +31,3 @@ repos: rev: 5.0.4 hooks: - id: flake8 - -# mypy - static type checking -- repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.910 - hooks: - - id: mypy - -# pydocstyle - docstring style checking -- repo: https://github.com/pycqa/pydocstyle - rev: 6.1.1 - hooks: - - id: pydocstyle From 0c660f7b3f2623d87aeb00bb351f1c8f938ecb72 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Thu, 16 May 2024 15:03:32 +0200 Subject: [PATCH 13/16] update flake --- .flake8 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.flake8 b/.flake8 index dba3834f..790df0a6 100644 --- a/.flake8 +++ b/.flake8 @@ -1,11 +1,11 @@ [flake8] -ignore = E203, E266, E501, W503 +ignore = E203, E266, E501, W503, F401 max-line-length = 88 exclude = .git, .venv, __pycache__, .eggs, *.egg, build, dist # Ignore F401 and F403 only for __init__.py files per-file-ignores = - */__init__.py: F401, F403 + */__init__.py: F403 # Warn if the complexity of a function exceeds 10 -max-complexity = 10 +max-complexity = 18 From 9df3c8925703e42f5ebf0a419535021c7a2867be Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Thu, 16 May 2024 15:03:40 +0200 Subject: [PATCH 14/16] fix str + int --- pyclesperanto/_operators.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyclesperanto/_operators.py b/pyclesperanto/_operators.py index 472d5541..68f55ffd 100644 --- a/pyclesperanto/_operators.py +++ b/pyclesperanto/_operators.py @@ -64,7 +64,7 @@ def _max(self, axis: Optional[int] = None, out=None): elif axis is None: result = maximum_of_all_pixels(self) else: - raise ValueError("Axis " + axis + " not supported") + raise ValueError("Axis " + str(axis) + " not supported") if out is not None: if isinstance(out, (Array, np.ndarray)): np.copyto(out, result.get().astype(out.dtype)) @@ -87,7 +87,7 @@ def _min(self, axis: Optional[int] = None, out=None): elif axis is None: result = minimum_of_all_pixels(self) else: - raise ValueError("Axis " + axis + " not supported") + raise ValueError("Axis " + str(axis) + " not supported") if out is not None: if isinstance(out, (Array, np.ndarray)): np.copyto(out, result.get().astype(out.dtype)) @@ -108,7 +108,7 @@ def _sum(self, axis: Optional[int] = None, out=None): elif axis is None: result = sum_of_all_pixels(self) else: - raise ValueError("Axis " + axis + " not supported") + raise ValueError("Axis " + str(axis) + " not supported") if out is not None: if isinstance(out, (Array, np.ndarray)): np.copyto(out, result.get().astype(out.dtype)) From c2500ed3a6fa47ac10792f2d9a5b9b277d8f42d7 Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Thu, 16 May 2024 15:20:14 +0200 Subject: [PATCH 15/16] rm isort as it break import order --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index adabc9bf..b39285f0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,11 +20,11 @@ repos: hooks: - id: black -# isort - import sorting -- repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: - - id: isort +# # isort - import sorting +# - repo: https://github.com/pycqa/isort +# rev: 5.12.0 +# hooks: +# - id: isort # flake8 - linting - repo: https://github.com/pycqa/flake8 From fa48e7ed2bb63a2c95bd751cb16801cacc4359fc Mon Sep 17 00:00:00 2001 From: Stephane Rigaud Date: Thu, 16 May 2024 15:20:28 +0200 Subject: [PATCH 16/16] fix import order --- pyclesperanto/__init__.py | 5 ++++- pyclesperanto/_array.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pyclesperanto/__init__.py b/pyclesperanto/__init__.py index ba2ff738..845ed7e8 100644 --- a/pyclesperanto/__init__.py +++ b/pyclesperanto/__init__.py @@ -11,8 +11,8 @@ wait_for_kernel_to_finish, ) from ._functionalities import execute, imshow, list_operations, native_execute -from ._interroperability import * from ._memory import create, create_like, pull, push + from ._tier1 import * from ._tier2 import * from ._tier3 import * @@ -21,6 +21,9 @@ from ._tier6 import * from ._tier7 import * from ._tier8 import * + +from ._interroperability import * + from ._version import CLIC_VERSION as __clic_version__ from ._version import COMMON_ALIAS as __common_alias__ from ._version import VERSION as __version__ diff --git a/pyclesperanto/_array.py b/pyclesperanto/_array.py index f51cdb2f..e8de978a 100644 --- a/pyclesperanto/_array.py +++ b/pyclesperanto/_array.py @@ -2,11 +2,12 @@ import numpy as np -from . import _operators from ._core import Device, get_device from ._pyclesperanto import _Array as Array from ._utils import _assert_supported_dtype +from . import _operators + def _prepare_array(arr) -> np.ndarray: """Converts a given array to a numpy array with C memory layout.