<jupyter_start><jupyter_text>Deskew in X directionDeskew data thats sheared in X direction<jupyter_code>from skimage.io import imread
import matplotlib.pyplot as plt
import pyclesperanto_prototype as cle

cle.get_device()
#Image acquired using Janelia lattice

voxel_size_x_in_microns = 0.1028
voxel_size_y_in_microns = 0.1028
voxel_size_z_in_microns = 0.359712  

deskewing_angle_in_degrees = 31.5<jupyter_output><empty_output><jupyter_text>The example image data shown below was kindly provided by [<NAME>](https://imaging.wehi.edu.au/about-us/cindy-evelyn), [Dr <NAME>](https://imaging.wehi.edu.au/about-us/niall-geoghegan) and [Dr. <NAME>](https://imaging.wehi.edu.au/about-us/kelly-rogers) from the [Centre for Dynamic Imaging, WEHI, Melbourne, Australia](https://imaging.wehi.edu.au/) who used lattice light sheet microscopy to capture red blood cells and study the [malaria parasite invasion process](https://www.nature.com/articles/s41467-021-23626-7). The data is acquired using the Janelia lattice lightsheet system.In these so called raw data images taken with dual objective lattice light sheet microscopes, the Z-plane is swept through the sample in a tilted way. This is not obvious when studying the Z-planes of the given stack:<jupyter_code>original_image = imread('../../data/45_CamA_ch0_stack0006_488nm_0016799msec_0013438399msecAbs-1.tif')

print("Original image shape", original_image.shape)
fig, axs = plt.subplots(1, 1, figsize=(15,5))

cle.imshow(original_image[25])
cle.imshow(original_image[50])
cle.imshow(original_image[110])<jupyter_output>Original image shape (140, 290, 200)<jupyter_text>Deskew in X direction<jupyter_code>deskewed_x = cle.deskew_x(original_image, 
                        angle_in_degrees=deskewing_angle_in_degrees, 
                        voxel_size_x=voxel_size_x_in_microns, 
                        voxel_size_y=voxel_size_y_in_microns, 
                        voxel_size_z=voxel_size_z_in_microns)

print(deskewed_x.shape)

fig, axs = plt.subplots(3, 1, figsize=(10,10))


cle.imshow(deskewed_x[5], plot=axs[0])
cle.imshow(deskewed_x[30], plot=axs[1])
cle.imshow(deskewed_x[70], plot=axs[2])
fig, axs = plt.subplots(2, 1, figsize=(5,15))

cle.imshow(cle.maximum_y_projection(cle.flip(deskewed_x, flip_z=False)).T, plot=axs[0])
axs[0].title.set_text("Deskewed image")
cle.imshow(cle.maximum_x_projection(original_image), plot=axs[1])
axs[1].title.set_text("Raw image")<jupyter_output><empty_output><jupyter_text>View in napari<jupyter_code>import napari
viewer = napari.Viewer()

viewer.add_image(original_image)
viewer.add_image(deskewed_x)<jupyter_output>Public access to Window.qt_viewer is deprecated and will be removed in
v0.5.0. It is considered an "implementation detail" of the napari
application, not part of the napari viewer model. If your use case
requires access to qt_viewer, please open an issue to discuss.
{'fraction_non_alphanumeric': 0.10597637248088951, 'fraction_numerical': 0.037873523280055596, 'mean_word_length': 5.498871331828442, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 5, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '161739', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1037, 'n_words': 225, 'path': 'demo/transforms/deskew_x_test.ipynb', 'repo_name': 'DrLachie/pyclesperanto_prototype', 'size': '2902'}