This is an archive of the old MediaWiki-based ImageJ wiki. The current website can be found at

Graph Cut

Graph Cut
Project Fiji
Source on GitHub
License GPLv3
Release 1.0.2
Date Sat Apr 29 22:44:45 CDT 2017
Development status Stable
Support status Minimal
Founders Jan Funke
Leads Jan Funke
Developers -
Debuggers -
Reviewers Jan Funke
Support -
Maintainers Curtis Rueden
Contributors Johannes Schindelin, Albert Cardona, Jan Eglinger, Mark Longair, Yili Zhao, Ignacio Arganda-Carreras, Mark Hiner


The Graph Cut plugin provides a way to obtain a globally smooth binary segmentation. As input, you have to provide a gray-scale image that represents the pixel affinities for belonging to the foreground. Via a single parameter you can adjust the smoothness of the segmentation.


This plugin is based on a reimplementation of Kolmogorov's maxflow v3.01 library, which was written in C++. If you intend to use it for a publication, please cite:

Yuri Boykov and Vladimir Kolmogorov, An Experimental Comparison of Min-Cut/Max-Flow Algorithms for Energy Minimization in Computer Vision., In IEEE Transactions on Pattern Analysis and Machine Intelligence, September 2004.

The plugin can be found under Plugins › Segmentation › Graph Cut.


The only available setting so far is the "smoothness" value. Use it to adjust the penalty for label changes in the segmentation. The higher this value, the less label changes you will have, thus the segmentation gets smoother. A value of zero corresponds to thresholding the input image.


Assume we want to segment the following image into foreground/background, such that the foreground is the mitochondria and the background everything else:


Probability Image

First, we create a probability image that reflects the per-pixel probability of belonging to the foreground. For that, we can use the Trainable Weka Segmentation plugin. We train a classifier for the mitochondria and everything else. Instead of using the classifier directly for the segmentation, however, we create a probability image:


Running Graph Cut

Now we start the Graph Cut plugin on the probability image. With the "smoothness" slider we can adjust the smoothness of the segmentation to avoid some small extrema to corrupt our segmentation. In our example, we found that a value of about 600 gives reasonable results. The outcome of the plugin is a binary image, with white being the foreground segmentation:



Finally, we merge the original image and the segmentation for illustration purposes: