Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

WIP: benchmarking affine transforms #197

Merged
merged 10 commits into from
Jul 24, 2024
526 changes: 526 additions & 0 deletions benchmarking/benchmark_affine_transforms.ipynb

Large diffs are not rendered by default.

Binary file added benchmarking/data/Haase_MRT_tfl3d1.tif
Binary file not shown.
51 changes: 51 additions & 0 deletions pyclesperanto/_interroperability.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#

import warnings
from typing import Optional

import numpy as np

Expand All @@ -25,6 +26,56 @@

# scikit-image aliases
from ._tier5 import connected_components_labeling as label
from ._tier7 import affine_transform as _tier7_affine_transform

# enforce deprecation warnings display
warnings.filterwarnings("always", category=DeprecationWarning, module=__name__)


def affine_transform(
input_image: Image,
output_image: Image = None,
transform_matrix: Optional[list] = None,
interpolate: bool = False,
resize: bool = False,
transform: Optional[np.ndarray] = None,
linear_interpolation: Optional[bool] = None,
auto_size: Optional[bool] = None,
) -> Image:

if transform is not None:
warnings.warn(
"affine_transform : 'transform_matrix' parameter is deprecated. Please use 'transform' instead.",
DeprecationWarning,
)
transform_matrix = transform.ravel().tolist()

if linear_interpolation is not None:
warnings.warn(
"affine_transform : 'linear_interpolation' parameter is deprecated. Please use 'interpolate' instead.",
DeprecationWarning,
)
interpolate = linear_interpolation

if auto_size is not None:
warnings.warn(
"affine_transform : 'auto_size' parameter is deprecated. Please use 'resize' instead.",
DeprecationWarning,
)
resize = auto_size

if not isinstance(transform_matrix, list) and isinstance(
transform_matrix, np.ndarray
):
transform_matrix = transform_matrix.ravel().tolist()

return _tier7_affine_transform(
input_image=input_image,
output_image=output_image,
transform_matrix=transform_matrix,
interpolate=interpolate,
resize=resize,
)


def set_wait_for_kernel_finish(bool=True):
Expand Down
Loading