I've been able to save, read, adjust contrast, and display my unsigned
short monochrome raw data in my application using IJ and the JImagePanel.
I want to display the coordinates of the cursor and the original pixel
values. Getting the coordinates is no problem but I don't see how to get
the original pixel values.
Does stretching the image overwrite the backing array?
Must I save a copy of the original ImagePlus to have access to the original
data after stretching it or is there some other way?
Here are some code snippets.
Read and display image:
ImagePlus imp = IJ.openImage(inFile.getPath());
ContrastEnhancer ce = new ContrastEnhancer();
ce.equalize(imp);
jImagePanel.updateImage(imp);
Get cursor coordinates and value of pixel
jImagePanel = new JImagePanel();
jImagePanel.addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseMoved(MouseEvent e) {
int X = e.getX();
int Y = e.getY();
int val = imp.getProcessor().getPixel(X, Y);
System.out.println("X= " + X + " Y= " + Y + " DN " +
val);
}
});
Nate
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html