NEFI is a Python tool created to extract networks from images. Given a suitable 2D image of a network as input, NEFI outputs a mathematical representation of the structure of the depicted network as a weighted undirected planar graph. Representing the structure of the network as a graph enables subsequent studies of its properties using tools and concepts from graph theory.

NEFI was developed and tested primarily for the study of vein networks of the slime mold P. polycephalum. However, the authors successfully processed images of networks of different origin. Have a look at the examples in the Gallery for details.

NEFI builds on top of well-documented open source libraries in order to provide a reliable, transparent and extendable collection of interchangeable solutions. NEFI facilitates single image analysis as well as batch processing and aims to enable scientists and practitioners of various domains to freely explore, analyze and process their data in an intuitive, hands-on fashion.

Our major motivation in developing NEFI is to enable virtually everyone to automatically extract networks from images. While we may not be the first to attack this problem, we seek to overcome some of the limitations of existing solutions. To this end we present an extensible toolbox hidden behind an intuitive graphical user interface. NEFI was designed to give the practitioners in the labs the possibility to have a quick look at the pictures they just took to get a first impression of their observations. NEFI was designed to allow theoreticians to quickly falsify the predictions of their newest model using real world data. NEFI aims to enable and promote the application of graph theory across different fields and to be a useful tool for everyone seeking to bridge the gap between theory and experiment.

To learn bout how to use NEFI to extract graph structures from images please refer to our Quick Start Guide for users.

If you want to contribute to NEFI we advice you to go through our Quick Start Guide for developers.

Design philosophy

NEFI's approach is centered around the idea of intuitively combining algorithms to form an effective extraction pipeline. Thus NEFI does not stop at implementing a single solution to the network extraction problem but forms a flexible collection of powerful routines readily available for users of any experience level. We stress that NEFI does not require any prerequisite knowledge in image processing, computer vision or software design to be put to effective use. On the other hand, experts who are developing their own algorithms for network extraction are invited to consider using NEFI as an extendable framework. NEFI's modular design facilitates adding new methods to NEFI make it easier to compare different approaches against each other. Also, integrating your new algorithms into NEFI it might make it easier for you to reach wider audiences and thus gain a bigger impact.

These straightforward considerations have become the guiding principles in NEFI's development and are reflected in NEFI's design and implementation choices.

We use Python to develop NEFI and rely on a number of expertly written, well-documented and time-tested libraries. Thus NEFI becomes more efficient, better documented and more accessible to external contributers.

Accuracy, performance and limitations

NEFI was designed for efficient and robust single image as well as batch processing. Depending on the characteristics of the input image and the selected pipeline the quality of the resulting graph may vary. The major factor determining the quality of the graph is the segmentation step.

Many segmentation methods, including Watershed and GrabCut work very well if they do not have to deal with low-contrast pictures showing strong background color gradients. In such cases, more technically involved approaches are called for to overcome such challenging conditions.

NEFI's accuracy is a measure of how closely the computed graph resembles the originally depicted input network. Thus, when using segmentation as necessary step in network extraction, NEFI inherits the strengths and the weaknesses of its algorithms. NEFI tends to produce a lot of artifacts and faulty segmentations if the input pictures show

  • Highly irregular backgrounds with strong color/brightness gradients.
  • Isolated low contrast regions.
  • Networks with edges that are too fine to be segmented correctly with the given image resolution.
  • Networks that are too dense too be separated correctly

NEFI is designed to efficiently process large quantities of images. To this end NEFI outsources much of its computational load to highly optimized and reliable library code. The table below illustrates the effectiveness of a typical pipeline given input images of different size. The timings were obtained on a Mac notebook equipped with 2,4 GHz Intel i5 and 8 GB RAM.

Pipeline element Small image: 1152 x 864 pixels Large image: 5760 x 3840 pixels
Blur image < 1 s < 3 s
Guided Watershed with adaptive threshold mask < 1 s < 8 s
Guo-Hall Thinning < 1 s < 5 s
Node detection < 1 s < 10 s
Computing edge weights < 2 s < 10 s
Compute largest connected component < 2 s < 4 s

An additional limitation of NEFI consists of the inability to detect nodes of degree 2. NEFI's node detection relies on the skeleton of the segmented image. However, since the skeleton reflecting a path of nodes of degree two cannot be distinguished from a single long edge, degree 2 nodes are automatically contracted. The authors stress at this point that NEFI, like any other piece of code, has its limitations and we are not trying to wipe them under the rug. NEFI it is not capable of dealing with every possible input picture and was never intended to do so. However, NEFI tries to make up for its weaknesses by offering the possibility to integrate additional algorithms tailored towards a challenging input. If you managed to find a way to treat more difficult images, consider becoming a developer and share your advance with others by adding your solution to the set of NEFI's algorithms.

Making NEFI a community effort

Excellent code relies on excellent libraries. Excellent libraries are excellent, because they are actively developed and are ever improving. NEFI relies on many such libraries to be useful and strives to stay relevant in the future. Currently a 2-man team of students supervised by core developers is maintaining the code base to make sure that NEFI is not falling behind. However, one of our major goals with NEFI is to attract a larger base of interested external developers willing to tune in to the repository and keep an eye on the code. To make joining the project as easy as possible we decided to move from NEFI 1.0 to NEFI 2.0. With NEFI 2.0 we put a strong emphasis on clear design abiding best practices of software engineering paired with an extensive documentation suitable for users and developers alike. Using a very modular architecture it becomes trivial to add new algorithms to NEFI. Setting up a dedicated git repository as the backbone of NEFI ensures that future developments, issues and support are properly organized and taken care of.

Now, despite our efforts, we try to keep it real and do not expect a bunch of people to show up making enormous contributions all of a sudden. However, we worked hard to enable NEFI to gradually transition away from being a small "behind-closed-doors" research project towards a community-driven open source effort. We believe that by opening up the project to everyone NEFI has a larger potential to grow and stay relevant in the future. In order for NEFI to become self-suffcient, we need interested people willing to adopt NEFI as one of their projects.

If you are interested in contributing to the NEFI project in any way please contact us or visit our github.

If you need more informations about the structure of NEFI you should checkout the Documentation. For further questions we invite you to discuss the state of the NEFI project with us in the Issue section of our github page.

Watch Fork Issue

Download and Installation

NEFI is easy to install. If you are a Mac or Windows user, simply go to Download and download the package for your operating system. The packages listed in the download section are complete software deploys. Thus, you simply run NEFI at the click of a button with no additional strings attached.

For linux users and people interested in contribution to NEFI we offer a detailed explanation on how to install NEFI manually. To see a listing of all used technologies and librarys please visit our Dependencies section.

If you have any trouble during the installation process please contact us by creating an issue at our project github page.


Mailing List

NEFI is under active delevopment and updated on a regular basis. If you want to be notified about major changes and new versions, consider subscribing to our mailing list hosted at the Max-Planck Institute for Informatics.

How to cite NEFI

If you use NEFI in your research, please add a citation. You can use the following BibTex entry in your paper.

            Author = {Dirnberger, M. and Kehl, T. and Neumann, A.},
            Journal = {Scientific Reports},
            Title = {NEFI: Network Extraction From Images},
            Url = {},
            Volume = {5},
            Year = {2015}