Login  Register

Re: Averaging intensity along an outline

Posted by Michael Schmid on Jan 24, 2014; 1:14pm
URL: http://imagej.273.s1.nabble.com/Averaging-intensity-along-an-outline-tp5006251p5006258.html

Hi Jan, Jan, Wayne, and everyone,

to me it seems that the outlines of 'Analyze particles' are what you get from the particle's selection by 'draw'. These outlines are inside the particle in the top-left and outside the particle at the bottom right side. The particle analyzers 'Outlines' and 'Bare Outlines' are the same in this respect.

I agree that it would be nicer to have 'Analyze particles' draw the outlines as Process>Binary>Outline does it: These are completely inside the particle. With the outlines inside, it can never happen that the outlines of adjacent (but separate) particles touch.

There may be a problem, however, with changing this: 'Analyze Particles' is a core component of ImageJ that is used in thousands of user macros. Changing it might break some established macros or change the result of established analysis methods somewhere out there.

---

In any case, for analyzing the edge of particles, I would use Process>Binary>Outlines on the binary mask (it does not matter whether you create it with 'Analyze Particles' or Edit>Selection>Create Mask on a thresholded image; just beware that no image namedm 'Mask' should be present when running 'Create Mask').
Then, in Set Measurements,  redirect the measurement to your original image and run 'Analyze Particles' on the mask with the outlines ('include holes' should be off).
Now the 'Mean' column will be the average intensity of the outline.

Michael
________________________________________________________________
On Jan 24, 2014, at 12:29, Jan Brocher - BioVoxxel wrote:

> 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

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