Contrast stretching

contrast
fiji
Tags: #<Tag:0x00007fd54740d340> #<Tag:0x00007fd54740cb20>

#1

This post was flagged by the community and is temporarily hidden.


#2

Hi @Axel92Dev, and welcome to the forum!

Enhance Contrast will change the pixel values, as this macro should show:

run("Blobs (25K)");
selectWindow("blobs.gif");
run("Duplicate...", "title=blobs-enhanced.gif");
selectWindow("blobs.gif");
run("Histogram");
selectWindow("blobs-enhanced.gif");
run("Enhance Contrast...", "saturated=10 normalize");
selectWindow("blobs-enhanced.gif");
run("Histogram");
run("Tile");

If the image looks different but the histogram doesn’t change, then I’m not sure what’s going on.

To figure it out, it would be helpful to see a sample image and the exact steps you did, and the histograms before and after. It is convenient to use the macro recorder (Plugins > Macros > Record…) to keep track of your steps.

Hope this helps.


#3

Dear @Axel92Dev,

welcome to the forum! :slight_smile:

The Enhance Contrast command does not actually alter pixel intensities but changes the so-called look-up table (LUT). That is, the mapping between intensity values and color. To propagate the changes to the pixel intensities, you have to run Image > Lookup Tables > Apply LUT.

Best,
Stefan


#4

Trying to resolve this difference in behavior, I discovered Enhance Contrast has different behaviors according to the options that are selected. In the user guide:

This command does not alter pixel values as long as Normalize, Equalize Histogram or Normalize All n Slices (in the case of stacks) are not checked.

So Enhance Contrast does the following:

  • No boxes checked: only the display is enhanced. Image > Lookup Tables > Apply LUT to change pixel values.
  • Normalize or Equalize checked: pixel values will be altered.

#5

Thank you guys, you helped a lot!


#6