Re: Automatically detect circular ROI
Posted by
Herbie on
Nov 14, 2015; 9:15am
URL: http://imagej.273.s1.nabble.com/Automatically-detect-circular-ROI-tp5014946p5014950.html
Chapeau Volko !
Am 14.11.15 um 09:11 schrieb Volko Straub:
> imageName=getTitle;
> run("8-bit");
>
> //find filter and crop image
> run("Duplicate...", "TempImage");
>
> setAutoThreshold("Triangle");
> setOption("BlackBackground", true);
> run("Convert to Mask");
> run("Open");
> run("Dilate");
> run("Invert");
> if(roiManager("count")>0){
> roiManager("Deselect");
> roiManager("Delete");
> };
> run("Analyze Particles...", "size=1000-Infinity circularity=0.5-1.00 add");
> run("Set Measurements...", "area centroid bounding redirect=None
> decimal=1");
> run("Clear Results");
> roiManager("Measure");
> close();
>
> diameter=minOf(getResult("Width",0),getResult("Height",0));
> centreX=getResult("X",0)-diameter/2;
> centreY=getResult("Y",0)-diameter/2;
> selectWindow(imageName);
> makeOval(centreX,centreY,diameter,diameter);
> run("Crop");
>
> //remove gridlines
> run("Duplicate...", "TempImage");
> run("Subtract Background...", "rolling=50");
> setAutoThreshold("Triangle dark");
> run("Convert to Mask");
> run("Options...", "iterations=2 count=1 black do=Open");
> run("Watershed");
> run("Create Selection");
> close();
> selectWindow(imageName);
> run("Restore Selection");
> run("Clear Outside");
>
> //detect colonies
> run("Select None");
> run("Duplicate...", "TempImage");
> setAutoThreshold("MaxEntropy dark");
> run("Convert to Mask");
> run("Options...", "iterations=1 count=1 black do=Open");
> run("Watershed");
> if(roiManager("count")>0){
> roiManager("Deselect");
> roiManager("Delete");
> };
> run("Analyze Particles...", "add");
> close();
> selectWindow(imageName);
> roiManager("Show All");
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html