Posted by
Robert Lockwood on
URL: http://imagej.273.s1.nabble.com/snapshot-and-swapPixelArrays-tp5005347p5005354.html
---------- Forwarded message ----------
From: Rasband, Wayne (NIH/NIMH) [E] <
[hidden email]>
Date: Mon, Oct 28, 2013 at 9:26 AM
Subject: Re: snapshot and swapPixelArrays
To: Robert Lockwood <
[hidden email]>
"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?"
Chris, I have no problem displaying the stretched image, it's retrieving
the before stretch pixel value at the cursor position that's not working.
"You seem to be reinventing the wheel. ImageJ already does this. You can
look at the setMinAndMax() method in the ShortProcessor to see how it does
it. This method is used by Process>Enhance Contrast and
Image>Adjust>Brightness/Contrast to display 16-bit images contrast enhanced
without altering the pixel values."
Wayne, I don't see how to do this, could you please provide a little code?
Thanks to both
Nate
On Oct 28, 2013, at 11:20 AM, Robert Lockwood 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--
When I was 12 I thought I would live forever.
So far, so good.
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html