Dear Andrei,

Do you need any specific feature from VRML? If not, and you simply need to import the mesh into Blender, you can do this:

1) Convert the mesh to ASCII format:
/mris_convert somesurface somesurface.asc/

2) Save the attached script somewhere, make it executable with chmod, then use it to convert to Wavefront format, like this:
/./srf2obj somesurface.asc > somesurface.obj/

The script uses gawk (GNU awk), so make sure you have it on it's usual location, /usr/bin/gawk on most Linuxes. If different, e.g. on Mac with MacPorts or Fink, you may edit the first line to point the script to the correct location. Not sure if it will work with other awk implementations. Also, note that the output goes to stdout, so you really need the ">", as in the example above.

Hope this helps!

All the best,

Anderson


On 08/10/2011 11:13 PM, andrei sherstyuk wrote:
Greetings, I have problems exporting the surface data in VRML format. When I load the resulting .wrl file into Blender (a 3D modeling tool), the resulting surface is full of holes (bad/missing polygons) and connectivity of vertices is all wrong -- I see edges where they are not supposed to be. Is is a common problem with VRML export? I used "write_vrml 1" command, tksurfer version 5.

Any help will be greatly appreciated.

Cheers,

Andrei


_______________________________________________
Freesurfer mailing list
[email protected]
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.

#!/usr/bin/gawk -f

BEGIN { if (ARGV[1] == "") { 
print "Convert Surface ASCII format to OBJ."
print ""
print "Usage:"
print "srf2obj <input.srf>  >  <output.obj>"
print ""
print "The output goes to stdout. Use > to redirect to"
print "a file, as shown above"
print ""
print "_____________________________________"
print "Anderson M. Winkler"
print "Yale University / Institute of Living"
print "Jan/2010"
exit } }

# Count number of vertices and faces from the 2nd record
NR == 2 { nV=$1 ; nF=$2 }

# Print vertex coordinates
NR>=3 && NR<=nV+2 { print "v", $1, $2, $3}

# Print faces' vertex indices
NR>=nV+3 && NR<=nV+nF+2 { print "f", $1+1, $2+1, $3+1 }
_______________________________________________
Freesurfer mailing list
[email protected]
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.

Reply via email to