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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

mmettlen
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!



--
Sent from: http://imagej.1557.x6.nabble.com/

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

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

Wayne Rasband-2
> 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