###################################################################
UPDATE: 18 Oct 2017
###################################################################

Fix buffer overflow w/large rawdata vals (fourier)

The program, fourier, used by the csurf FOURIER
button, was originally designed to read short
(2-byte) data.  In Apr 2014, fourier was extended
to be able to read FLOAT BRIK's, but it was still
reading them into a short buffer, which could
result in overflows with FLOAT BRIK's containing
large (>32768) raw data values.  This localized
problem has now been fixed.


Better direct manipulate on Mac (tksurfer)

The responsiveness of the direct manipulation of
the surface (shift-click-drag in surface window)
was greatly improved on Mac OS X 10.10+.


HOWTO make AFNI utilities work on Ubuntu 16.04

Ubuntu 16.04 is missing libXp, a tiny X11 library
for printing, which is required/linked by AFNI
utilities included in this distribution.  Since
AFNI utilities (e.g., 2swap) are used in several
key places, the missing libXp will disable many
basic operations in csurf.

The libXp shared lib isn't available in the 16.04
archives, so here is how to install the working
version from Ubuntu 15.  Get the .deb file from
one of these places:

  https://launchpad.net/ubuntu/+archive/primary/+files/libxp6_1.0.2-2_amd64.deb
  http://www.cogsci.ucsd.edu/~sereno/.tmp/dist/csurf/libs/libxp6_1.0.2-2_amd64.deb

Install it like this:

  sudo dpkg -i libxp6_1.0.2-2_amd64.deb

At startup, csurf now checks if this critical
component is missing (if Debian or Ubuntu) and
explains how to install it.


Fix disappearing surface on Ubuntu 14.04/16.04

On Ubuntu on some machines but not others, the
cortical surface can disappear the first time you
click on it.  To guarantee that this doesn't
happen, the csurf interface now passes
-doublebufferflag 0 to tksurfer (same as: csurf ->
Preferences -> unclick Double Buffer).  Manipulation
still appears double-buffered (no tearing).

If you have this problem, when calling tksurfer
from the command line, add that flag as follows:

  tksurfer marty rh smoothwm -doublebufferflag 0

Tested for Ubuntu 14.04 and 16.04.


Open terminal in current subject or session scripts dir

For quicker access to the command line in the
scripts dir of the current subject or session, two
new "File" menu items were added:

  Terminal -> Subject Scripts
  Terminal -> Functional Scripts


Display label/annotation borders with white dots.

A ctrl-shift-mid-click on the unlabeled tick next
to "label:" toggles between the standard
annotation borders (1-face-wide border around each
region) and 1-pixel dots at border vertices, which
will occlude less of the underlying data.

To make the one-pixel dots less prominent,
increase the resolution of the standard 600x600
pixel window with "winxy:" at the lower right.

Finally, the density of the dots can be pruned
with a ctrl-shift-right click on the same tickbox
(C/tcl funct: prune_annotbord) after they have
been displayed.


Write out tksurfer surface/colors in glTF format

Csurf surface geometry and current surface color
can now be exported to a binary, glTF 2.0 format
file ("GLB" button at top right of the fn-F3
panel).

The glTF format (GL Transmission Format) is an
API-neutral format for runtime delivery (loading
and transmission) of 3D surface data.

The goal of the format is improved
intercommunication between 3D content creation
programs as well as efficient loading of 3D data
into WebGL browsers.

The format specification can be found here:

  https://github.com/KhronosGroup/glTF/tree/master/specification/2.0

It is further explained in the the R-click help
for the "GLB" button on the [fn-]F3 tksurfer
panel.

Not yet extensively tested :-}


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

Compiled a dist for PPC Mac :-}

fourier can operate on one column of ASCII rawdata data

##########################################################################
UPDATE: 18 Oct 2017
##########################################################################
--tksurfer.tcl auto-append .asc/.vtk/.off/.stl/.glb: testreplace warn overwrite
--lib/help/tksurfer/outsurfglb_write: update
--tksurfer.c: write_glb_surface(): uses curr displayed/cached colors
--tksurfer.tcl: add ctrl-shift-right-click prune_annotbord overload label tick
--tksurfer.c: prune_annotbord() if neigh annotbord's >= total neighbors-1 (OK)
--lib/help/tksurfer/label_toggle: update
--tksurfer.tcl: add ctrl-shift-mid-click $annotborddotflag overload label tick
--tksurfer.c: add annotborddotflag (add white dots on label border vertices)
--mk0{.csh}: insttmp: AFNI-req'd libXp .deb in $CSURF_DIR/lib/deb for user inst
--dist/precompiled/deb/{libxp6_1.0.2-2_amd64.deb,libxp6_NOTES.txt}
--fourier.c: read rawdata float BRIK to floatbuff to avoid >32768 overflow
--fourier.c: block non-power of 2 (until convert to fftw.c)
--fourier.c: new option -1D to process 1 col in ASCII timecourse table
--fourier.c: if no -freqsurr (not req'd arg!), set def hifreq -1 => Nyquist
--lib/help/tksurfer/save_pnt: update help
--tksurfer.c: SEND/find_orig_vertex_coordinates reports midpnt curr normsearch
--csurf: add GLB (glTF output) button to all-help panel
--lib/help/tksurfer/outsurfglb_write: new help file, update mk0*
--tksurfer.tcl: add GLB (glTF output) output button on fn-F3 panel
--tksurfer.c: add write_glb_surface(): write binary glTF (*.glb) surface
--wrappers.tcl: positionpopup can now just return position
--csurf: File menu items to open xterm/gnome-terminal in subj/sess scripts dir
--nmovie.c: fix byte-swapped *.rgb image in 10.4
--csurf: if Ubuntu/Debian, use ldd to check of libXp missing, warn/explain fix
--wrappers.tcl: def testclose (usu. overwritten) so kill win w/just wrappers.tcl
--csurf: improved cmdline help, --f OK too (force start csurf from Mac Terminal)
--csurf: explicit tixSelect -padx 11 (fix VBOX update def reset "Views: lat..")
--FreeSurfer.csh: failed try to mk ppc bins run on x86: would req ship ppc X11
--lib/help/tksurfer/arrownorm: better doc of constant-length gradient arrows
--csurf: missing env var better error: both tcsh (setenv) and bash (export)
--tksurfer.c: call do_one_glx_event 10x -> much better 10.10+ responsiveness
--tksurfer.c: do_one_glx_event() -> do_all_glx_events(): "if" -> "while"

##########################################################################
PREVIOUS UPDATE: 21 Jun 2017
##########################################################################
--tksurfer.c: count_mgh_annot_neigh2stat() also prints neigh IDnums to outfile
--tkmedit.tcl: before flip, if not CORONAL, warn/force CORONAL/center
--tkmedit.c: ptype errors, un-global/clean-up impt,ipt,jpt
--tkmedit.c: goto_point_coords->goto_point_zcoords, unzoomed: goto_point_coords
--csurf: add tkmedit CORONAL/SAGITTAL/HORIZONTAL to all help window
--lib/help/tkmedit/{hbutt,coronal,sagittal,horizontal}: new help, update mk0*
--tkmedit.tcl: overload "CORONAL" butt (mid-click) with flip_corview_xyz popup
--tksurfer.tcl: fix GR button error popup bug, manually bind avoids dup L-*-clk
...




