Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

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: https://launchpad.net/rminc - 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)

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

> library(RMINC)

# There is a variable that was loaded into R containing the genotype and the location of the Jacobian determinants called filenames, it contains the following:

> filenames
 scaled_jacobians                              genotype
1 01_wt-log-determinant-scaled-fwhm0.1.mnc           wt
2 02_wt-log-determinant-scaled-fwhm0.1.mnc           wt
3 03_wt-log-determinant-scaled-fwhm0.1.mnc           wt
4 04_wt-log-determinant-scaled-fwhm0.1.mnc           wt
5 05_mut-log-determinant-scaled-fwhm0.1.mnc         mut
6 06_mut-log-determinant-scaled-fwhm0.1.mnc         mut
7 07_mut-log-determinant-scaled-fwhm0.1.mnc         mut
8 08_mut-log-determinant-scaled-fwhm0.1.mnc         mut

# The first thing to do now is to get the volume information of all the structures, the atlas with the labels is called resampled_atlas.mnc

> volumes <- anatGetAll(filenames$scaled_jacobians, "resampled_atlas.mnc")

# This atlas contains information about both left and right structures, but in this case we will combine the information of left and right structures and only look at combined volumes:

> volumes_combined <- anatCombineStructures(volumes)

# Run a linear model to get information about f-statistics and t-statistics on the structures. The first argument is the formula to be used, in this case we want to look at differences between the genotype, the second argument is the data which is stored in the variable filenames, and lastly the actual volume information

> anatLm(~ genotype, filenames, volumes_combined)

# The output will be a list of all the structures with a number of columns for the values of the f-statistics and t-statistics. Next to find out which of these changes survive multiple comparison corrections:

> anatFDR(anatLm(~ genotype, filenames, volumes_combined))
N: 20 P: 2
Beginning vertex loop: 62 3
Done with vertex loop
Computing FDR threshold for all columns
 Computing threshold for F-statistic 
 Computing threshold for (Intercept) 
 Computing threshold for genotypewt 
Multidimensional MINC volume
Columns: F-statistic (Intercept) genotypewt 
NULL
Degrees of Freedom: c(1, 18) 18 18 
FDR Thresholds:
     F-statistic (Intercept) genotypewt
0.01       NaN     25.36429         NaN
0.05  20.80325     25.36429    6.172145
0.1   17.94643     25.36429    4.542356
0.15  14.99036     25.36429    3.871739
0.2   14.99036     25.36429    3.871739
There were 11 warnings (use warnings() to see them)

# Which will give a table indicating what is significant at which FDR thresholds. In this case, all structures that have a t-statistic of at least 6.172145 or at most -6.172145 are significant at a 5% FDR threshold, all structures that have a t-statistic of at least 4.542356 or at most -4.542356 are significant at a 10% FDR threshold, etc. There are no structures significantly different at a 1% FDR threshold as indicated by the NaN.

Installation

Installing the RMINC library the easy way:

  • Download the tarball from the Launchpad RMINC website https://launchpad.net/rminc/ (current version (March 12, 2008) is 0.4 https://launchpad.net/rminc/1.0/0.4)
  • 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.4):

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

If you want to make it nice and complicated: 

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

    bzr branch lp:rminc /directory/where/sourcefiles/go
  • Get a copy of the McGill m4 package. They should go in a directory called "m4" inside the root directory of the RMINC installation files.

    cd /directory/where/sourcefiles/go
    mkdir m4
    svn co https://repo.phenogenomics.ca/subversion/mni-m4/trunk/ m4/
  • 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

    chmod u+x autogen.sh
    ./autogen.sh
  • Install the package

    R CMD INSTALL /directory/where/sourcefiles/go --configure-args='--with-build-path=/install/directory/minc2'
  • No labels