Login  Register

Re: printing out pixel values to a results table

Posted by Wayne Rasband on Jun 02, 2007; 3:16am
URL: http://imagej.273.s1.nabble.com/printing-out-pixel-values-to-a-results-table-tp3699251p3699252.html

Here is a macro that writes non-zero pixel values to the Log window.

   h=getHeight();
   w=getWidth();
   for (y=0; y<h; y++) {
       for (x=0; x<w; x++) {
           value = getPixel(x, y);
           if (value!=0) print(x, y, value);
      }
   }

-wayne

On Jun 1, 2007, at 4:06 PM, Paxton Provitera wrote:

> Hi.
>
> I am having the hardest time doing something that should be easy.
>
> I want to print non-zero pixel values out to the results table.
>
> I have 640 by 480 images that will have about 20K non-zero pixel  
> values.
> is there an easy way to do this?
>
> thanks a ton!
>
> -Paxton