------------------------------------------------
 Csurf -- cortical surface program manager
------------------------------------------------
The data base consists of two main directories:

(1) the subjects tree (e.g., /usr/subjects)

  Permanent home of structural MRI data, filtered
  MRI data, and folded, unfolded, and flattened
  surfaces for subjects.  The startup value of
  this must be set with:

    setenv SUBJECTS_DIR <whatever>

  The directory (database) name for each subject
  is typically a first name plus last initial
  (e.g., martys).  The root of the subjects tree
  can be interactively changed with csurf.

(2) functional sessions tree (e.g., /usr/fspace)

  Directory containing individual functional
  sessions.  The startup value of this must be
  set with:

    setenv FUNCTIONALS_DIR <whatever>

  A session is defined as a set of scans taken
  with one subject, in one position, in one RF
  coil.  Individual sessions can be saved
  anywhere.  The name for a session is a date,
  then initials.  The date is in year/month/day
  order so 'ls' will sort a bunch of them
  chronologically (e.g., 000624MS).  The root of
  the sessions tree can be interactively changed
  with csurf.

Each functional session directory (e.g.,
000624MS) is associated with a single subject
directory (e.g., martys).  However, several
different sessions may point to the same
subject.

Csurf generally runs programs from the "scripts"
subdirectory inside the currently selected
session or subject.  A flat file of current
configurations--csurf.dat--is stored there.  It
is read by csurf on entering that session or
subject, and written when you press SAVE or
SAVE/CLOSE on one of the csurf configuration
panels, or when you actually perform an action.
If you remove or move aside the csurf.dat file,
the current configuration of a session or subject
directory will be forgotten, but no data files
will be affected.

The "scripts" directory is also the directory in
which ASCII notes are conventially made.  There
are menu items under File to automatically open
the current subject or session's NOTES file in a
text editor to encourage this practice.

There are two main sets of menu items,
SubjectTools and SessionTools for manipulating
the two main directory trees.  The menu items
within each one are arranged in the order in
which they are normally run.

The general procedure is to first reconstruct a
surface.  Once a surface has been reconstructed,
individual functional sessions can be associated
with it, and statistics can be calculated in 3D
or on the surface, and then rendered.

Log View

As csurf runs command line programs in the
background, it pipes their outputs into a log.
These outputs can be viewed at any time with
Preferences -> View Logs (Alt-l).  There are
three logs--one for medit, one for surfer, and
one for command line programs.  When you quit
csurf, the entire contents of the log is saved
into a file in the current scriptsdir: csurf.log

User Setup

Individual users need at minimum, 4 lines that
look something like this in their .cshrc files:

 setenv CSURF_DIR        /usr/local/FreeSurfer0.8
 setenv SUBJECTS_DIR     ~/subjects
 setenv FUNCTIONALS_DIR  ~/fspace
 source $CSURF_DIR/FreeSurferDefs.csh

Other useful aliases:

 # cd to subj/session scripts dir w/just name
 alias cds 'cd $SUBJECTS_DIR/\!*/scripts; ls'
 alias cdf 'cd $FUNCTIONALS_DIR/\!*/*/scripts; ls'
 alias surfdoc \
  'acroread $CSURF_DIR/docs/FreeSurferManual.pdf'

Per-Vertex File Formats

  The format of some of the per-vertex files has
  changed in more recent distributions of
  FreeSurfer.  There is a new curvature file
  format (*.curv, *.sulc), the area file format
  (*.area) was discontinued (new area files have
  the same format as new curvature).  The value
  file format (e.g., paint output files, *.w) is
  unchanged.  The curvature and area files list
  data for every vertex and contain no vertex
  numbers.  The value files contain a list of
  vertex/value pairs so a subset of vertices may
  be specified.  The byte sizes for the different
  file types are:

  file type             olddist     newdist
  --------------------------------------------
  curv (*.curv,*.sulc)  33{2},..    344{4},..
  area (*.area)         33{4},..    344{4},..
  val (*.w)             23{34},..   23{34},.. 
  --------------------------------------------

Details of file formats (byte sizes in brackets):

  oldcurv
    header:  vertexcnt[3],facecnt[3]
    data:    floatcurv*100[2], ...
  newcurv
    header:  -1[3],vcnt[4],fcnt[4],valspervtx[4]
    data:    floatcurv[4], ...
  oldarea
    header:  vertexcnt[3],facecnt[3]
    data:    floatarea[4], ...
  newarea
    [same as newcurv]
  valfile
    header:  latency[2],vertexcnt[3]
    data:    {vtxnum[3],floatval[4]}, ...
