Hi @iarganda,

Sorry for asking your help again.

I created a very simple macro to obtain “the mean and the standard deviation of the intensity of each image and select the one with the most common mean and largest standard deviation”.

```
//Get the Result Table
if (nSlices>1) run("Clear Results");
getVoxelSize(w, h, d, unit);
n = getSliceNumber();
Stack.getStatistics(stackMean);
for (i=1; i<=nSlices; i++) {
setSlice(i);
getStatistics(area, mean, min, max, std);
row = nResults;
if (nSlices==1) setResult("Area ("+unit+"^2)", row, area);
setResult("Mean ", row, mean);
setResult("Std ", row, std);
setResult("Min ", row, min);
setResult("Max ", row, max);
}
setSlice(n);
updateResults();
//Get the stackMean
sum =0;
for (d=0; d<=nResults-1;d++)
sum= sum + getResult("Mean ", d) ;
stackMean=sum/nResults;
print("stackMean = ", stackMean);
//Get the maxStd
maxStd=0;
for (d=0; d<=nResults-1;d++)
if (maxStd<= getResult("Std ", d)) maxStd=getResult("Std ", d) ;
print("maxStd =",maxStd);
//Determining which image is representative
for (f=0; f<=nResults-1;f++)
setResult("optMean",f, ((getResult("Mean ", f)-stackMean)*(getResult("Mean ", f)-stackMean)));
for (f=0; f<=nResults-1;f++)
setResult("optStd",f, ((getResult("Std ", f)-maxStd)*(getResult("Std ", f)-maxStd)));
for (f=0; f<=nResults-1;f++)
setResult("optValue",f,getResult("optMean",f)+getResult("optStd",f));
```

However, I need to determine which parameter (between the mean or the standard deviation) is the more significant in aim at optimizing my image selection. Do you know how I could weight my optimization function (i.e this part : getResult(“optMean”,f)+getResult(“optStd”,f))

Thank you in advance for your kind help,

Best

Baptiste