snapshot and swapPixelArrays

Posted by Robert Lockwood on
URL: http://imagej.273.s1.nabble.com/snapshot-and-swapPixelArrays-tp5005347.html

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