Tao Ju, 2008

StackAligner is a toolkit designed for aligning a stack of serially sectioned tissues, preferably Nissl-stained histology sections, with the direction of sectioning is vertical. Serial sectioning typically induces global (e.g., shifting and rotation) as well as local (e.g., stretching, compacting, folding, image artifacts, etc.) distortions, which makes direct 3D reconstruction difficult. This toolkit helps to correct both global and local distortions so that a smooth volume can be reconstructed with minimum human input. An example result is shown below, using a stack of 350 histological coronal sections of a mouse brain. Note that the jaggedness in the sagittal and horizontal views in the original stack are caused by sectioning distortions that vary from one section to another, which is corrected by this toolkit to form a contiguous 3D volume.

The toolkit consists of two parts: a rigid alignment tool, and an elastic alignment tool.

Rigid alignment
This tool corrects rigid-body transformations induced by the sectioning process, including translation and rotations. The automatic alignment is guided by the center of the tissue region (determined by a grayscale threshold) and possibly the symmetry line (if the sections are coronal). The user can also interactively change the parameters, such as setting the grayscale threshold, identifying the main tissue component (if there are multiple components) from which the center is computed, and manually place the symmetry line. The tool automatically removes the non-tissue components in the image.

Elastic alignment
This tool corrects local distortions caused by cutting, which takes place mostly in the direction of cutting (presumably vertical). The alignment proceeds by first computing a warp function between every two successive sections in the stack, then warping each section using a weighted average of the warp functions in an extended neighborhood. The user controls parameters such as the maximum distortion in horizontal and vertical directions, the smoothness of the warp function in each direction, and the size of the extended neighborhood. The alignment further provides the options to normalize the size and histograms of the sections, remove random image noise (e.g., air bubbles and tissue fold-overs) using a majority filter, and visualize synthetic sagittal and horizontal cuts of the stack.


  • "3D Volume Reconstruction of a Mouse Brain from Histological Sections using Warp Filtering", by T. Ju, J. Warren, J. Carson, M. Bello, I. Kakadiaris, W. Chiu, C. Thaller and G. Eichele, Journal of Neuroscience Methods, 156(1-2):84-100, 2006. (PDF)

    The code and data are provided for research purposes only. (Lastest Version: 1.1 Updated: Aug. 8, 2008)

  • Comments or suggestions: taoju at