***The most up to date information is available on the RMINC on Github page. It should be the FIRST place you explore for information. The README (scroll down on the homepage) contains numerous examples/tutorials. Including how to do voxelwise statistics, visualizing with RMINC, etc.***
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.
Table of Contents 

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).
...
The main RMINC documentation comes in the form of a minibook ; 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/MouseImagingCentre/RMINC/master/inst/documentation/visualizationTutorial.html
Visualizing 3D Objects with RMINC: https://rawgit.com/MouseImagingCentre/RMINC/master/inst/documentation/RMINC_rgl.html
Exploring your data using the shiny app (launch_shinyRMINC):
Code Block 

# instructions on how to use the shiny app:
?launch_shinyRMINC 
Analyzing volume differences in neuroanatomy with a single set of labels
...
Code Block 

> 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_wtlogdeterminantscaledfwhm0.1.mnc wt 2 02_wtlogdeterminantscaledfwhm0.1.mnc wt 3 03_wtlogdeterminantscaledfwhm0.1.mnc wt 4 04_wtlogdeterminantscaledfwhm0.1.mnc wt 5 05_mutlogdeterminantscaledfwhm0.1.mnc mut 6 06_mutlogdeterminantscaledfwhm0.1.mnc mut 7 07_mutlogdeterminantscaledfwhm0.1.mnc mut 8 08_mutlogdeterminantscaledfwhm0.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 fstatistics and tstatistics 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 fstatistics and tstatistics. 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 Fstatistic Computing threshold for (Intercept) Computing threshold for genotypewt Multidimensional MINC volume Columns: Fstatistic (Intercept) genotypewt NULL Degrees of Freedom: c(1, 18) 18 18 FDR Thresholds: Fstatistic (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 tstatistic of at least 6.172145 or at most 6.172145 are significant at a 5% FDR threshold, all structures that have a tstatistic 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. 
Analyzing differences in neuroanatomy with multiple sets of labels
Anchor  


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:
Code Block 

> anatGetAll
function (filenames, atlas = NULL, method = "jacobians", defs = "/projects/mice/jlerch/cortexlabel/c57_brain_atlas_labels.csv",
dropLabels = FALSE, side = "both") 
...
 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.
...
Code Block 

#anatGetAll call, with slightly different arguments volumes < anatGetAll(filenames$labels, filenames$labels[1], method="labels", defs="brain_label_mappings.csv") #combining structures, anatLm, anatFDR proceed as above: volumes_combined < anatCombineStructures(volumes, defs="brain_label_mappings.csv") anatLm(~ genotype, filenames, volumes_combined) anatFDR(anatLm(~ genotype, filenames, volumes_combined)) 
...
Code Block  

 
# load the RMINC library library(RMINC) # load the mapping of your input files and in this case genotype # the aim of this example is to test the variance of the Jacobian determinants between wild types and mutants gf < read.csv("filenames_and_genotype.csv") # Figure out how your function works on your data. For example test # it on a single voxel: voxel < mincGetVoxel(gf$jacobians, 0,0,0) # Run the function you want to use # the "car" library provides "leveneTest" library(car) leveneTest(voxel, gf$Strain, center=mean) # the output looks like this: Levene's Test for Homogeneity of Variance (center = mean) Df F value Pr(>F) group 2 1.5514 0.2188 74 # in this example we will extract the F value, and the # p value which can be done as so: leveneTest(voxel, gf$Strain, center=mean)[1,2] leveneTest(voxel, gf$Strain, center=mean)[1,3] # also it's smart to encapsulate the return value by # as.numeric to make sure it's returned as a number # write a function that will be passed on to pMincApply. This # function will directly refer to variables in the gf object # this function will return the Fvalue and p value from the Levene's Test # which comes from row 1, column 2 (as a numeric value) and column 3 leveneTestForRMINC < function(x) { fout < as.numeric(leveneTest(x, gf$Strain, center=mean)[1,2]) pout < as.numeric(leveneTest(x, gf$Strain, center=mean)[1,3]) return(c(fout, pout)) } ########################################################################################### ################# SNOWFALL ##################### ########################################################################################### # Use the "global" argument to specify all variables and functions you need # Use the "packages" argument to specify all libraries # The mask will restrict the calculations to that area outLeveneTest < pMincApply(gf$jacobians, quote(leveneTestForRMINC(x)), mask="mask.mnc", workers=8, global=c("gf","leveneTestleveneTestForRMINC"), packages="car") # write your stats out to file mincWriteVolume(outLeveneTest, "f_values.mnc", 1) mincWriteVolume(outLeveneTest, "p_values.mnc", 2) ########################################################################################### ################# SGE ##################### ########################################################################################### # instead of running the pMincApply in parallel on your machine, you can also use sge: outLeveneTest < pMincApply(gf$jacobians, quote(leveneTestForRMINC(x)), mask="mask.mnc", workers=8, global=c("gf","leveneTestleveneTestForRMINC"), packages="car", method="sge") 
...