- R 77.4%
- C 13.8%
- C++ 5.6%
- M4 2.3%
- Go Template 0.5%
- Other 0.4%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .github/workflows | ||
| docs | ||
| etc | ||
| inst | ||
| man | ||
| R | ||
| src | ||
| tests | ||
| tools | ||
| .dockerignore | ||
| .git-blame-ignore-revs | ||
| .gitattributes | ||
| .gitignore | ||
| .Rbuildignore | ||
| _config.yml | ||
| _pkgdown.yml | ||
| AGENTS.md | ||
| ChangeLog | ||
| cleanup | ||
| configure | ||
| configure.ac | ||
| DESCRIPTION | ||
| Dockerfile | ||
| Gemfile | ||
| index.Rmd | ||
| INSTALL | ||
| LICENSE | ||
| Makefile | ||
| NAMESPACE | ||
| NEWS | ||
| README.md | ||
| RMINC.Rproj | ||
| run-tests.sh | ||
RMINC
Statistical Tools for Medical Imaging NetCDF (MINC) Files
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:
-
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.
-
libminc from source: If the toolkit is not found, RMINC's
configurewill 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
gccvia 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 exactFLIBS/LDFLAGSsetup 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
- Voxel-wise Statistics (somewhat out of date)
- How RMINC Parallel Works
- RMINC 2D Visualization
- Visualizing 3D Objects with RMINC
- Analyzing Anatomy with Hierarchical Atlases
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.