###################################################################
UPDATE: 08 Feb 2019
###################################################################


----------------------------------------------
Illuminate inside of a surface
----------------------------------------------

The inside of a surface (backside of a flat
patch), which is rarely visible, is not normally
lit.  To illuminate the inside of a surface, use
ctrl-middle-click-REDRAW.  This is now
automatically done when using PLANE to cut a
surface, and it useful in other rare circumstances
(e.g., better view of a cut, folded cerebellar
surface :-} ).

----------------------------------------------
Display MGH 3D segmentation colors in tkmedit
----------------------------------------------

The standard 6-column MGH FreeSurfer color lookup
table (idnum, name, r, g, b, a) is now used in
tkmedit to display MGH 3D segmentation labels
(either byte or int) in their proper colors:

  $CSURF_DIR/lib/lut/FreeSurferColorLUT.txt

The color table is read, sorted, and loaded by new
C/tcl function, read_sort_mghval2rgblut.  The
existing csurf function, read_val2rgblut, which
reads 4-column csurf color tables designed for
color interpolation of overlay stats (value, r, g,
b), defaults to the new function if it detects the
standard name above.

This all occurs automatically when an MGH
segmentation file (e.g., aseg+aparc.mgz) is
selected in the "im2:" entry dropdown and read
using the adjoining "R".  Once read, a
double-middle-click on the image window displays
the name, idnum, and rgb of a labeled region.

The "la" tickbox toggles the visibility of the
label overlay.

The "tran:" entry on the large F4 tkmedit
interface ([fn]-F4 in the tkmedit buttons window)
controls the label transparency (default is 127,
which is 50%).

----------------------------------------------
Dump timecourses using MGH 3D segmentation in tkmedit
----------------------------------------------

A new tkmedit C/tcl function:

  write_segid_timecourses <idnum>

dumps rawdata timecourses for an MGH FreeSurfer
segmentation region (idum).  After opening a
rawdata-containing scan using VOLUME-STATS, read a
segmentation file, enter the idnum of a region in
the "roiup:" entry, and middle-click the "T"
button.

This generates an ASCII file, for example,

  segid-12120.raw

containing the time courses of any rawdata voxels
in that region.  This file also includes the
number of 'hits' for each voxel (since the rawdata
voxels are typically larger than 1x1x1mm
segmentation voxels).

----------------------------------------------
Dump all MGH 3D segmentations to BRIK
----------------------------------------------

A new tkmedit C/tcl function:

  write_allsegids

creates an AFNI BRIK containing the int idnums
from every 3D region in the currently loaded MGH
FreeSurfer segmentation.  This BRIK has the
resolution of the underlay (typically 1x1x1mm).

----------------------------------------------
Temp fix for tksurfer going black after first click
----------------------------------------------

On a default CentOS 7 install, with onboard
unaccelerated graphics libs, tksurfer goes black
after the first click on the surface, afterwards
only showing the selected vertices.  As a tmp fix,
in this case, csurf starts up tksurfer (on 3.0+
kernel Linux) in singlebuffer mode, which will
still look doublebuffered :-}

For tksurfer started from the command line, fix
this problem by turning off doublebuffering with
an option (argument is a "zero") as follows:

  tksurfer <name> <hemi> <surfext> -doublebufferflag 0 [-opts ...]

Better fix in progress!  If the 'intelligence' in
csurf (e.g., OK to use doublebuffer if nvidia
driver found to be in use) makes the wrong choice
(e.g., still black screen, or alternatively, you
see the redraws when you move the brain), you can
force csurf to use single- or double-buffered
startup of tksurfer with:

  csurf -sb
  csurf -db

----------------------------------------------
Linux fonts fixed
----------------------------------------------

The unpleasant looking (to me!) default Linux
fonts in csurf, tksurfer, tkmedit, and tkregister
are now finally fixed (made the same as on Mac).
The nicer looking fonts are slightly larger and
easier to read than before.

In the unlikely event you like the way they
looked before, to go back, find the following
line in your FreeSurferEnv startup script:

  FreeSurferEnv.sh   =>  #skipfontsflag=1
  FreeSurferEnv.csh  =>  #set skipfontsflag = 1

and comment it in (rm the '#').

----------------------------------------------
Display color phase contour over dark overall activation
----------------------------------------------

The original phasemovie.tcl shows a moving phase
contour in white over the colored phase map.  The
phasemovie.tcl script popup can now invert this.
Ticking colphasecontourflag on the popup (which
sets $colphasecontourflag to 1) causes the phase
stripe to be colored (with its usual phase color)
while the remainder of the activation that is not
at the (adjustable) phase range of the stripe is
given the same color controlled by the variable
$phasecontour_bright.  This is like movie in Chen,
Kreutz-Delgado, Sereno, Huang (2018).

To make the moving colored phase stripe clearly
visible, use a dark color for the overall
activation (phasecontour_bright = 20; this is
autoset when colphasecontourflag ticked).

-----------------------------------------------
Bug fixes, small changes
----------------------------------------------

fix Mac AFNI startup crash by using /opt/X11/lib/flat_namespace

add tksurfer -justheaderflag (after mris_info OS crash on read cereb)

tksurfer/tkmedit upper-left "i" buttons to control interface size

Patch tk raise command for Linux (raise tools win w/double-clk surf win)
  CentOS 5 -> was fail
  CentOS 6 -> was fail
  CentOS 7 -> was fail w/giant, empty, upper-right popup

fixed FRED_TONO wraparound bug

many small helpfile updates

all standard tcl scripts now have R-click help from popup

fix bash navigation aliases (e.g., cds <subj> => cd to subject's scripts)

new function: norm_move_vertices_fracthick <frac>

README.txt note: explain HOWTO shrink stupid-big Gnome window title bars

README.txt note: explain HOWTO stop Gnome auto-maximize

tkmedit/tksurfer 'i' buttons for interface size



##########################################################################
UPDATE: 08 Feb 2019
##########################################################################
--lib/help/tkmedit/roiup_write: update
--tkmedit.tcl: overload "W" button on "roiup:" line with write_allsegids
--tkmedit.c: add write_allsegids
--csurf: fix afni crash new Mac: add DYLD if exists /opt/X11/lib/flat_namespace
--lib/help/tkmedit/roiup_time: update
--tkmedit.tcl: overload "T" on "roiup:" line to run write_segid_timecourses
--tkmedit.c: add write_segid_timecourses <idnum> (first load segmentation)
--csurf: block all abspath paradigmdir's in deconvcmd, rawaveragecmd (concat)
--lib/help/csurf/setuprand: suggest only stim1Ds dir inside each scandir
--FreeSurferEnv.{c}sh: Mac: if exists /opt/X11/lib/flat_namespace add to DYLD_
--tkregister.tcl: fix cmd typo disabling SAGMIRR! (showvisble -> showvisible)
--tkmedit.c: thin gray dividers for all3views
--tksurfer.tcl: "clo" button R-click help
--tkmedit.c: thin gray dividers for all3views
--csurf: add "clo" tickbox help to csurf allhelp panel
--lib/help/tksurfer/selectdmax: new helpfile for tksurfer "clo" (near isocont)
--tksurfer.c: fix accidental regressed (Nov2018) while->if in do_all_glx_events
--mk0{.csh}: add patch to tk compile to fix tk "raise" cmd
--README.txt: explain how to shrink stupid-big Gnome window title bars
--lib/help/tk{medit,surfer}/interface: new R-click help files
--tksurfer.tcl: add "i" button for toggle interface size (skip popup)
--FreeSurfer.sh: (bash-only) fix bug in detect if skipfontsflag override exists
--csurf: CentOS 7 back to doublebuffer if nvidia kernel module there
--tksurfer.c: add -justheaderflag (after mris_info hung computer on cereb surf)
--tksurfer.tcl: mid-click "N" bot left lg F3 pan: norm_move_vertices_fracthick
--tksurfer.c: norm_move_vertices_fracthick
--tkmedit.tcl: small "i" left of SAGITTAL to get interface size toolbar
--wrappers.tcl: new buttonbar proc for no-arg command list (only one allowed)
--lib/help/tkmedit/{clks,im2read,im2entry,seglabel}: update
--tkmedit.c:  read FreeSurferColorLUT.txt region name, dbl-mid-clk reports
--tkmedit.tcl: F4 interface tick to disable double click
--tkmedit.c: export blockdoubleclickflag (mid:reportseg right:winhelp)
--tkmedit.c: do_one_glx_event -> do_all_glx_events (slight speedup)
--tkmedit.c: double-middle-click reports seg idnum (like tksurfer)
--tkmedit.c: genstrret_1k exported variable for single return string
--tkmedit.tcl: auto-back to 1st buff on read MGH seg overlay to show it
--tkmedit.tcl: read 2ndimg use read_sort_mghval2rgblut if FreeSurferColorLUT.txt
--lib/help/tkmedit/seglabel: update
--tkmedit.c: log reports mgh segmentation label number if loaded
--tkmedit.c: read_sort_mghval2rgblut: conv/sort/read FreeSurferColorLut.txt
--tkmedit.c: read_val2rgblut (4col) switches to above (6col) if std FS name
--tkmedit.c: drawslice() uses either byte or int segid (intern:intsegidsflag)
--FreeSurfer.sh: conv long-broken aliases to functs: sdir/fdir/lss/lsf/cds/cdf
--csurf: sort fix{surface,patch} globlist before resort (10.6=OK->CentOS7=rand)
--tkmedit.c: read_second_images now accepts int/float/short
--tkmedit.tcl: add "tran" entry to control overlayalpha on large F4 interface
--tksurfer.tcl: show non-standard patch types in "patch:" dropdown after std
--tksurfer.tcl: "clo" tick to adj selectdmax (def=2mm, deep near vert surf=0.25)
--csurf: "csurf -db" or "csurf -sb" to force start doublebuffer or singlebuffer
--tksurfer.c: export selectdmax to tweak select_vertex (omit selectzwinfact)
--tksurfer.tcl: PLANE button turns on light inside surfaces
--tksurfer.c: set_complex_color correct draw w/vals_cart2polarflag=1 for morph
--lib/help/tksurfer/redraw: update
--tksurfer.tcl: ctrl-middle-click REDRAW: toggle light back/inside surfaces
--tksurfer.c: lighttwosidedflag to light back/inside surfaces
--tksurfer.c: req read img before clear_selfintersect (cereb: override def=256)
--FreeSurfer.{c}sh: Linux uses MaxOSX 10.6 75dpi Helv fonts for Linux
--mk0{.csh}: copy good MaxOSX 10.6 75dpi Helv fonts for Linux (finally same!)
--csurf: tmp disable doublebuffer for CentOS 7 (3.0+ kernels)
--csurf: add separated tcl script helps
--lib/tcl/script_{offset/phase/movie360,flatten,explode}movie: bind helpwin's
--lib/help/tksurfer/script_{offset/phase/movie360,flatten,explode}movie: new
--std script help fished from lib/help/tksurfer/script to R-clk each pop-up
--lib/help/tksurfer/script: document new exposed vars
--phasemovie.tcl: expose dontsaveframes, {col}phasecontour{modflag,_bright}
--tksurfer.c: phasecontour_bright affects phasecontourmodflag=1 (def still wht)
--tksurfer.c: colphasecontourflag: col phcont on gray (req phasecontourflag)
--lib/help/tksurfer/shrink: say how to save surface made with SRHINK!
--lib/help/tkmedit/surf2col: say how to show 2 surfaces!
--csurf: now singlebuffer also for CentOS (until I fix underlying problem)
--wrappers.tcl: linux also chk /etc/*-release: fix CentOS7 giant helv14,droparr
--lib/help/csurf/tksurfer: add REDRAW stereo, "Col:", LUT ticks, MGH label
--tksurfer.tcl: ltw hover saves curr colscale, undo change->ltw w/no val2rgblut
--tksurfer.tcl: "R" on "lut:" line warns if val2rgblut file doesn't exist
--tksurfer.c: set_complex_color() catches off-edge's if fred/pha LUT maxval<1
--tksurfer.c: FRED_TONO same: immed gray->orange, gray at end (vs zero-cent)
--tksurfer.c: make_color_luts() now wraps fredtonolut[] correctly (0-1)
--tksurfer.c: write_val2rgblut() now writes FRED_TONO colscale=18

##########################################################################
PREVIOUS UPDATE: 21 Jun 2018
##########################################################################
--csurf: explicit -padx 11 fixes Linux extra-wide "Slice Ord" tixSelect
--lib/help/csurf/tk{surfer,medit,register,strip}: Mac shellscript help
--tkregister.c: check/explain/exit DYLD_LIBRARY_PATH unset,maybe Mac shellscript
--tkmedit.c: check/explain/exit DYLD_LIBRARY_PATH unset, maybe Mac shellscript
--tksurfer.c: check/explain/exit DYLD_LIBRARY_PATH unset, maybe Mac shellscript
--csurf: CSURF_LIBRARY_PATH not set err before load tix (print after load fail!)
--csurf: "csurf -h" err if CSURF_LIBRARY_PATH not set
--lib/help/csurf/setupfour: clarify that 3D and surfcluster different
--lib/help/tksurfer/script_annot2roi: new R-click help popup (cp from scripts)
--lib/help/csurf/tkregister: update w/simple usage (tkregister s1.mgz s2.mgz)
...
