-------------------------------------------
var,funct: write OFF (object file format) surface (ASCII)
  set outsurf <surface>
  write_off_surface
-------------------------------------------

Large Panel Only: [fn-]F3

The "OFF" button on the "outsurf:" line on the
large fn-F3 panel writes out current surface as a
OFF (object file format) ASCII file whose name is
current value of $outsurf (entry at left) after
auto-appending ".off" if it isn't already there.

The button checks overwrite but the equivalent
tclfunct, write_off_surface, doesn't.

Here is an example of how to import and display
an *.off file in Mathematica (tested on vers=9):

  Show[Import["/tmp/lh.inflated.off"], ViewPoint -> Left]

The colored surface can them be manipulated in 3D
within Mathematica.

The vertex coordinates are not transformed in any
way -- they are written in the native freesurfer
coordinate system (which may not display as a
lateral view of a hemisphere in an .off file
viewer).  The units are millimeters.

Currently, only writes a triangle file.  The
format of the file is:

  --line 1: OFF (or COFF)
  --line 2: # comment line ...
  --line 3: <vertex-count> <face-count> <edge-count>
  --line 4: <x> <y> <z>
  --line 5: <x> <y> <z>
  ...
  ... [to vertex-count lines]
  --line n+1: 3 <n1> <n2> <n3>    => 1st face vtx nums
  --line n+2: 3 <n1> <n2> <n3>    => 2nd face vtx nums
  ...
  ... [to face-count lines]

Colored surfaces

If this button is middle-clicked instead of
default left-clicked, the vertex colors of the 3
corners of each face are averaged and appended to
each face line (RGBA in 0.0-1.0 units).

If this button is shift-middle-clicked instead of
default left-clicked, vertex colors are instead
appended to each vertex line, and the first line
of the file is changed to COFF from OFF.

Currently, any displayed transparent labels are
ignored when saving face/vertex colors.

Example output

For example, an .off file with vertex colors
looks like this (indented below, but natively
left justified):

  COFF
  # created by sereno (subj=john,vtxs=148993,faces=...
  148993 297982 446973
  -19.720390 -17.439209 -56.901649 0.108 0.832 0.108 1
  -19.841877 -17.408539 -57.191742 0.108 0.832 0.108 1
  ...
  ...
  -39.697487 97.215988 -12.510045 0.390 0.390 0.390 1
  -39.618374 98.124832 -12.841537 0.390 0.390 0.390 1
  3 0 1 8
  3 9 8 1
  ...
  ...
  3 133758 133078 133757
  3 134353 134916 134907

