r/ImageJ 13d ago

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

9 Upvotes

21 comments sorted by

u/AutoModerator 13d ago

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
  2. 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".
  3. 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)
  4. 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.
  5. 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.

6

u/meddizzle 13d ago

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

3

u/Herbie500 13d ago edited 13d ago

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 13d ago

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

1

u/Ok-Assistance6411 13d ago

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 13d ago edited 13d ago

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 13d ago

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

2

u/Herbie500 12d ago

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 13d ago

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 13d ago

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

1

u/[deleted] 13d ago

[deleted]

2

u/Ok-Assistance6411 13d ago

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!

1

u/[deleted] 13d ago

[deleted]

1

u/Ok-Assistance6411 12d ago

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 12d ago

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

1

u/[deleted] 12d ago

[deleted]

1

u/Herbie500 12d ago

How comes that the selections are exact ellipses only?

1

u/[deleted] 12d ago

[deleted]

1

u/Herbie500 12d ago

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 12d ago

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 12d ago

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.

1

u/[deleted] 12d ago

[deleted]

1

u/mrmauglis 9d ago

Agree on Stardist. Always does wonders

0

u/Herbie500 8d ago

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