Login  Register

Re: Default LUT

Posted by Rasband, Wayne (NIH/NIMH) [E] on Aug 21, 2014; 11:32pm
URL: http://imagej.273.s1.nabble.com/Default-LUT-tp5009240p5009298.html

On Aug 21, 2014, at 12:32 PM, Matt wrote:

> Thanks Wayne! It kind of works. If I open file from ImageJ then I get desired LUT but if I open the file from Windows Explorer directly then I only get greyscale image. Is it possible to make it work by directly opening the file?

You can do this using a plugin that implements the ImageListener interface. The following plugin is a customized version of the example at

    http://imagej.nih.gov/ij/plugins/image-listener.html

It applies the Fire LUT when an image is opened. Save the plugin as "Image_Listener.java" in the plugins folder or immediate subfolder and use the Plugins>Compile and Run command to compile and run it. The plugin will run automatically when ImageJ starts if you add

   run("Image Listener");

to the Edit>Options>Startup dialog (requires v1.49e or later).

-wayne


//****** start of "Image_Listener.java" plugin ******
import ij.*;
import ij.plugin.*;

public class Image_Listener implements PlugIn, ImageListener {
    private static Image_Listener instance;

    public void run(String arg) {
        if (instance==null)
            ImagePlus.addImageListener(this);
        instance = this;
    }

    public void imageOpened(ImagePlus imp) {
        if (imp.getBitDepth()!=24)
            IJ.run(imp, "Fire", "");
    }

    public void imageClosed(ImagePlus imp) {
    }

    public void imageUpdated(ImagePlus imp) {
    }
   
}
//****** end of "Image_Listener.java" plugin ******

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