Dear all,
I would like to adjust the intensity of my Z stack.
I would like to measure the mean, the minimum and the maximum intensity of each slide. I would like to adjuste the min and max intensity depending on the mean intensity. I wrote a macro:
adjustBackground();
function adjustBackground(){
run("Set Measurements...", "area mean standard min display redirect=None decimal=3");
slices=nSlices();
for(i=1 ; i<=slices ; i++) { //function to adjust the bright field background according with the initial mean intensity (cutoff 8).
setSlice(i);
List.setMeasurements();
background = List.getValue("Mean");
print(background);
min = List.getValue("Min");
print(min);
max = List.getValue("Max");
print(max);
if(background<8) {
setMinAndMax(min, 80); // for dark bright field
}
if(background>8) {
setMinAndMax(min/1.2, max);// for bright bright field
}
}
}
So, ideally, I would like that on those slides where the intensity is below 8, the minAndMax intensity were adjusted to (min, 80). If the mean intensity of the slide was below 8, then I would like that the intensity was adjusted to (min/1.2, max).
Unfortunately, the script adjust the intensities of the slides according with the last slide which is a black slide.
Can someone help me to understand what is not working here?
Thank you.