Skip to main content

 This is a Matlab demo code of patch-based sparse representation for brain image segmentation: Li Wang et al., Segmentation of Neonatal Brain MR Images using Patch-Driven Level Sets, Neuroimage, 84, 141-158, 2014.[PDF] [PPT] [Matlab code]

 

Code document: Generally, we assume the similar patches share the same labels. Based on this assumption, we employ the sparse representation to measure the patch similarity between the target patch and the template patches, then propagate the labels from the templates to the target image. In this source code, the target image is test.img, the atlas intensity image are named as atlas1, …, atlas7 and their corresponding labels are names as atlas1_label, …, atlas7_label. I have already aligned all the atlases to the target image space based on the intensity image (Note that atlas images and labels are in the Atlas folder). 

Installation: 

1. Download the sparse coding toolbox: SPMAS toolbox (http://spams-devel.gforge.inria.fr/hitcounter2.php?file=33814/spams-matlab-v2.5-svn2014-07-04.tar.gz). After downloading, unzip it and run the examples in 

Matlab to see if it is correctly working. 

2. Modify the path in the Demo_sparse_segmentation.m: 

addpath(genpath(‘YOUR_OWN_SPAMS_PATH’)); 

3. In Matlab, run “mex extract_patches_for_prior.c” 

4. Run Demo_sparse_segmentation.m in Matlab. 

5. Enjoy and you will get the following results. 

Results: 

The following shows the results by the source code:

 Fig. 1. Estimated probability maps of WM, GM and CSF by Wang et al., Neuroimage 2014. 

Citation: If you find the code is useful in your work, please cite the following references:

References: 

  • Li Wang, Feng Shi, Gang Li, Yaozong Gao, Weili Lin, John H. Gilmore, Dinggang Shen. Segmentation of Neonatal Brain MR Images using Patch-Driven Level Sets, Neuroimage, 84, 141-158, 2014. 
  • Li Wang, Feng Shi, Yaozong Gao, Gang Li, John H. Gilmore, Weili Lin, Dinggang Shen. Integration of Sparse Multi-modality Representation and Anatomical Constraint for Isointense Infant Brain MR Image Segmentation, Neuroimage, 89, 152-164, 2014. 
  • Li Wang, Yaozong Gao, Feng Shi, Gang Li, John H. Gilmore, Weili Lin, Dinggang Shen. LINKS: Learning-based multi-source IntegratioN frameworK for Segmentation of infant brain images, Neuroimage, 108, 160-172, 2015.