| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.

View
 

Installing iELVis

Page history last edited by David Groppe 1 year ago

iELVis consists of a collection of Matlab and Bash functions/scripts that you can download from:

https://github.com/iELVis/iELVis

 

Installing Matlab Files

1) After you download the Matlab files you need to add them your Matlab path. You can do this via the "Set Path" option in the Matlab GUI:

 

Alternatively you can use the addpath.m and genpath.m functions.

 

2) You also need to define a global variable that stores the path to your FreeSurfer subjects folder. You do this by the adding something like the following lines your startup.m script that Matlab automatically runs every time you launch Matlab:

>>global globalFsDir;
>>globalFsDir='/Applications/freesurfer/subjects/';

 

Here's an example startup file:

startup.m

 

3) If you want to use the Yang, Wang et al. method for estimating the locations of subdural grid electrodes, you will need to use the mex file (i.e., a Matlab executable file), fastmarch_mex.mexa64. The version of this file in the iELVis repo may not be compatible with your computer's operating system. If that's the case you will need to create a new mex file using the raw C++ code.

 

4) To check the installation of iELVis, do the following:

  a) Download the PT001 and fsaverage folder from here

  b) Uncompress both files and put them in your FreeSurfer subjects directory

  c) Run the iELVis script check_iELVisInstall.m

 

4) The iELVis brain shift correction functions yangWangElecPjct.m and dykstraElecPjct.m depend on some MATLAB toolboxes that may not be included in your MATLAB license. Specifically yangWangElecPjct.m uses functions in the Statistics and Machine Learning toolbox and dykstraElecPjct.m uses functions in the Optimization toolbox and the Statistics and Machine learning toolbox. If you do do not have access to these toolboxes, you can still use a simplified version of the Dykstra algorithm by setting its minimizeChange parameter to 0.

 

Finally, FreeSurfer's -localGI option requires MATLAB's Image Processing Toolbox. If you do not have a license for the Image Processing Toolbox, you will not be able to use either iELVis method for correcting subdural electrode locations for brain shift.

 

 

Installing Bash Files

To facilitate using the iELVis bash functions, add them to your bash path by adding something like the following to your .bashrc file:

export PATH=$PATH:/Users/penfield/PATH_TO_YOUR_BASH_FUNCTIONS

 

where "PATH_TO_YOUR_BASH_FUNCTIONS" is the folder where you placed the iELVis bash files.

 

If you use a Mac, you might need to add that line to your .profile file instead of your .bashrc file (depending on your OS version). You will also need make the bash function executable by running something like following command (if you're in the director with the bash scripts):

$chmod *.sh

 

 

Installing Other Software Used by iELVis

iELVis relies on the following freely available software packages for some functions. While these software packages are all over 10 years old and the functions that iELVis depends on quite stable, we recommend that users subscribe to the announcement lists for these packages to be notified of any bugs or major changes. If we become aware of any bugs or changes in these packages that affect iELVis, we will alert the iELVis Users Google Group and post them as issues on the iELVis GitHub repo.

 

1. BioImage Suite

This program is used for labelling electrodes in postimplant CT or MRI scans. It runs on Windows, Mac OS, or Linux. You need to install the "legacy" version of BioImageSuite:

https://medicine.yale.edu/bioimaging/suite/lands/

 

The current version of BioImageSuite (http://bioimagesuite.yale.edu/) does not yet support electrode localization (as of June 2018).

 

Note that the stable version of BioImage Suite does not work on the most recent Mac Os. To get a beta version that works, see the links on the NITRC discussion board.

 

 

2. FreeSurfer

This program is used for automated segmentation of preimplant MRIs, reconstructing the pial and leptomeningeal surface, and mapping to an average brain for group analyses. It runs easily on Mac OS or Linux. You can run it on Windows with a virtual machine as detailed on the FreeSurfer website:

http://freesurfer.net/

 

Note that FreeSurfer comes with a set of Matlab functions. Some of these functions are used by iELVis. Depending on your version of FreeSurfer, these may differ from the versions used to develop iELVis. The FreeSurfer functions used by iELVis can be downloaded from our GitHub repo. If you run into to problems using iELVis, make sure you are using the iELVis versions of the FreeSurfer functions. Note, in the past we have found that the localGI option of recon-all fails in the default install of FreeSurfer because of a bug in their SearchProjectionOnPial.m function. The version of SearchProjectionOnPial.m in our Github repo should solve the problem. If recon-all gives you an error that starts with this:

 

In an assignment  A(:) = B, the number of elements in A and B must be the same.

Error in dsearchn (line 79)
        [d(i),t(i)] = min(sum((x-yi).^2,2));

 

then replacing the default FreeSurfer function SearchProjectionOnPial.m with the version in our GitHub repo should solve it.

 

 

3. FSL

FSL is used by the Bash scripts for MRI/CT coregistration and visualization. Specifically we use FSL's flirt and slices functions. It runs easily on Mac OS or Linux. You can run it on Windows with a virtual machine as detailed on the FSL website:

http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/

 

If you prefer to coregister CT and MRI images with other tools, FSL is not necessary.

 

 

4. 7-ZIP (Windows computers only)

On Windows computers, 7-Zip is necessary to unzip .mgz medical imaging files before loading them into Matlab. 7-Zip is an open-source Windows software:

http://www.7-zip.org

 

Please install 7-Zip in the default directory, "C:\Program Files\7-Zip\". If you need to install 7-Zip in another directory, you will need to edit load_mgh.m and ntools_elec_load_nifti.m to direct them to the correct location on your system.

 

Comments (0)

You don't have permission to comment on this page.