Thanks very much, Yasser.
I've also fixed the bug by using my own, now-outdated copies of FreeSurfer's MATLAB functions (https://github.com/epiSurg/EpiSurg/tree/master/FSURF_MATLAB), but I'm hoping the FreeSurfer developers can fix it in the current releases.
     much appreciated,
          -David


On Tue, Dec 27, 2016 at 11:19 AM, Yasser Alemán <yaleman@hggm.es> wrote:
Hi David, 

I had the same problem 3 days ago. I have fix it by changing some matlab scripts located inside freesurfer_root_directory/matlab

I am sending to you the modified scripts. Please take care and save the original versions before copying the new ones. 

Save inside <freesurfer_root_directory>/matlab
getFacesArea.m 
mesh_adjacency.m
SearchProjectionOnPial.m.

I have also found another bug related to matlab startup.m file. If you have modified your startup.m file to select by default a working directory then the lgi computation will fail. When matlab starts it changes the current directory (<$SUBJECTS_DIR>/<subjID>/surf) to the directory specified in the startup.m file and the scripts are looking for a specified filename (ie. lh.pial) inside the specified working directory. 

I am sending to you also the modified versions of the scripts with this bug  solved. I have tested in our VMs and everything goes ok.

Save inside <freesurfer_root_directory>/bin
mris_compute_lgi

Save inside <freesurfer_root_directory>/matlab
compute_lgi.m
find_corresponding_center_FSformat.m
make_roi_paths.m

We have to wait for freesurfer developers to see their opinion. Maybe they have fixed this already. The original code and changes are commented.

I hope this can be helpful.
Best regards
Yasser





2016-12-23 16:11 GMT+01:00 David Groppe <david.m.groppe@gmail.com>:

Dear FreeSurfer Developers,
     I think there is a bug in FreeSurfer's MATLAB code that is used to compute the local gyrification index. Specifically, when I run this command:

recon-all -s PT001 -localGI


I get the following error:

face 115000 / 118360

mesh_outer =

         vertices: [59182x3 double]
            faces: [118360x3 double]
    facesOfVertex: [59182x1 struct]

preparing pial mesh structure ...
...searching for mesh edges...done (171.44 sec).
... creating path file for vertex 1 / 59182
area file for outer ROIs saved at 1
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));

Error in mesh_vertex_nearest (line 29)
nearestIndex = dsearchn(vertices,points);

Error in reorganize_verticeslist (line 28)
    [nextindex,nextvalue]=mesh_vertex_nearest(mesh_total.vertices(remaininglist,:),mesh_total.vertices(verticeslist(start_vertex),:));
   
Error in make_roi_paths (line 93)
    reorglist = reorganize_verticeslist (mesh_total, A, mesh_outer, perim,
    verticeslist, step);

 
>>
ERROR:  make_roi_paths did not complete successfully!

I ran the command in debugging mode and x and yi are both empty variables.

I am using a freshly installed version of the Lion OS X 10.7 (64b Intel) version of FreeSurfer (freesurfer-Darwin-lion-stable-pub-v5.3.0.dmg; freesurfer-Darwin-lion-stable-pub-v5.3.0) and am running on OS 10.11.6 using MATLAB version R2015b (8.6.0.267246). The recon-all.log is attached.

Let me know if there is any further information I can provide and thanks for producing such a fantastic piece of freeware.
     -David Groppe




_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer


The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.