neuroformats

Handling of structural neuroimaging file formats for Rust.

The neuroformats crate provides access to structural neuroimaging data in Rust by implementing parsers for various file formats. The focus is on surface-based brain morphometry data, as produced from 3D MRI images by tools like FreeSurfer, CAT12 and others.

Installation

A very early version of the neuroformats crate is on crates.io.

To use the library in your project, add it as a dependency in your Cargo.toml file, e.g.:

toml [dependencies] neuroformats = "0.2.0"

Features

Various utility functions are implemented for performing common computations on the returned structs, e.g. computing the vox2ras matrix from the MGH header data or finding all vertices in a brain surface parcellation that belong to a certain brain atlas region.

Documentation

API docs

The neuroformats API docs can be found at docs.rs/neuroformats.

Usage example

Read vertex-wise cortical thickness computed by FreeSurfer:

rust use neuroformats::read_curv; let curv = read_curv("subjects_dir/subject1/surf/lh.thickness").unwrap(); let thickness_at_vertex_0 : f32 = curv.data[0];

You now have a Vec<f32> with the cortical thickness values in curv.data. The order of the values matches the vertex order of the respective brain surface reconstruction (e.g., the white surface mesh of the left brain hemisphere in subjects_dir/subject1/surf/lh.white).

See the neuroformats API docs and the unit tests in the source code for more examples.

Development

Unit tests and continuous integration

Continuous integration results:

Build Status Travis CI under Linux

LICENSE

The neuroformats crate is free software, dual-licensed under the MIT or APACHE-2 licenses.

Help and contact

If you have trouble or found a bug, please open an issue here on Github.

The neuroformats crate was written by Tim Schäfer. You can find my email address on my website if you need to contact me in person.