Isolate a crystal of sugar

Hi there,

I am new using Image J and I am stuck analysing this image.

I want to get a single crystal of sugar, so I can mesure it more easily.

In the end, I should get something like “result.png”.

Can you help me?




Hi Martin,

and welcome to the Forum!

I would suggest dividing your workflow into two steps. First, isolate the bright phase (“segmentation” step, second, separate the components (1 component <-> one cristal ?).

For the first step, a threshold should be enough (Image->Adjust Threshold…"). If necessary, you could smooth the image before applying threshold.

For the separation, a typical way to separate overlapping or touching particles is to apply a distance map (i.e., compute for each foreground voxel the distance to the background), computes its complement (voxels within grains will have lower value than voxels close to borders), apply a 3D watershed to compute the region associated with each grain, and combine with the original binary image.
I suggest using the MorphoLibJ library (disclaimer: I am one of the authors), that contains the tools for performing it. In particular, the plugin “MorphoLibJ->Binary Images->Distance Transform Watershed 3D” should work out of the box for the separation operation.

Hi, thanks for the answer,

First of all, congrats for your library, it works well!

For the moment, I have this two images :

It’s way easier to do my measures now. But I couldn’t extract a single crystal from all the components…

Should I use the MorphoLibJ library?


What I had in mind is shown for example here (Fig. 6):

if you have some noise (black dots) inside the particles, this will generate unwanted boundaries. So you need to either adjust the threshold value, or use filtering before threshold (gaussian, median…), or use post-procedding to remove small black dots (median, morphological closing).

hope this helps?

Yeah, this helped a lot, I have a great image now.