# Draw sphere around cell in 3D images

Hi, I’m working on 3D images of cells like this.

I also have hand-made 3D coordinates for each cell center (which is probably not the exact center).
My aim is, for each cell, to obtain a sphere which fit, more or less, the volume of the given cell, but being quite new to ImageJ library and image analysis in general, I can’t find a way to do that.

I’ve already made a script to extract cube volumes around each cell so that I can work locally on a 3D interval of the marked center.
I think I should correct the center of mass first to find the center of the sphere, but I don’t know how actually (maybe identifying the local max looking in the NearestNeighborhood).
Then I thought it would be sufficient to select a threshold based on some statistics of the cell cube and then increase the sphere radius iteratively until it finds the border of the cell.

Is this procedure even quite valid?
I’m not looking for a specific answer, instead I’d like to know which ImageJ and/or ImgLib2 tools I should study to get this task done since I’m just a bit familiar with IJ ImageStacks and similar, not much more and have difficulties finding the right documentation/references.

Thank you in advance!
Zemp

Hi @zemp,

Since you have 3D coordinates of the centers, the easiest way to segment your cells would be to use watershed, you can find 3D watershed implementations in 3D ImageJ Suite orMorphoLibJ . Alternatively since your cells are very contrasted, you could use classical thresholding to segment them.

Hope this helps

Best

Thomas

2 Likes

Thank you very much, I found the watershed technique very useful.
One more question: the seeds that I have are not very accurate, so I thought it would be better to re-center the seeds finding the local maximum around it. It works quite well on most images but sometimes it gets a wrong (too local) maximum. Should I try finding more of a center of mass instead of a maximum? And if yes, which algorithm should I try?

Hi @zemp,

Actually in the 3D ImageJ Suite there is a tool I developed long time ago, called Manual Spot Segmentation, that should do what you want. You need to open the raw image, put the list of centres you have in the ImageJ RoiManager, the plugin will look for the closest local maxima and then perform the segmentation. Unfortunately it is not documented but you can give it a try.

Best,

Thomas

Thank you again, I’ve tried to use that tool but I found that looking for local max isn’t the best choice. For this reason now I’m trying to implement the meanshift clustering algorithm using the local maxima of each cell as seeds for better center of mass determination.
I will probably make use of your 3D ImageJ suite library which is very useful for my task. In particular I’ll try to use ImageHandler methods like sphereNeighborhood for the meanshift implementation. Maybe the 3D image suite KDTree would be useful too. Hope you could give me some advice on that.

Thank you anyway

Best,
Zemp

Hi @zemp,

I will be happy to help you to use the library. Looking at your image I am still thinking that thresholding could give you quite good results. You can have a look at hysteresis thresholding or iterative thresholding.

Do you mind sharing some data, so I , and other people, can try different algorithms ?

Best,

Thomas

Here you have four images with relative points. As you can see the contrast and definition of the cells are quite different.

Hi @zemp,

Thanks for the images, they look pretty cool. I tested the iterative thresholding with a hidden feature called markers, if you have an image named markers it will detect only objects containing a marker. Here the results, however it will detect only the soma of the cells, not the neurites.

Best,

Thomas