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 revision Previous revision
Next revision
Previous revision
ajay:neuroelf_usage_notes [2013/01/30 16:56]
ajay [Check preprocessing]
ajay:neuroelf_usage_notes [2016/08/03 22:36] (current)
ajay [Scripting and Batching: Tips and Pitfalls]
Line 47: Line 47:
  
   - 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).   - 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) ====
   - How to put your design into a prt file.   - How to put your design into a prt file.
Line 304: 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 316: Line 326:
   - plot(mdm.Handles.SDMs{1}.SDMMatrix) :this plots the matrix.   - 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.   - 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 331: 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 359: Line 374:
   - to restrict stats to voxels with brain data, keep the multiplication box checked; potentially alter the minimum anatomical value to increase/​decrease visibility of stats around the border of the data   - to restrict stats to voxels with brain data, keep the multiplication box checked; potentially alter the minimum anatomical value to increase/​decrease visibility of stats around the border of the data
   - higher interpolation (cubic/​sinc) takes longer but gives also better quality output (mostly useful for higher resolution renderings);​ only set to sinc for final shot!   - higher interpolation (cubic/​sinc) takes longer but gives also better quality output (mostly useful for higher resolution renderings);​ only set to sinc for final shot!
 +
 +===== Using the new 3D rendering tool with skull =====
 +Jochen Email
 +  - download and install the latest snapshot: http://​neuroelf.net/​NE_14032023.zip
 +  - then use "​neuroelf_setup"​ and "​neuroelf_makefiles all" (without quotes)
 +  - when you next open the NeuroElf GUI, load the following VMR/​anatomical from the File -> Colin menu: colin_brain_rendskull_ICBMnorm.vmr and colin_hires_ICBMnorm.vmr
 +  - in the main UI, ensure that the colin_hires_ICBMnorm.vmr is selected
 +  - use the render button (below the surface view button) on the right side to switch to render view
 +  - in the newly open render UI, select the colin_brain_rendskull_ICBMnorm.vmr dataset as the "Alpha volume"​ (transparency information;​ dropdown close to the top)
 +  - once the rendering is complete, you can use the same controls as for the surface view (mouse; with shift to translate and alt to zoom; and also cursor keys)
 +
 +When you want to add a stats map (or several maps), please know that each map will be resampled into the resolution of the anatomical prior to rendering, so to display 3 stats maps (at the same time) on top of the high-res colin brain, you probably need between 2 and 3 GB free memory! Also, for stats maps, I suggest changing them to "​stats-dependent transparency"​ (pressing the "​n"​ key while in the slice-view, THEN selecting the map/s you want to show, and then switching to render view)
  
 ===== Drawing/​creating a mask ===== ===== Drawing/​creating a mask =====
Line 442: Line 469:
  
  
-==== Scripting and Batching: ​Dangers  ​==== +==== Scripting and Batching: ​Tips and Pitfalls ​====
-Sometimes we may want to run multiple glms changing one or another option.+
  
-If this is what you want to do, BE SURE TO DO THESE TWO THINGS+Verify the parameters for you GLM. In the command line, once you load the glm (E.g. by using >>glm = xff('​*.glm'​)),​ you can ensure the parameters (e.g. motion correction as covariates, percent signal change transform, filter type and implementation,​ etc.) using the following two locations in the glm object. 
 +  - glm.Study(1).RunTimeVars.Predictors'​  
 +  - glm.RunTimeVars 
 + 
 +Sometimes we may want to run multiple glms changing one or another option. If so, BE SURE TO DO THESE TWO THINGS:
   - 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
 +  - VERIFY YOUR GLM using the methods indicated above.
 +
 +If your scripting is running inordinately slow, it may be because NeuroElf is loading, closing, and re-loading relevant data for a given step in your code. For example, when obtaining the betas from a glm for a set of vois, if you iterate across the vois to load the GLM, then it may reload all the GLM data each time. This is because NeuroElf runs efficiently by not loading up all the data unless it really needs to, but if you're coding, then you need to specify that. Use the following:
 +   >>​glm.LoadTransIOData
 +
 +
 +
 +==== 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.1359561361.txt.gz · Last modified: 2013/01/30 16:56 by ajay