Masking with Matlab

Recently, I had a bunch of images for which I wanted to make all grey pixels transparent, in order to just see the color coded regions.


This was one of the situations, in which I was wondering whether I should do it manually (for 37 images) with Gimp, or write a script that can do the job for me. I was happy, that I decided to write a script, because it turned out that it just took me one minute to figure out the commands in Matlab and an additional minute to write the script. At the end I saved a lot of time and obtained images with an even more accurate mask than those images that I produced with Gimp. Here is the script for this kind of job:

function maskImage(filename)
a = imread(filename);
c = ((a(:,:,1) == a(:,:,2)).* (a(:,:,2) == a(:,:,3))) == 0;
imwrite(a, filename, 'png', 'Alpha', double(c));


Neural network visualization


Recently, I was asked to create an abstract illustration of my current project. This is what I came up with. I work on an artificial neural network model of the cortex-hippocampus-loop in the brain. In particular, I am interested in the transformation of population activity into a spatio-temporal spiking pattern that results from converging connections from the cortex to the hippocampal loop. Spike-timing and heterogenous conduction delays between neurons are crucial properties in this model.


The picture was created in Blender and rendered in Cycles.

Allen Brain Atlas as SVG

allen_brainJust discovered that you can download single images of the Allen Brain Atlas as SVG-files. This tutorial explains how to download the vector files. The simplest way is to use this URL in your browser

Where plane_id is the id of the plane you want to download, e.g.

Very cool, that they share all the data in an open source vector format.

Neural Networks: What should we borrow from biology?

This is a nice (and freely available) article by Oliver Coleman:

Models of  the brain: What Should We Borrow From Biology?

It was presented on the AAAI Symposium How Should Intelligence Be Abstracted in AI  Research and reviews several basic properties of neural networks that are possibly of critical importance for their functioning but mostly neglected in artificial neural networks. This is a great article for every computer scientist interested in neural networks and in the neuroscientific perspective on neural networks. It is hopefully a source of inspiration for new and more complete models.

Blender in Science

Blender is becoming increasingly important for scientific purposes. Its close integration of Python makes it extremely flexible and suitable for visualization of scientific data but also for simulations. Prominent examples are BioBlender, an add-on to visualize and study proteins,


and MORSE, a robot simulator.

MORSE 1.0 Trailer from HCAI TUM on Vimeo.

A few months ago, Py3DN appeared, which is another add-on for Blender to visualize and analyse morphological data of neurons.

py3dnGood tools, which show that Blender is becoming a powerful environment for the fast development of specialized software tools.

SWC importer for Blender

neuron is a website with a huge database of neuron morphologies, which can be downloaded in the SWC-format. As I wanted to display those neurons in Blender and could not find any importer, I wrote a small Python script that does the job for me. I thought it might be worth sharing this script just in case anybody else wants to use Blender to display and render the morphology of realistic neurons.

Update 27.05.2015:

The script is now available at Github.

Five Rules for the Evolution of Cooperation

Nowak, Martin A. 2006: Five Rules for the Evolution of Cooperation, Science 314: 1560–63

This paper provides a very easy to understand mathematical approach for the evolution of cooperation.

Cooperation is needed for evolution to construct new levels of organization. Genomes, cells, multicellular organisms, social insects, and human society are all based on  cooperation. Cooperation means that selfish replicators forgo some of their reproductive potential to help one another. But natural selection implies competition and therefore opposes cooperation unless a specific mechanism is at work. Here I discuss five mechanisms for the evolution of cooperation: kin selection, direct reciprocity, indirect reciprocity, network reciprocity, and group selection. For each mechanism, a simple rule is derived that specifies whether natural selection can lead to cooperation.


The evolution of modular neural networks

A nice discussion is going on in the NEAT User Group about the mechanism that lead to modular (artificial) neural networks, motivated by the recently published paper The evolutionary origin of modularity. The discussion around the questions, what modularity in a neural network actually is, how to measure it and how to setup evolutionary mechanisms to promote modularity in neural networks highlights the different views on that field that people with different backgrounds have.

Principles of Brain Evolution

I recently got the book Principles of Brain Evolution and can recommend it to everyone interested in evolutionary mechanisms that lead to the complexification of natural neural networks. The author writes in a subjective style that makes explicit why which topics are discussed in the book and which are just touched. Furthermore, he explains the categories in which brain evolution is studied and outlines the general limitations and problems with these categories. In this regard, the book provides a good and comprehensive introduction into the current notion of brain evolution from a cautious, distant perspective.