Brainsimulation
Simulation of the human brain.
BrainSimulation

Simulation of the human brain.

How to build

Linux

  1. Clone the repository.
  2. From the working directory root run

    $ make

  3. The makefile supports the install target (optional).

Windows

  1. Clone the repository.
  2. Open *win32.sln* in Visual Studio.
  3. Build using Visual Studio

Customizing the build

You can customize the build by passing Preprocessor options. Using make, pass them to the DFLAGS variable. Use GCC's regular -D switch.

Example, sets the THREADFACTOR directive to 0.5 using GCCs -D switch:

$ make DFLAGS="-DTHREADFACTOR=0.5"

Available switches:

Available function modificators:

These factors can be configured during compilation to customize the behavior of each node during the simulation.

How to run

  1. Create a ./testoutput directory in the directory from which you execute the brainsimulation. Results will be written to this directory.
  2. (Optional) Configure inputs bitmap image files
  3. Execute the simulation in one of the following ways:
    • Linux, running from the build directory:

      $ ./brainsimulation -x X_NODES -y Y_NODES --ticks SIMULATION_TICKS [OPTIONAL PARAMETERS]

    • Linux, after compiling using make install:

      $ brainsimulation -x X_NODES -y Y_NODES --ticks SIMULATION_TICKS [OPTIONAL PARAMETERS]

    • Windows:

      > .\brainsimulation -x X_NODES -y Y_NODES --ticks SIMULATION_TICKS [OPTIONAL PARAMETERS]

Command Line Parameters

Command line parameters are also shown when starting the brainsimulation with brainsimulation --help.

Generally, run with: brainsimulation -x X_NODES -y Y_NODES --ticks SIMULATION_TICKS [OPTIONAL PARAMETERS]

Mandatory parameters:

Recommended parameters (technically optional, but doesn't really make sense not to use them):

Optional parameters:

Example:

brainsimulation -x 200 -y 200 --ticks 5000 --xobs 50 51 --yobs 50 51 --startlevels 10 11 --startx 10 11 --starty 10 11 --freqs 3 5 --freqx 25 26 --freqy 25 26

Example using bitmaps:

brainsimulation -x 200 -y 200 --ticks 3000 --xobs 50 51 --yobs 50 51 --freqbitmaps testinput/input0.bmp testinput/input1.bmp testinput/input2.bmp --minbitmapfreq 10 --maxbitmapfreq 40 --bitmapduration 1000

Using Bitmap Images as Inputs

You can choose to use bitmap images as inputs and pass them using the --freqbitmaps paramter. Doing this will generate input timeseries for all non-zero (non-black) pixels from the specified 24-bit bitmap images. Each pixel will be directly mapped to the corresponding node in the simulation (using its x and y coordinates, with 0,0 at the top left). Bitmaps must have the same dimensions and must be encoded using uncompressed, 24-bit bitmap files, which is the MS-Paint default. Bitmap color values are summed (R+G+B) and translated to frequencies. The minimum non-0 color (1) is mapped to the value provided using --minbitmapfreq and the maximum color (765) is mapped to the value provided using --maxbitmapfreq. Other frequencies are determined using linear interpolation. A black (value 0) pixel will always be interpreted as a pixel that is currently not generating a signal.

You can specify multiple images. Each image is shown for the duration specified using --bitmapduration (in ticks). Once its duration is up, the next image is used for generation (analogous to a frame in a movie). The simulation loop over the bitmaps in case the the total simulation duration exceeds the duration of the bitmap "movie".

Developing

Check out our code documentation at https://descartesresearch.github.io/BrainSimulation/