← Home

Beyond the lab

Code

Older side projects: research tools from my graduate work and the 2D games I wrote while learning to program. Today I work mostly in Python, MATLAB and embedded C.

Python program to assess motor sequence learning

A test game built to run inside a scanner or while measuring brain activity. The participant presses five keys in a specific order to complete a sequence, and the program records movement time for each execution and finger force data in real time.

Download the archive (RAR, 11.3 MB; requires Python 2 and a few libraries)

Diagram of one trial: fixation, pre-cue, then three executions of a five-digit sequence

Generating anatomical masks with FreeSurfer

I needed binary masks of a few Brodmann areas (e.g. SMA, premotor cortex) mapped onto brain imaging data, so that only the regions of interest are kept in later processing and voxels irrelevant to the paradigm are discarded. I ran FreeSurfer from the command line on Debian. Replace the parts in angle brackets.

1. Process the data and create the labels:

recon-all -s <subject directory> -ba-labels

2. Create a registration matrix so the mask matches the template. The template can be mri/rawavg.mgz or a functional-space file:

mri_tkregister2 --mov <template path> --s <subject id> --regheader --reg ./register.dat

3. Generate the mask, here the left anterior primary motor cortex (BA4a):

mri_label2vol --subject <subject id> --label <subject path>/label/lh.BA4a.label \
  --temp <template path> --reg register.dat \
  --proj frac 0 1 .1 --fillthresh .3 --hemi lh --o <mask>.nii.gz
Brain MRI slices with a yellow mask over the left anterior primary motor cortex Brain MRI slices with a yellow mask over the left premotor cortex and SMA
Masks in yellow, in anatomical space: left anterior primary motor cortex (left) and left premotor cortex and SMA (right).

2D platform games

L'île de Cloé (Cloé's Island, 2011)

A game I coded and designed for practice and fun, mainly in Ruby. A girl stranded on an island tries to survive. Fight the crabs and solve puzzles to progress.

Download (RAR, 32.2 MB)

Top-down pixel-art island with palm trees and the player character
Screenshot of L'île de Cloé gameplay Screenshot of L'île de Cloé gameplay in another area

Cugel l'astucieux (Cugel the Clever, 2008)

One of my first games, also written mainly in Ruby for practice and fun. Cugel is a wanderer. One night he tries to cross the enchanted forest of Tantreval.

Download (RAR, 134.3 MB)

Pixel-art forest at night with the player character
Screenshot of Cugel l'astucieux in the enchanted forest