<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div>Dear Jan-Mathijs,</div><div><br></div><div>many thanks for this! Your patched version of the read_surf function indeed works for me - so, many thanks for your help!</div><div><br></div><div>I have already contacted the freesurfer folks to inform them about the issue and will look into whether this might warrant a more general update on their side, too.</div><div><br></div><div>Again, thanks a lot and all the best,</div><div>Darinka<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 2, 2019 at 8:56 AM Schoffelen, J.M. (Jan Mathijs) <<a href="mailto:jan.schoffelen@donders.ru.nl">jan.schoffelen@donders.ru.nl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div style="overflow-wrap: break-word;">
Hi Darinka,
<div><br>
</div>
<div>If I comment out one of the ‘fgets’ I can read the file. I suggest you check whether your reported issue is an isolated one, i.e. it only occurs in this specific file, or a more general. If the latter, I’d contact the freesurfer people to make
them aware of the problem. Even better would be to provide them with a patched version of read_surf.m (based on the slightly more recent version they host on
<a href="https://github.com/freesurfer/freesurfer" target="_blank">https://github.com/freesurfer/freesurfer</a>), where code improvements can be suggested by means of a Pull Request. A not so elegant solution would be, to check whether the vnum and fnum are integers,
and if not, rewind to the beginning of the file and do the reading with a single fgets.</div>
<div><br>
</div>
<div>Below screenshot shows some (old) documentation about the fileformat I found online. It seems that in your file the comment is terminated by a single “\n”, and not by two of them, as is expected currently in read_surf. It may be that Freeview
etc. did not suffer, because it is more robust.</div>
<div><br>
</div>
<div>Further below, I have pasted a version of read_surf (based on the latest version of the freesurfer repo) that should work in your case.</div>
<div><br>
</div>
<div>Best wishes,</div>
<div>Jan-Mathijs</div>
<div><br>
</div>
<div><br>
</div>
<div><img id="gmail-m_26205524781599552754368172F-A678-44AB-8FCF-8DE9DA8BD353" src="cid:16a785c3d52391858221" width="1229" height="490"></div>
<div><br>
<div>%%%%%%%%%%%%%%%%%%%%%</div>
<div>% PATCHED VERSION</div>
<div><br>
</div>
<div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
<span style="color:rgb(4,51,255)">function</span> [vertex_coords, faces, magic] = read_surf(fname)</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
%</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% [vertex_coords, faces] = read_surf(fname)</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% reads a the vertex coordinates and face lists from a surface file</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% note that reading the faces from a quad file can take a very long</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% time due to the goofy format that they are stored in. If the faces</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% output variable is not specified, they will not be read so it </div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% should execute pretty quickly.</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
%</div>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45);min-height:12px">
<br class="gmail-m_2620552478159955275webkit-block-placeholder">
</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45);min-height:12px">
<br class="gmail-m_2620552478159955275webkit-block-placeholder">
</p>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
%</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% read_surf.m</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
%</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% Original Author: Bruce Fischl</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% CVS Revision Info:</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% $Author: fischl $</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% $Date: 2014/04/30 12:59:03 $</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% $Revision: 1.7 $</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
%</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% Copyright © 2011 The General Hospital Corporation (Boston, MA) "MGH"</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
%</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% Terms and conditions for use, reproduction, distribution and contribution</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% are found in the 'FreeSurfer Software License Agreement' contained</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% in the file 'LICENSE' found in the FreeSurfer distribution, and here:</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
%</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% <a href="https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferSoftwareLicense" target="_blank">
https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferSoftwareLicense</a></div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
%</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% Reporting: <a href="mailto:freesurfer@nmr.mgh.harvard.edu" target="_blank">freesurfer@nmr.mgh.harvard.edu</a></div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
%</div>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45);min-height:12px">
<br class="gmail-m_2620552478159955275webkit-block-placeholder">
</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45);min-height:12px">
<br class="gmail-m_2620552478159955275webkit-block-placeholder">
</p>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
%fid = fopen(fname, 'r') ;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
%nvertices = fscanf(fid, '%d', 1);</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
%all = fscanf(fid, '%d %f %f %f %f\n', [5, nvertices]) ;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
%curv = all(5, :)' ;</div>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45);min-height:12px">
<br class="gmail-m_2620552478159955275webkit-block-placeholder">
</p>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
% open it as a big-endian file</div>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45);min-height:12px">
<br class="gmail-m_2620552478159955275webkit-block-placeholder">
</p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45);min-height:12px">
<br class="gmail-m_2620552478159955275webkit-block-placeholder">
</p>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
%QUAD_FILE_MAGIC_NUMBER = (-1 & 0x00ffffff) ;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45)">
%NEW_QUAD_FILE_MAGIC_NUMBER = (-3 & 0x00ffffff) ;</div>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(37,153,45);min-height:12px">
<br class="gmail-m_2620552478159955275webkit-block-placeholder">
</p>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
TRIANGLE_FILE_MAGIC_NUMBER = 16777214 ;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
QUAD_FILE_MAGIC_NUMBER = 16777215 ;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
NEW_QUAD_FILE_MAGIC_NUMBER = 16777213 ;</div>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;min-height:12px">
<br class="gmail-m_2620552478159955275webkit-block-placeholder">
</p>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
fid = fopen(fname, <span style="color:rgb(178,69,243)">'rb'</span>, <span style="color:rgb(178,69,243)">
'b'</span>) ;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
<span style="color:rgb(4,51,255)">if</span> (fid < 0)</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)">
<span style="color:rgb(0,0,0)"> str = sprintf(</span>'could not open surface file %s.'<span style="color:rgb(0,0,0)">, fname) ;</span></div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
error(str) ;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(4,51,255)">
end</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
magic = fread3(fid) ;</div>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;min-height:12px">
<br class="gmail-m_2620552478159955275webkit-block-placeholder">
</p>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
<span style="color:rgb(4,51,255)">if</span>((magic == QUAD_FILE_MAGIC_NUMBER) | (magic == NEW_QUAD_FILE_MAGIC_NUMBER))</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
vnum = fread3(fid) ;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
fnum = fread3(fid) ;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
vertex_coords = fread(fid, vnum*3, <span style="color:rgb(178,69,243)">'int16'</span>) ./ 100 ; </div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
<span style="color:rgb(4,51,255)">if</span> (nargout > 1)</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
<span style="color:rgb(4,51,255)">for</span> i=1:fnum</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
<span style="color:rgb(4,51,255)">for</span> n=1:4</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
faces(i,n) = fread3(fid) ;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
<span style="color:rgb(4,51,255)">end</span></div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
<span style="color:rgb(4,51,255)">end</span></div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(4,51,255)">
<span style="color:rgb(0,0,0)"> </span>end</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
<span style="color:rgb(4,51,255)">elseif</span> (magic == TRIANGLE_FILE_MAGIC_NUMBER)</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
fgets(fid) ;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
fgets(fid) ;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
vnum = fread(fid, 1, <span style="color:rgb(178,69,243)">'int32'</span>) ;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
fnum = fread(fid, 1, <span style="color:rgb(178,69,243)">'int32'</span>) ;</div>
<div style="margin:0px;line-height:normal"><font size="1" face="Courier"> </font><font size="1" face="Courier" color="#25992d">% possibly the comment line was not followed by two \n’s, this patch is suggested by J.M.Schoffelen,
20190502</font><span style="font-family:Courier;font-size:x-small"> </span></div>
<div style="margin:0px;line-height:normal"><span style="font-family:Courier;font-size:10px;color:rgb(4,51,255)"> if</span><font size="1" face="Courier"> ~isa(vnum,
</font><span style="font-family:Courier;font-size:10px;color:rgb(178,69,243)">'int32'</span><font size="1" face="Courier">) || ~isa(fnum,
</font><span style="font-family:Courier;font-size:10px;color:rgb(178,69,243)">'int32</span><font size="1" face="Courier" color="#b245f3">’</font><font size="1" face="Courier">)</font></div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
<span style="color:rgb(37,153,45)"> </span>frewind(fid);</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
fread3(fid);</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
fgets(fid);</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
vnum = fread(fid, 1, <span style="color:rgb(178,69,243)">'int32'</span>) ;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
fnum = fread(fid, 1, <span style="color:rgb(178,69,243)">'int32'</span>) ;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(4,51,255)">
<span style="color:rgb(0,0,0)"> </span>end</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
vertex_coords = fread(fid, vnum*3, <span style="color:rgb(178,69,243)">'float32'</span>) ; </div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
<span style="color:rgb(4,51,255)">if</span> (nargout > 1)</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
faces = fread(fid, fnum*3, <span style="color:rgb(178,69,243)">'int32'</span>) ;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
faces = reshape(faces, 3, fnum)' ;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(4,51,255)">
<span style="color:rgb(0,0,0)"> </span>end</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(4,51,255)">
else</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(178,69,243)">
<span style="color:rgb(0,0,0)"> fprintf(</span>'ERROR: magic number %d unknown\n'<span style="color:rgb(0,0,0)">,magic);</span></div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
vertex_coords = [];</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
faces = [];</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(4,51,255)">
<span style="color:rgb(0,0,0)"> </span>return<span style="color:rgb(0,0,0)">;</span></div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(4,51,255)">
end</div>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:Courier;color:rgb(4,51,255);min-height:12px">
<br class="gmail-m_2620552478159955275webkit-block-placeholder">
</p>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
vertex_coords = reshape(vertex_coords, 3, vnum)' ;</div>
<div style="margin:0px;font-size:10px;line-height:normal;font-family:Courier">
fclose(fid) ;</div>
<div><br>
</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
<blockquote type="cite">
<div>On 1 May 2019, at 16:56, Darinka Trübutschek <<a href="mailto:darinkat87@gmail.com" target="_blank">darinkat87@gmail.com</a>> wrote:</div>
<br class="gmail-m_2620552478159955275Apple-interchange-newline">
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div>Dear Jan,</div>
<div><br>
</div>
<div>thanks for your reply. <br>
</div>
<div><br>
</div>
<div>Yes, I can confirm that I am calling the read_surf function included with the fieldtrip toolbox. I think the problem (perhaps specific to me?) might arise from the fact that the surface files I recently generated with freesurfer (e.g., the attached
lh.pial from sample subject bert) differ slightly in their format from previous ones?
<br>
</div>
<div><br>
</div>
<div>For example, when reading in a previously generated file (that works) into matlab using the read_surf function from fieldtrip, I get the following:</div>
<div><br>
</div>
<div>fid = fopen(fname, 'rb', 'b') ;<br>
if (fid < 0)<br>
str = sprintf('could not open curvature file %s.', fname) ;<br>
error(str) ;<br>
end<br>
magic = fread3(fid) ;</div>
<div><br>
</div>
<div>magic = 16777214;</div>
<div><br>
</div>
<div>>> a = fgets(fid);<br>
>> a<br>
<br>
a =<br>
<br>
'created by dante on Fri Jul 20 21:37:20 2018<br>
'</div>
<div>>> b = fgets(fid);<br>
>> b<br>
<br>
b =<br>
<br>
'<br>
'</div>
<div><br>
</div>
<div>>> vnum = fread(fid, 1, 'int32') ;<br>
fnum = fread(fid, 1, 'int32') ;<br>
>> vnum<br>
<br>
vnum =<br>
<br>
147285<br>
<br>
>> fnum<br>
<br>
fnum =<br>
<br>
294566<br>
</div>
<div>When I do the same with the surfaces I just generated (for example, for the attached lh_pial from sample subject bert), variable b no longer corresponds to a newline, but actually already contains some information.<br>
</div>
<div><br>
</div>
<div>fname =<br>
<br>
'/home/darinka/Test_Freesurfer/subjects/bert/surf/lh.pial'<br>
<br>
>> fid = fopen(fname, 'rb', 'b') ;<br>
if (fid < 0)<br>
str = sprintf('could not open curvature file %s.', fname) ;<br>
error(str) ;<br>
end<br>
magic = fread3(fid) ;<br>
>> a = fgets(fid);<br>
>> a<br>
<br>
a =<br>
<br>
'created by darinka on Fri Apr 5 15:33:41 2019<br>
'<br>
>> b = fgets(fid);<br>
>> b<br>
<br>
b =<br>
<br>
' XI ������� ����Z ��s����%��g� D�\ ¾=��ٴ���� "�ZR�B@¾����(�¿5����.{#�T��� ¾~��Z���P½���o��$¾@��h ���¾� ��<br>
'<br>
<br>
>> <br>
</div>
<div><br>
</div>
<div>>> vnum = fread(fid, 1, 'int32') ;<br>
fnum = fread(fid, 1, 'int32') ;<br>
>> vnum<br>
<br>
vnum =<br>
<br>
-1.0516e+09<br>
<br>
>> fnum<br>
<br>
fnum =<br>
<br>
-1.0276e+09</div>
<div><br>
</div>
<div>I am not sure as to why exactly this discrepancy seems to exist (especially given that the visualization in freeview works fine for either one) and whether it is specific to my setup or something more general, but I was hoping that someone with
more expertise in these specific functions might be able to point me in the right direction?</div>
<div><br>
</div>
<div>Again, many thanks for your help and all the best,</div>
<div>Darinka<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Wed, May 1, 2019 at 3:28 PM Schoffelen, J.M. (Jan Mathijs) <<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank">jan.schoffelen@donders.ru.nl</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>Hi Darinka,
<div><br>
</div>
<div>I cannot confirm your problem, although admittedly I have used different software versions (matlab/fieldtrip/freesurfer) etc.</div>
<div>The problem seems to occur in read_surf, which is not maintained by us, but comes from the freesurfer folks. Can you confirm that the version of read_surf that the call to ft_read_headshape ends up using is in external/freesurfer?</div>
<div><br>
</div>
<div><br>
</div>
<div>best wishes,</div>
<div>Jan-Mathijs</div>
<div><br>
</div>
<div><br>
<div>
<blockquote type="cite">
<div>On 1 May 2019, at 14:56, Darinka Trübutschek <<a href="mailto:darinkat87@gmail.com" target="_blank">darinkat87@gmail.com</a>> wrote:</div>
<br class="gmail-m_2620552478159955275gmail-m_4070395714673011906gmail-m_-8147963435700313580Apple-interchange-newline">
<div>
<div dir="ltr">
<div dir="ltr">
<div>Dear fieldtrip community,</div>
<div><br>
</div>
<div>Sorry for double-posting - my original message somehow seems to have been cut short...</div>
<div><br>
</div>
<div><br>
</div>
<div>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:</div>
<div><br>
</div>
<div>pial = ft_read_headshape('freesurfer/surf/lh.pial');<br>
Error using fread<br>
Invalid size.<br>
<br>
Error in read_surf (line 72)<br>
vertex_coords = fread(fid, vnum*3, 'float32') ;<br>
<br>
Error in ft_read_headshape (line 909)<br>
[pos, tri] = read_surf(filename);<br>
</div>
<div><br>
</div>
<div>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). </div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>Many thanks!</div>
<div>Darinka</div>
<div><br>
</div>
-- <br>
<div dir="ltr" class="gmail-m_2620552478159955275gmail-m_4070395714673011906gmail-m_-8147963435700313580gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr"><font face="tahoma, sans-serif">Darinka Trübutschek, PhD</font></div>
<div dir="ltr"><font face="tahoma, sans-serif"><br>
</font>
<div>
<div>Department of Experimental Psychology</div>
<div>Anna Watts Building</div>
<div>Radcliffe Observatory Quarter</div>
<div>Woodstock Road</div>
<div>Oxford, OX2 6GG</div>
<div>UK</div>
</div>
<div><font face="tahoma, sans-serif"><br>
</font></div>
<div><font face="tahoma, sans-serif">website: <a href="https://sites.google.com/site/dtruebutschek/" target="_blank">https://sites.google.com/site/dtruebutschek/</a></font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</div>
</blockquote>
</div>
<br>
</div>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202" rel="noreferrer" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</blockquote>
</div>
<br clear="all">
<br>
-- <br>
<div dir="ltr" class="gmail-m_2620552478159955275gmail-m_4070395714673011906gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr"><font face="tahoma, sans-serif">Darinka Trübutschek, PhD</font></div>
<div dir="ltr"><font face="tahoma, sans-serif"><br>
</font>
<div>
<div>Department of Experimental Psychology</div>
<div>Anna Watts Building</div>
<div>Radcliffe Observatory Quarter</div>
<div>Woodstock Road</div>
<div>Oxford, OX2 6GG</div>
<div>UK</div>
</div>
<div><font face="tahoma, sans-serif"><br>
</font></div>
<div><font face="tahoma, sans-serif">website: <a href="https://sites.google.com/site/dtruebutschek/" target="_blank">https://sites.google.com/site/dtruebutschek/</a></font></div>
</div>
</div>
</div>
</div>
</div>
</div>
<span id="gmail-m_2620552478159955275cid:f_jv5bp40a0"><lh.pial></span></div>
</blockquote>
</div>
<br>
</div>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202" rel="noreferrer" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><font face="tahoma, sans-serif">Darinka Trübutschek, PhD</font></div><div dir="ltr"><font face="tahoma, sans-serif"><br></font><div><div>Department of Experimental Psychology</div><div>Anna Watts Building</div><div>Radcliffe Observatory Quarter</div><div>Woodstock Road</div><div>Oxford, OX2 6GG</div><div>UK</div></div><div><font face="tahoma, sans-serif"><br></font></div><div><font face="tahoma, sans-serif">website: <a href="https://sites.google.com/site/dtruebutschek/" target="_blank">https://sites.google.com/site/dtruebutschek/</a></font></div></div></div></div></div></div></div>