//Autothreshold‚ð—p‚¢‚é convergence_threshold = 1; getSelectionBounds(roix, roiy, roiwidth, roiheight); if(getSliceNumber() != 1){ showMessage("Select first slice."); exit(); } iSlice = 1; seltype = selectionType(); if(seltype < 0 || seltype >= 5){ showMessage("Make adequate selection."); exit(); } meanlist = newArray(nSlices+1); minlist = newArray(nSlices+1); maxlist = newArray(nSlices+1); setAutoThreshold("Li dark"); run("Set Measurements...", "area min centroid stack redirect=None decimal=3"); run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00 show=Nothing display clear slice"); if(nResults == 0){ showMessage("No objects found at first slice."); exit; } maxarea = 0; maxi = 0; for(i=0; imaxarea){maxi = i;} } objx = getResult("X", maxi); objy = getResult("Y", maxi); offsetx = roix - objx; offsety = roiy - objy; ///////////////////////// Slice loop ////////////////////////// for(iSlice=1; iSlice <= nSlices; iSlice++){ setSlice(iSlice); repeat = 1; do{ prevobjx = objx; prevobjy = objy; run("Restore Selection"); setSelectionLocation(objx + offsetx, objy + offsety); setAutoThreshold("Li dark"); run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00 show=Nothing display clear slice"); if(nResults == 0){ showMessage("No objects found at "+iSlice+"th Slice."); exit; } maxarea = 0; maxi = 0; for(i=0; imaxarea){ maxarea = area; maxi = i; } } objx = getResult("X", maxi); objy = getResult("Y", maxi); repeat++; //print("pow" + iSlice + " " + objx + " " + prevobjx + " " + pow((objx-prevobjx),2)); } while ( pow((objx-prevobjx),2) + pow((objy-prevobjy),2) > pow(convergence_threshold,2) && repeat<=5) run("Restore Selection"); setSelectionLocation(objx + offsetx, objy + offsety); getStatistics(area, mean, min, max, std, histogram); meanlist[iSlice]=mean; minlist[iSlice]=min; maxlist[iSlice]=max; run("Draw", "slice"); //print("Slice" + iSlice + ": repeated " + repeat-1 + " times"); } run("Select None"); resetThreshold; print("area= ", area); print("slice mean mean-min"); for(i=1; i<=nSlices; i++){ print(i + " " + meanlist[i] + " " + meanlist[i]-minlist[i]); }