Login  Register

Re: How to programmatically apply a lut to an image

Posted by Wayne Rasband on Jul 27, 2006; 5:11pm
URL: http://imagej.273.s1.nabble.com/How-to-programmatically-apply-a-lut-to-an-image-tp3701957p3701958.html

> Hello,
> Is it possible to programmatically set a lut, let's say Red, green
> or Blue, to a 8 bit Image without using IJ.run("color") because my
> images are not visibles during processing.
>
> I would like my plugin to save images with differents lut.

In a macro, you can can apply a LUT to a non-visible image by running
the macro in batch mode. Here is an example:

    setBatchMode(true);
    run("Blobs (25K)");
    run("Fire");
    saveAs("Tiff", "/Users/wayne/blobs.tif");

In a plugin, you can do it by using the
WindowManager.setTempCurrentImage() method:

    ImagePlus img = IJ.openImage("/Users/wayne/blobs.tif");
    WindowManager.setTempCurrentImage(img);
    IJ.run("Fire");
    IJ.saveAs("Tiff", "/Users/wayne/blobs2.tif");

-wayne