Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9, '3.10']
python-version: [3.9, '3.10', '3.11', '3.12', '3.13']
platform: [ubuntu-latest] #, macos-latest] # windows-latest broken for now
steps:
- uses: actions/checkout@v2
Expand All @@ -37,8 +37,8 @@ jobs:
python --version
conda install -y pyopencl
python -m pip install --upgrade pip
pip install setuptools wheel pytest pytest-cov pytest-benchmark dask networkx igraph pandas scikit-image==0.19.3
pip install -e .
pip install setuptools wheel pytest pytest-cov pytest-benchmark dask networkx igraph pandas scikit-image

- name: Test
shell: bash -l {0}
run: pytest -v --cov=./ --cov-report=xml
Expand All @@ -65,5 +65,5 @@ jobs:
# TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }}
# run: |
# git tag
# python setup.py sdist bdist_wheel
# python -m build
# twine upload dist/*
2 changes: 1 addition & 1 deletion pyclesperanto_prototype/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
from ._tier10 import *
from ._tier11 import *

__version__ = "0.24.5"
__version__ = "0.24.6"
__common_alias__ = "cle"
61 changes: 53 additions & 8 deletions pyclesperanto_prototype/_tier8/_AffineTransform3D.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from warnings import warn

import numpy as np
import transforms3d
import math
from ._utilities import shear_angle_to_shear_factor

Expand All @@ -16,9 +15,55 @@ class AffineTransform3D:

"""

@staticmethod
def _identity_matrix():
return np.eye(4, dtype=float)

@staticmethod
def _scale_matrix(sx=1.0, sy=1.0, sz=1.0):
return np.asarray([
[sx, 0, 0, 0],
[0, sy, 0, 0],
[0, 0, sz, 0],
[0, 0, 0, 1],
], dtype=float)

@staticmethod
def _rotation_matrix_x(angle_in_rad):
c = np.cos(angle_in_rad)
s = np.sin(angle_in_rad)
return np.asarray([
[1, 0, 0, 0],
[0, c, -s, 0],
[0, s, c, 0],
[0, 0, 0, 1],
], dtype=float)

@staticmethod
def _rotation_matrix_y(angle_in_rad):
c = np.cos(angle_in_rad)
s = np.sin(angle_in_rad)
return np.asarray([
[c, 0, s, 0],
[0, 1, 0, 0],
[-s, 0, c, 0],
[0, 0, 0, 1],
], dtype=float)

@staticmethod
def _rotation_matrix_z(angle_in_rad):
c = np.cos(angle_in_rad)
s = np.sin(angle_in_rad)
return np.asarray([
[c, -s, 0, 0],
[s, c, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1],
], dtype=float)

def __init__(self, transform = None, image=None):
if transform is None:
self._matrix = transforms3d.zooms.zfdir2aff(1)
self._matrix = self._identity_matrix()
if isinstance(transform, AffineTransform3D):
self._matrix = np.copy(transform._matrix)
if isinstance(transform, str):
Expand Down Expand Up @@ -56,11 +101,11 @@ def scale(self, scale_x: float = None, scale_y: float = None, scale_z: float = N
warn('scale_z must not be 0')
scale_z = 1
if scale_x is not None:
self._concatenate(transforms3d.zooms.zfdir2aff(scale_x, direction=(1, 0, 0), origin=(0, 0, 0)))
self._concatenate(self._scale_matrix(sx=scale_x))
if scale_y is not None:
self._concatenate(transforms3d.zooms.zfdir2aff(scale_y, direction=(0, 1, 0), origin=(0, 0, 0)))
self._concatenate(self._scale_matrix(sy=scale_y))
if scale_z is not None:
self._concatenate(transforms3d.zooms.zfdir2aff(scale_z, direction=(0, 0, 1), origin=(0, 0, 0)))
self._concatenate(self._scale_matrix(sz=scale_z))

return self

Expand All @@ -83,11 +128,11 @@ def rotate(self, axis : int = 2, angle_in_degrees : float = 0):
angle_in_rad = angle_in_degrees * np.pi / 180.0

if axis == 0:
self._concatenate(self._3x3_to_4x4(transforms3d.euler.euler2mat(angle_in_rad, 0, 0)))
self._concatenate(self._rotation_matrix_x(angle_in_rad))
if axis == 1:
self._concatenate(self._3x3_to_4x4(transforms3d.euler.euler2mat(0, angle_in_rad, 0)))
self._concatenate(self._rotation_matrix_y(angle_in_rad))
if axis == 2:
self._concatenate(self._3x3_to_4x4(transforms3d.euler.euler2mat(0, 0, angle_in_rad)))
self._concatenate(self._rotation_matrix_z(angle_in_rad))

return self

Expand Down
52 changes: 52 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[build-system]
requires = ["setuptools>=68", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "pyclesperanto_prototype"
version = "0.24.6"
description = "GPU-accelerated image processing in python using OpenCL"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.9"
license = { text = "BSD-3-Clause" }
authors = [
{ name = "Robert Haase", email = "robert.haase@uni-leipzig.de" }
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"Topic :: Scientific/Engineering :: Image Processing",
"Topic :: Scientific/Engineering :: Information Analysis",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: OS Independent",
"License :: OSI Approved :: BSD License"
]
dependencies = [
"numpy>=2.0.0",
"pyopencl",
"toolz",
"scikit-image>0.20.0",
"matplotlib"
]

[project.urls]
"Bug Tracker" = "https://github.com/clEsperanto/pyclesperanto_prototype/issues"
Documentation = "https://github.com/clEsperanto/pyclesperanto_prototype#README.md"
"Source Code" = "https://github.com/clEsperanto/pyclesperanto_prototype"
"User Support" = "https://github.com/clEsperanto/pyclesperanto_prototype/issues"

[project.entry-points."bia_bob_plugins"]
plugin1 = "pyclesperanto_prototype._bia_bob_plugins:list_bia_bob_plugins"

[tool.setuptools]
include-package-data = true

[tool.setuptools.packages.find]
include = ["pyclesperanto_prototype*"]
47 changes: 0 additions & 47 deletions setup.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/test_skimage_imsave.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ def test_skimage_imsave():
image = cle.push([1, 2, 3])

from skimage.io import imsave
imsave('test.tif', image)
imsave('test.tif', image, photometric='minisblack')
Loading