Cortex - Deep learning tools for neuroimaging
Python Jupyter Notebook


Cortex: a deep learning toolbox for neuroimaging

Cortex is a framework for training and evaluating neural networks using Theano. Cortex is not specific to, but includes tools for neuroimaging. Cortex is not meant to replace Theano, but is intended to be used as a compliment to scripting in python. It is very customizable, as all methods and classes are suggested templates, and pure Theano can be used when needed.


Cortex is a brand-new project and is under rapid development. If you encounter any bugs or have any feature requests, please email or create a GitHub issue.


Currently Cortex supports the following models:

  • Feed forward networks
  • RBMs
  • RNNs, GRUs, and LSTMs
  • Helmholtz machines as well as variational inference methods
  • Common datasets, such as MNIST and Caltech silhoettes
  • Neuroimaging datasets, such as MRI


You can install Cortex using the Python package manager pip.

$ pip install cortex

To get the most up-to-date version, you can install from the git repository:

$ pip install git+git://

However, currently the demos give the best example of how to script using cortex. So, if this is your first time using cortex, it is recommended to clone from the github repository:

$ git clone
$ cd cortex
$ python install

If you don't have administrative rights, add the --user switch to the install commands to install the packages in your home folder. If you want to update Cortex, simply repeat the first command with the --upgrade switch added to pull the latest version from GitHub.

In either case, you need to run the setup script:

$ cortex-setup

Follow the instructions; you will be asked to specify default data and out directories. These are necessary only for the demos, and can be customized in your ~/.cortexrc file.


Basic Requirements

Neuroimaging Requirements


These are not required for basic functionality, but are necessary for neuroimaging tools. afni, in particular, needs to be installed manually.


Cortex has several command-line demos of functionality. If the basic dataset was installed using cortex-setup, then the following demos are available:

$ cortex-classifier-demo

$ cortex-rbm-demo

$ cortex-vae-demo

If you installed the neuroimaging data, then the neuroimaging demos can be run:

$ cortex-rbm-vbm-demo

$ cortex-rbm-olin-demo

These are partial datasets used for demo purposes only.


Source documentation can be found here.