[MINC-users] running voxel-wise mixed-effects modeling on huge dataset with Python Rpy2 and pyezminc
Vladimir S. Fonov
vladimir.fonov at gmail.com
Wed Feb 19 01:43:59 EST 2014
Hello Everybody,
just wanted to share news about a new tool for running voxel-level
statistical analysis on minc files, an alternative to RMINC and glim_image.
It is under active development, but it is already usable:
https://github.com/BIC-MNI/pyezminc/tree/develop
in short it is a python module to interface with MINC, mainly developed
by Haz-Edine from NeuroRX with my additions. It is using cython (I
recommend using the latest version 0.20 ) and numpy to interact with
minc files using EZminc API. I have extended it to be able to stream
data to and from multiple minc files to easily perform voxel-level
statistical analysis.
Integrating with Rpy2 ( R interface for Python) allows to easily run
statistical tests.
For example:
https://github.com/BIC-MNI/pyezminc/blob/develop/examples/glim_image.py
- performs a simple voxel-level t-test on difference between two cohorts
, using DBM data from 64 subjects (with ROI covering the whole brain)
execution time is 14m56s , equivalent analysis performed using
glim_image on the same computer takes 3m12s.
The advantage is it is possible to use more complicated statistical
models (similar to RMINC), next example:
https://github.com/BIC-MNI/pyezminc/blob/develop/examples/lme_image.py -
performs voxel-level mixed-effect modeling (quite slowly).
Fortunately, it is pretty simple to parallelize execution of statistical
modeling in python, example number 3 - running voxel-level mixed-effect
modelling on a cluster using SCOOP ( https://code.google.com/p/scoop/ )
:
https://github.com/BIC-MNI/pyezminc/blob/develop/examples/parallel_lme_image.py
Running full-brain linear mixed effect model on 899 scans ( volume of
mask is 235818 2mm^3 voxels) on a 16 core machine took approximately 23
minutes. Note that the example doesn't try to play nice with the memory,
so overall memory used was approximately 10Gb. It will be pretty trivial
to significantly reduce the memory requirement by not submitting all the
computation jobs at once , but in chunks.
It should be also possible to make scoop play nicely with SGE (
http://scoop.readthedocs.org/en/0.7/usage.html#startup-scripts-cluster-or-grid
)
p.s. pyezminc depends on a modern installation of MINC (such as that
found in minc-toolkit). And could be compiled and installed in your
private python library by running "python setup.py install --user" .
Currently dependencies are : Cython , numpy and scipy . Examples also
use Rpy2 and scoop . All these libraries can be installed by running
"python setup.py install --user" without the need to have root access on
your system.
--
Have Fun,
Vladimir S. Fonov
More information about the MINC-users
mailing list