User Tools

Site Tools


Automatic detection of neuronal labeling in histological image series

Axonal tracers such as biotinylated dextran amine (BDA) and Phaseolus vulgaris leucoagglutinin (Pha-L) yield highly specific visualization of neural connections in histological sections. High-resolution section images generated by robotic microscopes or slide scanners are well suited for mapping of connections across large series of sections. Computational image analysis can be used to automate and increase the efficiency and throughput of such analyses by delivering measurements of the amount (area) and position of labeling. Building on an earlier workflow for collection and analysis of tract-tracing data (Zakiewicz et al. 2011), we here present a set of ImageJ plugins and macros that automate detection of labeling, selection of regions of interest (ROIs), noise filtering, and measurement of labeled area and centroid position in large series of microscopic images (Papp et al. 2016).


Download files to the ImageJ/plugins or ImageJ/plugins/Macros directory. The zip package is organized into the right folder structure and can be extracted directly to the ImageJ directory. Processing of image series is primarily handled by the macros, available from the ImageJ menu Plugins → Macros. The NeSys Pixel Counter plugin can be used on individual images by placing the .class file into the ImageJ/plugins directory, or compiling the Java source code (.java) in the same place (Plugins → Compile and run), and thereafter running the plugin from the Plugins menu. The CDgetPrimaryChannel plugin is intended for usage together with the NeSys Labeling Detection macro and is not available from the Plugins menu.

Download the complete package:

Package contents

Plugins (ImageJ/plugins) Macros (ImageJ/plugins/Macros) Parameter file (ImageJ/plugins/Macros) NeSys_Labeling_Detection_Macro.txt colourdeconvolution.txt
CDgetPrimaryChannel.class NeSys_Main_ROI_Selector_Macro.txt NeSys_Median_Filtering_Macro.txt
NeSys_Pixel_Counter.class NeSys_Pixel_Counter_Macro.txt


After installation, the macros are available from the Plugins → Macros menu. Images to be processed are expected to be within the same folder in one of the following formats: .gif, .jpg, .jpe, .jpeg, .png, .tif, .tiff, .bmp, or .pgm.

1. Detection of labeling in series of microscopic images

The NeSys Labeling Detection macro uses the CDgetPrimaryChannel plugin to perform Colour Deconvolution on series of color (RGB) images using a shortened version of the plugin from G. Landini based on the method of A.C. Ruifrok. Vectors for Colour Deconvolution are expected to be acquired in advance using the original plugin and saved in the colourdeconvolution.txt file located in the Imagej/plugins/Macros folder. The parameter file is formatted according to the example provided by Benjamin Pavie (bpavie) on GitHub. Requires ImageJ version 1.39f or later.

We recorded Colour Deconvolution vectors for the following staining combinations (see colourdeconvolution.txt): Staining combinations

  • BDA and Neutral Red
  • BDA and no background
  • Pha-L and no background
  • Pha-L and thionine
  • BDA and cytochrome oxidase

For details on histological processing, see Zakiewicz et al. 2011.

The following processing steps are performed automatically on each image:

  1. The primary channel resulting from Colour Deconvolution is calculated using the selected vectors.
  2. The resulting image is converted to 8-bit (greyscale).
  3. The greyscale image is thresholded using the default method in ImageJ (IsoData).
  4. The end result is a binary image that is saved in .gif format in a separate directory.

2. Selection of ROIs throughout the series

The NeSys Main ROI Selector macro uses the Analyze Particles command in ImageJ to identify regions of interest (ROIs) in series of binary images based on the size and circularity of continuous areas in black. Eventual holes are included. Optionally, centroid coordinates are measured for each ROI. ROIs are then combined into a common selection and all other image elements are removed. A margin for extending the outer limits of the combined selection can be specified before processing. The resulting images containing only the ROI(s) are saved in .gif format in a separate directory. Centroid coordinates are saved in Excel-compatible tab-delimited format for each image. Only binary images are processed, other file types will be ignored. Requires ImageJ version 1.35g to 1.47v.

3. Noise filtering

The NeSys Median Filtering macro applies a median filter with a user-specified radius to a series of binary images. The resulting filtered images are saved in .gif format in a separate directory. Requires ImageJ version 1.35g or later. Only binary images are processed, other file types will be ignored.

4. Measurement of labeled area in processed images

The NeSys Pixel Counter macro uses the NeSys Pixel Counter plugin to record the number of black pixels in a series of (binary) images. Results are saved in Excel-compatible tab-delimited format containing the filename and the number of black pixels for each image. Requires ImageJ version 1.45o or later.

See also

How to cite

Papp EA, Leergaard TB, Csucs G, Bjaalie JG (2016) Brain-wide mapping of axonal connections: workflow for automated detection and spatial analysis of labeling in microscopic sections. Frontiers in Neuroinformatics 10:11 doi: 10.3389/fninf.2016.00011


Ruifrok AC and Johnston DA (2001) Quantification of histochemical staining by color deconvolution. Anal Quant Cytol Histol 23, 291-299 PubMed
Zakiewicz IM, Van Dongen YC, Leergaard TB, and Bjaalie JG (2011) Workflow and atlas system for brain-wide mapping of axonal connectivity in rat. PLoS One 6, e22669 doi: 10.1371/journal.pone.0022669

plugin/analysis/autodetection_of_neuronal_labeling_in_histological_image_series/start.txt · Last modified: 2019/04/12 13:13 by

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki