-------------------------------------------
function: shrink <steps>
tcl wrapper funct: startstopshrink <steps> <cyc> [normflag]
-------------------------------------------

Runs requested number of steps of surface
deformation, possibly paying attention to one or
more loaded 3D data sets.

The sum of the vectors to neighboring vertices is
first computed.  Each vertex is then moved
according to a scaled tangential force and a
scaled normal force.

The tangential force is the component of the
vector sum perpendicular to the local surface
normal (tangential to the surface).  The normal
force is the component of the vector sum in the
direction of the local surface normal.

SHRINK can also use one or more 3D data sets to
modify the normal force (if areaflag=0).

Middle-click SHRINK also runs normalize_area
after every cycle of n steps (useful for
inflate).

To save the result of a shrink in standard
FreeSurfer surface format, enter a surface suffix
in the "outsurf:" entry (default: surftmp) and
click "W" (or ASC, VTK, OFF, STL, GLB for other
formats).  Checks overwrite.


Shrink Parameters (defs, not relevant all modes/types)

 ## shrink() -- areaflag=0, flag2d=0, shrinkfillflag=0
 # dx = sx*ws + nx*nforce;
 ws (0.5) -- {area_}shrink: tangent weight (restore geom)
 wn (0.5) -- {area_}shrink: normal weight (curv reduce)
 forcemode (0)
   0: force = mstrength* tanh((val - mmid)*mslope);
   1: force = mstrength* tanh((inval - mmid)*mslope);
   2: force = mstrength*(tanh((inval - mmid)*mslope)
        - ptanh((outval - mmid)*mslope));
   3: force = 0.5*(mstrength*tanh((inval-whitemid)*mslope)
        + mstrength*tanh((val - graymid)*mslope));
 sulcflag (0) -- enable add up movement in normal dir
 locklabelflag (0) -- vertices under label won't move
 MRIflag (0) -- check T1 image ($inim)
 mstrength (0.125) -- mri image outward force factor
 mslope (0.05) -- normal force sigmoid steepness
 mmid (45.0) -- main mri value target
 whitemid (45.0) -- (force=3) inner
 graymid (30.0) -- (force=3) outer
 cthk (1.0) -- shrink est. cort thick
 chkselfintflag (0) -- self intersect: normforce=OFF,req MRI
 selfstilt (-1.0) --  slight in/neg unsticks out-moving surf
 chkfilledflag (0) -- filled ($inim2) not 0 turns off normforce
 chkthirdflag (0) -- T2 ($inim3) bright turns off normforce
 chkthird_lolim (60) -- bot lim im3 turnoff normforce
 chkthird_hilim (120) -- top lim im3 turnoff normforce
 chkgradampflag (0) -- check 3D gradient amp image
 gradampfac (5.0) -- scale 1-either-side grad amp to byte
 expandflag (0) -- normal expand no matter what
 explodeflag (0) --  if stress too high, rupture

 ### area_shrink() -- areaflag=1, flag2d=0, shrinkfillflag=0
 # dx = tx*wt + ax*wa + sx*ws + nx*nc*wn + nx*nforce*wc;
 areaflag (0) --  replace shrink() with area_shrink()
 ncthreshflag (0) -- no-op if norm component below
 ws (0.5) -- {area_}shrink: tangent weight (restore geom)
 wn (0.5) -- {area_}shrink: normal weight (curv reduce)
 wa (0.5) -- area_shrink: orig area preserving
 wt (0.5) -- area_shrink: radial border-only force
 wc (0.0) -- area_shrink: neg arat -> norm force (def=OFF!)
 wsh (0.5) -- shrink2d: shear force
 wbn (0.5) -- shrink2d: boundary normal force
 bordneiflag (1) -- area_shrink: mv bord w/non-bord nei

 ### shrink2d() -- flag2d=1, shrinkfillflag=0
 # dx = tx*wt + ax*wa + sx*ws + shx*wsh + tnx*wbn;
 flag2d (0) -- replace shrink() with shrink2d() 

 ### shrink_to_fill() -- shrinkfillflag=1
 shrinkfillflag (0) -- replace shrink() with shrink_to_fill()

 ### curv_shrink_to_fill(), ellipsoid_morph()
 icstrength (1.0) -- original ellipsoid sulc morph

 ### sphere_morph() -- spherical curv/stat/cmplx register
 # dx += (xn - x)*w;  /* nei basis, w from curv/sta/cpx */
 ws (0.5) -- tangent weight (restore geom)
 wcrv (0.5) -- curv targ img error weight
 wsta (0.0) -- stat targ img error weight
 wcpx (0.0) -- complex targ img error weight
 [for details, see R-click help to "REG" button]

 ### common parms
 momentumflag (1) -- dr = decay*lastr + update*dr;
 update (0.9) -- frac new to use
 decay (0.9) -- frac old to use

The tcl wrapper function, startstopshrink:

  startstopshrink <steps> <cyc> [normflag]

can be used to run the shrink function after the
interface is up (it make the button
purple/killable).  The <cyc> argument controls
how many rounds of <steps> updates to do before
the display is refreshed.  To see every refresh,
set <steps> to 1.
