External Email - Use Caution
Dear freesurfer community,
I am currently trying to import cortical surfaces extracted with freesurfer (version: freesurfer-linux-centos7_x86_64-dev-20190403-dacefd1) into Matlab (version: R2018b) using the fieldtrip function ft_read_headshape (version: 20190329). All of this is run in an Ubuntu 18.04.2 LTS environment. While all of the extracted surfaces seem fine upon visual inspection in freeview, the import into Matlab fails, throwing the following error message:
pial = ft_read_headshape('freesurfer/surf/lh.pial'); Error using fread Invalid size.
Error in read_surf (line 72) vertex_coords = fread(fid, vnum*3, 'float32') ;
Error in ft_read_headshape (line 909) [pos, tri] = read_surf(filename);
It is most certainly related to the fact that, both for the number of vertices (vnum) and the number of faces (fnum), the function read_surf returns non-sensible (?) values (i.e., vnum = -1.0263e+09 and fnum = -1.0529e+09). The same code produces no error when run on the same pial surface extracted with a different version of freesurfer (freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.0-2beb96c) in a different Ubuntu environment (Ubuntu 16.04 LTS).
As visual inspection in Freeview of the 2 surfaces from the two different Freesurfer versions reveals no obvious differences, I am therefore at a loss as where exactly to start to fix this problem and would be grateful for any help.
Many thanks! Darinka
Hi Darinka
what is fieldtrip? I don't think it is anything of ours. What happens if you call read_surf directly?
cheers Bruce On Wed, 1 May 2019, Darinka Trübutschek wrote:
External Email - Use Caution
Dear freesurfer community,
I am currently trying to import cortical surfaces extracted with freesurfer (version: freesurfer-linux-centos7_x86_64-dev-20190403-dacefd1) into Matlab (version: R2018b) using the fieldtrip function ft_read_headshape (version: 20190329). All of this is run in an Ubuntu 18.04.2 LTS environment. While all of the extracted surfaces seem fine upon visual inspection in freeview, the import into Matlab fails, throwing the following error message:
pial = ft_read_headshape('freesurfer/surf/lh.pial'); Error using fread Invalid size.
Error in read_surf (line 72) vertex_coords = fread(fid, vnum*3, 'float32') ;
Error in ft_read_headshape (line 909) [pos, tri] = read_surf(filename);
It is most certainly related to the fact that, both for the number of vertices (vnum) and the number of faces (fnum), the function read_surf returns non-sensible (?) values (i.e., vnum = -1.0263e+09 and fnum = -1.0529e+09). The same code produces no error when run on the same pial surface extracted with a different version of freesurfer (freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.0-2beb96c) in a different Ubuntu environment (Ubuntu 16.04 LTS).
As visual inspection in Freeview of the 2 surfaces from the two different Freesurfer versions reveals no obvious differences, I am therefore at a loss as where exactly to start to fix this problem and would be grateful for any help.
Many thanks! Darinka
-- Darinka Trübutschek, PhD
Department of Experimental Psychology Anna Watts Building Radcliffe Observatory Quarter Woodstock Road Oxford, OX2 6GG UK
freesurfer@nmr.mgh.harvard.edu