Skip to content

Mouse-Imaging-Centre/RMINC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,371 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RMINC

Statistical Tools for Medical Imaging NetCDF (MINC) Files

R Tests License: BSD-3-Clause R >= 4.0 Unix

Tools for reading, writing, analyzing, and visualizing MINC neuroimaging files with R. Supports voxel-wise linear models, mixed-effects models, correlations, ANOVA, FDR correction, TFCE, ROI-based anatomy analysis, surface-based vertex statistics, and parallel execution.

Unix only (Linux, macOS). Requires R >= 4.0. No native Windows support (WSL may work — see INSTALL).


Table of Contents

Features

Capability Key functions
Voxel-wise linear models mincLm, mincAnova, mincTtest, mincWilcoxon
Correlations & summaries mincCorrelation, mincMean, mincSummary
Mixed-effects models mincLmer, mincLmerEstimateDF, mincLogLikRatio
Surface / vertex statistics vertexLm, vertexLmer, vertexTFCE
ROI / anatomy analysis anatLm, anatLmer, hanatLm (hierarchical atlases)
Multiple comparisons mincFDR, mincTFCE, mincRandomize
I/O mincGetVolume, mincWriteVolume, mincArray
Visualization mincPlotSliceSeries, mincTriplanarSlicePlot (2D), rgl (3D), hanatView
Parallel execution pMincApply, qMincApply, mincLm(parallel = ...)

Installation

The easiest way to install is with devtools from the develop branch:

devtools::install_github(
  "Mouse-Imaging-Centre/RMINC@develop",
  upgrade_dependencies = FALSE
)

System Requirements

RMINC depends on the MINC C library. You have two options:

  1. minc-toolkit-v2 (recommended): Download binary installers from http://bic-mni.github.io/ or build from source at https://github.com/BIC-MNI/minc-toolkit-v2. This provides the MINC library plus command-line tools.

  2. libminc from source: If the toolkit is not found, RMINC's configure will attempt to build libminc for you. This requires CMake (> 2.6), git, and the HDF5 development headers.

Debian / Ubuntu:

sudo apt-get install libhdf5-dev cmake git lsof autoconf automake libtool

macOS (Homebrew):

brew install hdf5 cmake autoconf automake libtool

macOS note: RMINC's compiled backend needs a Fortran compiler. Apple's default clang does not include one — install gcc via Homebrew (brew install gcc libssh2 libgit2 libomp zlib) or gfortran directly, and point R at it via ~/.R/Makevars. See the INSTALL file for the exact FLIBS/LDFLAGS setup and detailed instructions.

Troubleshooting

If configure cannot find MINC, set the install prefix via an environment variable:

export MINC_TOOLKIT=/opt/minc/1.9.18

Or pass the path at install time from R:

devtools::install_github(
  "Mouse-Imaging-Centre/RMINC@develop",
  args = "--configure-args='--with-build-path=/opt/minc/1.9.18'",
  upgrade_dependencies = FALSE
)

Quick Example

Fit a voxel-wise linear model across a set of MINC volumes. The response column in data holds MINC file paths; the model is fit independently at every voxel:

library(RMINC)

# `gf` is a data frame whose `volumes` column holds MINC file paths
fit <- mincLm(volumes ~ group, data = gf)

# Output columns: "F-statistic", "R-squared", beta coefficients,
# t-statistics, "logLik". Write the whole-model F-statistic (column 1):
mincWriteVolume(fit, output.filename = "group_Fstat.mnc", column = 1)

Function-level documentation is available in R via ?mincLm, ?mincLmer, ?vertexLm, ?anatLm, etc.

Dockerized Testing

Build the test image:

docker build -t rminc-test .

Run checks and tests (mount the source directory):

docker run -v $(pwd):/RMINC rminc-test              # check + tests (default)
docker run -v $(pwd):/RMINC rminc-test check          # R CMD check --as-cran only
docker run -v $(pwd):/RMINC rminc-test test            # tests only
docker run -v $(pwd):/RMINC rminc-test test mincLm     # filtered tests
docker run -v $(pwd):/RMINC rminc-test shell           # interactive bash shell

Tutorials

Getting Help

Function documentation is available through R's ? interface (e.g. ?mincLm). The MICePUB wiki has additional background and usage notes. Report bugs or request features at the issues page.

Development

The develop branch is where active development happens; the master branch may lag behind. Contributions via pull requests to develop are welcome.

The C/C++ backend is built with Rcpp and autoconf — src/Makevars is generated from src/Makevars.in, and RcppExports.{R,cpp} are auto-generated by Rcpp. Do not edit these files directly.

After editing R source containing roxygen comments, regenerate documentation and the NAMESPACE with:

roxygen2::roxygenise()

License

RMINC is released under the BSD 3-Clause License.

About

Statistics for MINC volumes: A library to integrate voxel-based statistics for MINC volumes into the R environment. Supports getting and writing of MINC volumes, running voxel-wise linear models, correlations, etc.; correcting for multiple comparisons using the False Discovery Rate, and more. With contributions from Jason Lerch, Chris Hammill, J…

Topics

Resources

License

Stars

26 stars

Watchers

10 watching

Forks

Packages

 
 
 

Contributors