Documentation

A description of how to use SegEM for your own research

This toolkit provides all code described in the paper SegEM: Efficient Image Analysis for High-Resolution connectomics. (Berning, Boergens & Helmstaedter, Neuron, 2015)

There are two main use cases:

  1. De-novo training of (or the use of the pretrained) CNNs for the analysis of a novel EM dataset
  2. Connectomic analysis of a volume-segmented data set based on skeleton reconstructions in retina dataset

Prerequisites:

The Matlab jobmanager has to be operational. If no compute cluster with a Matlab jobmanager is available, the jobmanager ‘local’ will usually work by default. Furthermore the Matlab-mex compiler has to be configured. This can be done done by typing:

mex -setup

at the Matlab command prompt. In case your system does not have a compiler installed please follow the instructions by Mathworks. This is required to compile some of the routines for the user’s computer. In case this does not work you can try to use the precompiled versions.

Usage

This code was tested on Matlab R2014b.

Set the Matlab working directory to the root folder of the SegEM repository.

Execute initalSettings.m and provide the requested information in the small GUI:

  • Data Directory = Please mount the webdav directory as indicated in the Data Repository
  • Name of jobmanager = Name of operational Matlab job manager (‘local’ in case no cluster is available)
  • Output Directory = Directory to store data and figures generated by SegEM scripts
  • Code version = for use case 1 choose SegEM for de-novo analyses; for use case 2 choose legacy version for analysis of retina dataset ek563

Press OK. Then, the relevant scripts will be opened in the Matlab editor.

Use case overview

The scripts are conveniently executed using the cell mode in Matlab (pressing Ctrl+Enter executes the current script section; see ‘cell mode’ help in Matlab). Inline comments explain what the code is doing in each cell.

For use case 1: start with cnnStart.m, then proceed to cnnParameterSelection.m, mainSeg.m, wholeDatsetFwdPass.m and skeletonsToContacts.m; these scripts will be opened in the matlab editor automatically for you.

For use case 2: start with skeletonsToContacts.m. When working with the retina dataset ek563, use legacy version skeletonsToContacts_legacy.m, instead.

Use Case 1

Brief description of the most relevant SegEM code files:

  1. cnnStart.m: load training data, train convolutional neuronal networks (parallel network training on multiple GPUs)
  2. cnnParameterSelection.m: Automated hyper-parameter selection and variation of learning rates for each CNN layer
  3. mainSeg.m: Contains steps from classification result by CNN to segmentation (grid parameter search for watershed segmentation) including skeleton based split-merger metrics
  4. (Optional) - visSeg.m: visualize a given segmentation, e.g. object collected along skeletons in dense skeletonization, movies of segmentation and similar
  5. wholeDatasetFwdPass.m: Apply trained CNN classifier (trained in step 1 or 2) and watershed segmentation steps (with parameters optimized in step 3) to whole dataset
  6. skeletonsToContacts.m: Volume reconstruction and contact detection based on skeleton reconstructions. This requires volume segmentation (either via step 4 or via the segmentations provided at www.segEM.io)

Use Case 2

To further analyze the retina dataset ek563, the following SegEM legacy code is provided:

  1. main_legacy.m: Load training data, train a convolutional neuronal network, parallel network training
  2. mainSeg_legacy.m: Contains steps from classification result by CNN to segmentation (grid parameter search for watershed segmentation) including skeleton based split-merger metrics
  3. visSeg_legacy.m: Visualize a given segmentation, e.g. object chains, segMovies, errorMovies = detected merger errors etc.
  4. skeletonsToContacts_legacy.m: Use segmentation of whole dataset (provided) and human skeleton reconstructions for volume reconstructions or contact detection between cell pairs