// Smallest valued mode of a stack if (nSlices<2) exit("This macro requires a stack."); makeModalZProject(); function makeModalZProject() { setBatchMode(true); run("Reslice [/]...", "input=1.000 output=1.000 start=Top"); depth = nSlices; width=getWidth(); height=getHeight(); for (z=0; zmodef) modef=h[p]; } // the following will get the smallest valued mode i=0; // change to 255 to get the largest valued mode while(h[i]