problem with incomplete contrast adjustment

Posted by Finn Peters on
URL: http://imagej.273.s1.nabble.com/problem-with-incomplete-contrast-adjustment-tp3683343.html

Hi,

in the following macro I do contrast and brightness adjustments on two
images (one in red the other in green) and subsequently a selection of
the red image is laid over the green image. Now I am quite puzzled
because the same macro seemingly by chance yields different results (see
attached jpgs) In the first case it worked out but in the second example
only the upper part of the green image has been adjusted in contrast.
The bottom part still has the same linear contrast as in the orignial image.

I really have no idea what could be the reason for this.

cheers,

Finn


macro code:


inputFolder = getDirectory("Input folder");
files = getFileList(inputFolder);
count = 0;
id = 0;
for (i = 0; i < files.length; i++) {
         open(inputFolder + files[i]);
         id2 = id;
         id = getImageID();
         count++;
         if ((count % 2) == 0) {
             selectImage(id);
             run("8-bit");
             run("Red");
             setAutoThreshold("Default");
             //run("Threshold...");
             setThreshold(3, 7);
             run("Create Selection");
             run("RGB Color");
             run("Copy");

             selectImage(id2);
             run("Brightness/Contrast..."); setMinAndMax(16, 44);
             run("Paste");
             run("Select None");

             name = getTitle();
             saveAs("Tiff", "C:/Users/Admins/Desktop/test/target/"+name+
"_merged.tif");
             close();
             close();
             count = 0;
         }}

merged version 1.jpg (3K) Download Attachment
merged version 2.jpg (2K) Download Attachment