\chapter{Preparing the data} This chapter will briefly discuss how to generate structural imaging data useable for the statistical analyses described in the rest of the book. \section{Types of datasets} Describe what can be done. \subsection{Voxel based morphometry} Some more detail on VBM. \subsection{Deformation based morphometry} Some more detail on DBM. \subsection{Other} Mention cortical thickness, manual segmentation, etc. \section{Input data} Once the files have been processed, the easiest way to proceed is by settting up a text file containing all the necessary information about each scan. This file should be comma or space separated, have one row per scan, with each column containing info about each scan. One of the columns should contain the filename pointing to the MINC volumes to be processed. The example from the five male and five female mice is the following: \begin{verbatim} Filename, Gender, coil, weight volumes/img_08nov05.0-fwhm1.0.mnc,Female,1,22.6 volumes/img_08nov05.1-fwhm1.0.mnc,Female,2,19.6 volumes/img_08nov05.2-fwhm1.0.mnc,Female,3,21.8 volumes/img_29sept05.0-fwhm1.0.mnc,Male,1,24.0 volumes/img_29sept05.2-fwhm1.0.mnc,Male,3,27.0 volumes/img_30sept05.0-fwhm1.0.mnc,Male,1,28.3 volumes/img_30sept05.1-fwhm1.0.mnc,Male,2,26.5 volumes/img_30sept05.2-fwhm1.0.mnc,Male,3,28.1 volumes/img_31oct05.0-fwhm1.0.mnc,Female,1,20.5 volumes/img_31oct05.2-fwhm1.0.mnc,Female,3,20.0 \end{verbatim} Notice how the first row contains a header. This is optional, but makes later access to the data easier and is therefore recommended. The next step is to actually load this file into R. The steps are given below: <>= library(xtable) @ <>= library(RMINC) gf <- read.csv("control-file.csv") @ The library commands load the RMINC library into R. The next line then reads the information describing this dataset from a comma-separated text file. The basic syntax of an R command is a variable name - which can be whatever you chose, within only a few limits - on the left hand side, the arrow (less than followed by a dash) indicating an assignment, and then the function call (in this case read.csv to read a comma separated value) with any arguments (in this case the filename) in parentheses. Strings - such as the filename in this case - are placed inside quotes. <>= xtable(gf, caption="GLIM File") @ The little code fragment and table above just shows what the gf variable looks like after being read into R\footnote{xtable is only necessary for display purposes in this manual (which, by the way, is being written using Sweave, a tool for combining R with latex).}