Skip to end of metadata
Go to start of metadata

RMINC

RMINC is a library for the R statistical environment designed to read and write MINC volumes as well as perform optimized statistical routines at every voxel of a set of files.

 

Development

The main development home for RMINC can be found here: RMINC on Github - that page includes access to the source code, downloads, bug reporting, and facilities for asking questions (and getting them answered, of course).

Documentation

The main RMINC documentation comes in the form of a mini-book; find the most recent version here: https://launchpad.net/rminc/+download, or a direct link to the pdf here: VBMstats.pdf (Note: this document was last updated on April 16, 2008)

Some of the latest tutorials from GitHub

RMINC Visualization: https://rawgit.com/Mouse-Imaging-Centre/RMINC/master/inst/documentation/visualizationTutorial.html

Visualizing 3D Objects with RMINC: https://rawgit.com/Mouse-Imaging-Centre/RMINC/master/inst/documentation/RMINC_rgl.html

Exploring your data using the shiny app (launch_shinyRMINC):

 

 

Analyzing volume differences in neuroanatomy with a single set of labels

  1. When you are analyzing structures, make sure that the label file you use accurately segments out your final non-linear model, otherwise your analysis will be meaningless
  2. Use the Jacobian determinants that capture the absolute differences (in our case the *log-determinant-scaled* )
  3. Use little blurring, for instance for files with a 56 micron resolution use 100 micron blur (in our case the *log-determinant-scaled-fwhm0.1* )

 

To analyze individual structures in the brain, you will need two things: a set of registered images and an atlas that segments the final average of your registration pipeline into classified labels. This is known as a classified atlas. (Information about how you can align a segmented set of labels to your data set can be found here: Atlas to Atlas Segmentation) The main idea is the following: Through the registration pipeline we have information about the change in volume of the voxels for each of the individual mouse brains. This is captured in the Jacobian determinant files. Using the classified atlas, we can integrate the information captured in the Jacobian determinants to find out the volume of the structures for each of the individual input files.

The Jacobian determinant fields are fairly noisy if you use them unprocessed. For this reason we blur them before we do analysis on them. The amount of blurring you want to use depends on what kind of changes you want to capture. When looking at neuroanatomy it is important to use only a small amount of blurring, because you want to avoid smoothing out information around borders of structures. The mouse brains we generally look at have a resolution of 56 micron, and we do structural analysis on Jacobian determinants that have been blurred using a 100 micron kernel.

A second thing to keep in mind is that the registration pipeline produces two types of Jacobian determinants. One that reflects relative changes (overall scaling or brain size differences have been taking out) and absolute changes which still contain the brain size differences. When analyzing neuroanatomical structures you want to use the determinants that reflect the absolute changes. Currently the naming convention for those files is as follows:

FILENAME_BASE-log-determinant-scaled-fwhm_KERNEL_.mnc

Here is an example of how to do the analysis in R

Analyzing differences in neuroanatomy with multiple sets of labels

In addition to the procedure described above (which uses a single atlas and jacobian determinants for each individual brain) we can generate a unique set of labels for each individual brain. This can be done using MAGeT. Once you have a set of labels for each brain, analysis can proceed as described above, but with one major difference: the anatGetAll command must be called with a different set of arguments. Let's look at this function more closely:

The default values for method, defs, dropLabels and side are set for users at MICe who do 56 micron ex-vivo registrations. In these cases, the anatGetAll call is as shown above:

For labels generated using MAGeT, you would need the following:

  • filenames: Instead of the scaled_jacobian files, you would instead include the labels for each brain generated by MAGeT.
  • atlas: This argument is NOT USED when each file has its own set of labels. Unfortunately, you still need to specify something or the function will fail. An example of what to specify is the labels for the first file – filenames$labels[1]
  • method: method = "labels" must be specified
  • defs: This is critical if the label definitions for the files you are looking at differ from the standard set of 62, described in Dorr, et. al. This will also need to be specified for users who wish use the set described in Dorr et.al, but are not using the machines at MICe.
  • dropLabels and side can continue to use the defaults.

So, putting it all together, here is what your anatGetAll call and following analysis would look like:

pMincApply

pMincApply, just as mincApply, can be used to run any function on all voxels in your input files. The difference with mincApply, is that pMincApply can be parallelized (hence the p). You can use snowfall to run it locally using multiple cores on your machine, or sge to submit jobs to a batch system. Here is a short example of how to use pMincApply to run a function on your input files that is not implemented by any of the standard MINC functions.

 

Installation

Installing RMINC from a release:

  • Download the tarball from the Github RMINC website https://github.com/mcvaneede/RMINC/tree/master/releases 
  • By default, the library will be installed in /usr/share. If you want to change this location, the R_LIBS variable needs to be set:

    export R_LIBS=/build/directory
  • Install the package (example is for the tarball version 0.5):

    R CMD INSTALL RMINC_0.5.tar.gz --configure-args='--with-build-path=/install/directory/minc2'

Installing RMINC using the current state of the package: 

  • Retrieve a copy of the bazaar repository of the RMINC library

    git clone https://github.com/mcvaneede/RMINC.git RMINC
  • The R_LIBS variable determines where the library is installed. By default it will be installed under /usr/share. If you want to install the library somewhere else, the R_LIBS environment variable should be set.

    export R_LIBS=/build/directory
  • Run autogen.sh

    cd RMINC
    ./autogen.sh
    cd ..
  • Install the package

    R CMD INSTALL RMINC --configure-args='--with-build-path=/install/directory/minc2'
  • If for some reason setting the R_LIBS environment variable does not work, you can also explicitly state where you want to install the library as follows:

    R CMD INSTALL RMINC --library=/patch/to/library/tree --configure-args='--with-build-path=/install/directory/minc2
  • No labels