Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Region Adjacency Graph giving no output... #21

Closed
lacan opened this issue May 4, 2018 · 2 comments
Closed

Region Adjacency Graph giving no output... #21

lacan opened this issue May 4, 2018 · 2 comments
Assignees

Comments

@lacan
Copy link
Contributor

lacan commented May 4, 2018

Hi, I would like to use the Region Adjacency Graph Plugin, which says works on labelled images. However I fail to get any data out of it.

If I run this imageJ macro code

run("Blobs (25K)");
setAutoThreshold("Default");
run("Analyze Particles...", "  show=Masks");
run("Connected Components Labeling", "connectivity=4 type=[8 bits]");
run("Region Adjacency Graph", "  image=blobs.gif");

The results table is empty

@dlegland dlegland self-assigned this May 4, 2018
@dlegland
Copy link
Contributor

dlegland commented May 4, 2018

Hi,
this is not really a bug. In this sample image, the blobs do not touch each other, and hence are not adjacent. Therefore, an empty output is normal...

To have an adjacency result, one possibility is to compute the influence region of each blob, using for example watershed on the distance transform.

run("Blobs (25K)");
setAutoThreshold("Default");
//run("Threshold...");
//setThreshold(126, 255);
setOption("BlackBackground", false);
run("Convert to Mask");
run("Close");
run("Invert");
run("Chamfer Distance Map", "distances=[Borgefors (3,4)] output=[32 bits] normalize");
run("Classic Watershed", "input=blobs-dist mask=None min=0 max=255");
run("Region Adjacency Graph", "show image=blobs.gif");
selectWindow("blobs.gif");

Hope this helps?

@lacan
Copy link
Contributor Author

lacan commented May 4, 2018

Hi,

Thanks for the heads up! I see now that you expect the regions to be touching. Thing is I would have expected it to work by first computing a voronoi diagram (which is what you did) and that it was then simply measuring the distance of each particle to its delaunay neighbors.

But not I see that I need to add that extra step myself. Thanks so much. I did almost the same but passed by the voronoi diagram.

run("Blobs (25K)");
setAutoThreshold("Default");
//run("Threshold...");
//setThreshold(126, 255);
setOption("BlackBackground", false);
run("Convert to Mask");
run("Voronoi");
setThreshold(0, 1);
setOption("BlackBackground", true);
run("Convert to Mask");
run("Connected Components Labeling", "connectivity=4 type=[8 bits]");

run("Region Adjacency Graph", "show image=blobs.gif");
selectWindow("blobs.gif");

@lacan lacan closed this as completed May 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants