Skip to content
LUNA16 Lung Nodule Analysis - NWI-IMC037 Final Project
Python Shell
Branch: master
Clone or download
Latest commit adc76fd Mar 13, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
config 10 way split on candidates v2 Jul 26, 2016
images new images Jun 23, 2016
scripts Set scripts to generate candidates v2 Jul 20, 2016
src 10 way split on candidates v2 Jul 26, 2016
.gitignore Scripts for new dataset.. Jun 25, 2016
LICENSE Add license Mar 13, 2017
lung_segmentation.mlab Add lung segmentation network Apr 29, 2016
lung_segmentation_automatic.mlab New network May 6, 2016


LUNA16 Lung Nodule Analysis - NWI-IMC037 Final Project

Respository containing code for our final project of the computer aided medical diagnosis course, which yielded an entry in the LUNA16 competition. Unfortunately this project is ill documented, as it was created very quickly and pragmatically as we hurried to meet deadlines for the university course this was the main project of. Running it will likely require minor edits left and right (mostly to do with filepaths), unless you place the data in the same folder as we did.

A rough list of requirements:

Python 2.7 with theano, lasagne (with CUDNN configured), tqdm, pandas, numpy, scipy, scikit-image, scikit-learn, opencv2.

UNET for dense prediction


Convert data to 1x1x1mm_512x512 slices. A requirement is also a set of segmentations of the lungs (can be found on the LUNA16 website). Place your data in folder data/original_lungs:

Use script src/data_processing/, this may take a long time (up to 24 hours) depending on your machine.

Then, download imagename_zspacing.csv from here and put it in the data folder.

Unet training

src/deep/unet/ <config>

Example conifg config/unet_splits/split01.ini. Repeat this for each of the splits.

Unet held out set dense predictions

src/deep/predict <model_name> <epoch>

When training a model a folder is created in /models. The folder name is the model name here. Manually look up which epoch had the lowest validation set loss and was a checkpoint.

Unet dense predictions -> candidates:

This part is likely hard to redo using our code, as it was done by manually editing the scripts. This part is however the easiest conceptually and clearly described in our method description on the Luna competition page. To go from dense prediction to the initial set without postprocessing you can look at src/ You will have to edit line 30.

False positive reduction (Wide ResNet)


We performed this on a large cluster (using up to 20 nodes simoultaneously, this may take very long on a single machine). First we equalize the spacings tp 0.5mm0.5mm0.5mm using src/data_processing/ Then we create the 96x96 patches in all three orientations using src/data_processing/ Scripts to perform this using SLURM for job management (will require some editing of paths) can be found in /scripts/create_patches/ and /scripts/rescale.


python <config> in /src/deep
Configurations: with X 0 through 9.


src/deep/predict_resnet <model_name> <epoch> <which subsets to predict>

The prediction CSV can then be found in the model folder. All you have to do now is combine these. You could use src/ for this, which also features some equalization of predictions of the different models.

You can’t perform that action at this time.