mdm.voicondaverage
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
| — | mdm.voicondaverage [2011/03/15 02:44] (current) – created jochen | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== MDM:: | ||
| + | ===== Motivation ===== | ||
| + | Just as statistical maps are useful to visualize whole-brain patterns of activity, it can be useful to inspect and visualize the time course properties of conditions in specific regions of the brain. | ||
| + | |||
| + | As this usually requires several, repetitive steps (data extraction, averaging across voxels of regions, removing nuisance variance, normalizing data to a baseline, averaging across trials within conditions, etc.), a comprehensive method is useful to perform these steps. | ||
| + | |||
| + | ===== Requirements ===== | ||
| + | This function is currently implemented for BrainVoyager QX's MDM, PRT and VTC formats only. The following files must be available: | ||
| + | * MDM file referencing time course (VTC) as well as protocol (PRT) files containing the onsets of the conditions of interest | ||
| + | * referenced PRT and VTC files for all runs of all subjects | ||
| + | * optionally the realignment parameter files (supported formats: TXT for SPM rp*.txt files, [[xff - SDM format|SDM]] for BV's motion correction output) | ||
| + | |||
| + | **Note: The same naming convention as for the [[mdm.ComputeGLM|ComputeGLM]] method is required!** | ||
| + | |||
| + | ===== Reference / mdm.Help(' | ||
| + | < | ||
| + | |||
| + | | ||
| + | |||
| + | Input fields: | ||
| + | |||
| + | | ||
| + | | ||
| + | | ||
| + | .avgtype | ||
| + | .avgwin | ||
| + | .baseline | ||
| + | .basewin | ||
| + | .conds | ||
| + | .group | ||
| + | .interp | ||
| + | .motpars | ||
| + | .motparsd | ||
| + | .motparsq | ||
| + | .ndcreg | ||
| + | .remnuis | ||
| + | .restcond | ||
| + | .robust | ||
| + | .samptr | ||
| + | .sdse either or {' | ||
| + | .subsel | ||
| + | .subvois | ||
| + | .tfilter | ||
| + | .tfilttype temporal filter type (either ' | ||
| + | .trans | ||
| + | .unique | ||
| + | .voisel | ||
| + | .xconfound just as motpars, but without restriction on number | ||
| + | |||
| + | | ||
| + | |||
| + | | ||
| + | | ||
| + | |||
| + | Note: this call is only valid if all model files in the MDM are PRTs! | ||
| + | |||
| + | for conv and deconv, a GLM regression is performed and the | ||
| + | |||
| + | the baseline window (basewin) must be evenly spaced!</ | ||
| + | |||
| + | ===== Algorithm ===== | ||
| + | The following steps are performed by the method: | ||
| + | |||
| + | * extracting region-averaged time courses (using the [[mdm.VOITimeCourses|VOITimeCourses]] method, this already per-cent or z-transforms the data!) | ||
| + | * accessing (or collecting) the onsets for all time courses (using the [[mdm.ConditionOnsets|ConditionOnsets]] method) | ||
| + | * accessing (or creating) the design matrices (for the removal of nuisance variance, using the [[mdm.SDMs|SDMs]] method) | ||
| + | * applying a selecting of subjects, if desired | ||
| + | * allocating space in memory (for time course extracts and their standard deviation) | ||
| + | * removal of nuisance variance (plain regression for now) | ||
| + | * sampling the baseline window as well as the averaging window (in the desired temporal resolution, using cubic spline by default) | ||
| + | * subtracting the baseline of the data | ||
| + | * potentially collapsing across subjects (FFX) | ||
| + | * computing means and standard deviation across trials | ||
| + | * optionally computing mean and standard deviation across subjects (RFX) | ||
| + | * optionally re-scaling the standard deviation as standard error | ||
| + | |||
| + | ===== Usage example ===== | ||
| + | The image below was created from one particular dataset, using cluster peaks of complex contrasts and the code below the image: | ||
| + | |||
| + | {{: | ||
| + | |||
| + | <code matlab mdm_voiaverage_example.m> | ||
| + | mdm = xff(' | ||
| + | |||
| + | % load VOI | ||
| + | voi = xff(' | ||
| + | |||
| + | % get list of conditions from first protocol | ||
| + | prt = xff(mdm.XTC_RTC{1, | ||
| + | conds = prt.ConditionNames; | ||
| + | |||
| + | % extract average timecourses for all conditions with options: | ||
| + | % - baseline window is from -2000 through 2000 milliseconds (sampled in 2s intervals) | ||
| + | % - motion parameters from mdm.RunTimeVars are used (if present) to remove nuisance variance | ||
| + | % - FFX grouping | ||
| + | % - the sampling of the average time courses is in 100ms steps | ||
| + | % - the error term returned is SE (SD / sqrt(N)) | ||
| + | [fmtc, fmtcse] = mdm.VOICondAverage( ... | ||
| + | voi, conds, struct( ... | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | |||
| + | % create list of colors | ||
| + | col = [1, 0, 0; 0.8, 0.2, 0.2; 0, 0, 1; 0.2, 0.2, 0.8]; | ||
| + | |||
| + | % the plots were then created as follows: | ||
| + | % - get the VOI names | ||
| + | vn = voi.VOINames; | ||
| + | |||
| + | % loop over VOIs | ||
| + | for vc = 1:numel(vn) | ||
| + | |||
| + | % create a figure and axes object | ||
| + | f(vc) = figure; | ||
| + | a = axes; | ||
| + | | ||
| + | % loop over condidions | ||
| + | for x=1: | ||
| + | | ||
| + | % use tcplot to plot into the same axes | ||
| + | l(x) = tcplot(a, 0:0.1:20, fmtc(:, x, vc), fmtcse(:, x, vc), fmtcse(:, x, vc), ... | ||
| + | struct(' | ||
| + | end | ||
| + | | ||
| + | % add title and legend | ||
| + | title(vn{vc}); | ||
| + | legend(l(: | ||
| + | end | ||
| + | end | ||
| + | |||
| + | % set figures to same size | ||
| + | set(f, ' | ||
| + | |||
| + | In this case, figures were manually positioned on the screen and a screenshot was taken, but that can, naturally, be scripted as well :) | ||
mdm.voicondaverage.txt · Last modified: 2011/03/15 02:44 by jochen
