====== Deskewing ====== This page is an overview of deskewing. Image viewers such as FIJI assume that stacks of camera images are formed using motion orthogonal to the image plane, but that assumption is not true for single-objective light sheet, lattice light sheet, and diSPIM with stage scanning. https://doi.org/10.1364/BOE.479977 has a nice overview of the problem; this is from Figure 2 and shows a helpful diagram: {{ :docs:deskew_from_lamb_paper.png?800 |}} Here is another figure from http://dispim.org/hardware/controller {{ :hardware:deskew_vs_reslice.jpg?600 |}} Hopefully these diagrams show how deskewing makes the data appear in the correct way so that it can be correctly interpreted by image viewers. Deskewing retains the same viewing direction as the raw data and simply adds blank spaces so that the images line up appropriately. This can explode the size of the dataset by adding blank space. An alternative to deskewing is reslicing, which confusingly is sometimes called deskewing or "deskewing and rotating" in the literature. Reslicing partitions the raw data into new images oriented in different reference frame, usually chosen with resulting images along the lab’s Z axis. If the stage translation speed is chosen to be an integer number of pixels then resclicing might be as simple as reshuffling pixels in memory, but generally it involves some degree of interpolation. Reslicing spreads the optical low-resolution between 2 axes. Reslicing makes the light sheet data more comparable to data collected using e.g. confocal microscopes. For acquisition volumes that are relatively flat, reslicing has the advantage of not adding as much empty data as deskewing. ===== Methods for Deskewing and Reslicing ===== There are tens of software solutions for deskewing and reslicing, and computationally-inclined researchers sometimes find it easier implement their own pipeline rather than use existing software. Here we discuss two methods implemented within Micro-Manager. ==== Deskewing in Micro-Manager 1.4 ASI plugin ==== Use the “Data Analysis” tab of the plugin which looks like this: {{ :docs:um-dataanalyis-tab.png?600 |}} Use the controls in the area "Deskew stage scanning data" even if you are deskewing galvo-scan data from the single-objective light sheet. The angle that the deskew uses between the scanning and the objective is set in the “Settings” tab in the “Stage Scanning” section. Populate this angle setting even for single-objective light sheet. The plugin uses the pixel size and slice spacing in the metadata. If these are incorrect then you can apply a non-unity fudge factor until the deskewed data looks correct, e.g. that a single object appears to come in and out of focus without translating in the output data. The checkbox "Invert direction" changes the assumed direction of the raw data. If the deskew exacerbates the apparent lateral translation of a single object seen in adjacent planes instead of reducing it then enable that checkbox. The checkbox "Rotate direction" should be checked if the data moves up/down in the raw data (the original implementation assumes that the scrolling is horizontal instead of vertical. For both the diSPIM and the single-objective light sheet, if the illumination propagates vertically in the image then check this box. Hitting the button "Deskew Open Dataset" will use the current top-most window as input and create a new window with the deskewed result. This new window can then be saved or manipulated as desired. ==== "Deskewing" (Reslicing) in Micro-Manager 2.0 Image Processor ==== Micro-Manager 2.0 has an image processor for "deskewing" data, but according to the earlier terminology it actually performs a reslicing operation where the output data is in a different reference frame. Access using the Plugins menu under "On-The-Fly Image Processing" and then "Deskew" entry. When you click the "Configure…" button you can change the settings. The option "CPU (Fast)" does a nearest neighbor approximation and is generally fine for projections. The option "GPU (Quality)" uses interpolation on the GPU and is recommended when creating full 3D volumes. It is limited to performing operations on datasets that are 25% of the GPU memory size, although it tries to be smart about timepoints and positions and do the operation separately. This image processor can create max or average projections without creating a new 3D dataset, which is relatively efficient computationally. This is particularly handy for sample finding where the actual 3D data is not important, but rather seeing the projection is sufficient. There are various self-explanatory options for the output data. You can reslice existing data that is open in Micro-Manager using the very bottom drop-down menu to select the dataset that you wish to use and then click the "Process" button. Many of these functionalities will be integrated in the LightSheetManager plugin. Important: as of Nov 2024 the MM2.0 plugin uses a different convention than the MM1.4 datasets for the z_step parameter. See https://github.com/micro-manager/micro-manager/issues/1984.