Skip to content
Branch: master
Go to file

Latest commit


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

CREMI Python Scripts

Python scripts associated with the CREMI Challenge.


If you are using pip, installing the scripts is as easy as

pip install git+

Alternatively, you can clone this repository yourself and use distutils

python install

or just include the cremi_python directory to your PYTHONPATH.

Reading and writing of CREMI files

We recommend you use the package for reading and writing of the CREMI files. This way, you can be sure that the submissions you produce are of the form that is expected by the challenge server, and that compression is used.

You open a file by instantiating a CremiFile object:

from import CremiFile
file = CremiFile("example.hdf", "r")

The second argument specifies the mode, which is "r" for reading, "w" for writing a new file (careful, this replaces an existing file with the same name), and "a" to append or change an existing file.

The CremiFile class provides read and write methods for each of the challenge datasets. To read the neuron IDs in the training volumes, for example, use read_neuron_ids():

neuron_ids = file.read_neuron_ids()

This returns the neuron_ids as a cremi.Volume, which contains an HDF5 dataset ( and some meta-information. If you are using the padded version of the volumes, neuron_ids.offset will contain the starting point of neuron_ids inside the raw volume. Note that these numbers are given in nm.

To save a dataset, use the appropriate write method, e.g.,:


See the included and for more details.


For each of the challenge categories, you find an evaluation class in cremi.evaluation, which are NeuronIds, Clefts, and SynapticPartners.

After you read a test file test and a ground truth file truth, you can evaluate your results by instantiating these classes as follows:

from cremi.evaluation import NeuronIds, Clefts, SynapticPartners

neuron_ids_evaluation = NeuronIds(truth.read_neuron_ids())
(voi_split, voi_merge) = neuron_ids_evaluation.voi(test.read_neuron_ids())
adapted_rand = neuron_ids_evaluation.adapted_rand(test.read_neuron_ids())

clefts_evaluation = Clefts(test.read_clefts(), truth.read_clefts())
fp_count = clefts_evaluation.count_false_positives()
fn_count = clefts_evaluation.count_false_negatives()
fp_stats = clefts_evaluation.acc_false_positives()
fn_stats = clefts_evaluation.acc_false_negatives()

synaptic_partners_evaluation = SynapticPartners()
fscore = synaptic_partners_evaluation.fscore(

See the included for more details. The metrics are described in more detail on the CREMI Challenge website.


Evaluation code contributed by:


Python scripts to read and write the CREMI hdf5 file format.



No releases published


You can’t perform that action at this time.