How extract cluster membership from BioVoxxel Cluster Indicator analysis

I have the following code:

infile = "my_image.tif";
open(infile);
setAutoThreshold("Default");
setThreshold(0, 102);
setOption("BlackBackground", true);
run("Make Binary", " ");
run("Make Binary", "thresholded remaining");
run("Cluster Indicator", "cluster_diameter=40 density=2 iterations=35 method=[average NND] fuse log");

And the following input file my_image.tif

my_image

I get this cluster result

The cluster is indicated in red boundary.
How can I get the cluster membership, in therms of Analyze particles ROI result output.

Hi @Peverall_Dubois,

First, some comments regarding the image. Your image is rather small and thus the resolution quite low. This leads to the fact that your cells (I guess those are cells?) consist of only a few pixels. This can makes it difficult to reliably detect them in the first place and therefore the debris in their surrounding might be of a similar size. I am mentioning this because in your image it looks like there are tiny (1-3 pixel) objects which are most likely no cells. Problem is, that you include those objects in the cluster detection and overestimate the cluster formation.
My suggestion would be to try to image with a higher resolution (bigger image size in pixels for your field of view and magnification). For more suggestions we would need to see also the original image in addition to your binary output image.

Second, I would try to optimize on (having a higher resolution image) the object extraction. Potentially, some filter or background correction can improve this but this again depends on the original image. After optimizing the thresholding (which I would not just do with the “Make Binary” function but rather using a manual or automatic threshold figuring out which setting works for your image series. To this end it might also help to have a look at the following ImageJ wiki pages or workshop videos:

Third, to your question…

What exactly do you mean by that? Do you want to get the Analyze Particle results table with measurements for each single cluster ROI? Or do you want to get the ROIs of the clusters as individual ROIs in the ROI Manager?

Thank you for your suggestion. I meant this:

How can I do that?

The following macro should do this starting with the result image after the cluster indicator was run. It reads in the cluster ROIs and then runs an analysis per ROI.

run("Set Measurements...", "area mean standard modal min centroid center perimeter bounding fit shape feret's integrated median skewness kurtosis area_fraction stack display redirect=None decimal=3");
run("To ROI Manager");
roiManager("Select", 0);
roiManager("Split");
roiManager("Select", 0);
roiManager("Delete");

for(r=0; r<roiManager("Count"); r++) {
	roiManager("Select", r);
	run("Analyze Particles...", "display exclude summarize");
}

Hope this helps

1 Like

Thanks a lot Biovoxxel.

But how can I get the corresponding cluster ID with their member particles ID in Results table??

The code I have below based on yours:

infile = "my_image.tiff";
open(infile);
setAutoThreshold("Default");
setThreshold(0, 102);
setOption("BlackBackground", true);
run("Make Binary", " ");
run("Make Binary", "thresholded remaining");
run("Cluster Indicator", "cluster_diameter=30 density=3 iterations=50 method=[average NND] fuse log");

run("Set Measurements...", "area mean standard modal min centroid center perimeter bounding fit shape feret's integrated median skewness kurtosis area_fraction stack display redirect=None decimal=3");
run("To ROI Manager");
roiManager("Select", 0);
roiManager("Split");
roiManager("Select", 0);
roiManager("Delete");


for(r=0; r<roiManager("Count"); r++) {
	roiManager("Select", r);
	run("Analyze Particles...", "display exclude summarize");
}

The results table I get looks like this:

Hope to hear from you again.

P.D.

Hi @Peverall_Dubois,

in the results table after the name of the image is the number associated with the ROI. The structure is:

name of image : ROI-ID

If you want this to be displayed in the image choose from the ROI Manager ►More►Options… and tick the checkbox next to “use ROI names as label” and you can activate them in the ROI Manager to highlight a specific one in the image.

2 Likes

Thank you so much! That works great.

I have one last question. As you can see in my OP the clustering is sparse. Namely there are some particles that don’t get clustered at all. What should I do in my code to increase the cluster coverage?

Cluster indication depends on the size of the window you use and the particle density specified (so, per se a user biased detection). Obviously, if you increase the area in which the plugin searches for neighbor clustering and/or decrease the minimal density you will get most likely bigger and/or more clusters indicated. But since the sense is rather to test areas of more densely packed objects vs. those not so densely packed a certain stringency should be kept. The algorithm does this according to the DBSCAN clustering method to be more independent of cluster shapes but suffers from the dependency on the user input. According to the explanations in the link, the particles not indicated in clusters do neither represent core points nor reachable points.

[Edit]: In the near future, I might add a new plugin based on DBSCAN clustering, but currently can’t tell a definite date

1 Like