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

bugfix orthogonal interpolation #284

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 37 additions & 28 deletions demo/transforms/deskew.ipynb

Large diffs are not rendered by default.

31 changes: 20 additions & 11 deletions demo/transforms/deskew_artifact_interpolation.ipynb

Large diffs are not rendered by default.

17 changes: 10 additions & 7 deletions demo/transforms/deskew_x_test.ipynb
Copy link
Member Author

@pr4deepr pr4deepr Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haesleinhuepf I think we ran some of the notebooks before we made some kernel changes, especially the flip z for backward compatbility
As far as I can tell, there are no breaking changes downstream..

Large diffs are not rendered by default.

36 changes: 22 additions & 14 deletions demo/transforms/deskew_x_with_other_data.ipynb

Large diffs are not rendered by default.

39 changes: 19 additions & 20 deletions demo/transforms/inverse_deskewing.ipynb

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pyclesperanto_prototype/_tier8/_affine_transform_deskew_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ def affine_transform_deskew_3d(source: Image, destination: Image = None,
# we invert the transform because we go from the target image to the source image to read pixels
transform_matrix = np.asarray(transform.copy().inverse())

# precalculate these functions that are dependent on deskewing angle
tantheta = np.float32(np.tan(deskewing_angle_in_degrees * np.pi/180))
sintheta = np.float32(np.sin(deskewing_angle_in_degrees * np.pi/180))
costheta = np.float32(np.cos(deskewing_angle_in_degrees * np.pi/180))
# precalculate these functions that are dependent on deskewing angle and ensure they are positive
tantheta = np.float32(np.absolute(np.tan(deskewing_angle_in_degrees * np.pi/180)))
sintheta = np.float32(np.absolute(np.sin(deskewing_angle_in_degrees * np.pi/180)))
costheta = np.float32(np.absolute(np.cos(deskewing_angle_in_degrees * np.pi/180)))

gpu_transform_matrix = push(transform_matrix)

Expand Down
7 changes: 6 additions & 1 deletion pyclesperanto_prototype/_tier8/_deskew_y.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,14 @@ def deskew_y(input_image: Image,
from ._AffineTransform3D import AffineTransform3D
from ._affine_transform import affine_transform
from ._affine_transform_deskew_3d import affine_transform_deskew_3d, DeskewDirection
from ._rotate import rotate

if angle_in_degrees<0:
input_image = rotate(input_image,angle_around_y_in_degrees=180,auto_size=True)

transform = AffineTransform3D()

# define affine transformation matrix
transform = AffineTransform3D()
transform._deskew_y(angle_in_degrees=angle_in_degrees, voxel_size_x=voxel_size_x, voxel_size_y=voxel_size_y,
voxel_size_z=voxel_size_z, scale_factor=scale_factor)

Expand Down
7 changes: 6 additions & 1 deletion tests/test_skimage_imsave.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
def test_skimage_imsave():
import pyclesperanto_prototype as cle
image = cle.push([1, 2, 3])
import numpy as np

image = cle.push(np.asarray([
[1, 2],
[3, 4]
]))

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