How to crop images nuclei automaticaly

Dear all,

i would like to autodetect the blue nuclei on the append picture, and after that i would like that they get saved in single pictures, so that every nuclei it self is saved,
i found some description how to count them but not how to crop them automaticaly

thank you

Good day Marcel,

you may have a look at the macro recoder feature of ImageJ. And please study the relevant sections of the ImageJ user guide:



Here in this older thread I created a script to save all cropped particles from a particle analysis (along with the results table). It might be a help for you:

Essentially it performs a particle analysis (the final macro does this from multiple images in a folder) which adds each detected particle to the ROI Manager.

Then each selection (ROI) is cropped and saved as an image.

1 Like

Wow thats amazing :slight_smile: hmm but works only for jpg why not for tiff?

It does work here with you sample image when saved in TIF-format.



Hi Herbie and Marcel,

I am very new at this stuff.
I tried to copy the macro listed above into the “record macros” thing. Then I saved it in Macros. Then I installed it. It appears as a macro, but when I try it on a jpg of a histologic image, all I get is “clear outside”

Please tell me what I have done wrong.

Good day,

please try the macro with the sample image, the OP has posted!

Paste the macro code to an empty macro window (Plugins >> New >> Macro) and run it with the sample image open in ImageJ.

Make sure you’ve copied the whole macro code. It ends with “exit();”

And please never ever use JPG-compressed image for scientific work because JPG introduces artifacts that can’t be removed!

Please report if you still encounter problems with the macro when applied to the OP’s sample image.

Applying the macro to other images may indeed not work and you should post typical images of the kind you like to process, so that we can have a look at them and perhaps adapt the processing.