-------------------------------------------
funct (left-click): toggle temporary truncate buf1,buf2
-------------------------------------------
funct (mid-click): actually truncate editable buffer
  run_wmfilter stdtrunc to_buf1
-------------------------------------------
funct (shift-middle-click): count voxels between lims
  countvox <low> <high>
-------------------------------------------
funct (ctrl-mid-click): truncate editable w/im2 colrange
  crop_im_using_im2cols
-------------------------------------------
funct (ctrl-right-click): as above, but only im outside colrange
  crop_im_using_im2cols_save
-------------------------------------------
funct (shift-right-click): cp im->im2 replacing range cols
  cp_im_to_im2_replacing_cols
-------------------------------------------
funct (no hotkey): trunc editable w/2d colspace ellipse
  imim2op <0=inside2off,1=outside2off>
-------------------------------------------


Detailed Description TRUNC button

A default left-click of the TRUNC button toggles
a temporary truncation to white matter (affects
both editable and second buffer).

Set low ($white_lolim) and high ($white_hilim)
limits for the white matter using the entries to
the right of the TRUNC button.  Pixels that are
above or below these numbers go to black.

To test manual normalizations using the controls
on the lower right part of the F3 panel, engage
TRUNC to see what will be the basic final
truncation-to-white-matter result (minus the
plane filter refinement).

Alternate functions below easiest to access via
popup from R-click help.

-------------------------------------------
Alt funct (middle-click):
  run_wmfilter stdtrunc to_buf1
-------------------------------------------

To apply the current truncation to the editable
buffer (so it can be saved), middle-click the
TRUNC button.  This runs the tcl function:

  run_wmfilter <operation> <targbuf>

as follows:

  run_wmfilter justtrunc to_buc1

For reference, the full set of possible arguments
to run_wmfilter are:

  operation:  justtrunc, stdtrunc, gauss
  targbuf:     to_buf1, to_buf2

See help for the PF and PFGAU buttons for
interactively running the plane filter (stdtrunc,
gauss).

-------------------------------------------
Alt2 funct (shift-middle-click):
  countvox <low> <high>
-------------------------------------------

To count voxels that have values between the low
and high limits shift-middle-click TRUNC.  Voxels
equal to the limits are included, so to count
voxels with a single value, set low and high
limits to the same value.

-------------------------------------------
Alt3 funct (ctrl-middle-click):
  crop_im_using_im2cols
-------------------------------------------

This can crop an edtabale image using another
imageset.  This requires that a second image has
been loaded using "R" on the bottom middle "im2:"
line.

A control-mid-click on the TRUNC button truncates
the editable buffer (im) using locations in the
second buffer (im2) that have colors
within/including $while_lolim to $white_hilim
(entries immediately right of TRUNC button) to a
new color, $gray_hilim (entry to right of PF
button):

  for im2 range:
    lo: $white_lolim
    hi: $white_hilim
  im new:
    $gray_hilim

The editable buffer can then be saved with SAVE
IMGS (overwrites editable image), or "W" on "im:"
line (F1 interface) if you want to SaveAs/rename
the result.

To duplicate the result of a hand-edit to black,
use target color 1 (EDITED_TO_OFF).

This can be used, for example, to crop the
background of the editable image set using a
different (already processed, e.g., skull
stripped) image set.

To undo, alt/cmd-z in image window (or tools 
window).

-------------------------------------------
Alt4 funct (ctrl-right-click):
  crop_im_using_im2cols_save
-------------------------------------------

Similar to crop_im_using_im2cols above, but only
edits image if im (not im2!) is outside the range
of:

  lo: $edit_lolim2
  hi: $edit_hilim2

This second pair of limits allows saving more
structure in the editable image.  Do a R-click on
the TRUNC button (or the entries to the right of
it) to get a popup, tick $im2boundsflag, to
enable the second bounds, and set them.

For a mouse-driven version of the same thing, use
shift-left-click in the image window.

To undo, alt/cmd-z in image window (or tools 
window).

-------------------------------------------
Alt5 funct (shift-right-click):
  cp_im_to_im2_replacing_cols
-------------------------------------------

This can edit a range of colors in an editable
image to a single color, allowing a before/after
blink comparison.

A shift-right-click copies the entire contents of
the editable buffer to im2, replacing a range of
colors (including range limit values) in the
editable buffer with a single im2 color.
shift-right-click TRUNC.  The im color range to
replace is specified by the values in the 2
entries to the right of the TRUNC button, and the
new/replaced im2 color by the entry to the right
of the PF button:

  for im range:
    lo: $white_lolim
    hi: $white_hilim
  im2 new:
    if within range: $gray_hilim
    else: same as im
 
To save the color-replaced im2 buffer, first swap
it to editable buffer:

   middle-click-COMPARE
   SAVE IMGS *or* "W" on "im:" line 

In contrast to the in-place operation above that
also uses im2 (crop_im_using_im2cols), this funct
allows a blink comparison using the COMPARE
button, because only one image is initially
loaded.

To duplicate the result of a hand-edit to black,
use target color 1 (EDITED_TO_OFF).

This can be used, for example, to edit bright
fluid to black in place.

For a mouse-driven version of the same thing, use
shift-left-click in the image window (with
$im2boundsflag unticked).

-------------------------------------------
Alt6 funct (no hotkey): trunc editable w/2d colspace ellipse
  imim2op <operation=0,1>
  $imcolcent
  $imcolrad
  $im2colcent
  $im2colrad
-------------------------------------------

[also avail. from "OP" button on F3 panel]

This runs a 2D color space operation (edit if
pixel inside or outside 2D color ellipse) using
the data currently in the main/editable buffer
(im) and the second/compare (im2) buffer.

Visualize the color space ellipse (at each pixel)
in a 2D space with im color on the x-axis and im2
color on the y-axis.

To see the result as a transparent overlay
without actually doing the truncation, click bold
"im2:" label to get a test popup.

N.B.: the truncation result is applied to the
editable buffer (im).  To undo, alt/cmd-z in
image window (or tools window).

The operations:

  $imim2opnum

currently available are:

   0: set colors INSIDE ellipse to OFF
   1: set colors OUTSIDE ellipse to OFF

The ellipse size and center is set with:

  $imcolcent
  $imcolrad
  $im2colcent
  $im2colrad

In more detail, the operation are:

-------------------------------------------
0:  edit ellipse *inside* im,im2 space to OFF
-------------------------------------------

   (x-m)^2      (y-n)^2
   --------  +  --------   <   1
     w^2           h^2

where (x,y) is current color, (m,n) is center
color, and (w,h) are color radii.  If < 1, edit.

TODO:
  x' = x*cos(th) + y*sin(th)
  y' = y*cos(th) - x*sin(th)

-------------------------------------------
1:  edit ellipse *outside* im,im2 space to OFF
-------------------------------------------

Same as 0, but save stuff inside ellipse.

To save the edits, set the desired output name in
the "im:" field and use "W".

N.B.: using SAVEIMG will save the edited images
over the originally-read-in set of images
(probably not wanted, so be sure to first change
name).

