Login  Register

Re: How to analyse a pattern of holes?

Posted by Krs5 on Aug 06, 2015; 1:33pm
URL: http://imagej.273.s1.nabble.com/How-to-analyse-a-pattern-of-holes-tp5013892p5013933.html

Dear Bill.

I have put some code together but at the moment the burned etches of the hole is causing still some problems. The code is not optimized yet and nothing is done with the result but it gives you an idea what could be done.  Try it on some of your images and see if it works or what the problems are.

----------------------------------------- code --------------------------------------------
title = getTitle();
title2 = File.nameWithoutExtension();
run("Duplicate...", " ");
run("Mean...", "radius=20");
imageCalculator("Subtract create 32-bit", title, title2+"-1.jpg");
run("8-bit");
run("Subtract Background...", "rolling=50 light");
setAutoThreshold("RenyiEntropy");
//setThreshold(0, 169);
run("Convert to Mask");
run("Analyze Particles...", "size=50-Infinity circularity=0.00-1.00 add");
setForegroundColor(0, 0, 0);
roiManager("Fill");
roiManager("Delete");
run("Analyze Particles...", "size=2-50 circularity=0.00-1.00 add");
roiManager("Deselect");
roiManager("OR");
roiManager("Delete");
roiManager("Add");
roiManager("Select", 0);
getStatistics(area); print("areaAll = "+area);
areaAll = area;
run("To Bounding Box");
run("Fit Circle");
roiManager("Delete");
run("Analyze Particles...", "add");
roiManager("Deselect");
roiManager("OR");
getStatistics(area); print("areaCircle = "+area);
areaCircle = area;
while (areaCircle/areaAll > 0.95){
 
r = areaCircle/areaAll;
print(r);
 run("Restore Selection");
 roiManager("Deselect");
 roiManager("Delete");
 run("Enlarge...", "enlarge=-25");
 run("Analyze Particles...", "add");
 roiManager("Deselect");
 roiManager("OR");
 getStatistics(area);print(area);
 areaCircle = area;
}
while (areaCircle/areaAll < 0.95){
r = areaCircle/areaAll;
print(r);
 run("Restore Selection");
 roiManager("Deselect");
 roiManager("Delete");
 run("Enlarge...", "enlarge=1");
 run("Analyze Particles...", "add");
 roiManager("Deselect");
 roiManager("OR");
 getStatistics(area);print(area);
 areaCircle = area;
}
r = areaCircle/areaAll;
print(r);
run("Restore Selection");
roiManager("Deselect");
roiManager("Delete");
roiManager("Add");
selectWindow(title);
roiManager("Select", 0);

----------------------- end code ----------------------------

This all can get speeded up and looped to open images automatically

Best wishes

Kees

Dr Ir K.R. Straatman
Senior Experimental Officer
Advanced Imaging Facility
Centre for Core Biotechnology Services
University of Leicester
http://www2.le.ac.uk/colleges/medbiopsych/facilities-and-services/cbs/lite/aif

________________________________________
From: ImageJ Interest Group [[hidden email]] on behalf of BillyWu [[hidden email]]
Sent: 05 August 2015 16:18
To: [hidden email]
Subject: Re: How to analyse a pattern of holes?

Dr. Straatman,

Here is a link to one of my image samples.
http://i367.photobucket.com/albums/oo113/Vanguaard/test%204%20A1_zpsq0vzyaqt.jpg

Best regards,


Bill



--
View this message in context: http://imagej.1557.x6.nabble.com/How-to-analyse-a-pattern-of-holes-tp5013892p5013908.html
Sent from the ImageJ mailing list archive at Nabble.com.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html