Python interface


The interface is the same as the C++ interface, and details of the interface can be explored in [GooseEYE.h] here you can find some comments to get you going. Start by

import GooseEYE

Ensemble or individual image

There are two modes of using the code. One can compute the statistics based on:

  • An individual image.
  • An ensemble of images.

The actual computation is contained in the computation of the ensemble, around which a wrapper is provided to evaluate an individual image. The computation of the ensemble proceeds in three steps:

  1. Initialize the ensemble, defining some settings of which the shape of the region-of-interest is mandatory. For example:

    ensemble = GooseEYE.Ensemble((51,51))
  2. Add the statistics by evaluating the different images in the ensemble. For example:

  3. Evaluate the result:

    result = ensemble.result();

    The separate raw result and normalization are also available.

Using the individual images wrapper all these steps are combined in a single function call with almost the same arguments as the underlying GooseEYE.Ensemle functions. The only limitation is the the raw data and normalization cannot be accessed.



The functions are available directly in the GooseEYE namespace for individual images, and as member functions of the Ensemble-class.


The arithmetic mean. An overload is available to mask certain voxels.


2-point probability / auto-correlation. Overloads are available for (binary and integer) images and np.flat images, and for masked images.


Weighted correlation. Overloads are available for different combinations of (binary and integer) images and np.float images, and for masked images.


Collapsed weighted correlation (see: Weighted correlation). Overloads are available for (binary and integer) images and np.float images, and for masked images. To automatically compute the clusters and their centres use W2c_auto.

Miscellaneous functions


Identify the clusters in a binary images.


Identify the clusters and their centres in a binary images.


Dilate a binary or integer image.


Define a kernel.


Define a path between two voxels.


Return the voxel-paths use in the computation of the lineal path function and collapsed weighted correlation.


Create a dummy binary images of circles.


To compile and install one can use

python build
python install

whereby python has to be replaced with your favourite Python executable. The prerequisites can be installed using pip install cppmat pybind11 (again replace pip with your favourite Python executable).