Motivation: The fruit fly (Drosophila melanogaster) is a commonly used model organism in biology. We are currently building a 3D digital atlas of the fruit fly larval nervous system based on a large collection of fly larva GAL4 lines, each of which targets a subset of neurons. To achieve such a goal, we need to automatically align a number of high-resolution confocal image stacks of these GAL4 lines. One commonly employed strategy in image pattern registration is to first globally align images using an affine transform, followed by local nonlinear warping. Unfortunately, the spatially articulated and often twisted larval nervous system makes it difficult to globally align the images directly using the affine method. In a parallel project to build a 3D digital map of the adult fly ventral nerve cord, we are confronted with a similar problem. Results: We proposed to standardize a larval image by best aligning its principal skeleton (PS), and thus used this method as an alternative of th...