###################################################################
LATEST EMAIL UPDATE: 20 Nov 2015
###################################################################

Mac OS X 10.11 (El Capitan)

csurf/Csurf.app now work on Mac OS X 10.11 (El
Capitan).  The new version also works on previous
releases back to 10.6.8 (Snow Leopard).

[gory details for the masochistic]

The new System Integrity Protection, SIP, on Mac
OS X 10.11, among other things, no longer passes
some shell environment variables to subshells
(e.g., $PATH and $DYLD_LIBRARY_PATH are not
passed).  The first line of csurf was:

  #! /usr/bin/env wish8.5

which relied on $PATH being passed to the
subshell that env starts so the right X11 wish8.5
got called (instead of the Aqua wish8.5). This
also relied on $DYLD_LIBRARY_PATH being passed so
that the csurf-internal tcl libs got used
(instead of the incompatible Aqua tcl libs).

Here is the workaround (trick based on different
interpretation of backslash in sh and tcl) to
avoid a subshell (exec replaces the current
shell, and sh can use an inline environment):

  #! /bin/sh
  # next b/c Mac 10.11 doesn't pass DYLD_LIBRARY_PATH to subshell \
  DYLD_LIBRARY_PATH=$CSURF_LIBRARY_PATH exec wish8.5 $0 ${1+"$@"}

The "env" command was also being using inside
csurf to start tksurfer, since some variables
were being passed as environment variables to tcl
scripts.  Those variables are now passed using a
tmpfile.

HOWTO first-time Csurf.app start-up

To use Csurf.app on Mac OS X 10.9+, first
temporarily set System Preferences -> Security &
Privacy "Allow apps downloaded from:" setting  to
"Anywhere" and open Csurf.app once and say "OK to
use app downloaded from internet".

After first open, put Security & Privacy
preferences back to restrictive (e.g., just "App
Store"), and Csurf.app will always reopen.  If you
don't do this, you will get misleading error
message: "Csurf.app is damaged and can't be
opened.  You should move it to the Trash".

Read VTK surfaces and data overlays

An initial and not-completely-general :-} facility
has been added to directly *.vtk files (ASCII
format, for displaying Leipzig MIPAV data).

VTK ASCII triangle surface files can be read into
tksurfer.  To appear in the csurf "surfaces:"
dropdown, the filename must be given a
freesurfer-like prefix.  For example, rename:

  <some_arbitrary_long_filename>.vtk

to

  rh.orig.<some_arbitrary_long_filename>.vtk

If these files are appended with overlay data --
that is, vertexwise ASCII data in one or more
columns per vertex after surface specification,
and following an intercalated header line:

  POINT_DATA <vertexcount>

then tksurfer will accept them as a val file (they
will be loaded into the "val:" dropdown.  For this
purpose, the preceding surface specification will
be ignored.  The number of vertices must match
that of the currently loaded surface.

The MIPAV and freesurfer coordinate system
definition differ, so you will have to rotate the
brain 180 deg.  The surfaces can be converted to
native freesurfer surfaces using "W" on the
"outsurf:" line on the larger tksurfer F3 panel.
To rotate, scale, and save out a *.vtk surface
surface with a tcl script, do:

  really_rotate_brain_y 180
  really_scale_brain 1.5 1.5 1.5   ;# guess: this shrunken?
  really_center_brain
  setfile outsurf lh.orig
  testreplace $outsurf write_binary_surface
  confirmalert "now restart tksurfer to init w/new center"

#########################################
Latest addition to $CSURF_DIR/UPDATES.txt
#########################################

### UPDATE: 21 Nov 2015
--lib/help/csurf/{csurf,rc-surfaces}: HOWTO make vtk surf appear in "surface:"
--csurf: surface combo includes $hemi.{orig,inflated}* at end, better sorting
--lib/help/tksurfer/val: doc new multi-column ASCII .vtk vertex data format
--lib/help/csurf/csurf: doc new ASCII .vtk surface format
--tksurfer.tcl: "val:" line "R" choose column num popup if .vtk filehdr ncols>1
--tksurfer.tcl: also load *.vtk files (sub+sess) to "val:" (ignore $hemi)
--tksurfer.c: read_binary_values: .vtk w/3lines: POINT_DATA,SCALARS,LOOKUP_TABLE
--tksurfer.tcl: also load *.crv files into "val:" dropdown (ignore $hemi)
--medtestrender checks functscanlists($page,tkregtargdir) exists old csurf.dat
--csurf: add explicit csurf "h" help butt lower right (parallel to tksurfer etc)
--tkregister.tcl: small upper left "h" button for tkregister help
--tkmedit.tcl: small upper left "h" button for tkmedit help
--tksurfer.tcl: small upper right "h" button for tksurfer help
--wrappers.tcl: allow abs helpfile -- tk{surfer,medit,register} in csurf subdir
--csurf: R-click csurf help from intermenu, above "Structural"/"Functional"
--lib/help/csurf/{viewscandirs,handnormalize}
--csurf: R-click help for SessionTools setup panels
--csurf: all help: add omitted "val:" line help for "W" button
--lib/help/tksurfer/val_write: better explanation of C/tcl functions used
--lib/help/tksurfer/label_timecourses: pointer to % from already painted _x,_y
--lib/help/tksurfer/label_corr: better documentation of wrapper functions
--Csurf.app (no change to applescript) now works on Mac OS X 10.11
--csurf: rm env: surftestrendernopanel, medtestrender, surftestrender
--csurf: rm env: fixinflatedavg, fieldsigncmd, findretinborderscmd
--csurf: surfercmd: tclenv->file, if $csurftclenv != "",readenv.tcl uses to set
--csurf: mk3dscript, mkviewcutscript, mkflatscript source readenv.tcl
--readenv.tcl: $csurftclenv exists/nonempty/there, var=val lines set tcl vars
--[tkmedit.c/tkregister.c don't need -csurftclenv: no tcl vars passed via env]
--[need -csurftclenv b/c can't use env, even tho it *does* pass non-PATH,DYLD]
--tksurfer.c: new/exported csurftclenv: non-empty only if -csurftclenv <arg>
--csurf: new: DYLD_LIBRARY_PATH=$CSURF_LIBRARY_PATH exec wish8.5 $0 ${1+"$@"}
--csurf: go back to sh vs. tcl comment startup trick to pass DYLD_LIBRARY_PATH
--csurf: old: #! /usr/bin/env wish8.5 => fail: env doesn't pass DYLD to subshell
--FreeSurfer.{c}sh: CSURF_LIBRARY_PATH to fix Mac OS X 10.11 nopass-env2subshell
--MacOSX 10.11 (ElCapitan): PATH, DYLD_LIBRARY_PATH not passed to subshell
--csurf: fix writelog if run dir moved out from under running csurf

### UPDATE: 10 Oct 2015
--csurf: Render panel: add/cpprev botedgelutflag,zerosymmfadeflag
--tksurfer.tcl "bot","sym" on F3 panel, sm radios: "none"->"no", "curv"->"cv"
...




