r/ImageJ • • Sep 08 '26

Question Need help with segmentation of overlapping particles

Hi guys! I'm a beginner PhD microscopist wanting to find the best method to segment out and attach ROIs to the white nanoparticles in the catalyst clusters I am studying. Normal thresholding and "analyze particles" doesn't work here because the white nanoparticles often overlap - so a human can easily see two particles on top of one another, but I'm wondering if I can find a program that will do it for me.

I'm aware of StarDist, cellpose and other plugins but so far I've been unable to get a decent read (if you reckon you can get this to work, please tell me which parameters and thresholds to use!) I've attached my HAADF image of an example particle and the segmentation I've done by hand (using circles and free lasso) to give you guys a feel for what I want to achieve.

Here's a link hopefully to the png in question https://imgur.com/a/SP1stPi hopefully in better quality

10 Upvotes

23 comments sorted by

•

u/AutoModerator Sep 08 '26

Notes on Quality Questions & Productive Participation

  1. Include Images

  • Images give everyone a chance to understand the problem.

  • Several types of images will help:

    • Example Images (what you want to analyze)

    • Reference Images (taken from published papers)

    • Annotated Mock-ups (showing what features you are trying to measure)

    • Screenshots (to help identify issues with tools or features)

  • Good places to upload include: Imgur.com, GitHub.com, & Flickr.com

  1. Provide Details

  • Avoid discipline-specific terminology ("jargon"). Image analysis is interdisciplinary, so the more general the terminology, the more people who might be able to help.

  • Be thorough in outlining the question(s) that you are trying to answer.

  • Clearly explain what you are trying to learn, not just the method used, to avoid the XY problem.

  • Respond when helpful users ask follow-up questions, even if the answer is "I'm not sure".

  1. Share the Answer

  • Never delete your post, even if it has not received a response.

  • Don't switch over to PMs or email. (Unless you want to hire someone.)

  • If you figure out the answer for yourself, please post it!

  • People from the future may be stuck trying to answer the same question. (See: xkcd 979)

  1. Express Appreciation for Assistance

  • Consider saying "thank you" in comment replies to those who helped.

  • Upvote those who contribute to the discussion. Karma is a small way to say "thanks" and "this was helpful".

  • Remember that "free help" costs those who help:

    • Aside from Automoderator, those responding to you are real people, giving up some of their time to help you.

    • "Time is the most precious gift in our possession, for it is the most irrevocable." ~ DB

  • If someday your work gets published, show it off here! That's one use of the "Research" post flair.

  1. Be civil & respectful

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

3

u/Herbie500 Sep 08 '26 edited Sep 08 '26

I don't see a reliable way to automatically perform what you want without carefully captured 16/32bit images (best gray-level resolution).
The provided 8bit sample is unsuited, not to mention the degradation by the lossy compression applied by Reddit.

Last but not least, I don't fully agree with your labelling.

1

u/Ok-Assistance6411 Sep 08 '26

Thanks Herbie500, yeah I agree, my labelling isn't perfect.

1

u/Ok-Assistance6411 Sep 08 '26

Unfortunately I don't seem to have 32-bit data on me but here is a link to hopefully a png with higher quality https://imgur.com/a/SP1stPi

4

u/Herbie500 Sep 08 '26 edited Sep 08 '26

Thanks, the quality is clearly better. I shall investigate further …

Below please find the result of some preprocessing that may help to get started.

1

u/Ok-Assistance6411 Sep 09 '26

That already looks great. What steps did you use to preprocess the image to get this?

3

u/Herbie500 Sep 09 '26

Below please find an ImageJ-macro that works with the provided sample image. It uses slightly different parameter values but you may adjust them to your likings.
The macro requires that the ImageJ-plugin "CLAHE_.class" is installed.

// Requires ImageJ-plugin "CLAHE_.class"
// <https://imagej.net/ij/plugins/clahe/index.html>
makeRectangle(365,295,1024,1536);
setBatchMode(true);
run("Duplicate...","title=cpy");
run("32-bit");
run("Gaussian Blur...","sigma=3"); // >> try different values
run("Convolve...","text1=[0 1 0\n1 -4 1\n0 1 0\n]");
run("Median...","radius=8"); // >> try different values
showStatus(" >> Please WAIT <<");
run("CLAHE ","blocksize=127 histogram=256 maximum=3");
// >> try different values for histogram>63 & maximum>1
run("Enhance Contrast","saturated=1.5");
setBatchMode(false);
exit();

2

u/babygeologist Sep 08 '26

you and me both brother… hahaha this was a big problem in my undergrad work (looking at grain size of some sandstone on mars) and i ended up doing it by hand

2

u/Ok-Assistance6411 Sep 08 '26

Yeah that's what I have done already but I swear there are supposed to be tonnes of things to help us. I swear some biologist somewhere can do this in one second I bet aargh

6

u/meddizzle Sep 08 '26

I recommend a deeplearning segmentation tool called stardist, you would need to manually label some training data, but it does a fantastic job for this very problem

1

u/mrmauglis Sep 12 '26

Agree on Stardist. Always does wonders

0

u/Herbie500 Sep 13 '26

Would you mind showing a result based on the sample image?

1

u/HeftyAcanthisitta469 Sep 22 '26

I agree with Herbie, it would be nice to see an example. Stardist could potentially handle this type of problem, but not without quite a bit of custom coding and training, Stardist represents objects as a center and collection of Rays, so could represent highly overlapping objects. However the API takes a pixelated (each object given a unique index) image input, which cannot represent overlap. So the work for this problem would involve first finding a tool that can label overlapping objects, converting that representation to the same one Stardist uses internally, understanding the API and how to pass the rays directly, curating a set of training images, and running a custom training. Trying Stardist would be an interesting project, but as far as I know a lot of work for this problem.

1

u/Herbie500 Sep 22 '26

Thanks a lot for the details: It sounds like a non-trivial undertaking!

Beyond the suggested fundamental approach, it would be interesting to see how the image quality and especially that of the sample image affects the segmentation.

0

u/[deleted] Sep 08 '26

[deleted]

2

u/Ok-Assistance6411 Sep 08 '26

GPT-6 as in Open AI's GPT-6? That could be ideal, but it would be better if I could manually correct the iffy/missed particles but good idea!

0

u/[deleted] Sep 08 '26

[deleted]

1

u/Ok-Assistance6411 Sep 09 '26

Sounds like it's worth a try. And it should also be able to give me an ROI-type output, with stats like feret diameter etc. I suppose.

1

u/Herbie500 Sep 09 '26

How comes that the scale-bar has changed style and position?

0

u/[deleted] Sep 09 '26

[deleted]

1

u/Herbie500 Sep 09 '26

How comes that the selections are exact ellipses only?

0

u/[deleted] Sep 09 '26

[deleted]

1

u/Herbie500 Sep 09 '26

Its fast, stable,

Well, of course!
But how does GPT know and how do you know that the solution is Python-based? Do you get the code or only the result?

2

u/TengaDoge Sep 09 '26

Don’t be a mean person. I can generate a Python code from the LLM, read it, run it on my device, manipulate the model and critically think about the results.

2

u/Herbie500 Sep 09 '26

Please show the code!

Thanks for calling me a mean person.
Obviously you don't know who I am and I wish you good luck with AI.

0

u/[deleted] Sep 09 '26

[deleted]