Segmentation of neurons in microscopy images

version 1.0.3 (1.25 MB) by Omer Yuval
Set up, train and apply a neural network for segmentation of neurons in microscopy images.


Updated 13 Aug 2021

View License

Quick start:
0. Set network and training parameters in Params.m.
1. Prepare input and output images:
Im_In = {Im_In_1,Im_In_2,Im_In_3};
Im_Out = {Im_Out_1,Im_Out_2,Im_Out_3};
2. Generate training set:
3. Train:
net = Train;
4. Apply the trained network to an image:
[Im_Out,Im_Label] = Segment_Neuron(net,Im_In_4);
* Example raw and annotated neuron images can be found in this paper [1].
* An example pre-trained network is included.
* Please cite this paper [1].
Advanced options:
- Control sample size (see "Input_Size" in Params.m).
- Control class weights during training (see "Class_Weights" in Params.m).
- Control the minimum number of neuron pixels in training samples (see "Functions" block in Params.m).
- You can generate the training set locally and train on another machine (see "Paths" block in Params.m).

Cite As

Omer Yuval (2022). Segmentation of neurons in microscopy images (, MATLAB Central File Exchange. Retrieved .

Yuval, Omer, et al. “Neuron Tracing and Quantitative Analyses of Dendritic Architecture Reveal Symmetrical Three-Way-Junctions and Phenotypes of Git-1 in C. Elegans.” PLOS Computational Biology, edited by Hugues Berry, vol. 17, no. 7, Public Library of Science (PLoS), July 2021, p. e1009185, doi:10.1371/journal.pcbi.1009185.

View more styles
MATLAB Release Compatibility
Created with R2021a
Compatible with R2020b and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!