-------------------------------------------
funct: "Display Curr-to-Orig Log Area Ratio (left-click-D)"
  calcdisp_curr2orig_logarat (tksurfer.tcl)
-------------------------------------------
funct: "Display Curr-to-Orig Area Ratio (all pos) (mid-clk-D)"
  calcdisp_curr2orig_arat (tksurfer.tcl)
-------------------------------------------
funct: "Disp Area-to-AreaPial Area Ratio (shift-mid-clk-D)"
  calcdisp_arat (tksurfer.tcl)
-------------------------------------------


Detailed Description of Area "D" Button Actions

-------------------------------------------
funct: "Display Curr-to-Orig Log Area Ratio (left-click-D)"
  calcdisp_curr2orig_logarat (tksurfer.tcl)
-------------------------------------------

The "D" button on the "area:" entry line
calculate local areal distortion of the current
surface and display using curvature color scale.
Current local area is divided by the original
local area (from area file for $hemi.white), then
log taken before display (no distortion => zero).

Green is stretched, red is compressed, gray is
undistorted.  Color saturation indicates degree
of distortion.

Left-clicking the "D" button performs the
following operations (after confirm):

  (1) (re)load $hemi.area as .origarea
  (2) calc curr/orig area ratio (.area = .area/.origarea)
  (3) take log of .area, save back in .area
  (4) save result as $hemi.area.logarat
  (5) display result using curv color scale
  (6) adjust cslope/cmid (for inverted)
  (7) reinstate current surface area (to .area)

Here is a tcl script to do this same thing, and
then also save a tiff of the result in the rgb
dir of the current subject (setfile is a globbing
"set"):

  ### read first file area (redundant)
  setfile area ~/surf/$hemi.area
  read_binary_areas

  ### divide second by first (0 if orig=0), take log
  compute_curr2orig_area_ratio
  compute_logarea

  ### write area ratio file
  setfile area ~/surf/$hemi.area.arat
  write_binary_areas

  ### read in area file as a curvature
  setfile curv ~/surf/$hemi.area.arat
  read_binary_curv

  ### display: reset midpoint, flip red/green
  set cmid 0.0        ;# red/green midpoint
  set cslope -0.75  ;# minus -> flip red/grn
  smooth_curv 5
  redraw

  ### reinstate current surface area (to .area)
  compute_normals_areas

  ### save rgb
  setfile rgb ~/rgb/logaratio-$hemi-inflated-lat.tiff
  save_rgb

-------------------------------------------
funct: "Display Curr-to-Orig Area Ratio (all pos) (mid-clk-D)"
  calcdisp_curr2orig_arat (tksurfer.tcl)
-------------------------------------------

Same as above, except display all-positive area
ratio (instead of log area ratio).  Resets color
scale to change around 1.0 instead of 0.0.

Green is stretched, red is compressed, gray is
undistorted.

Middle-clicking the "D" button performs the
following operations (after confirm):

  (1) (re)load $hemi.area as .origarea
  (2) calc curr/orig arearatio (.area = .area/.origarea)
  (3) save result as $hemi.area.arat
  (4) display result using curv color scale
  (5) adjust cslope/cmid (for inverted/all-pos)
  (6) reinstate current surface area (to .area)

Here is a tcl script to do this same thing:

  ### read first file area (redundant)
  setfile area ~/surf/$hemi.area
  read_binary_areas

  ### divide second by first (0 if orig=0)
  compute_curr2orig_area_ratio

  ### write area ratio file
  setfile area ~/surf/$hemi.area.arat
  write_binary_areas

  ### read in area file as a curvature
  setfile curv ~/surf/$hemi.area.arat
  read_binary_curv

  ### display: re-center, flip red/green for all-pos
  set cmid 1.0      ;# red/green midpoint
  set cslope -1.0  ;# minus -> flip red/grn
  smooth_curv 5
  redraw

  ### reinstate current surface area (to .area)
  compute_normals_areas

-------------------------------------------
funct: "Disp Area-to-AreaPial Area Ratio (shift-mid-clk-D)"
  calcdisp_arat (tksurfer.tcl)
-------------------------------------------

Similar to above, but calculates area ratio
between .area and .area.pial:

  (1) (re)load $hemi.area as .origarea
  (2) load $hemi.area.pial as .origarea2
  (3) calculate area ratio (.area = .origarea2/.origarea)
  (4) save result as $hemi.area.arat
  (5) display result using curv color scale
  (6) adjust cslope/cmid (for inverted/all-pos)
  (7) reinstate current surface area to .area

Here is a tcl script to do this same thing:

  ### read first file area (redundant)
  setfile area ~/surf/$hemi.area
  read_binary_areas

  ### read second area file
  setfile area ~/surf/$hemi.area.pial
  read_binary_areas2

  ### divide second by first (0 if first=0)
  compute_area_ratio

  ### write area ratio file
  setfile area ~/surf/$hemi.area.arat
  write_binary_areas

  ### read in area file as a curvature
  setfile curv ~/surf/$hemi.area.arat
  read_binary_curv

  ### display: re-center, flip red/green for all-pos
  set cmid 1.5      ;# red/green midpoint
  set cslope -1.0  ;# minus -> flip red/grn
  smooth_curv 5
  redraw

  ### reinstate current surface area (to .area)
  compute_normals_areas

