------------------------------------------------
 The SessionsTools -> Combine 3D Raw Images
 menu averages/concatenates raw funct data
------------------------------------------------
The basic layout of this panel (scan directories
to the left, common action button at the top,
pages of parameters to the right) is similar to
the other SessionTools panels.  For more details,
see Help -> Setup Align/Funct.

This panel creates a new scan directory that
will contain averaged scans.

Configuration Buttons--Make Avg Dir, Unset Dir

First carefully choose a name for the average
directory in the entry to the right of the Make
Avg Dir button.  Clicking Make Avg Dir creates
that directory.  If the directory already exists,
it will be re-used rather than re-created.

To ignore an existing raw avg/concat directory,
use Unset Dir.  The files the unset directory
will not be altered and any saved parameters will
re-appear if you Make Avg Dir with that directory
name again.

Operation

Selected scans can either be averaged, time point
by time point, or concatenated.

Choosing Scans to Combine

A list of currently available functional scans
can be found in the "Select to Add" dropdown
combobox.  Selecting one of them will add it to
the "Dirs to Average" list.  To delete (or
re-order) directories from that list, select it
in the list and use the Delete or Backspace key.

Action Button--COMBINE

This button performs averages or concatenates the
3D time series data sets and writes the result
into the current raw average directory as a set
of bshort files (each bshort file has all the
time points for one slice) for averaging, and
AFNI briks for concatenation.  The registration
matrix from the first scan is copied into the raw
avg/concat directory and by convention, the first
scan in the average is used to name the output
files:

 infiles (several x-y-z-t images):

   scandir1/scanname1[-vreg]+orig.BRIK
   scandir2/scanname2[-vreg]+orig.BRIK

 outfiles (one x-y-z-t image):

   avgdir/scanname1[-vreg]+orig_000.bshort
   avgdir/scanname1[-vreg]+orig_000.hdr
   avgdir/scanname1[-vreg]+orig_001.bshort
   avgdir/scanname1[-vreg]+orig_001.hdr
   [etc]
            (or if concat)

   avgdir/scanname1[-vreg]+orig.BRIK

If the scans have been volume-registered, those
will automatically be used.  Otherwise, the
original raw scans are used.  The averaging is
done in 3D without any additional registration.
Note that register.dat files are ignored.

Other Files Generated by "Concatenate"

If the COMBINE operation is concatenate, an AFNI
boundary file, runs.1D, is automatically created
(units are TRs).  If the time series is analyzed
using deconvolution, this file is consulted to
prevent stimulus events at the end of one run
from accounting for variance at the beginning
of the next run.

If motion correction has been run on the
individual scans, a concatenated motion.1D file
will also automatically be generated.

Finally, if paradigm files are present in a
paradigm subdirectories (default: stim1Ds/)
of each scan to be
concatenated, the paradigm files for each
condition will be separately concatentated and placed in a paradigm
directory in the new concatenated scandir.
For the automatic concatenation of paradigm 1D
files to work correctly, the paradigm files in
the stim1Ds subdir in each of the scan dirs to
be concantentated *must* be named as follows:

  scan1
    face1.1D
    house1.1D
  scan2
    face2.1D
    house2.1D
  ...

That is, the condition name stem (up to the
number before the .1D suffix) much be exactly
the same across all scans to be concatentated.
The stem must be immediately followed by a single
numeral before the .1D suffix.

The list of conditions (1D files) to concatenate
is taken from the first directory in the list.
That is, each successive scan should have
the same set of conditions in it.  It's OK if
numerals are the same across scans (e.g., same
randomization in those scans).  The concatenated
paradigm file will be given a name that has the
numeral position replaced by a 'C'.

Touch up

If you averaged the data, at this point you
may want to go back to SessionTools -> Setup
Align/Funct Scans to touch up the FUNCT=>SUBJ
registration for the averaged scan.

