Spatial registration of serial microscopic brain images to three-dimensional reference atlases with the QuickNII tool

Modern high throughput brain wide profiling techniques for cells and their morphology, connectivity, and other properties, make the use of reference atlases with 3D coordinate frameworks essential. However, anatomical location of observations made in microscopic sectional images from rodent brains is typically determined by comparison with 2D anatomical reference atlases. A major challenge in this regard is that microscopic sections often are cut with orientations deviating from the standard planes used in the reference atlases, resulting in inaccuracies and a need for tedious correction steps. Overall, efficient tools for registration of large series of section images to reference atlases are currently not widely available. Here we present QuickNII, a stand-alone software tool for semi-automated affine spatial registration of sectional image data to a 3D reference atlas coordinate framework. A key feature in the tool is the capability to generate user defined cut planes through the reference atlas, matching the orientation of the cut plane of the sectional image data. The reference atlas is transformed to match anatomical landmarks in the corresponding experimental images. In this way, the spatial relationship between experimental image and atlas is defined, without introducing distortions in the original experimental images. Following anchoring of a limited number of sections containing key landmarks, transformations are propagated across the entire series of sectional images to reduce the amount of manual steps required. By having coordinates assigned to the experimental images, further analysis of the distribution of features extracted from the images is greatly facilitated.


Background
QuickNII is one of several tools developed by the Human Brain Project (HBP) with the aim of facilitating brain atlas based analysis and integration of experimental data and knowledge about the human and rodent brain. QuickNII is a stand-alone tool for user guided affine spatial registration (anchoring) of sectional image data, typically high resolution microscopic images, to a 3D reference atlas space. A key feature in the tool is the capability to generate user defined cut planes through the atlas templates, matching the orientation of the cut plane of the 2D experimental image data. The reference atlas is transformed to match anatomical landmarks in the corresponding experimental images. In this way, the spatial relationship between experimental image and atlas is defined, without introducing transformations in the original experimental images. Following anchoring of a limited number of sections containing key landmarks, transformations are propagated across the entire series of images to reduce the amount of manual steps required.

Image requirements and pre-processing steps
QuickNII v1.0 and v2.0 supports standard web-compatible image formats, 24-bit PNG and JPEG. Images can be loaded up to the resolution of 16 megapixels (e.g. 4000x4000 or 5000x3000 pixels), however QuickNII does not benefit from image resolutions exceeding the resolution of the monitor in use. For a standard FullHD or WUXGA display (1920x1080 or 1920x1200 pixels) the useful image area is approximately 1500x1000 pixels, using a similar resolution ensures optimal image-loading performance and also eliminates excess storage size.
Preprocessing of images (downsampling, rotation, renaming) can be achieved with other open access software tools (e.g. ImageMagick, Matlab scripts) or python scripts found in many open source libraries (e.g. PIL). Serial section images should be assigned consecutive serial numbers, preferably indicated by three-digit numbers at the end of the file name, e.g. Sample_ID_s001.tif. Section sampling is given by the serial numbers. The section images are collected in a folder. As fulfilling these requirements usually results in preprocessing images (converting to PNG or JPEG and downscaling to screen-like size), QuickNII keeps track of original image dimensions as part of its series descriptor.

Generate your images descriptor file with FileBuider
Serial section images should be assigned consecutive serial numbers, preferably indicated by three-digit numbers at the end of the file name, e.g. Sample_ID_s001.tif. Section sampling is given by the serial numbers. The section images are collected in a folder.
Use the small program "FileBuilder.bat" provided with QuickNII. A new window will open, and ask for the folder where your images are located. Point to the correct folder, mark all image files, and click ok.
Files will be reviewed and an xml file will be generated. Click "Save xml". You can now open the dataset in QuickNII. If the section number is not recognized, you have the option to number the images in the file builder.

Open QuickNII and load the data
There are two versions of QuickNII for the rodent brains:  For the mouse brain, the current version is called "QuickNII-ABAv3-pMRI" and contains the Mouse reference atlas from Allen Institute version 3 (1,2,) .
 For the rat brain, the current version is called "QuickNII-WHSv2" and contains the Waxholm rat reference atlas version 2 (3,4) .
Open the QuickNII program from the .exe file. Once the program opens, click the Manage data button. The angles of the current atlas slice relative to the default atlas plane can be read out in the boxes shown above, corresponding to the sagittal (1) and horizontal (2) navigation windows.
In coronal sections, the dorsoventral angle can be determined by examining the relationship between landmarks in dorsal and ventral parts of a section, e.g. between the corpus callosum and anterior commissure, between the dorsal and ventral hippocampus, or between the pons and inferior colliculus. The mediolateral angle can be seen by comparing landmark structures across hemispheres. It is most easily found by examining the development of the corpus callosum, anterior striatum, anterior commissure, anterior hippocampus, or size differences of the cortex in the posterior part of the brain.
Note that the result might look similar with angles that deviate 180 degrees (corresponding to looking at the animal from the back or from the front). To ease the curation process, however, we recommend using the smallest angle possible.

Final adjustments of in plane positions
Go now to another image further away and repeat the anchoring procedure. Once the second image is stored, the QuickNII tool will automatically calculate the anteroposterior positions of all the images, as well as propagating the registered angles and scaling. This accelerates the anchoring procedure, i.e. the images will better match the template in an incremented way along with the anchoring of images from your dataset. However, there might be cases where the automatically propagated parameters do not fit the section, for example if a section has been tilted during mounting.
Once defined, apply the same angles to all the sections in the series and save your results! NB! Every section in the series should be inspected to verify the proposed anchoring, making manual adjustments when necessary.
In-plane rotations are done using buttons in the main window. Rotations in the small coronal window will result in a rotation around the anteroposterior axis.

Saving results and validation
Remember to save the anchoring result by clicking "store". Export the data by clicking "Export Propagation". A new window will open and you will be able to export results into a new xml file. Type a new name, e.g. initials and date.
You will also be able to export custom atlas slices corresponding to your series by clicking on the "export Slices" button.
Graphs provide an initial indication of registration accuracy. If deviations from the linear regression line are present, a revision of the anchoring should be done. Independent validation by a curator is recommended.