I have more code to share. This time it is something I think could be useful to a slightly bigger audience than my last code drop. It is a pure-python module for nrrd files. Nrrd (Nearly Raw Raster Data) is a file format for storing N-dimensional raster data and often used for DTI data.
The format is well-documented and it has a high-quality C-library (part of the excellent teem project) to support it. At a certain point I wanted to do some prototyping in Python (with numpy) around data stored in nrrd files. Rather than wrapping the library to create a python nrrd module, I gave writing a pure-python nrrd module a try. Such a module would have the advantage of having few external dependencies.
Python’s expressiveness and “batteries included” combined with the feature-full numpy package made implementing nrrd’s format definition relatively easy. Even though the module is note yet complete (most importantly, it is lacking write support), in the light of “release early, release often” I thought I’d put it out there anyway.
The process of making a proper easily installable module has been a useful learning experience as well. With the help of pylint I’ve cleaned up the code and I tried to make it as compliant as possible to PEP8. I’ve put the code on github again, hoping that it might be useful to others.