Posted by
gankaku on
Jan 24, 2014; 11:29am
URL: http://imagej.273.s1.nabble.com/Averaging-intensity-along-an-outline-tp5006251p5006252.html
Hi Jan,
The following macro might give you the desired result.
@ Wayne Rasband & all
I figured out that actually the outlines you get after "Analyze Particles" and the ones you can produce under >Process >Binary >Outlines are not the same. Furthermore the ROIs you get after selecting "Add to Manager" under the Analyze Particle menu are exactly the inner part of the outlines produced by >Process >Binary >Outlines.
The question here is if these differences exist on purpose or due to a difference in the outline production due to the java code or if this might be a bug!??
Here is the macro....
//average intensity at particle outlines
openImages=nImages;
if(openImages==0) {
exit("No open images found");
}
imageNames = newArray(nImages);
for (i=0; i<imageNames.length; i++){
selectImage(i+1);
imageNames[i] = getTitle();
}
Dialog.create("Setup");
Dialog.addChoice("original image:", imageNames);
Dialog.addChoice("binary image", imageNames);
Dialog.addString("Area", "0-Infinity");
Dialog.addString("Circularity", "0.00-1.00");
Dialog.addChoice("Show", newArray("Nothing", "Outlines", "Bare Outlines", "Ellipses", "Masks", "Count Masks", "Overlay Outlines", "Overlay Masks"), "Nothing");
Dialog.addCheckboxGroup(3, 2, newArray("Display results", "Clear results", "Summarize", "Add to Manager", "Exclude edges", "Include holes"), newArray(false, false, false, true, false, false));
Dialog.show();
original=Dialog.getChoice();
binary=Dialog.getChoice();
Area=Dialog.getString();
Circularity=Dialog.getString();
Output=Dialog.getChoice();
DisplayResults=Dialog.getCheckbox();
if(DisplayResults==true) {DisplayResults=" display";} else {DisplayResults="";}
ClearResults=Dialog.getCheckbox();
if(ClearResults==true) {ClearResults=" clear";} else {ClearResults="";}
Summarize=Dialog.getCheckbox();
if(Summarize==true) {Summarize=" summarize";} else {Summarize="";}
AddToManager=Dialog.getCheckbox();
if(AddToManager==true) {AddToManager=" add";} else {AddToManager="";}
ExcludeEdges=Dialog.getCheckbox();
if(ExcludeEdges==true) {ExcludeEdges=" exclude";} else {ExcludeEdges="";}
IncludeHoles=Dialog.getCheckbox();
if(IncludeHoles==true) {IncludeHoles=" include";} else {IncludeHoles="";}
roiManager("reset");
setBatchMode(true);
selectWindow(binary);
run("Select None");
run("Analyze Particles...", "size=" + Area + " circularity="+Circularity+" show=" + Output + ExcludeEdges + ClearResults + IncludeHoles + Summarize + " record" + AddToManager);
n = roiManager("count");
roiManager("Show None");
selectWindow(original);
run("Select None");
for(i=0; i<n; i++) {
roiManager("select", i);
run("Make Band...", "band=1");
roiManager("Update");
run("Measure");
}
setBatchMode(false);
//end of macro
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html