-------------------------------------------
functs (left-click): mirror-image surface
  really_flip_brain_x
  compute_normals_areas
  redraw
-------------------------------------------

The "FlipHemi" button at the upper far right of
the larger F3 interface mirror-images the
currently displayed surface by taking the
negative of the x-coordinate.

N.B.: this will misalign the surface with any 3D
image data that it was derived from.

N.B.: there is no permanent effect until the
surface is saved (see below).

This operation is occasionally needed for surface
coordinates read in from other software packages
that navtively use a left-handed coordinate
system.

For reference, FreeSurfer (and Talairach) use a
right-handed (RAS) coordinate system:

  +x -> R (right)
  +y -> A (anterior)
  +z -> S (superior)

There are a large number of possible Cartesian
coordinate systems for 3D space (48 possible),
half of which are are right-handed like RAS and
Talairach.  For a left-handed coordinate system
like the PIL system used in Brain Voyager (all
positive):

  +x -> P (posterior)
  +y -> I (inferior)
  +z -> L (left)

if the native x,y,z surface vertex coordinates
are read verbatim into the right-handed
FreeSurfer display system, a right hemisphere
will appear as a left hemisphere, and vice versa.

Reversing (taking the negative of) the
coordinates of any single axis will cause the
surface to be mirror-imaged (the original surface
data file is untouched).  The "FlipHemi" button
on the larger F3 interface does this operation on
the x-coordinate.

The C/tcl functions used by "FlipHemi" are:

  really_flip_brain_x
  compute_normals_areas
  redraw

After the x-coordinate has been flipped, the
order of the corner vertices in the entry for
each face is flipped so that lighting
calculations work correctly.  The y- and
z-coordinates can be flipped with
really_flip_brain_y and really_flip_brain_z.

The resulting flipped surface can be saved to a
native freesurfer surface by entering a name in
the upper-left "outsurf:" entry in the F3
interface and clicking "W".  To perform the same
action with a tcl script, do something like:

  setfile outsurf ~/surf/lh.my_flipped_RH
  write_binary_surface

