Re: snapshot and swapPixelArrays

Posted by ctrueden on
URL: http://imagej.273.s1.nabble.com/snapshot-and-swapPixelArrays-tp5005347p5005353.html

Hi Nate,

Using the snapshot feature just to display a 16-bit image with stretched
contrast seems very convoluted to me. Why not just set the image's
displayed min and max values to achieve the same thing?

-Curtis
On Oct 28, 2013 10:22 AM, "Robert Lockwood" <[hidden email]> wrote:

> Thought I had this working but I don't. My (16 bit monochromeTIFF) images
> are very low contrast so I want to automatically enhance the contrast for
> display.  On the other hand I want to show the original datum at the
> cursor.
>
> I have attempted to use Snapshot and swapPixelArrays but it doesn't work as
> I expected. that is, backup the original data, enhance it, display it, and
> then swap the buffers so that the original pixel value can be retrieved.
>
> Display
>   Imp = IJ.openImage(inFile.getPath());
>   imp.getProcessor().snapshot();
>   ContrastEnhancer ce = new ContrastEnhancer();
>   ce.equalize(imp);
>   jImagePanel.updateImage(imp);
>   imp.getProcessor().swapPixelArrays();
>
> Get datum at cursor:
>   int X = e.getX();
>   int Y = e.getY();
>   int val = imp.getProcessor().getPixel(X, Y);
>
> I think I'm misunderstanding something ...
>
> Nate
> --
> When I was 12 I thought I would live forever.
> So far, so good.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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