Login  Register

Re: coding a contrast stretch.

Posted by dscho on Sep 26, 2013; 10:29pm
URL: http://imagej.273.s1.nabble.com/coding-a-contrast-stretch-tp5004955p5004956.html

Hi Nate,

On Thu, 26 Sep 2013, Robert Lockwood wrote:

> I have a ByteBuffer with an image (16 bits per pixel and monochrome)
> that I can display in my UI and I can save as a TIFF file using ImageJ.
>
> I've just written code to read a saved TIFF from a file using ImagePlus,
> get the BufferedImage and both display it in my UI and as an ImageJ
> window.
>
> My test images have absolutely rotten contrast so I need to do a linear
> stretch but have not found it in the DOCS yet and Google has been no
> help.

Probably use the setDisplayRange() method on the ImagePlus before
extracting the AWT Image to display?

http://jenkins.imagej.net/job/ImageJ1-javadoc/javadoc/ij/ImagePlus.html#setDisplayRange%28double,%20double%29

Ciao,
Johannes

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