User Tools

Site Tools


ajay:neuroelf_usage_notes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
ajay:neuroelf_usage_notes [2012/11/14 22:35] – [Running a GLM] ajayajay:neuroelf_usage_notes [2014/02/03 23:26] – [Using command lines to extract beta's from a glm and voi NeuroElf] ajay
Line 45: Line 45:
  
   - the SPM preprocessing dialog (Run) should also create VTC files at the end (basically the preprocessed image files in another format that allows for rapid processing of data), which you can simply check by using the File -> Open menu option in NeuroElf   - the SPM preprocessing dialog (Run) should also create VTC files at the end (basically the preprocessed image files in another format that allows for rapid processing of data), which you can simply check by using the File -> Open menu option in NeuroElf
 +
 +  - Jochen: The blue bars (boxes, really) represent a spike-detection algorithm that I have implemented together with Katherine Duncan (Daphna's new post-doc, who was working at NYU before). She found that in the fourier spectrum (original acquisition space) there are sometimes artefacts that produce "wave-like" patterns in voxel space (per slice, not full-brain). To detect these artefacts, the mean of the time series is subtracted from each slice and then the FFT is computed; if then the FFT image contains large "spikes" (single frequency/phase pairs that indicate energy too large to be explained by regular deviations), a blue box is printed for those slice timepoints. I would not be overly worried about single boxes, nor about a "series of boxes" in top (or bottom) slices where almost no brain data is collected; given that the true signal portion is very low, the detection threshold adapts and then finds more "noise" components in the image (quite normal). However, if you see a volume with several boxes (such as in the range of 120 to 140 on the volume/time axis), that might be a sign of a real problem... You can then (normal) click on the slice timecourse (blue box) to bring up a secondary window that shows three rows of data: the actual data (including the timepoint before and after the one you clicked on), the mean-removed data, and at the bottom the FFT of the mean-removed data. The detection works on the data of the last row (but you can then observe the effect of this artefact in image space, to see how bothered you are by it).
 +
 +==== VTC file formats ====
 +  - The preprocessed data are transformed from NII to VTC in the final step.
 +  - VTC formats have an advantage in speed of processing for later steps because they put time as the first dimension in the 4D image matrix.
 +  - VTC axes are not in the same exact ordering as NII axes: it goes time, Y, X, Z. 
 +  - The defaults set the bounding box of the image to cover the MNI brain.
 +  - The defaults use 3mm voxel sizes, timepointsx66x52x47 size... note that the 66 is in the y direction...
 +
  
 ==== Making Design Files (prt files) ==== ==== Making Design Files (prt files) ====
Line 303: Line 313:
  
   - Then...<code matlab ajay_get_betas_in_glm_from_voi.m>   - Then...<code matlab ajay_get_betas_in_glm_from_voi.m>
-voi_betas = glm.VOIBetas(voi);</code>  +voi_betas = glm.VOIBetas(voi); 
- +%or to get all the beta maps not limited to a voi 
 +betas = glm.GLMData.Subject(S).BetaMaps(:,:,:,:);  
 +</code> 
 ==== Using command lines to extract design information from glm NeuroElf ==== ==== Using command lines to extract design information from glm NeuroElf ====
   - glm.SubjectPredictors provides names of predictors   - glm.SubjectPredictors provides names of predictors
Line 311: Line 322:
   - glm.Study(1).RunTimeVars contains more information, including info about glm that is applied to data   - glm.Study(1).RunTimeVars contains more information, including info about glm that is applied to data
   - To view the design matrix including filters: plot(ztrans(g1.Study(1).RunTimeVars.SDMMatrix))   - To view the design matrix including filters: plot(ztrans(g1.Study(1).RunTimeVars.SDMMatrix))
-  - +  - To get a sense of the correlations between regressors including the filters 
 +  - mdm.Handles.SDMs{1}.PredictorNames' :this lists out the predictor names for the columns. 
 +  - plot(mdm.Handles.SDMs{1}.SDMMatrix) :this plots the matrix. 
 +  - corrcoef(mdm.Handles.SDMs{1}.SDMMatrix(:, [2:2:24,25:32])) : this, e.g., calculates correlations between regressors. 
 +===== Visualization Tools =====  
 + 
 +==== Scripting Output Displays ==== 
 +For outputting many slices for several maps, this section describes how to script the output visuals at the command line. 
 + 
 ===== Using the surface rendering ===== ===== Using the surface rendering =====
   - load up your VMP and threshold it (height threshold)   - load up your VMP and threshold it (height threshold)
Line 327: Line 347:
     - then, repeat these steps with the hiresolution ones for figures     - then, repeat these steps with the hiresolution ones for figures
     - smoothing values (as a starting suggestion) for hires: 400 iterations, and force between .4 and .6     - smoothing values (as a starting suggestion) for hires: 400 iterations, and force between .4 and .6
- 
 ===== Using the voxel rendering ===== ===== Using the voxel rendering =====
   - load up your VMP and threshold it (height and cluster threshold)   - load up your VMP and threshold it (height and cluster threshold)
Line 397: Line 416:
   - Starting with your meta-analysis in an xls sheet...   - Starting with your meta-analysis in an xls sheet...
   - The header row must have: Study, x, y, z   - The header row must have: Study, x, y, z
 +  - Study must be a string... to ensure this, add a dummy string prior to each study name e.g. 's_<study name>'
   - It should also have: CoordSys with "T88" or "MNI" tokens, it will be converted to MNI during import   - It should also have: CoordSys with "T88" or "MNI" tokens, it will be converted to MNI during import
   - The header row may optionally and usefully have: N (nr of subjects), FixedRandom (0/1 coding of FFX or RFX)   - The header row may optionally and usefully have: N (nr of subjects), FixedRandom (0/1 coding of FFX or RFX)
Line 403: Line 423:
   - If a column has 'yes' and 'no' values only, it will be recoded into 1/0. BUT, if you have 'yes' and 'no' and other kinds of codes (e.g. 'maybe', 'missing', 'both', or what have you), you should recode the 'yes' and 'no' to something else.   - If a column has 'yes' and 'no' values only, it will be recoded into 1/0. BUT, if you have 'yes' and 'no' and other kinds of codes (e.g. 'maybe', 'missing', 'both', or what have you), you should recode the 'yes' and 'no' to something else.
   - Make sure you have a place holder for empty cells or missing values (and not NaNs unless it's a numeric column). E.g. "MISSING"   - Make sure you have a place holder for empty cells or missing values (and not NaNs unless it's a numeric column). E.g. "MISSING"
 +  - Do not have any empty columns included.
   - Now save your data as a .csv file from Excel.   - Now save your data as a .csv file from Excel.
   - Rename as a .txt file.   - Rename as a .txt file.
Line 442: Line 463:
   - clear the object between analyses. glm.ClearObject; mdm.ClearObject;   - clear the object between analyses. glm.ClearObject; mdm.ClearObject;
   - 'bless' the command where you run the mdm: glm = bless(mdm.ComputeGLM(opts));   - 'bless' the command where you run the mdm: glm = bless(mdm.ComputeGLM(opts));
 +
 +A second potential error when making a glm is to not set the options structure correctly. Specifically, for realignment parameters or any other cell array input into the opts structure, you must enclose it in curly brackets:
 +  - CORRECT: struct('tfilter',200,'tfilttype','dct','motpars',{rps})
 +  - INCORRECT: struct('tfilter',200,'tfilttype','dct','motpars',rps)
 +  - where rps is a cell array pointing to files name for realignment parameters
 +
 +
 +
 +==== Exporting files to SPM, FSL, etc.  ====
 +Neuroelf has export functions in the gui menus.
 +The default options for some of these didn't work well for FSLview.
 +To deal with this, be sure to use a recent version of NeuroElf (12/12/12 or later).
 +  - vmp.ExportNifti('NIFTI_FILE.nii', true);
 +  - where the second argument, true, makes the output be written in TAL order, such that it complies with FSL's internal preference.
 +  - also works with vtc, glm, etc.
 +
 +
ajay/neuroelf_usage_notes.txt · Last modified: 2016/08/03 20:36 by ajay