Re: [Freesurfer] read_surf surface
The surface coordinates are in "tkregister" coordinates whereas freeview is giving you scanner coordinates. See https://surfer.nmr.mgh.harvard.edu/fswiki/CoordinateSystems for how to convert between them On 3/25/2021 7:14 AM, Shizuka Hayashi wrote: External Email - Use Caution Dear Freesurfer team, I have a question about the inconsistency between the vertex read from read_surf and vertex shown in Freeview. I have a volume from the hippocampal subfield pipeline and I converted it to surface mesh using mri_tessellate mri/lh.hippoAmygLabels-T1.long.v21.mgz -an surf/lh.hippoAmygLabels-T1.long.v21.surf. Then I smoothed the surface using mris_smooth surf/lh.hippoAmygLabels-T1.long.v21.surf surf/lh.hippoAmygLabels-T1.long.v21.surf Now I want to get the corresponding voxel of lh.hippoAmygLabels-T1.long.v21.mgz with the vertex. In Freeview, for example, the vertex 0 is [5.17, -19.5, 4.83]. I know how to convert this vertex to the corresponding voxel. However, when I read the surf/lh.hippoAmygLabels-T1.long.v21.surf from Matlab using read_surf, the first vertex ( vertex(1,:,:)) is equal to [165.4900,217.3600,-159.7300]. Are there any ways to solve the issue? Thank you. Regards, Shizuka ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
[Freesurfer] read_surf surface
External Email - Use Caution Dear Freesurfer team, I have a question about the inconsistency between the vertex read from read_surf and vertex shown in Freeview. I have a volume from the hippocampal subfield pipeline and I converted it to surface mesh using mri_tessellate mri/lh.hippoAmygLabels-T1.long.v21.mgz -an surf/lh.hippoAmygLabels-T1.long.v21.surf. Then I smoothed the surface using mris_smooth surf/lh.hippoAmygLabels-T1.long.v21.surf surf/lh.hippoAmygLabels-T1.long.v21.surf Now I want to get the corresponding voxel of lh.hippoAmygLabels-T1.long.v21.mgz with the vertex. In Freeview, for example, the vertex 0 is [5.17, -19.5, 4.83]. I know how to convert this vertex to the corresponding voxel. However, when I read the surf/lh.hippoAmygLabels-T1.long.v21.surf from Matlab using read_surf, the first vertex ( vertex(1,:,:)) is equal to [165.4900,217.3600,-159.7300]. Are there any ways to solve the issue? Thank you. Regards, Shizuka ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
[Freesurfer] Read_surf error in reading "lh.seghead" head surface created from "mkheadsurf"
Dear FreeSurfer users, I have used the "mkheadsurf" function to create "lh.seghead" in the surf folder of my subject. Now I am trying to extract the vertices and faces of "lh.seghead" in the following way: *[vertex_coords, faces] = read_surf('lh.seghead')* but get an error in read_surf which is: *Undefined function or variable "faces".* * Error in read_surf (line 80)* * faces = faces+1;* After a bit of investigation I found that the "magic" number of the file is 16777213 while the triangle magic number is 16777214. Since these are unequal, it doesn't go into the if statement where faces are defined. When I try to changed the magic number manually to be the same as the triangle magic number, I get the following error: *Error using reshape* * To RESHAPE the number of elements must not change.* * Error in read_surf (line 76)* * faces = reshape(faces, 3, fnum)' ;* But I don't think making this change is a good idea as it would affect the surfaces that I try to read that DO have magic number that is actually equal to the triangle magic number. Does anybody know why this might be happening? Any suggestions for me to try? The read_surf works fine when I use it for the pial surface, just not the lh.seghead. I am using FreeSurfer version 5.3.0. I would appreciate any advice! Thanks, Maheen ___ 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.
[Freesurfer] read_surf and free surfer 5.0
Hi, I am trying to read a surface generated by mri_tessellate using matlab's API (read_surf.m) However, it seems like the function is not up-to-date, because the magic number in the surface file is 16777213, and the two magic-numbers recognized by read_surf are 16777214 and 16777215. Is there a newer version of read_surf.m out there? Thanks, -- Shay ___ 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.
[Freesurfer] read_surf - update
Hi again, OK. I managed to reverse engineer things back from mri_tessalate.c Here is the code snippet that should be added to read_surf to parse these new files: NEW_QUAD_FILE_MAGIC_NUMBER =16777213; elseif (magic == NEW_QUAD_FILE_MAGIC_NUMBER) vnum = fread3(fid); fnum = fread3(fid); vertex_coords = fread(fid, vnum*3, 'float32') ; tmp = fread(fid, fnum*3*3, 'uchar') ; tmp = reshape(tmp, 3, 3, fnum) ; faces = reshape(bitshift(tmp(1,:,:), 16) + bitshift(tmp(2,:,:),8) + tmp(3,:,:),3, fnum)'; end -- Shay ___ 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.
Re: [Freesurfer] read_surf - update
Sorry, I guess it got out of date. We don't it much Bruce On May 29, 2012, at 9:12 PM, Shay Ohayon shay.oha...@gmail.com wrote: Hi again, OK. I managed to reverse engineer things back from mri_tessalate.c Here is the code snippet that should be added to read_surf to parse these new files: NEW_QUAD_FILE_MAGIC_NUMBER =16777213; elseif (magic == NEW_QUAD_FILE_MAGIC_NUMBER) vnum = fread3(fid); fnum = fread3(fid); vertex_coords = fread(fid, vnum*3, 'float32') ; tmp = fread(fid, fnum*3*3, 'uchar') ; tmp = reshape(tmp, 3, 3, fnum) ; faces = reshape(bitshift(tmp(1,:,:), 16) + bitshift(tmp(2,:,:),8) + tmp(3,:,:),3, fnum)'; end -- Shay ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer ___ 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.
Re: [Freesurfer] read_surf/patch issue
Corey, Matlab uses vertex numbers starting from one. However, the vertex numbers from Freesurfer start from zero. This error in matlab can be fixed by adding 1 to the vertex numbers. Jooman On Mon, 2009-02-02 at 16:14 -0500, Keller, Corey J. wrote: Hi Freesurfers, I am having some issues plotting a reconstructed brain in matlab. I have used the read_surf function to load in the pial surface file lh.pial and save the lh_pial.vert and lh_pial.tri. I get the following output: fv.vertices fv.faces] = read_surf('lh.pial') fv = vertices: [140817x3 double] faces: [281630x3 double] h = patch(fv,'FaceColor',[.5 .5 .5]) ??? Error using == patch Faces values must be = 1.0. My first 10 face values are: fv.faces(1:10,1:3) ans = 0 1 5 6 5 1 026 1 27 126 0 526 3926 5 1 2 6 7 6 2 12728 128 2 This seems to be the issue because every other row the faces values are greater than zero. Do you know why all of my recon output pial files look like this and how I can fix the issue. Thanks. Best, Corey ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
RE: [Freesurfer] read_surf/patch issue
Hi Jooman, That worked! Thanks. -Corey -Original Message- From: Jooman Han [mailto:joo...@nmr.mgh.harvard.edu] Sent: Monday, February 02, 2009 4:35 PM To: Keller, Corey J. Cc: Freesurfer Mailing List Subject: Re: [Freesurfer] read_surf/patch issue Corey, Matlab uses vertex numbers starting from one. However, the vertex numbers from Freesurfer start from zero. This error in matlab can be fixed by adding 1 to the vertex numbers. Jooman On Mon, 2009-02-02 at 16:14 -0500, Keller, Corey J. wrote: Hi Freesurfers, I am having some issues plotting a reconstructed brain in matlab. I have used the read_surf function to load in the pial surface file lh.pial and save the lh_pial.vert and lh_pial.tri. I get the following output: fv.vertices fv.faces] = read_surf('lh.pial') fv = vertices: [140817x3 double] faces: [281630x3 double] h = patch(fv,'FaceColor',[.5 .5 .5]) ??? Error using == patch Faces values must be = 1.0. My first 10 face values are: fv.faces(1:10,1:3) ans = 0 1 5 6 5 1 026 1 27 126 0 526 3926 5 1 2 6 7 6 2 12728 128 2 This seems to be the issue because every other row the faces values are greater than zero. Do you know why all of my recon output pial files look like this and how I can fix the issue. Thanks. Best, Corey ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
[Freesurfer] read_surf error under Matlab R14 Linux
Hi, I was using Matlab R14 in Linux to read a surface and compute a thickness histogram. I noticed that the read_surf function fails in every lh.thickness or rh.thickness file. Even in bert dataset. Here the error: [vertex,f] = read_surf ('/usr/local/freesurfer/subjects/p111/surf/lh.thickness'); ??? Subscripted assignment dimension mismatch. Error in == read_surf at 41 faces(i,n) = fread3(fid) ; I'm using Freesurfer 3.0.5 Thanks, Pedro Paulo Oliveira Jr. P.S. - I know that this issue has been previously discussed here but I have patients with a cortex thickness larger than 5mm and the truncation makes the statistical calculation fault in some aspects of my work. It would be possible to have a raw thickness calculation? Tks again PPJ ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
Re: [Freesurfer] read_surf error under Matlab R14 Linux
Hi Pedro you can use mris_thickness -max max thick to generate a thickness with a different max. Note that the ?h.thickness files are in curv format, they are not surfaces (they have no topological information in them), so they should be read with the read_curv.m file. cheers, Bruce On Sat, 8 Sep 2007 [EMAIL PROTECTED] wrote: Hi, I was using Matlab R14 in Linux to read a surface and compute a thickness histogram. I noticed that the read_surf function fails in every lh.thickness or rh.thickness file. Even in bert dataset. Here the error: [vertex,f] = read_surf ('/usr/local/freesurfer/subjects/p111/surf/lh.thickness'); ??? Subscripted assignment dimension mismatch. Error in == read_surf at 41 faces(i,n) = fread3(fid) ; I'm using Freesurfer 3.0.5 Thanks, Pedro Paulo Oliveira Jr. P.S. - I know that this issue has been previously discussed here but I have patients with a cortex thickness larger than 5mm and the truncation makes the statistical calculation fault in some aspects of my work. It would be possible to have a raw thickness calculation? Tks again PPJ ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
[Freesurfer] read_surf
Hi Doug, I'm using the matlab routine 'read_surf' from the 3.0.3 distribution to read a surface generated by mri_tessellate. The magic number for the surface is: 16777213, which does not match either the QUAD or the TRI magic numbers listed in read_surf and hence does not read it. Is there an updated version of read_surf available? Thanks, Satra ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
Re: [Freesurfer] read_surf
Hi Satra, I think the magic # should still be 16777215. Did your surface get corrupted somehow? Bruce On Thu, 13 Jul 2006, Satrajit Ghosh wrote: Hi Doug, I'm using the matlab routine 'read_surf' from the 3.0.3 distribution to read a surface generated by mri_tessellate. The magic number for the surface is: 16777213, which does not match either the QUAD or the TRI magic numbers listed in read_surf and hence does not read it. Is there an updated version of read_surf available? Thanks, Satra ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
RE: [Freesurfer] read_surf
Hi Bruce, tksurfer can read the surface but matlab cannot. I'm therefore not sure if it is corrupted. I'm running on a 64 bit opteron, if that makes a difference. Satra -Original Message- From: Bruce Fischl [mailto:[EMAIL PROTECTED] Sent: Thursday, July 13, 2006 1:56 PM To: Satrajit Ghosh Cc: freesurfer@nmr.mgh.harvard.edu Subject: Re: [Freesurfer] read_surf Hi Satra, I think the magic # should still be 16777215. Did your surface get corrupted somehow? Bruce On Thu, 13 Jul 2006, Satrajit Ghosh wrote: Hi Doug, I'm using the matlab routine 'read_surf' from the 3.0.3 distribution to read a surface generated by mri_tessellate. The magic number for the surface is: 16777213, which does not match either the QUAD or the TRI magic numbers listed in read_surf and hence does not read it. Is there an updated version of read_surf available? Thanks, Satra ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer