TODO: clonefunct button next to AFNI
  add a "Directory suffix: " entry line w/"CLONEFUNCT" button
  check already exists, and is plain funct (not combine dir)
  just link BRIK/HEAD and register.dat and define as functdir
  have to re-setup, redo all other analyses (e.g., fourier, combine)
  e.g., might want to use to compare fourier w/slice order vs. not


##########################################################################
--changed csurf to allow non-zero paint min (and min operation)

##########################################################################
# csurf READ_HEADER needs to check/warn non-short BRICK_TYPES parm
--each time point has a BRICK_TYPES (0=byte 1=short 2=int 3=float) 

##########################################################################
checkiniput: rm skip etc
signed amplitude
  change from complex f to _sa
  load into dropdown instead of sigf
  use trunc limits (always do? default trunc limits pol only?)
oldfourier flag for fourier panel (default new except if config)
  added variable
  still need default except already config'd
3Dphaseavg panel -- flag use spect: backup to rerun/savespect/avg/*del*spect
surfavg panel -- same as above (rcxcombine or rcxcombts)
cross subject spherical panel(s)
  AFNI
  complex  vect avg, full spect, signed amplitude, trunc



  
##########################################################################
-polort != 2 fails redo
##########################################################################
fonts not found in default fedora/enterprise

  set mfont   -*-helvetica-medium-r-normal-*-14-*-*-*-*-*-*-*
  set ffontbb -*-helvetica-bold-*-*-*-15-*-*-*-*-*-*-*

##########################################################################
From dhagler@cogsci.ucsd.edu  Thu Jun 10 20:28:30 2004

Hi Marty,

Hopefully the paper reads fine and we will be ready to send it off soon.

Anyway, when you get a chance, there are some minor changes to csurf that 
I made while you were gone.  You can see what changes they are by 
xdiff'ing /myrtos/usr1/tmp/dhagler/bin-all/csurf-new and csurf-new.0

Some are bug fixes, but some are things that I would like to change.  Here 
is a list:

1.  line 4108 of csurf-new: tshift during vreg ...  I added it in, but 
maybe this could be an option controlled by the user interface?

2.  line 5045: -1noneg should not be used for fout ...  I usually output 
signed coefficients and the -1noneg removes the negative values.  You 
might want to make this an option that is independent of deconvtype.

3.  line 5056: instatstem" ... but I see you already fixed that

4.  line 5063: -b $valuefile-tmpclustmask+orig ... you left out the orig, 
which made extraction fail

5.  line 5517: bigstem for surface phase average ... this causes problems 
when the filename gets too long.  I changed it so the stem is the 
scandir name

6.  line 11211: justpaintflag and calcrandbu ... there is no paint button 
on the calcrand page.  testing for $justpaintflag and calling $paintbu 
made the batch process fail

Here is another suggestion that I haven't done anything about:

7.  In the 3dDeconvolve interface, you could add a button for doing not 
just subtractions but conjunctions as well.  to do this you would create a 
matrix file with two lines.  The first line would have all zeros except 
for the coefficients for the first condition and the second line would 
have all zeros except for the coefficients for the second condition.
something like this:
0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0

Another possible change is to add a different type of contrast where 
instead of comparing the area under the curve, you test for whether 
there is a difference at any single time point during the hemodynamic 
response function.  This is also a multi-line matrix, with one line for 
each lag.  It looks something like this:

0 0 0 0 0 0 1 0 0 0 -1  0  0  0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0  0 -1  0  0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 0  0  0 -1  0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 1  0  0  0 -1 0 0 0 0 0 0

I think this may make it a bit easier to find a difference between two 
conditions.  It would be nice to have the option.

Don
##########################################################################
From dhagler@cogsci.ucsd.edu  Mon Jun 14 23:48:59 2004

Hi Marty,

Is there a way you could make the stim1Ds directory name optionally 
relative?  Like "*/stim1Ds" or something.  I've been copying analyzed scan 
sessions to my home computer and I have to manually change the directory 
names.  No big deal, but it seems like something that would be easy to 
fix (when you have nothing better to do).

Don

##########################################################################
  3) area under curve
TODO:
  1) allow fixed/prior (waver) hemodynamic 
  2) iresp to get complete time course condition+t briks


##########################################################################
DONE
after you debug the 3ddeconvolve interface, if you feel energetic, maybe we
can also fix the clustering before painting panel :-)

here is a way we found to do the clustering in afni. it (unfortunately)
requires two steps as i was telling you about:

first you need to make a mask file using 3dmerge.

to make mask:

3dmerge -1noneg -1thresh 15.3 -dxyz=1 -1clust_order 0 150 -1dindex
14 -1tindex 15 -prefix maskfile inputfile+orig

below are variables, i used example values above:
15.3 = f threshold
0 = nearest neighbor
150 = min clust size
14 = coefs brik
15 = stats brik

maskfile will have the clusters and the values will be the cluster order
(1=biggest cluster in brik, 2=second biggest etc..).

then, apply mask to original brik to mask out non-cluster voxels but retain
original values:

3dcalc -a inputfile -b maskfile -prefix clustfile -expr "a * step(b)"

if you leave out the -1noneg in the 3dmerge command, then it will keep the
negative clusters too. (may be desirable for painting t-stats)

the 3dcalc command will operate on all subbriks, so the output from 3dcalc
probably contains enough information to feed into freesurfer.

i can try to clarify anything which doesn't make sense.

##########################################################################
IN PROG:

#  set stmlist "\
#    -num_stimts 11 \
#    -stim_file 1 stim1Ds/face.1D -stim_label 1 \"face\" -stim_maxlag 1 4 \
#    -stim_file 2 stim1Ds/font.1D -stim_label 2 \"font\" -stim_maxlag 2 4 \
#    -stim_file 3 stim1Ds/char.1D -stim_label 3 \"char\" -stim_maxlag 3 4 \
#    -stim_file 4 stim1Ds/obj.1D -stim_label 4 \"obj\" -stim_maxlag 4 4 \
#    -stim_file 5 stim1Ds/dig.1D -stim_label 5 \"dig\" -stim_maxlag 5 4 \
#    -stim_file 6 motion.1D\[1\] -stim_label 6 \"Roll\" \
#    -stim_file 7 motion.1D\[2\] -stim_label 7 \"Pitch\" \
#    -stim_file 8 motion.1D\[3\] -stim_label 8 \"Yaw\" \
#    -stim_file 9 motion.1D\[4\] -stim_label 9 \"dS\" \
#    -stim_file 10 motion.1D\[5\] -stim_label 10 \"dL\" \
#    -stim_file 11 motion.1D\[6\] -stim_label 11 \"dP\" \
#    "
#  set gltlist "\
#    -num_glt 9 \
#    -glt 1 mats/face.mat -glt_label 1 \"face\" \
#    -glt 1 mats/font.mat -glt_label 2 \"font\" \
#    -glt 1 mats/char.mat -glt_label 3 \"char\" \
#    -glt 1 mats/obj.mat -glt_label 4 \"obj\" \
#    -glt 1 mats/dig.mat -glt_label 5 \"dig\" \
#    -glt 1 mats/faceVSobj.mat -glt_label 6 \"faceVSobj\" \
#    -glt 1 mats/fontVSobj.mat -glt_label 7 \"fontVSobj\" \
#    -glt 1 mats/fontVSchar.mat -glt_label 8 \"fontVSchar\" \
#    -glt 1 mats/charVSdig.mat -glt_label 9 \"charVSdig\" \
#    "

/kamares/usr/local/FreeSurfer0.8/local/bin/Linux/3dDeconvolve  -input rawavg+orig  -concat runs.1D  -nlast 383  -polort 2   -num_stimts 11  -stim_file 1 stim1Ds/face.1D -stim_label 1 "face" -stim_maxlag 1 4  -stim_file 2 stim1Ds/font.1D -stim_label 2 "font" -stim_maxlag 2 4  -stim_file 3 stim1Ds/char.1D -stim_label 3 "char" -stim_maxlag 3 4  -stim_file 4 stim1Ds/obj.1D -stim_label 4 "obj" -stim_maxlag 4 4  -stim_file 5 stim1Ds/dig.1D -stim_label 5 "dig" -stim_maxlag 5 4  -stim_file 6 motion.1D[1] -stim_label 6 "Roll"  -stim_file 7 motion.1D[2] -stim_label 7 "Pitch"  -stim_file 8 motion.1D[3] -stim_label 8 "Yaw"  -stim_file 9 motion.1D[4] -stim_label 9 "dS"  -stim_file 10 motion.1D[5] -stim_label 10 "dL"  -stim_file 11 motion.1D[6] -stim_label 11 "dP"     -num_glt 9  -glt 1 mats/face.mat -glt_label 1 "face"  -glt 1 mats/font.mat -glt_label 2 "font"  -glt 1 mats/char.mat -glt_label 3 "char"  -glt 1 mats/obj.mat -glt_label 4 "obj"  -glt 1 mats/dig.mat -glt_label 5 "dig"  -glt 1 mats/faceVSobj.mat -glt_label 6 "faceVSobj"  -glt 1 mats/fontVSobj.mat -glt_label 7 "fontVSobj"  -glt 1 mats/fontVSchar.mat -glt_label 8 "fontVSchar"  -glt 1 mats/charVSdig.mat -glt_label 9 "charVSdig"    -nocout -fout -bucket rawavg-stats

#set testflag = 0
#set deconnum = 1
#foreach dir ($decondirlist)
#  echo "starting decon for $dir ..."
#  cd $destdir/$dir
#  if ($testflag) then
#    set DeconCmd = (3dDeconvolve -nodata)
#  else
#    set DeconCmd = (3dDeconvolve -input $deconnamelist[$deconnum])
#  endif
#  if ($numruns > 1) then
#    set DeconCmd = ($DeconCmd -concat runs.1D)
#  endif
#  @ lastTR = $totalTRs - 1
#  @ numstims = $nummodes + $nummotion
#  set DeconCmd = ($DeconCmd -nlast $lastTR -polort 2 -num_stimts $numstims)
#  set stimnum = 1
#  foreach modename ($modenamelist)
#    set stimfile = $modenamelist[$stimnum]'.1D'
#    set DeconCmd = ($DeconCmd -stim_file  $stimnum $paradigmdir/$stimfile)
#    set DeconCmd = ($DeconCmd -stim_label $stimnum \"$modename\")
#    set DeconCmd = ($DeconCmd -stim_maxlag $stimnum $maxlag)
#    @ stimnum++
#  end
#  set DeconCmd = ($DeconCmd -num_glt $numglts)
#  set gltnum = 1
#  foreach matname ($matnamelist)
#    set DeconCmd = ($DeconCmd -glt 1 mats/$matname'.mat')
#    set DeconCmd = ($DeconCmd -glt_label $gltnum \"$matname\")
#    @ gltnum++
#  end
#  echo $DeconCmd' \\' > temp
#  set motionreg = 1
#  foreach motion ($motionlabels)
#    set temp = ($motionname\[$motionreg\])
#    set DeconCmd = (-stim_file $stimnum "$temp")
#    set DeconCmd = ("$DeconCmd" -stim_label $stimnum \"$motion\")
#    @ motionreg++
#    @ stimnum++
#    echo "$DeconCmd"' \\' >> temp
#  end
#  if ($testflag) then
#    echo "" >> temp
#    chmod +x temp
#    ./temp
#  else
#    echo -nocout -fout -bucket $outnamelist[$deconnum]-stats >> temp
#    chmod +x temp
#    ./temp >& decon.out &
#  endif
#  @ deconnum++
#end

