.. _transform_top: Transform ========= .. only:: html .. sidebar:: Tutorials & Sample Data Watch on YouTube: |br| `Tutorial 11: Image Transformations `_ :download:`Tut11data.zip (15.1MB) ` .. contents:: :depth: 1 :local: :backlinks: top The Transform tab contains commands that allow users to manipulate the orientation, position and resolution of the images. The Transform commands alter the image data and allows the user to save the transformed images (unlike the View commands that only alter the way the images are displayed). .. _tx_rotate_new_volume: Rotate and Create new volume (changes voxel size) ------------------------------------------------- Acts on all layers (image and ROI, visible and invisible). Opens a dialog (**Rotate Volume**, :numref:`fig_rotate_volume`). Creates a new document labeled as the original with \_rotated_n suffix (n – integer). Transforms the source image by applying rotation, scaling, and interpolation. .. _fig_rotate_volume: .. figure:: ../images/transform_rotate_volume.png :alt: Rotate Volume Panel :align: center :figclass: align-center Rotate Volume Panel. Rotations are specified by entering angles of rotation, in degrees, about X, Y, and Z axes into the boxes labeled X-angle (deg), Y-angle (deg), Z-angle (deg). Resampling is specified by Scale, a numerical coefficient between 0.01 and 100. The transformed image is resampled to isotropic resolution so that :math:`\text{Scale} = \frac{\text{Smallest dimension of original voxel}}{\text{Isotropic dimension of transformed voxel}}` . Therefore, Scale>1 indicates upsampling (increasing resolution) and Scale<1 indicates downsampling (decreasing resolution). The **Interpolation** dropdown menu allows the user to select an interpolation method. Options include: Nearest neighbor, Tri-linear (default), Wsinc2, Wsinc 3, and Wsinc 4. The Tri-linear method is preferable for CT and Wsinc methods are more appropriate for MRI. If Scale<1 (the image is downscaled), the user may select the downscale method. **Gaussian downscale** checkbox selects downsampling by Gaussian filter (blur) followed by thresholding, with user-specified Binary Threshold specified in percent (50% by default). As a result, Gaussian downscale may be able to preserve the image details that would be lost with regular downscale. If the **Gaussian downscale** box is unchecked, **regular downsampling** is used, and the new voxel values are determined based on a simple average of the original voxel intensities with filtering at a fixed 50% threshold. Checking the box **Preserve original FOV and resolution** suppresses resampling and retains only rotation. The transformed image will have the same field of view (FOV) and voxel size as the original, regardless of Scale. .. _tx_rotate_orthogonal: Rotate Orthogonal and Create new volume (preserves voxel size) -------------------------------------------------------------- Acts on all layers. Creates a new document labeled as the original document with a suffix \_RotOrtho_n (n-integer). Opens a dialog panel (**Rotate Volume Orthogonally around Volume Center**, :numref:`fig_rotate_orthogonal`). Performs orthogonal rotations around 1\ :sup:`st`, 2\ :sup:`nd`, and 3\ :sup:`rd` rotation axes. .. _fig_rotate_orthogonal: .. figure:: ../images/transform_rotate_orthogonal.png :alt: Rotate Volume Orthogonally Panel :align: center :figwidth: 80 % :figclass: align-center Rotate Volume Orthogonally around Volume Center Panel. The drop-down menus labeled 1\ :sup:`st`, 2\ :sup:`nd` and 3\ :sup:`rd` Rotation Axis are used to select X, Y, Z, None axes of rotation. The buttons labeled -90< deg and >90 deg are used to rotate the volume in 90-degree increments in counterclockwise or clockwise directions about a selected axis. The bottom part of the panel displays the rotation matrix M in one of the two configurations: 1) Source=M*Target or 2) Target=M*Source. **Reset** button clears all entries. **Matrix to Clipboard** copies the transformation matrix to clipboard and allows it to be pasted into a text editor or spreadsheet. **Save** creates a VTF file (by default in FireVoxel Temp directory) with information about this transformation. .. _tx_load_landmark_file: Load landmark file ------------------ Opens browse for file dialog to load a landmark file. :red:`ADD DETAILS` See :ref:`Coregister with Landmarks ` .. _tx_landmark_to_z_slice: Landmark alignment to a single Z-slice -------------------------------------- Requires an image and a set of at least three landmarks (see :ref:`Coregister with Landmarks `). If no landmarks are present, shows an error message (**At least 3 points are required in this operation**). If the landmarks are present, shows image processing dialog with the measurement of the **Plane fitting error (mm)**. Once the user clicks OK, opens **Rotate Volume** dialog (:numref:`fig_rotate_volume`) with pre-filled values of rotations about X, Y, and Z axes. After the user clicks OK, the command creates a new document window and displays in it the transformed image. The document is named [original]_Z_[n], where n is the number of landmarks. The landmarks are transferred into new document under the same names, but transformed according to the same rule as the image. .. _tx_w_vtf: Transform using VTF file ------------------------ Acts on the active layer and all visible layers. Requires a previously saved .VTF file (see :ref:`Volume Transform File `). Opens a dialog panel (:numref:`fig_transform_w_vtf`). .. _fig_transform_w_vtf: .. figure:: ../images/transform_w_vtf.png :alt: Transform Using VTF :align: center :figclass: align-center Transform Using VTF. The user can select the Interpolation method (Nearest neighbor, Tri-linear, Wsinc2, Wsinc 3, Wsinc 4). If the image is downsampled (target resolution is lower than the original resolution), the user may select Gaussian downscale and the threshold value (50% by default). The user must also enter into the Transformation File text box the name of the previously created .VTF file (or click Browse to open a browse for file). Pressing OK applies the affine transformation described by the .VTF file to all visible layers. If the .VTF file does not match the dimensions of the active layer, FireVoxel shows an error message and the command is not performed. .. _tx_save_alignment: Save Alignment (\*.vtf) ----------------------- Open file save dialog to save the Volume Transform File (with .vtf extension) with the information about the image transformations. The file retains the information about a sequence of transformations since the last document save. .. _tx_vtf: Volume Transform File (.vtf) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. _fig_vtf_content: .. figure:: ../images/transform_vtf.png :alt: Volume Transform File :align: center :figclass: align-center Volume Transform File. The Volume Transform File (\*.vtf) can be opened with a text editor (:numref:`fig_vtf_content`). The file contains the transform type (affine), the matrix size and resolution (voxel size in mm) in X, Y, and Z direction of the source and target images, and the Transform Data (12 matrix elements of affine transformation matrix). The affine transformations include scaling, rotations, shear, and translations and can be expressed in matrix form: x' = A x + t, where x is the source, x’ is the target, A is the affine transformation matrix and t is the translation vector. This expression can be rewritten in terms of matrix elements (:numref:`fig_affine_matrix`): In VTF, the Transform Data are the twelve elements of the affine matrix (marked with the red box) listed row by row (a\ :sub:`11`, a\ :sub:`12`, a\ :sub:`13`, t\ :sub:`x`, a\ :sub:`21`,…,t\ :sub:`z`). .. _fig_affine_matrix: .. figure:: ../images/transform_affine_matrix.png :alt: Affine Transformation Matrix :align: center :figclass: align-center Affine Transformation in matrix form. .. _tx_make_isotropic: Make isotropic -------------- Acts on all layers in a document. Opens dialog (**Specify Resolution (mm)**), to enter the voxel dimension of the transformed image. Creates a **new document window** named after the original window with an added iso\_[number] suffix. The image and the ROI layers, both visible and invisible, are transformed together and retained in the transformed image. By default, the resolution is set to the smallest dimension of the original voxel. The transformed image has isotropic resolution (cubic voxels). If the target voxel is larger than the original (i.e., target resolution is lower than the original), **regular downsampling** method is used. To perform Gaussian downsampling (more favorable to small details) use :ref:`Rotate and Create new volume `. .. _tx_mirror_voxels: Mirror voxels along axis (X, Y, Z) ---------------------------------- Acts on all active layers. Does not create a new document. Reflects all visible layers with respect to the selected axis. .. _tx_translate_w_vector: Translate Active layer using vector ----------------------------------- Acts on the active layer and *all visible* layers. Requires a vector object (vector – a two-point polyline) (:numref:`fig_translate_vector`). Shifts (translates) layer(s) by the distance and in the direction specified by a vector object. Does not create a new document. .. _fig_translate_vector: .. figure:: ../images/transform_vector.png :alt: Translate using vector :scale: 50% :align: center :figclass: align-center Translate using vector. **Steps:** 1. Draw a vector (a two-point vector object) using :ref:`Insert polyline ` connecting the origin and destination of translation. Use **View** > :ref:`Display\\Hide curve length ` to display the length of the vector, if needed. 2. Select **Vector** > **Translate using vector command**. The active layer, along with all other visible layers, is shifted as defined by the vector. 3. To save the transformation as .VTF file, see :ref:`Save Alignment `. 4. To undo, use :ref:`Discard Alignment `. .. _tx_rotate_w_sector: Rotate Active layer using sector -------------------------------- Acts on the active layer and *all visible* layers. Requires a vector object, a segment -- a 3-point polyline (:numref:`fig_rotate_sector`). Rotates layer(s) by the angle specified by the sector. .. _fig_rotate_sector: .. figure:: ../images/transform_sector.png :alt: Rotate Using Vector :align: center :scale: 50% :figclass: align-center Rotate using sector. **Steps:** 1. Draw a sector -- a vector object made of three ordered points (or two straight segments), using :ref:`Insert polyline `. The first segment (from the first to the second point) should be aligned with the original alignment. The second segment (from the second to third points) should be aligned with the target direction. The second point is the center of rotation. Use **View** > :ref:`Display\\Hide curve length ` to display the angle measure of the sector, if needed. The direction of rotation is indicated by an arrow inside the sector. Adjust the sector by moving the anchor points after placing them. 2. Use **Vector** > **Rotate using sector**. The layer(s) are rotated about the center of rotation by the angle indicated by the sector in the direction from the first segment towards the second segment. 3. To save the transformation as .VTF file, see :ref:`Save Alignment `. 4. To undo, use :ref:`Discard Alignment `. .. _tx_discard_alignment: Discard Alignment ----------------- Reverses all transformations performed since the last saving of the document. If several transformations were performed sequentially, all of them will be undone. The saved .VTF files from these transformations are not affected. .. _tx_project_to_slice: Active layer: Project to single slice volume -------------------------------------------- Requires an image layer. The command extracts the current slice from the active document, resamples this slice to isotropic resolution equal to the smallest dimension of the original voxel, and displays this slice in a new document labeled **snapshot**. |top|