Hi,
Is there a way one can tell ImageJ to always open images with specified LUT? This would greatly reduce my time of analyzing images since every time I need to convert grey scale images to specified LUT. Thanks, Matt -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Aug 16, 2014, at 6:19 AM, Matjaz Panjan wrote:
> Hi, > > Is there a way one can tell ImageJ to always open images with specified > LUT? This would greatly reduce my time of analyzing images since every time > I need to convert grey scale images to specified LUT. You can do this with a macro like the following, which opens images with the Fire LUT. Add the macro to the ImageJ/macros/StartupMacros.txt file and you will be able to open an image with the Fire LUT by typing "o". macro "Open with Fire LUT... [o]" { open(""); run("Fire"); } -wayne -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by surjpanj
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?
Thanks, Matt -- ImageJ mailing list: http://imagej.nih.gov/ij/list.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 |
In reply to this post by surjpanj
Great it works! Thank you very much :-)
I have one more request. How could I achieve that ImageJ always opens image with the maximum contrast? Namely, images are always shown with low contrast, which I fix by going to Image/Adjust/Brightness&Contrast and set the limits. Is there a way this could be atomized? I would always like to have "minimum display value" at 0 whereas the "maximum display value" should be automatically adjusted for particular image. Thanks, Matt -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Matt,
if you have 16-bit images, there are several choices for the default display range in Edit>Options>Appearance. Otherwise, if you start a plugin that registers as an ImageListener on ImageJ startup (run it in macro "AutoRun" of StartupMacros.txt), you can easily use that plugin to set the display range to any value you like. Use imp.getProcessor().setMinAndMax(min, max). Michael ____________________________________________________________________ On Sat, August 23, 2014 18:38, Matt wrote: > Great it works! Thank you very much :-) > > I have one more request. How could I achieve that ImageJ always opens > image with the maximum contrast? Namely, images are always shown with low > contrast, which I fix by going to Image/Adjust/Brightness&Contrast and set > the limits. Is there a way this could be atomized? I would always like to > have "minimum display value" at 0 whereas the "maximum display value" > should be automatically adjusted for particular image. > > Thanks, > Matt -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |