Skip to content

Matlab and Freesurfer

by manuel on September 1st, 2015

Some functions of Freesurfer 5.3.0 (like computing the local Gyrification Index) require integration with Matlab. In order to do this, the following code has to be in matlab’s startup.m file:

Also, if you are getting “ERROR: Matlab is required to run mris_compute_lgi!”, it means your have to add the Matlab path to Freesurfer`s $PATH variable for it to run.

To do this automatically when starting FS, just edit the .tcshrc file (assuming you run FS from TCSH) adding the location of your Matlab’s bin folder:

Finally, the LGI function also has a bug when running in Matlab versions 2013+. To fix this, make the following change to /Applications/freesurfer/matlab/SearchProjectionOnPial.m:

You should be able to run LGI now! 😉

From → Image Processing

2 Comments
  1. your answer helps me a lot, as you said:
    To do this automatically when starting FS, just edit the .tcshrc file (assuming you run FS from TCSH) adding the location of your Matlab’s bin folder:

    1
    setenv PATH “/Applications/MATLAB_R2014a.app/bin”:”$PATH”

    what if i do not run FS from TCSH( on mac )? I tried this commands, but it didn’t work. looking for your reply.

    • manuel permalink

      If you are running FS from bash, try export PATH=”/Applications/MATLAB_R2014a.app/bin”:”$PATH”.

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS

*