Monday, September 28, 2015

The unsung heroes of neuroinformatics

There are many fascinating and exciting developments in human cognitive and clinical neurosciences. We are constantly drawn to novel and groundbreaking discoveries. There is nothing wrong with this - I would even say that's part of the human nature. This kind of research is not, however, what I want to talk about today. This post is dedicated to people building tools that play a crucial role as a backbone of research - helping novel discoveries happen. They go beyond providing a proof of concept, publishing a paper and pointing to undocumented piece of code that works only in their labs. They provide maintenance, respond to user needs, and constantly update their tools fixing bugs and adding features. Here I will highlight two tools which in my personal (and very biased) opinion play an important role in supporting human neuroscience, and could do with some more appreciation.

Early years of Captain Neuroimaging


Anyone dealing with MRI data in Python must know about this library. Nibabel allows you to read and write a variety of different file formats used in neuroimaging (most importantly NIFTI). It hides the obscurity of those standards and provides easy to use objects and methods that let you efficiently access, modify and visualize neuroimaging data. It seems like nothing, but not having to deal with finding the right header format each time you want to read a file can be easily overlooked. I use nibabel all the time and I am very grateful for its existence!
Its a really good example of something that even though is not "novel" or sexy but is absolutely crucial and enables many researchers to get closer to understanding how the human brain works. Despite the fact that nibabel plays an essential role in python neuroimaging ecosystem it does not get enough credit. Nibabel is an open source project lead by +Matthew Brett who is tirelessly keeping it up to date with frequent release cycle.


Papaya is a relatively new project providing a modular, reusable javascript based NIFTI and DICOM viewer. Being able to read the data apply the right affine transformation and perform efficient interpolation is probably not the most fascinating work in the world, but it's incredibly important. Web based applications are the future and I am sure that Papaya will play a crucial role in bringing neuroimaging to the cloud. Papaya has already been used in projects such as NeuroVault, ANIMA, and NIFTI-drop. I wonder if those projects had to develop their own javascript viewer they would exist at all! Thanks to the work of of the Papaya team they can all reuse the same reliable and fast viewer.
Papaya is also an open source project, but it is mainly developed by Biomedical Image Analysis Division of the Research Imaging Institute at University of Texas San Antonio lead by Jack Lancaster. Their (sadly) unnamed developers are doing a great job by constantly improving the viewer and providing new features upon user request.

I love those two projects and I have written this post to tip my hat towards people spending their time making this software happen. It enabled me to do research over the years and build tools of my own. Behind my urge to compliment the unappreciated there is a bigger issue. Science is currently so obsessed with novelty and groundbreaking discovery there is no space for appreciating, crediting and most importantly funding those that provide essential support for this science to happen. If we want to have solid reproducible and robust findings we need to improve our tools and focus on maybe less fascinating, but nonetheless important work.

Sunday, September 13, 2015

Software workaround for corrupted RAM in OS X

Recently my computer has been acting up. Software started crashing, compilations failing, etc. Many small errors that I could not replicate. I wasn't too concerned, because I'm a natural tinkerer - I play with software, install many different additions and one of the side effects can be an unstable operating system. Eventually my system stopped booting - the partition table was corrupted. I had to wipe it and reinstall (which was a massive pain in the ass). I also tried to run some hardware checks just in case (the computer is over three years old), but the "Apple Hardware Test" was hanging each time I run (bad sign huh?). I'v eventually run memtest86 overnight and discovered that part of my RAM is corrupted. My computer is a Mac Book Pro Retina with expired warranty.

Normally I would buy new ram and install it myself, but the retina MBPs have RAM permanently soldered to the logic board. Instead of paying through the nose to get it fixed I researched software solutions. Linux users have a very handy kernel option that will tell the OS not to use a particular range of memory addresses - it's called memap. Situation on OS X is not so rosy. The only option available is to restrict memory up to the point where it's corrupted (but this way you lose everything after it). In my case I had around 60Mb range of corrupted memory in the 13th gigabyte. My only option was to restrict the system to use 12Gb. This is the procedure:

  1. Run memtest86 overnight to figure where your memory is corrupted.
  2. Estimate the lowest range of usable memory (in my case it was 12000Mb).
  3. Restrict the memory by setting a kernel flag: 
    sudo nvram boot-args="maxmem=12000"

This did the trick and made my laptop usable again!