Re: Set mean gray value (from 16 bit TIFF) as background color

Posted by Wayne Rasband-2 on
URL: http://imagej.273.s1.nabble.com/Set-mean-gray-value-from-16-bit-TIFF-as-background-color-tp5021471p5021491.html

> On Nov 19, 2018, at 9:34 PM, mmettlen <[hidden email]> wrote:
>
> My macro measures the mean gray value of 16-bit TIF images but I haven't
> figured out how to convert this value (e.g. 130) to use in
> setBackgroundColor(R, G, B).... Like always: thanks for helping!

Use setColor(mean), as in this example which fills the center of a 16-bit image with the mean pixel value:

  newImage("Untitled", "16-bit ramp", 500, 500, 1);
  getRawStatistics(nPixels, mean);
  makeOval(125, 125, 250, 250);
  setColor(mean);
  fill;
  run("Select None”);

-wayne

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html