Login  Register

Displaying an image on an JImagePanel

Posted by Robert Lockwood on Oct 29, 2013; 10:07pm
URL: http://imagej.273.s1.nabble.com/Displaying-an-image-on-an-JImagePanel-tp5005376.html

I my application use IJ to read a TIFF file, make a snapshot, enhance the
contrast and then display it on a JImagePanel.  Sometime later I use the
same method to read and display an image from a different TIFF file but the
image on the JImagePanel does not change (update).


  imp = IJ.openImage(inFile.getPath());  // Global ImagePlus imp;
  imp.getProcessor().snapshot();
     // Global short[] snapshotPixels;
  snapshotPixels = (short[]) (imp.getProcessor() .getSnapshotPixels());
  ContrastEnhancer ce = new ContrastEnhancer();
  ce.equalize(imp);
  jImagePanel.updateImage(imp);

I've tried a few but none have worked for me.

Should I be displaying the image differently?
Do I somehow get rid of the existing image first?

TIA

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