Analyzing C. elegans GFP images


Analyzing C. elegans GFP images

Our long-term goal is to explain how the relatively small nervous system of C. elegans implements observable learning behaviour, in order to obtain inspiration for building new robust learning algorithms. First results as paper and code are already available, see below.

This page describes the software accompanying the paper Quantifying Phenotypic Variation in Isogenic Caenorhabditis elegans... (Citation see below). The software analyzes images of C. elegans, determines pose, head and tail position and approximate vulva position for the worm, and computes average intensity for each cell of a regular 2D grid over the worm (each worm in the same orientation) which can be used to compare large sets of worms visually, for clustering worm sets, or for differential expression analysis. The software has been developed on images of worms that express hsp-16.2::GFP but may be suitable for other GFP proteins as well. If DIC images are available, they can also be similarily processed. However, the software relies on the availability of GFP images for segmentation.


The download contains one jar file with all the relevant software. We will describe the programs in the order they will normally be applied. Execution is via java -cp process.jar [program name] [parameters]. You do need a Java Runtime (version 1.5 or above).

  1. pixelClassification_AvgStD_eval: This program takes a base GFP tiff image (RGB tiff uncompressed, normalized, only green channel with nonzero values) and outputs a tagged image which contains in the blue channel the worm border (as #255) and all worm pixels (as #64). It should be called with the input image, the output image (to be created) and Log.eql.model -equalize -output -noview -nosave.

  2. meshAB_corrCoeff: is used to combine an a (head) and a b (tail) image of the same worm. Additionally, head and tail absolute pixel position are output (near Head on standard output). The vulva position is determined by worm curvature if possible (see paper). Parameters are the a input image, the b input image (both a and b images need to be output images from the previous step), the combined output image (a+b, to be created), and the tagged combined output image (a+b+tagging, also to be created, same format as output image from 1.).

  3. sampleCE: is used to create a floating point tiff image with average pixel intensity values for each grid cell. The parameters are input image (should be 16bit tiff), tagged input image, the HEAD_TAIL file, width, height and the output image (to be created). All input images should contain full worms (i.e. either the full worm in one image, or created via meshAB_corrCoeff). The HEAD_TAIL file contains one line per input image, with the name of each input image (first parameter) without path and without .tiff extension, followed by absolute X and Y position of the head, X/Y of tail, and X/Y of vulva (where vulva position needs to be only on the correct side of the worm body, either ventral or dorsal of "worm backbone"). These fields are delimited by a single space. This information can be taked from the output of meshAB_corrCoeff if available and needs to be added if not. For GFP output images width=15 and height=75, and for DIC output images width=45 and height=225 are proposed. The obtained resampled worm images can be used to conduct analysis such as the one described in our paper.


The images were taken from anesthesized worms which were put on a fresh plate. Clinging eggs, air bubbles and other contaminations may lead to wrong worm body estimates. Always check all tagged images before running sampleCE and remove or manually correct those where the tagging is imperfect.

While the input images to pixelClassification and meshAB should be normalized to a range of 8bit (0-255) in the green channel to improve worm segmentation, the input image for sampleCE should be (typ. 12-16bit) directly from the microscope without such normalization. Otherwise the average intensity can not be compared between worm images which limits the types of analysis which makes sense.


The provided jar file process.jar contains our code as well as ImageJ and WEKA. Our code is available under the GNU Affero General Public License, version 3 (AGPL v3)