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.
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).