applied neurodebian: python in...
TRANSCRIPT
http://www.pymvpa.org
http://neuro.debian.net
Applied NeuroDebian: Python in Neuroimaging
Yaroslav O. Halchenko
Dartmouth College, USA
Munich, Germany 2012
YOH (Dartmouth) Python & NeuroDebian Munich, Germany 2012 1 / 20
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 2 / 20
The Vision
We (society) have the software platform. . .
that works on all devices, operating systems, . . .that is guaranteed to be available for as long as we want,wherever we wantthat we can freely share with anyonethat makes manual maintenance trivial, or superfluousso all software is available in a single environmentso we can share our experience with colleaguesso we can share data processing workflows easilyso developers can focus their scarce resources
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 3 / 20
How do we get there?
Role modelOrigin of most active software distributionsVast archive of maintained software(≈30000 binary packages) – provenproceduresSelf-governed, “do-ocracy”, no need toearn money, going strong for 20 years
We . . .Adopt standards and proceduresParticipate in the Debian project andintegrate all research softwareBenefit from the work of thousandsof additional developersCall it , add fancy logo
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 4 / 20
How do we get there?
Role modelOrigin of most active software distributionsVast archive of maintained software(≈30000 binary packages) – provenproceduresSelf-governed, “do-ocracy”, no need toearn money, going strong for 20 years
We . . .Adopt standards and proceduresParticipate in the Debian project andintegrate all research softwareBenefit from the work of thousandsof additional developersCall it , add fancy logo
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 4 / 20
NeuroDebian from a researcher’s perspective
Install simple editor
apt-get install gedit
Install complex MRI analysis package
apt-get install fsl
Install software collection for psycho-physics
apt-get install science-psychophysics
Keep the whole system up-to-date
apt-get upgrade
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 5 / 20
NeuroDebian (http://neuro.debian.net)after X years and the contributions of many people:
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 6 / 20
Python in Neuroimaging (http://www.nipy.org)
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 7 / 20
Python in NeuroImaging
Find the community @ http://www.nipy.org
Stimuli Delivery
PsychoPyhttp://www.psychopy.org
PsychoPy is an easy, precise, platform-independent pack-age for stimulus presentation. Suitable for psychophysics,neuroimaging, and all areas of psychology.∙ Huge variety of stimuli generated in real-time∙ Cross-platform – run the same script on Linux, Win or
OS X∙ Flexible stimulus units (degrees, cm, or pixels)∙ Coder interface for those that like to program∙ Builder interface for those that don’t∙ Input from keyboard, mouse, joystick or button boxes∙ Multi-monitor support∙ Automated monitor calibration (supported photometers)
OpenSesamehttp://www.cogsci.nl/software/opensesame
OpenSesame is a graphical experiment builder for the socialsciences.∙ A comprehensive and intuitive graphical user interface∙ WYSIWYG drawing tools for creating visual stimuli∙ Cross-platform∙ Python scripting for complex tasks∙ A plug-in framework∙ Compatibility (through plug-ins) with commonly used
devices: (e.g. Eyelink eye trackers, serial responseboxes, Mantra object tracker)
∙ Compatibility with popular Python libraries: PsychoPy,PyGame, PyOpenGL, etc.
Data I/O
NiBabelhttp://nipy.org/nibabel
Nibabel provides read and write access to some commonmedical and neuroimaging file formats, including: ANA-LYZE (plain, SPM99, SPM2), GIFTI, NIfTI1, MINC, aswell as PAR/REC. NiBabel is the successor of PyNIfTI.The various image format classes give full or selective ac-cess to header (meta) information and access to the imagedata is made available via NumPy arrays.
Analysis
BrainVISAhttp://brainvisa.info
BrainVISA is an open-source, modular and customizablesoftware platform built to host heterogeneous tools ded-
icated to neuroimaging research. It aims at helping re-searchers in developing new neuroimaging tools, sharingdata and distributing their software.∙ Databasing capabilities∙ Massive computation facilities using Soma-workflow∙ Open environment, with many toolboxes∙ Specialized toolboxes for T1 MRI processing, sulci ang
gyri morphometry, diffusion imaging and fibers tracking,surfacic and structural analysis, 3D histology. . .
∙ Links with other software like SPM, FSL, FreeSurfer, orCIVET
D. Geffroy, D. Rivière, I. Denghien, N. Souedet, S. Laguitton,and Y. Cointepas. BrainVISA: a complete software platform forneuroimaging. In Python in Neuroscience workshop, Paris, Aug.2011.
DiPyhttp://nipy.org/dipy
Dipy is an international FOSS project for diffusion mag-netic resonance imaging analysis. Dipy is multiplatformand will run under any standard operating system such asWindows, Linux, Mac OS X. Some of our state-of-the-artapplications are:∙ Reconstruction algorithms e.g. GQI, DTI∙ Tractography generation algorithms e.g. EuDX∙ Intelligent downsampling of tracks∙ Ultra fast tractography clustering∙ Resampling datasets with anisotropic voxels to isotropic∙ Visualizing multiple brains simultaneously∙ Finding track correspondence between different brains∙ Warping tractographies into another (e.g. MNI) space∙ Support of various file formats e.g. Trackvis or NIfTI
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 8 / 20
Python in NeuroImaging
Find the community @ http://www.nipy.org
Stimuli Delivery
PsychoPyhttp://www.psychopy.org
PsychoPy is an easy, precise, platform-independent pack-age for stimulus presentation. Suitable for psychophysics,neuroimaging, and all areas of psychology.∙ Huge variety of stimuli generated in real-time∙ Cross-platform – run the same script on Linux, Win or
OS X∙ Flexible stimulus units (degrees, cm, or pixels)∙ Coder interface for those that like to program∙ Builder interface for those that don’t∙ Input from keyboard, mouse, joystick or button boxes∙ Multi-monitor support∙ Automated monitor calibration (supported photometers)
OpenSesamehttp://www.cogsci.nl/software/opensesame
OpenSesame is a graphical experiment builder for the socialsciences.∙ A comprehensive and intuitive graphical user interface∙ WYSIWYG drawing tools for creating visual stimuli∙ Cross-platform∙ Python scripting for complex tasks∙ A plug-in framework∙ Compatibility (through plug-ins) with commonly used
devices: (e.g. Eyelink eye trackers, serial responseboxes, Mantra object tracker)
∙ Compatibility with popular Python libraries: PsychoPy,PyGame, PyOpenGL, etc.
Data I/O
NiBabelhttp://nipy.org/nibabel
Nibabel provides read and write access to some commonmedical and neuroimaging file formats, including: ANA-LYZE (plain, SPM99, SPM2), GIFTI, NIfTI1, MINC, aswell as PAR/REC. NiBabel is the successor of PyNIfTI.The various image format classes give full or selective ac-cess to header (meta) information and access to the imagedata is made available via NumPy arrays.
Analysis
BrainVISAhttp://brainvisa.info
BrainVISA is an open-source, modular and customizablesoftware platform built to host heterogeneous tools ded-
icated to neuroimaging research. It aims at helping re-searchers in developing new neuroimaging tools, sharingdata and distributing their software.∙ Databasing capabilities∙ Massive computation facilities using Soma-workflow∙ Open environment, with many toolboxes∙ Specialized toolboxes for T1 MRI processing, sulci ang
gyri morphometry, diffusion imaging and fibers tracking,surfacic and structural analysis, 3D histology. . .
∙ Links with other software like SPM, FSL, FreeSurfer, orCIVET
D. Geffroy, D. Rivière, I. Denghien, N. Souedet, S. Laguitton,and Y. Cointepas. BrainVISA: a complete software platform forneuroimaging. In Python in Neuroscience workshop, Paris, Aug.2011.
DiPyhttp://nipy.org/dipy
Dipy is an international FOSS project for diffusion mag-netic resonance imaging analysis. Dipy is multiplatformand will run under any standard operating system such asWindows, Linux, Mac OS X. Some of our state-of-the-artapplications are:∙ Reconstruction algorithms e.g. GQI, DTI∙ Tractography generation algorithms e.g. EuDX∙ Intelligent downsampling of tracks∙ Ultra fast tractography clustering∙ Resampling datasets with anisotropic voxels to isotropic∙ Visualizing multiple brains simultaneously∙ Finding track correspondence between different brains∙ Warping tractographies into another (e.g. MNI) space∙ Support of various file formats e.g. Trackvis or NIfTI
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 8 / 20
http://goo.gl/DXZXB http://github.com/nipy/nipy-artwork
PsychoPyhttp://www.psychopy.org
PsychoPy is an easy, precise, platform-independentpackage for stimulus presentation. Suitable forpsychophysics, neuroimaging, and all areas of psychology.
Huge variety of stimuli generated in real-timeCross-platform – run the same script on Linux, Win or OS XFlexible stimulus units (degrees, cm, or pixels)Coder interface for those that like to programBuilder interface for those that don’tInput from keyboard, mouse, joystick or button boxesMulti-monitor supportAutomated monitor calibration (supported photometers)
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 9 / 20
PsychoPy: Builderhttp://www.psychopy.org
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 9 / 20
NiBabelhttp://nipy.org/nibabel
NiBabel (successor of PyNIfTI) provides read and writeaccess to some common medical and neuroimaging formats:
ANALYZE (plain, SPM99, SPM2)GIFTINIfTI1MINCPAR/RECFreesurfer volume/surface/spec
The various image format classes give full or selective access toheader (meta) information and access to the image data is madeavailable via NumPy arrays.Handy tools...
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 10 / 20
NiBabel: Handy toolshttp://nipy.org/nibabel
nib-dicomfs :FUSE filesystem on top of a directory with DICOMs
nib-ls :ls for neuroimaging data files
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 10 / 20
NiPyhttp://nipy.org/nipy
NIPY provides a rich suite of algorithms for pre-processing andanalysis of neuroimaging data
General linear model (GLM) statistical analysisCombined slice time correction and motion correctionGeneral image registration routines with flexible cost functions,optimizers and resampling schemesImage segmentationBasic visualization of results in 2D and 3DBasic time series diagnosticsClustering and activation pattern analysis across subjectsReproducibility analysis for group studies
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 11 / 20
Nipypehttp://nipy.org/nipype
Nipype allows you tointeract with tools from different software packages (SPM, FSL,FreeSurfer,Camino, AFNI, Slicer)combine processing steps from different packagesdevelop new workflows faster by reusing common steps from oldonesprocess data faster by running in parallelmake your research easily reproducibleshare your processing workflows with the community
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 12 / 20
Nipypehttp://nipy.org/nipype
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 12 / 20
PyMVPAhttp://www.pymvpa.org
PyMVPA eases statistical learning analyses(or otherwise called Multivariate pattern analysis, MVPA) of largedatasets, with an accent on neuroimaging.
Easy I/O to Neuroimaging data (via NiBabel)Variety of machine learning methods (e.g. SVM, SMLR, kNN)Uniform interfaces to other toolkits (e.g. MDP, Shogun,Scikit-learn)Flexible Searchlight-ingUber-Fast GNB/M1NN Searchlight-ingHyperalignment (Haxby et al 2011, Neuron)
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 13 / 20
http://www.pymvpa.org
PyMVPAhttp://www.pymvpa.org
Σ
S1S2S3S4S5S6S7S8S9
S0
Time (ms)
Unit #42 sensitivities 4-4
31
21
ANOVAI-RELIEFSMLRlinGPRlinCSVM
time (s)
.2 .4
-0.1
0.1
0.2 NormalizedSensitivityPz
21
EEG
fMRI
ECR
Classifier
FeatureSensitivity
FeatureSelection
FeatureNormalization
LOC, in
f.
TOFC
LOC, s
up.
Lingu
al G.
Front
al Po
le
Occ. P
ole
Angula
r G.
Hesch
l's G
.
.04
.08
.12 L1-normed sensitivities
SMLR-weightsANOVA
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 13 / 20
http://www.pymvpa.org
PySurferhttp://pysurfer.github.com
PySurfer is a module for visualization and interaction with corticalsurface representations of neuroimaging data from Freesurfer.
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 14 / 20
Python in NeuroImaging
Find the community @ http://www.nipy.org
Stimuli Delivery
PsychoPyhttp://www.psychopy.org
PsychoPy is an easy, precise, platform-independent pack-age for stimulus presentation. Suitable for psychophysics,neuroimaging, and all areas of psychology.∙ Huge variety of stimuli generated in real-time∙ Cross-platform – run the same script on Linux, Win or
OS X∙ Flexible stimulus units (degrees, cm, or pixels)∙ Coder interface for those that like to program∙ Builder interface for those that don’t∙ Input from keyboard, mouse, joystick or button boxes∙ Multi-monitor support∙ Automated monitor calibration (supported photometers)
OpenSesamehttp://www.cogsci.nl/software/opensesame
OpenSesame is a graphical experiment builder for the socialsciences.∙ A comprehensive and intuitive graphical user interface∙ WYSIWYG drawing tools for creating visual stimuli∙ Cross-platform∙ Python scripting for complex tasks∙ A plug-in framework∙ Compatibility (through plug-ins) with commonly used
devices: (e.g. Eyelink eye trackers, serial responseboxes, Mantra object tracker)
∙ Compatibility with popular Python libraries: PsychoPy,PyGame, PyOpenGL, etc.
Data I/O
NiBabelhttp://nipy.org/nibabel
Nibabel provides read and write access to some commonmedical and neuroimaging file formats, including: ANA-LYZE (plain, SPM99, SPM2), GIFTI, NIfTI1, MINC, aswell as PAR/REC. NiBabel is the successor of PyNIfTI.The various image format classes give full or selective ac-cess to header (meta) information and access to the imagedata is made available via NumPy arrays.
Analysis
BrainVISAhttp://brainvisa.info
BrainVISA is an open-source, modular and customizablesoftware platform built to host heterogeneous tools ded-
icated to neuroimaging research. It aims at helping re-searchers in developing new neuroimaging tools, sharingdata and distributing their software.∙ Databasing capabilities∙ Massive computation facilities using Soma-workflow∙ Open environment, with many toolboxes∙ Specialized toolboxes for T1 MRI processing, sulci ang
gyri morphometry, diffusion imaging and fibers tracking,surfacic and structural analysis, 3D histology. . .
∙ Links with other software like SPM, FSL, FreeSurfer, orCIVET
D. Geffroy, D. Rivière, I. Denghien, N. Souedet, S. Laguitton,and Y. Cointepas. BrainVISA: a complete software platform forneuroimaging. In Python in Neuroscience workshop, Paris, Aug.2011.
DiPyhttp://nipy.org/dipy
Dipy is an international FOSS project for diffusion mag-netic resonance imaging analysis. Dipy is multiplatformand will run under any standard operating system such asWindows, Linux, Mac OS X. Some of our state-of-the-artapplications are:∙ Reconstruction algorithms e.g. GQI, DTI∙ Tractography generation algorithms e.g. EuDX∙ Intelligent downsampling of tracks∙ Ultra fast tractography clustering∙ Resampling datasets with anisotropic voxels to isotropic∙ Visualizing multiple brains simultaneously∙ Finding track correspondence between different brains∙ Warping tractographies into another (e.g. MNI) space∙ Support of various file formats e.g. Trackvis or NIfTI
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 15 / 20
http://goo.gl/DXZXB http://github.com/nipy/nipy-artwork
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 16 / 20
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 17 / 20
Acknowledgements
Michael Hanke
FOSS developers ofPython, NumPy, SciPy,Matplotlib, H5Py, Rpy,
Nipy, nibabel, ...Inkscape, ...
Debian Community
James V. HaxbyStephen J. Hanson
INCF
Dr. Yaroslav O. HalchenkoDartmouth College, NH, [email protected]
about the slides:should become available at http://neuro.debian.netc© 2012 Yaroslav O. Halchenko & artwork authors,
snake-brain c© 2010 Arno Kleinslide style inspired by Stefano Zacchiroli
CC BY-SA 3.0 — Creative Commons Attribution-ShareAlike 3.0
YOH (Dartmouth) NeuroDebian Munich, Germany 2012 18 / 20
OS market share
Windows (W)
Mac OS X (M)
Debian basedRed Hat based
GNU/Linux (L)
Other OS
< 50%> 50%
Operating systems
Usage time
Always
Never
VirtualHost
VirtualGuest
Personal
Managed
A) B)
0#
Rep
ort
ed
com
bin
ati
on
s1
05
Proportion of participants
0 20 40 60 80 100%
MWL
Pers
on
al O
S
Managed OS
LW
MV
irtu
al h
ost
OS
Virtual guest OS
LW
M
L W M
L W M
Hanke & Halchenko, 2011, Front. Neuroinf.YOH (Dartmouth) NeuroDebian Munich, Germany 2012 19 / 20
NeuroDebian Paper
Halchenko & Hanke, 2012, Front. Neuroinf.YOH (Dartmouth) NeuroDebian Munich, Germany 2012 20 / 20