fmriquality
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
fmriquality [2010/06/17 15:15] – added final comment about thresholds being fixed for now jochen | fmriquality [2010/11/26 18:50] (current) – jochen | ||
---|---|---|---|
Line 2: | Line 2: | ||
===== Motivation ===== | ===== Motivation ===== | ||
- | There are several things that can go wrong during | + | As said on the [[Processing stream - quality assessment|quality assessment]] page, this function is used to determine whether or not a given dataset (run) is suitable |
- | + | ||
- | Relevant | + | |
- | * the subject had to exit the scanner before the experiment was completed -> usually such a dataset needs to be discarded | + | |
- | * the subject couldn' | + | |
- | * the scanner produced disproportionally strong noise in the data -> if possible, such a dataset should also be discarded | + | |
- | + | ||
- | Of course there are still many other possible reasons to discard any given subject (e.g. a score on a questionnaire/ | + | |
- | + | ||
- | This function, '' | + | |
===== Requirements ===== | ===== Requirements ===== | ||
- | To run the fMRI quality checking function, the images need to be in one of the functional imaging data formats currently supported by the xff class (Analyze/NIftI, FMR/STC, VTC). | + | To run the fMRI quality checking function, the images need to be in one of the functional imaging data formats currently supported by the xff class: |
+ | * BrainVoyager' | ||
+ | * BrainVoyager' | ||
+ | * SPM' | ||
===== Function reference ('help fmriquality' | ===== Function reference ('help fmriquality' | ||
Line 44: | Line 38: | ||
precision), plus some temporary arrays and, if motion correction | precision), plus some temporary arrays and, if motion correction | ||
is selected, with further memory allocation required!</ | is selected, with further memory allocation required!</ | ||
+ | |||
+ | ===== Algorithm ===== | ||
+ | The basic algorithm can be unpacked into the following steps: | ||
+ | * read in the data (memory must at least allow one run to be loaded!) | ||
+ | * reserve additional memory for some computation outcomes | ||
+ | * compute mean and standard deviation (over time) images | ||
+ | * detect foreground (brain) and background (black/air voxels) separately | ||
+ | * compute average time courses for foreground and background (global and per-slice) | ||
+ | * estimate the smoothness of the data (one value per volume; over time) | ||
+ | * create a conservative estimate of the average (temporal) standard deviation of the background | ||
+ | * compute a " | ||
+ | * compute a "local signal-to-noise ratio" (LocalSNR) image (using each voxel' | ||
+ | * temporally filter timecourses (univariately) and estimate the amount of variance determined by low frequencies | ||
+ | * if requested, perform motion detection/ | ||
+ | |||
+ | Additionally, | ||
+ | |||
+ | ==== Foreground / Background detection ==== | ||
+ | The detection of the foreground involves the following steps: | ||
+ | * selection of voxels for which the mean value (over time) exceeds the mean value over the entire 4D data slab | ||
+ | * removal of stray voxels (by one step of 3D erosion following by a back-dilation and logical AND with the original selection) | ||
+ | * sub-selection of the " | ||
+ | |||
+ | The detection of the background involves the following steps: | ||
+ | * picking the median of over-time mean values for voxels where the mean value does not exceed the mean value over the entire 4D data slab (in other words the opposite of the preliminary foreground mask!) | ||
+ | * selecting voxels for which the mean value is smaller than this median (very conservative background estimate) | ||
+ | * removal of voxels for which more than 5 per cent of values are exactly 0 (depending on the scanner type and sequence parameters as well as field homogeneity corrections, | ||
+ | * equally, sub-selection of the biggest chunk (to remove stray voxels) | ||
+ | |||
+ | ==== Background noise estimate ==== | ||
+ | The mentioned (conservative) estimate of the background noise is computed by | ||
+ | * sorting the values of the temporal standard deviation in voxels marked as background | ||
+ | * computing the average over the second and third quartile, so as not have voxels which are, for instance, on the fringe of the brain and, due to motion, for some portion of the run contain actual data, pollute the estimate; the idea being that the average noise picked up in air voxels should not be influenced by actual matter, even if only present in part of a run | ||
+ | |||
+ | ==== Outlier detection ==== | ||
+ | The following criteria are being considered for the detection of outliers: | ||
+ | * the estimated smoothness in a given volume is further away than 6 standard deviations from the mean | ||
+ | * the global foreground time course is further away than 5 standard deviations from the mean | ||
+ | * the absolute of the 1st order derivative of the global foreground time course is further away than 5 standard deviations from the mean (detecting stark signal level shifts) | ||
+ | * the Mahalanobis Distance over the foreground slices' | ||
+ | * the temporally fitered versions of the global foreground timecourse as well as Mahalanobis Distance over the filtered foreground slices' | ||
===== Usage ===== | ===== Usage ===== | ||
The most basic (and pre-configured) way of running fmriquality is by simply passing in the filename(s) or object of the run to check: | The most basic (and pre-configured) way of running fmriquality is by simply passing in the filename(s) or object of the run to check: | ||
- | * using Analyze files: <code matlab fmriquality_example1.m> | + | * using Analyze files: <code matlab fmriquality_example1.m> |
* using a BrainVoyager QX FMR file: <code matlab fmriquality_example2.m> | * using a BrainVoyager QX FMR file: <code matlab fmriquality_example2.m> | ||
qas = fmriquality(fmr);</ | qas = fmriquality(fmr);</ | ||
Line 62: | Line 97: | ||
% running fmriquality | % running fmriquality | ||
fmriquality(qafiles, | fmriquality(qafiles, | ||
+ | * create a quality assessment struct for all VTCs in an MDM, applying robust temporal filtering: <code matlab fmriquality_example4.m> | ||
+ | for study = 1: | ||
+ | | ||
+ | % perform quality assessment | ||
+ | q = fmriquality(mdm.XTC_RTC{study, | ||
+ | | ||
+ | % store as VTCNAME_qasheet.mat | ||
+ | save([mdm.XTC_RTC{study, | ||
+ | end</ | ||
+ | |||
+ | In case the QA sheet is not shown by the function (flag '' | ||
+ | |||
+ | <code matlab fmriqasheet_example.m> | ||
+ | load CPU4212_run3_qasheet.mat | ||
+ | |||
+ | % open QA sheet | ||
+ | fmriqasheet(q);</ | ||
+ | |||
If the '' | If the '' | ||
Line 77: | Line 130: | ||
Please be aware that the first argument **must** be a list of filenames; so, even for a single NIftI ([[xff - NII format|NII]]) file, a cell array must be passed in: | Please be aware that the first argument **must** be a list of filenames; so, even for a single NIftI ([[xff - NII format|NII]]) file, a cell array must be passed in: | ||
- | <code matlab | + | <code matlab |
qas = fmriquality({' | qas = fmriquality({' | ||
fmriquality.1276787752.txt.gz · Last modified: 2010/06/17 15:15 by jochen