Untilt Stack


Julian Cooper

History: 2009/05/22: First version
2009/06/01: Performance enhanced. Also handles anisotropic voxel calibration far more efficiently. Corrected bug in calculation.
2011/04/30: Updated to use latest version of TransformJ and imagescience library.
2015/11/26: Updated to use Imagescience 3.0 library
Source: Untilt_Stack.java
Installation: Download Untilt_Stack.class to the plugins folder and restart ImageJ or click Help > Update Menus.
Dependency: Requires the version 3.0 of Erik Meijering's Imagescience library to be installed in the ImageJ plugins folder.

This plugin is designed to remove tilt from a stack of images, where it is desired to make images of a longitudinal object parallel to the z-axis of the stack. An example would be an axial CT of a bone where the bone is tilted with respect to the stack z-axis. The plugin will work with isotropic and anisotropic voxel calibration (i.e. where the voxel depth is different to the pixel width and height).

Entry: the plugin can be run either with or without an ROI already selected. If already selected the ROI should be centred over the object to be aligned towards the upper (lower slice number) end of the stack. Any of the ImageJ selection tools appear to work well. If no ROI is present then the user will be prompted to scroll to the upper end of the stack and select the appropriate feature.

Distal end of radius selected using polygon tool: Distal end of radius selected

Selection of second point: the user is prompted to scroll to the lower end of the stack and to select the object to be aligned with the first point. Again any of the selection tools can be used. If you need to record the angular correction select the "Log angular corrections " checkbox. If you wish to inspect or save the transformation matrix checking the "Display matrix as text" box will open a text window containing a space-delimited layout of the 4x4 matrix used for the transformation.

Proximal end of radius selected with oval tool:Proximal end of radius selected

The plugin then calculates an affine transformation matrix that will rotate the stack correcting the tilt. The Imagescience Affine method is then called to apply the matrix, rotating the stack around the x-axis and y-axis so that the first selected point is now above the second.

Example: a stack of CT images (montaged summary) of a malunited complex forearm fracture referred for correction shows the forearm to be tilted:
Montaged stack of CT images of a malunited forearm fracture which is very tilted

Z-projections of orthogonal reslices of above stack (from top and from left). The red X marks each end of the radius to emphasise the tilt:
AP Z-projection of the original stack Lateral Z-projection of the original stack

After applying this plugin to the selected points at the distal and proximal ends of the radius the two ends lie in the same longitudinal alignment along the z-axis:
The untilted stack showing the forearm in the same general position in each slice

Image > Stacks > Orthogonal Views showing the proximal and distal ends of the radius lying on the same longitudinal axis. Log output also shown.
AP Z-projection of the untilted stack

|Plugins | Home |