What language do you use for analysis?

  • R
  • SAS / Stata
  • Matlab
  • Python

What language do you use for imaging analysis?

  • R
  • Matlab (e.g. SPM)
  • Python
  • bash (e.g. FSL)

(note SAS/Stata do not exist in this domain)

Why R?

  • Free, open-source
  • Cross-platform
  • Over 10000 packages
  • Taught by stat/biostat departments
  • Packaging system is good (well-documented, tested, doable)
  • RStudio
  • (I know R)


  • centralized bioinformatics/genomics packages
  • large community/number of packages (> 1300)
  • published tutorials and workflows
  • additional requirements to CRAN (e.g. packages need vignettes)


  • team of developers/maintainers
  • multiple grants of support

Inspiration flow

  • integrates multiple neuroimaging software
  • standardizes the syntax
  • provides workflows
  • allows the user to take advantage of all of Python
    • pandas, scikit-learn, Jupyter notebooks

Inspiration: SPM/MATLAB has GUI + courses!

What did R have?

What did R have?


An R Platform for
Medical Imaging Analysis

What really is Neuroconductor?

  1. A community of developers and users of R packages for imaging
  2. A website https://neuroconductor.org/.
    • with tutorials and help
  3. A team helping developers and users (John, Adi Gherman, Ciprian Crainiceanu, Brian Caffo)
  4. A centralized repository of maintained packages

Goal: Centralize the packages (currently 44)


Workflow for an Analysis

  • bash flow
  • FSL flow
  • ANTs flow
  • MRIcroGL flow
  • OsiriX flow
  • SPM 12 flow

Workflow for an Analysis

Multiple pieces of software used

  • all different syntax

It's typical to have lots of software choices


Carp, Joshua. "The secret lives of experiments: methods reporting in the fMRI literature." Neuroimage 63.1 (2012): 289-300.


Lower the bar to entry

  • all R code
    • pipeline tool
    • "native" R code

Complete pipeline

  • preprocessing and analysis

Using R as a Pipeline Tool: fslr

  • fslr package - call FSL from R

  • Requires FSL to be installed and in PATH
    • FSL only available on Unix-style systems


Why not CRAN: The story of ANTsR

ANTs: Advanced Normalization Tools

  • State-of-the-art image processing pipelines
  • Built at UPenn under Brian Avants
    • Group has won challenges for imaging analysis
  • Still actively maintained and developed
  • Depends on the Insight ToolKit (ITK) medical image processing library

The story of ANTsR: Porting ANTs to R

  • Group tried to wrap C++ code with Rcpp for it to work "seamlessly" with R
  • Had some issues with CRAN
  • Most developers response: "just make it work"
  • NOT like fslr - this built the libraries and could be called using .Call
    • possible (not yet) to use on Windows

Why not CRAN: Dependencies

  • ANTsR depends on CMake: flow
  • ANTsR also depends on ITKR - large code base
  • External dependencies are not always welcome
  • CRAN response: flow (more or less)

Why not CRAN: Checks

  • We would like more stringent checks than CRAN (like vignettes) like Bioconductor
  • But also more lenient ones
  • Examples may take > 5 seconds to compile
  • Time to build package may take a while
  • May not work on Windows if not applicable

Why not CRAN: Data

Medical images are big (> 5 mb) compared to code

CRAN doesn't like this

  • Example data packages are harder to get passed
  • We got kirby21.t1 and kirby21.fmri, but they have an implicit downloader function in the code
  • Necessary for testing code examples in imaging
  • STANDARDIZED file location (system.file)

Solution: Build a Bioconductor-like Solution using Current Tools

Git and GitHub

  • Git version control system: stores changes of files flow

  • GitHub is an online server of repositories
  • Distribute packages and install them via devtools::install_github


Continuous Integration: Travis and Appveyor

  • Builds and checks R packages on Windows (Appveyor) and Linux/OS X (Travis CI)
  • Works well with GitHub

flow     flow

Development Pipeline:

Check the package for stability

  • check against other imaging software (e.g. FSL)


ANTsR Revisited: Helping Developers

  • GitHub allows the Neuroconductor team to help fix issues
  • Standardized ANTsR checking for NeuroC
  • Pull Requests to Group ICA package (Brian Caffo)
  • Remove unnecessary hurdles for developers

Neuroconductor Capabilities

Capabilities Packages
DICOM Images oro.dicom, dcm2niir, divest, ANTsR
NIfTI Images oro.nifti, RNifti, ANTsR
Image Registration spm12r, fslr, ANTsR, freesurfer
Inhomogeneity Correction spm12r, fslr, ANTsR
Brain Extraction spm12r, fslr, ANTsR, extrantsr
Structure Segmentation spm12r, fslr, ANTsR, extrantsr, freesurfer
Intensity Normalization WhiteStripe, neurobase, ANTsR
3D Smoothing ANTsR, spm12r, fslr
Temporal Filtering spm12r, fslr, ANTsR
Slice-timing correction spm12r, fslr
DTI models rcamino, oro.dti, fslr

Benefits of Neuroconductor:

Allow imaging to use all R has to offer:

  • Statistics and Machine Learning
  • Versioning and testing
  • Reproducibile reports and analyses
  • Shiny (web applications)
  • Genomics/Imaging analysis in one platform
    • Bioconductor

flow Neuroconductor Downsides

  1. More control over the workflow = more work
  2. Users need external software (versions/installation)
  3. No control over external software
    • if maintainer changes something, not much recourse
  4. Need the content (buy-in from the community)

Potential Neuroconductor Downsides:

Enabling statisticians to do preprocessing also enables imagers to do advanced statistics.

  • Why enlist us for only this part?

Training we are providing

Without Knowing the Processing,
Analyses Cannot be Trusted

No Code = No Method

Current Neuroconductor Packages Overviews

dcm2niir and divest: Converting DICOM data

  • dcm2nii by Dr. Chris Rorden
    • jackknife for almost any DICOM type to NIfTI
  • dcm2niir wraps a binary executable of dcm2nii
    • calls the command prompt (not always Windows-friendly)
  • divest wraps the background C++ code of dcm2nii
    • runs in "native" R

neurohcp: Human Connectome Project

spm12r: Wrapper Functions for SPM

rcamino: Port of Camino Software

extrantsr: Extra functions for ANTsR

  • Wraps ANTsR functions for nifti objects (from oro.nifti)
  • malf function - performs a basic MALF algorithm
  • within_visit_registration - performs within-visit registration for structural MRI
  • preprocess_mri_within - pipeline to process within-visit sMRI

malf.templates: Segmented T1-weighted Images

  • Data from the MICCAI 2012 Challenge on Multi-atlas Labelling Data
  • From OASIS project and the labeled data as provided by Neuromorphometrics, Inc. (http://Neuromorphometrics.com/)
  • Have T1-weighted image, brain mask, image with mask applied, substructure segmentation
    • Hand segmented structures - useful for multi-atlas label fusion (MALF)

malf.templates: Segmented T1-weighted Images

MALF: Skull Stripping Example

From (Doshi et al. 2013):

  • Register templates to an subject T1
  • Apply transformation to the label/mask, average over voxels
    • there are "smarter" (e.g. weighted) ways

Neuroconductor installer:

Provide an installer to download the current packages:


kirby21.fmri: fMRI data from Kirby21

library(kirby21.t1) # load T1 data
library(kirby21.fmri) # load fMRI data
library(kirby21.base) # helper package to download data
library(neurobase) # neuroconductor base package
fnames = get_image_filenames_list(
  modalities = c("fMRI", "T1"), id = 113, visit = 1)
t1_fname = fnames$T1 
fmri_fname = fnames$fMRI

Plot the T1

Future work

  • F1000 R packages channel - get publication for workflow
  • Removing dupliate packages from CRAN - like Bioconductor
  • Docker image for Neuroconductor: flow
    • have all dependencies/external software in one container

Go to


Doshi, Jimit, Guray Erus, Yangming Ou, Bilwaj Gaonkar, and Christos Davatzikos. 2013. “Multi-Atlas Skull-Stripping.” Academic Radiology 20 (12). Elsevier: 1566–76.