Clone wiki

PyCA / Home

PyCA Wiki

Welcome to the PyCA wiki!

Required / Optional Dependencies

Operating Systems

The build system uses CMake. The current required prerequisites are:

  • C++ Compiler (gcc preferred: see this commit if you have version 4.7+)
  • CMake 2.8+
  • SWIG <= 3.0.2 or >= 3.0.10 (see issue #64)
  • CUDA (any version)
  • Python (version 2.7 or lower: see Python/numpy Issues)
  • FFTW
  • boost headers and runtime
  • numpy (development version including headers required)

The following are optional:

  • matplotlib 1.1.1+ (for full functionality in PyCA.Display and reading / writing png images)
  • scipy (some additional image/linear algebra functionality)
  • ITK (for reading/writing image formats other than png)
  • Doxygen (for generating html documentation and python docstrings)

Building the library:

Clone the git repository:

git clone [local directory to create]

If you omit the [local directory to create] it will just be cloned into a directory named 'pyca'. By default you will be on the latest development version. To check out a stable version, enter the source directory (cd pyca) and run git tag -l to see available versions, and check out the latest one. For example SEE NOTE BELOW:

> cd pyca
> git tag -l
> git checkout v0.01
[some output here]
> cd ..

NOTE: the current version (0.01) is very old, until 0.02 comes out you are probably better off using the development head, just omit the previous steps.

Next create a build directory and use cmake to configure the build:

mkdir pyca-bin
cd pyca-bin
ccmake ../pyca

Hit 'c' to perform initial configuration. The default install location (PYTHON_INSTALL_DIR) is ~/python/site-python. You can change this value if desired. If you want ITK support for reading / writing file formats and you've built ITK yourself (Note that ITK should be built with BUILD_SHARED_LIBS ON in order to enable the -fPIC flag), you may have to enter the build directory in the ITK_DIR entry. It's okay if CUDA_SDK_ROOT_DIR is not found. Press 'c' a few times until you get the 'g' (generate) option, then press 'g' to generate the build. You'll be dropped back to the shell, where you can build and install the project

make docstring
make install

Note that make docstring is optional and required Doxygen (this command inserts Doxygen documentation into python docstrings). The second make will include the docstring in the build result, it is only necessary if you made docstring. Make sure your python path is set to your installation directory by running the following or adding it to your ~/.bashrc script

export PYTHONPATH=~/python/site-packages:${PYTHONPATH}

You can then run the examples in the Examples directory, e.g.


Running testing:

From the Testing directory, all tests can be automatically discovered and run using unittest:

python -m unittest discover -v -p '*'

This will just give a pass/fail status on each test. To run an individual test with graphical results, the tests can be run individually from within IPython, for example to run the test_Exp test from CpuGpuUnitTest:

import CpuGpuUnitTest as cgtest
cgtc = cgtest.CpuGpuTestCase()

which will display the output of the test in matplotlib. For setup issues see the IPython notes page and matplotlib setup page

Tutorials and Web Documentation

We have web tutorials that are IPython notebooks

  • Introduction to Image3D and Field3D types (view / download)
  • Standard numerical operations (view / download)
  • Displaying (no tutorial yet)
  • I/O (no tutorial yet)
  • Difference operations/Gradients (no tutorial yet)
  • Applying deformations (view / download)
  • Memory Manager (view / download)
  • Multiscale Operations (view / download)
  • Filtering (no tutorial yet)

If you download the ipython, simply run

ipython notebook _TutorialName_.ipynb

on the downloaded tutorial and it will open an interactive session in your browser.

Running Examples

The examples in the Examples directory can be run simply as (for example running


or from IPython:


Note that these examples require matplotlib. For setup issues see the matplotlib setup page

Matplotlib Setup

See this page

IPython Notes

See this page



Developer Information

Windows support

Preliminary windows support is being actively developed. Check this wiki page for the latest status of PyCA on Windows.

Common Problems

If you get the following error:

.../Libraries/PyCA/inc/types/typesPYTHON_wrap.cxx:3478:31: fatal error: numpy/arrayobject.h: No such file or directory

see the note here