Re: ImageJ question

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

Re: ImageJ question

Wayne Rasband
> I am wondering if you can help me on this:
>
> If I use ImageJ to open an image, which has 100x100 pixels. Is there a
> menu/button which can give me a data window showing all the 100x100
> numbers behind pixels?

Here is a macro that displays, in the "Results" window, the values of
the pixels in an image or selection up to 124 pixels wide.

  macro "Display Pixel Values" {
      getSelectionBounds(xbase, ybase, width, height);
      if (width>124)
          exit("Image or selection width limited to 124 pixels");
      labels = newArray(width+1);
      labels[0] = "Y";
      for (i=0; i<width; i++)
         labels[i+1] = toString(xbase+i);
      run("Clear Results");
      for (row=0; row<height; row++) {
         setResult(labels[0], row, ybase+row);
         for (i=0; i<width; i++)
            setResult(labels[i+1], row, getPixel(xbase+i, ybase+row));
      }
      updateResults();
  }

-wayne