Random Forest for Membrane Detection

Here you can find the matlab code I used to train a random forest classifier to detect membranes of neurons in electron microscopy images. The code is arranged so that you can train interactively, giving membrane annotations in green and non-membrane annotations in red in the training images. Then you run the skript and get a classification output, which you then correct again in the training image, and so on.

The trained random forest classifier then gives membrane detections, which you can use with the gap completion framework described below.

Here is an example training image and a classification output. For the training I like to have the membrane probability maps in red overlayed on the gray value image. The green contours correspond to skeletonized membrane detections thresholded at 0.5. The contours only show detections belonging to closed contours, to give better feedback for the gap completion later. Feel free to change this representation in any way you like. Some people prefer to have only the skeleton contours, some like the probability map thresholded. It is up to you.

Example of a training image and the classification output from the random forest.
Figure 1: Example of a training image (left) and the classification output from the random forest (right). Training annotations in the left image are done in green (membrane) or red (non-membrane). In the right classification image the membrane detection votes are shown as a red overlay. The green contours are skeletonized closed contours of the thresholded votes (threshold = 0.5).

Gap Completion

Here you can find demo code for the paper:

Before you can run the demo you need to do three things:

Afterwards you can run demo.m to see example segmentations and the precision recall curves for a street view image of San Francisco and an example image from the drosophila larva dataset. The result should look like this:

Screenshot of the demo for the San Francisco street view
Figure 1: Screenshot of the demo run for a San Francisco street view example image. The color overlay shows example segmentations using gradient flux (red) and our good continuation term (green). In the precision recall plot, the colors also are red for gradient flux and green for good continuation.
Screenshot of the demo for a drosophila larva image
Figure 2: Screenshot of the demo run for a drosohpila larva TEM image. The color code for the first images is the same as for the street view image. In addition the image in the lower right corner shows a color overlay of the segmentation with good continuation and the ground truth label. False positives are shown in green and false negatives are colored in red.

If you encounter any problems or have any questions, please contact me.