Module: Align Slices ()
This module allows you to interactively align 2D slices of a 3D image stack. Alignment is performed in a separate graphics window that is activated by pressing the Edit button of the module's Action port. To close the slice aligner, press the Close button of the module's Action port.The align window displays by default two consecutive slices using different draw styles that can be selected from the View menu. The two displayed slices can be chosen using the slice slider on the toolbar. Only one of these two slices is editable at a given time. The slice that can be edited is selectable and it can be either the lower or the upper one. By dragging the editable slice using the left mouse button, the slice will be translated. The slice can be rotated around its center by dragging it while keeping the middle mouse button pressed. At any time the numbers of the current slice pair as well as the quality of the current alignment is displayed in the status bar at the bottom of the align window. The quality value is based on the sum of squared gray-value difference (SSD) between the two slices being aligned. The SSD is computed for all pixels in the area in which the two slices overlap (the size of this area depends on the transformation of the slices). The SSD is then normed, so that it lies between 0 and 1. The quality in alignSlices is 1 minus this value, and therefore also lies between 0 (0%/bad) and 1 (100%/best).
The AlignTransform parameters are written into the file header of the aligned stack (see Port Action below and Save transformation in the Options menu) and can be viewed with the Parameter Editor. For example,
slice044 6 4 -16.3025 -1
indicates that slice # 44 was translated 6 voxels in X, 4 voxels in Y, and rotated -16.3025 degrees about Z. The -1 means that the slice was not mirrored. (If 1, it would mean that the slice has been mirrored.)
The documentation of the align tool is organized into the following sections:
- Toolbar - describes the buttons of the toolbar.
- Menu bar - describes all entries of the menu bar.
- Image viewer - describes how to align images interactively.
- Key bindings - provides a list of all hot keys.
Data [required]
3D field for which the slices will be aligned. Currently, uniform Cartesian grids of type HxUniformScalarField3, HxUniformStackedScalarField3, and HxUniformColorField3 are supported.Reference [optional]
3D field from which the alignment informations can be read and transferred to the field that must be aligned (port Data). The reference field must have the same number of slices and the same dimensions as the data field.Mask [optional]
An additional HxLabelLattice3 that can be connected in order to be used as mask during the alignment process.LabelField [optional]
Label field to be aligned in accordance with the image data.
Intensity Range
This port allows the user to restrict the range of visible data values. Values below the lower bound are mapped to black, while values above the upper bound are mapped to white. Only the values between the two bounds are used by the gray value-based alignment algorithm. This port is only active if a gray value image is used as input data.Display Mode
Port for choosing display mode. Normal or maximum intensity projection are available.Resample method
This port allows the user to decide which resample method will be used for the calculation of an output image. The calculation takes place when the apply or the realign button from the Action port is pressed. Two resample methods are possible:
- Preview: A very quick but not very precise method. It should only be used as solution preview.
- High Quality: A much slower but very accurate interpolation method.
Action
Press the Edit button to open the align tool. Press the Resample button to create a new field according to the transformations made in the align tool. The new field will have by default the dimensions of the input image. The dimensions can be altered by the resize dialog. Press the Resample to Result button to overwrite an attached result. If a label image is attached to the existing result, the label image will also be transformed so that the former labels will also fit after the align procedure.
performance
Computes the number of frames per second in the Image Viewer.setSliceNumber <n>
Sets the current editable slice to be n.getSliceNumber
Gets the current editable slice.setEditableSlice {lower|upper}
Of the two currently displayed slices, sets the editable slice to be the lower/upper one.getEditableSlice
Returns whether the editable slice is the upper or lower of the currently displayed slices.translate <tx> <ty>
Translates the currently editable slice by tx on the X axis, by ty on the Y axis.rotate <phi>
Rotates the currently editable slice by phi. Angle phi is considered to be in degrees and the rotation is made counterclockwise.setAlignMode {0|1|2|3}
Changes the current alignment mode. The meaning of the parameter is 0 = principal axes alignment, 1 = least squares alignment, 2 = landmarks alignment, and 3 = edge detection alignment.getAlignMode
Changes the current alignment mode. The meaning of the result is 0 = principal axes alignment, 1 = least squares alignment, 2 = landmarks alignment, and 3 = edge detection alignment.setViewMode {0|1|2|3}
Changes the display mode. The view modes are encoded as follows: 0 = magenta/green view, 1 = checkerboard view, 2 = average view, 3 = invert view.align
Aligns the current slices pair.alignAll
Aligns all slices.setLandmark <i> <k> <x> <y>
Sets the landmark with index k of slice i to be the point (x,y).getLandmark <i> <k>
Returns the x and y coordinates of the landmark with index k of slice i.snapshot [filename]
Take a snapshot of the slice alignment viewer.edit
Shows the tool window (the same as the Edit button of the Action port).showXZView {0|1}
Toggles the display of a XZ cross section through the aligned stack.showYZView {0|1}
Toggles the display of a YZ cross section through the aligned stack.setXZViewSliceNumber <n>
Sets the slice number of the XZ cross section.getXZViewSliceNumber <n>
Returns the slice number of the XZ cross section.setYZViewSliceNumber <n>
Sets the slice number of the YZ cross section.getYZViewSliceNumber <n>
Returns the slice number of the YZ cross section.orthoViewZoomIn
Zooms in on the YZ and/or XZ cross sections.orthoViewZoomOut
Zooms out on the YZ and/or XZ cross sections.setUseMaxIntProjection {0|1}
Enables or disables the use of maximum intensity projections of n slices instead of the real image data for the reference image and the transformed image. This is particularly helpful when aligning very small (point-like) objects, e.g., cross sections of neurons. If enabled, the automatic alignment method will use these projections instead of the real images. The number n is separately adjustable for the editable slice and the reference slice, using the commands below. Default is false (0).getUseMaxIntProjection {0|1}
Returns whether maximum intensity projections are used for visualization.setMaxIntProjectionRefThickness <value>
Specifies the number of slices to be used for the maximum intensity projection visualization of the reference.getMaxIntProjectionRefThickness <value>
Returns the number of slices to be used for the maximum intensity projection visualization of the reference.setMaxIntProjectionSliceThickness <value>
Specifies the number of slices to be used for the maximum intensity projection visualization of the currently transformed slice.getMaxIntProjectionSliceThickness <value>
Returns the number of slices to be used for the maximum intensity projection visualization of the currently transformed slice.setTranslationStepSize <value>
Specifies the translation step size.getTranslationStepSize
Returns the translation step size.setRotationStepSize <value>
Specifies the rotation step size.getRotationStepSize
Returns the rotation step size.setMaxIterations <value>
Specifies the maximum number of iterations.getMaxIterations
Returns the maximum number of iterations.setResampleScaleFactor <value>
Specifies the resample scale factor.getResampleScaleFactor
Returns the resample scale factor.