Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Code for MICCAI 2017 paper "BRIEFnet: Deep Pancreas Segmentation using Sparse Dilated Convolutions"

by Mattias P. Heinrich and Ozan Oktay.

Please see for PDF and more details

Prerequisites to run example

1) Create free account and download pancreas dataset

"Beyond the Cranial Vault" MICCAI workshop (!Synapse:syn3193805/wiki/89480)

Log in, click on 'Files' and select 'Abdomen' (or go to!Synapse:syn3376386) you will only need to download (which has a size of 1.53 GBytes and contains 30 scans) and subsequently extract the files. Please note, that the files are not consecutively named (11-20 are missing) - which will be fixed in step 2.

2) Open a MATLAB instance and preprocess data

In case you have not used nifti files in MATLAB before install the toolbox of Jimmy Shen:

Once you have obtained the training data, it should be cropped using the provided bounding boxes (boundingboxes_abdomen15.mat). Run the script the following way:


providing input folder (i.e. the one you extracted the training folder of to) and an output folder (here 'pancreas'). This will generate 30 scans and corresponding (binary) segmentations of sizes 124x84x94. This may take more than 1 minute.

3) Install and compile MatConvNet

Follow the guide to compile the toolbox at When applying the trained models the CPU is sufficient, otherwise a GPU is recommended. Make sure MatConvNet is working and its paths are set within MATLAB. Add the following two custom files for BRIEFnet into the folder /matlab/+dagnn/

Mult.m and BRIEF.m

Finally, you need to extract the eigenlibrary files, which are used for the edge-preserving smoothing:

unix('tar zxf eigen.tar.gz');

4) Load a trained BRIEFnet model and apply it to a scan (#7)

We have split the cross-validation in 6 folds of 25 training images. Fold 1: #6-#30, Fold 2: #1-#5 and #11-#30 etc. For testing #7, we are using the following commands


We can evaluate the quality of the segmentation obtained with BRIEFnet, by calculating the Dice overlap (which should be 60%) with the ground truth and visualise an overlay using:

segmentTestGT=load_untouch_nii(['pancreas/seg7_res.nii.gz']); segmentTestGT=segmentTestGT.img;
figure; imshow(flip(permute(fused,[2,1,3]),1));

TODO: how to train a model with your own data.

If you find any problems or need help, feel free to contact me at lastname @

Mattias Heinrich


Code for MICCAI 2017 paper on binary sparse convolutions for semantic segmentation of medical images







No releases published


No packages published