Is there a way to disable this automatic adjustment of brightness contrast that happens when I open an image?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there a way to disable this automatic adjustment of brightness contrast that happens when I open an image?

Jeanine Hinterneder
I'm taking many sets of images as a series of images in three different
colors that correspond to three different stains and get saved as an image
stack.  Unfortunately, when I open each image stack in ImageJ, it
automatically sets the Minimum and Maximum Intensity  values based on the
top image.  I would like to be able to open images with the Minimum set to
zero and the Max to 4095 (the max value for my 12 bit camera).
It's a real pain to have to go through all my images and readjust every
time I open one!
So, is there a way to disable this automatic adjustment of brightness
contrast that happens when I open an image?

Thanks!

Jeanine Hinterneder
Post Doc at Brandeis University
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to disable this automatic adjustment of brightness contrast that happens when I open an image?

jmutterer
Jeanine,
you can add a custom "open with 12-bit range" command to the Plugins/Macros
menu by adding the following macro to the StartupMacros.txt file:

macro "open with 12-bit range [F1]" {
open();
setMinAndMax(0,4095);
}

You could also install the recent "Droplet" plugin from:
http://imagejdocu.tudor.lu/doku.php?id=plugin:utilities:droplet:start
and add the following "open with 12-bit range.txt" file in the
ImageJ/plugins/Droplet
Actions/ folder, so that you can just drag and drop your files on the
Droplet to have you images opened and the display range set immidiately.

// "open with 12-bit range.txt"
file=getArgument();
open(file);
setMinAndMax(0,4095);

Jerome.

On Tue, Oct 27, 2009 at 7:09 PM, Jeanine Hinterneder <[hidden email]>wrote:

> I'm taking many sets of images as a series of images in three different
> colors that correspond to three different stains and get saved as an image
> stack.  Unfortunately, when I open each image stack in ImageJ, it
> automatically sets the Minimum and Maximum Intensity  values based on the
> top image.  I would like to be able to open images with the Minimum set to
> zero and the Max to 4095 (the max value for my 12 bit camera).
> It's a real pain to have to go through all my images and readjust every
> time I open one!
> So, is there a way to disable this automatic adjustment of brightness
> contrast that happens when I open an image?
>
> Thanks!
>
> Jeanine Hinterneder
> Post Doc at Brandeis University
>
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to disable this automatic adjustment of brightness contrast that happens when I open an image?

Wayne Rasband
In reply to this post by Jeanine Hinterneder
 > I'm taking many sets of images as a series of images in
 > three different colors that correspond to three different
 > stains and get saved as an image stack.  Unfortunately,
 > when I open each image stack in ImageJ, it automatically
 > sets the Minimum and Maximum Intensity  values based on the
 > top image.  I would like to be able to open images with the
 > Minimum set to zero and the Max to 4095 (the max value for
 > my 12 bit camera). It's a real pain to have to go through
 > all my images and readjust every time I open one! So, is
 > there a way to disable this automatic adjustment of
 > brightness contrast that happens when I open an image?

Save the attached plugin in the plugins folder as
"Display_Range_Listener.java", compile it using Plugins>Compile and
Run, add

    macro "AutoRun" {
       run("Display Range Listener");
    }

to the beginning of ImageJ/macros/StartupMacros.txt, and restart ImageJ.

-wayne

// Display_Range_Listener.java
import ij.*;
import ij.plugin.*;
public class Display_Range_Listener implements PlugIn, ImageListener {
        public void run(String arg) {
                ImagePlus.addImageListener(this);
        }
        public void imageOpened(ImagePlus imp) {
                if (imp.getBitDepth()==16) {
                        imp.setDisplayRange(0, 4095);
                        imp.updateAndDraw();
                }
        }
        public void imageClosed(ImagePlus imp) { }
        public void imageUpdated(ImagePlus imp) { }
}