-------------------------------------------
 The Tools -> Create Surface menu item starts a
 six-part background process to create the left
 and right hemisphere cortical surfaces
-------------------------------------------
[old Linux-only FreeSurfer0.8]

(1) Fill White Matter

Start a 3-D region growing process from a
starting point within the white matter in order
to generate the starting point for a surface.
The output files written by this procedure are:

 images: $SUBJECTS_DIR/$name/mri/filled/COR-???

(2) Tessellate White Matter

Connect the surfaces of the filled white matter
voxels into a continuous surface.  The output
files written by this procedure are:

 surface: $SUBJECTS_DIR/$name/surf/rh.orig
 surface: $SUBJECTS_DIR/$name/surf/lh.orig

(3) Smooth Right Hemisphere White Matter
(4) Smooth Left Hemisphere White Matter

The reconstructed white matter surface of the
right and left hemispheres is smoothed.  The
output files written by this procedure are:

 surface: $SUBJECTS_DIR/$name/surf/rh.smoothwm
 surface: $SUBJECTS_DIR/$name/surf/lh.smoothwm

(5) Inflate Right Hemisphere
(6) Inflate Left Hemisphere

Inflate the right and left hemisphere surfaces
while attempting to preserve local angles and
area.  The output files written by this procedure
are:

 surface: $SUBJECTS_DIR/$name/surf/rh.inflated
 surface: $SUBJECTS_DIR/$name/surf/lh.inflated

================================================
Binary format (non-topo-corrected, short, quads)
================================================
Binary file format:
    [header]
  3bytes: 16777215
  3bytes: number of vertices
  3bytes: number of faces
    [vertex list--implicit vertex numbering]
  2bytes: x[vertex0]*100
  2bytes: y[vertex0]*100
  2bytes: z[vertex0]*100
  ...
    [face list--vertex numbers of corners]
  3bytes: face1: vertex number 1st corner
  3bytes: face1: vertex number 2nd corner
  3bytes: face1: vertex number 3rd corner
  3bytes: face1: vertex number 4th corner
  ...

[see Help -> csurf for all/new surf formats]

================================================
Obtaining ASCII representation of a surface
================================================
writing out ASCII representation
of any surface in FreeSurfer (e.g., rh.orig,
lh.smoothwm, etc).

1) COR coordinate system (lower box in tkmedit)

  0-255  Right -> Left
  0-255  Post -> Ant
  0-255  Inf -> Sup

2) Talairach (higher box with decimal point)

  [standard]

3) Surface coordinate system.  Surface coords
    are written to the log (3 numbers, x,y,z,
    after the "x =" ...)--or to tcl prompt if
    you run tksurfer from the command line--when
    you click a surface point (the surface
    normals are also written out "n=").

  0,0,0 in center of 256x256x256 volume
  x    positive -> Right
  y    positive -> Ant
  z    positive -> Sup


To write out ASCII file of x,y,z of points on any
surface (including topology-corrected):

tksurfer -marty rh smoothwm
% set vrmlsurf /tmp/zz.wrl
% write_vrml 0         ;# 0=points

This will write out a long list of of 3-D
coordinates of each vertex in the surface.

To write out ASCII file that also specifies the
vertices that are the corners of each face:

tksurfer -marty rh smoothwm
% set vrmlsurf /tmp/zz.wrl
% write_vrml 1

This will write out 2 concatenated lists.  The
first are the vertex x,y,z coordinates as
before.  This is followed by a list of vertex
number quadruples.  These numbers are the
implicit vertex numbers (followed by a -1).
write_vrml 1 *doesn't* work with topology
corrected surface currently.

To write out vrml 2.0 format files (the current
version read by plugin like Cortona from
parallelgraphics for windows), do the following
before write_vrml:

% set vrml2flag 1   ;# default is 0 => vers1.0

This only currently works for points.

Examples:

-----------------
VRML 1.0 points:
-----------------
#VRML V1.0 ascii
Coordinate3 {
        point [
12.72 -94.53 -32.12,
12.39 -94.58 -32.13,
11.64 -94.64 -32.22,
11.02 -94.43 -32.13,
...
19.78 -24.83 -29.55,
19.68 -25.31 -29.20,
20.87 -26.00 -28.69
        ]
}

----------------------------------
VRML 1.0 surface (quad surf only):
----------------------------------
#VRML V1.0 ascii
Coordinate3 {
        point [
8.23 -97.32 -19.20,
7.70 -97.32 -19.19,
7.24 -97.26 -19.22,
...
15.33 62.33 2.21,
14.67 62.38 2.09,
14.19 62.37 2.08
        ]
}
IndexedFaceSet {
        coordIndex [
0, 1, 6, 5, -1,
0, 21, 22, 1, -1,
0, 5, 29, 21, -1,
...
129668, 129672, 129673, 129669, -1,
129669, 129673, 129674, 129670, -1,
129670, 129674, 129675, 129671
        ]
}

-----------------
VRML 2.0 points:
-----------------
#VRML V2.0 utf8
Collision { collide FALSE
children [ Group { children [ Shape {
appearance Appearance {
  material DEF _DefMat Material {
    emissiveColor 1 1 1 } }
geometry PointSet { coord Coordinate {
        point [
8.23 -97.32 -19.20,
7.70 -97.32 -19.19,
7.24 -97.26 -19.22,
...
15.33 62.33 2.21,
14.67 62.38 2.09,
14.19 62.37 2.08
        ]
} } } ] } ] }


-----------------
VRML 2.0 surface
-----------------
 => not currently working

