Login  Register

Only count cells that contain nuclei (or holes in the binarized image)

Posted by Christopher Coulon-2 on Oct 15, 2015; 6:21pm
URL: http://imagej.273.s1.nabble.com/Only-count-cells-that-contain-nuclei-or-holes-in-the-binarized-image-tp5014654.html

This macro utilizes the analyzeParticles routine with and without the “include holes” option.

// intended for the binary image

setAutoThreshold("Default");

run("Set Measurements...", "area redirect=None decimal=5");
run("Analyze Particles...", "size=100-Infinity display exclude clear");

noHoles = newArray(nResults);
holes = newArray(nResults);

for (i = 0; i < nResults; i++) noHoles[i] = getResult("Area", i);

run("Analyze Particles...", "size=100-Infinity display exclude clear include");

print("Particles Containg Holes");

for (i = 0; i < nResults; i++) {
        n = i+1;
        holes[i] = getResult("Area", i);
        a = holes[i] - noHoles[i];
        if(a > 0) print(n + " area of hole = " + a);
}


> On Oct 15, 2015, at 8:38 AM, kirbyfloss <[hidden email] <mailto:[hidden email]>> wrote:
>
> Hi - is there a way to only count the cells in the attached binarized image
> that contain "holes"?
> <http://imagej.1557.x6.nabble.com/file/n5014650/workingCopy.png <http://imagej.1557.x6.nabble.com/file/n5014650/workingCopy.png>>
>
> I am trying to analyze slides with muscle stained with H&E - and would like
> to count the number of regenerating muscle fibers, which are distinguished
> by dark nuclei in the interior of the cell bodies (rather than on the
> periphery).
>
> This is the pipeline I have set up thus far:
> 1) Apply colour deconvolution (using plugin by G. Landini)
> 2) Set threshold to binarize the resulting image in channel 2
> 3) Analyze particles
>
> This works reasonably well to count all the cells in an image, but is there
> any way to only count the cells that contain a hole (or multiple holes)
> automatically? I'm aware of more manual tools, like Cell Counter, but was
> hoping for the most automated solution possible.
>
> Thanks!
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Only-count-cells-that-contain-nuclei-or-holes-in-the-binarized-image-tp5014650.html <http://imagej.1557.x6.nabble.com/Only-count-cells-that-contain-nuclei-or-holes-in-the-binarized-image-tp5014650.html>
> Sent from the ImageJ mailing list archive at Nabble.com <http://nabble.com/>.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html <http://imagej.nih.gov/ij/list.html>
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html