Cell segmentation in phase contrast



Hi all,

For a new project, I’d like to track cell shape in phase contrast images. I’ve managed to do something halfway decent using a couple of plugins, but I really think there’s scope to do better.

My images show a quite defined background texture from the plastic dish the cells were cultured on - is it possible to use this as a mask to detect pixels which ‘change’ and therefore should describe the cell as it spreads and moves?

Here’s an example movie;

Can anyone suggest some processing tricks I could use to enhance the contrast of the cell?

Thanks in advance,


Hello @Paul

Unfortunately I can’t see the movie.
Edit: Now I can see it.

Sometimes you can get rid of the background if you subtract from each frame a maximum projection of all frames.


Hello @Paul and @tibuch,

Since the background noise is multiplicative you should rather divide by the average of your frames:

Have a look at this work from Kevin Smith.

Different Types of Noise

Hi @iarganda & @tibuch

Thanks for the replies. I suppose my problem with subtracting an average of the whole stack is that the cell moves quite a lot over the course of the movie. And in fact, this is just 73 frames of a 1,000+ frame movie - so subtracting the average or any z-projection results in a large ‘smear’ across the image. I’m really interested in seeing the change in cell shape with the highest temporal resolution possible (i.e. frame by frame)

I have written a macro to calculate the ‘difference’ frame by frame using the Image Calculator, however just working out the difference isn’t quite right either. If the cell spreads in one direction, and retracts from another, both show up as high values.

So for example, I’ve created this image in which:
Red = Frame 0
Blue = Frame 15
Green = Average projection of 73 frame stack

Here, blue means we have the cell advancing, red means it has retracted, and grey indicates no change. The background of the plastic dish shows up nicely as grey, as I have corrected for drift. This gives me really nice contrast in the red, blue, and green channel - so my question is, how can I segment the image using these channels? Assuming I expand my macro to generate a stack of images like this?



Even better. Why don’t you calculate the average of the 1000+frames and divide each of them by it? It should nicely remove the background noise.

What about you give a try to any of the optic flow plugins such as FlowJ or the PIV analyser?


Hi @iarganda

When I average the stack, then divide through by the average (Image Calculator > Stack divided by AVG) I get nothing - it’s all 0s =/



Did you use a 32-bit result?


Ahh, I didn’t think that through. Thanks! It works perfectly with the 32-bit result

I’ll see what I do for segmentation of this new movie. One problem I’m having is that the averaged image creates a light blur in places where the cell will be/has been:

This means I have a high>low transition at the cell boundary in some places, and a low>high in others. Then, I also have a low>high>low where there’s a cell shadow! I couldn’t get much from FlowJ, but I’m trying the Trainable Weka Segmentation plugin now. Hopefully I can get that to classify the background pixels and then create a mask/ROI to define the cell area


I just discovered there are three optic flow plugins in Fiji that are not documented in the wiki: Gaussian Window MSE, Integral Block MSE and Integral Block PMCC. Maybe @axtimwalde can tell us more about them?


Hi @Paul,
Any luck using the Trainable Weka Segmentation plugin? I was interested in using it on DIC images so let me know if you had any luck implementing this. Thanks,


Hello All,

I have a slightly similar problem with phase image halos/shadow that interrupt the segmentation of my fungal spore edges.

I’ve tried all sorts of blurring and bkground subtraction to try and achieve an accurate measure of the spore area. For that reason I’m not keen to dilate and fill holes to obtain a spherical item. It needs to be representative.

Can anyone suggest a useful tool to eliminate the halo/shadow and leave me with only the cellular material?

Thank you in advance for any suggestions

Example attached.


you might want to try the PHANTAST plugin. Its available via Fiji update site.


Hi @MartinH

That looks really promising. What a fantastic tool.
However, after attacking it more I’ve settled on the Lapcacian segmentation within MorphoLibJ. It works really well for non-germinating spores. Luckily I’m not interested in germlings.

@iarganda Can this Morphological Segmentation work on stacks somehow? I have 20 stacks that I’d rather not have to split in order to use MorphoLibJ’s Lapcacian filter.

Using PHANTAST, it picked up spores and germlings, but they were all a little too inflated for my liking and therefore I’ve rejected it in this case. When I want objects of different shapes, I will certainly use PHANTAST.


Hi all,

@MartinH, thanks for the link! Great tool! I contacted the author and offered a few amends to the code, specifically to work on stacks better, and a couple of other fixes.

I’ve made a pull request to the original author. In the meantime, you can get it at my fork

@Darren_Thomson, I think your images are DIC, as per the directionality of the shadows you have, so unfortunately PHANTAST was not going to do a very good job.


Sorry the huge delay on answering, the answer is yes, Morphological Segmentation works on stacks as well, although you should take into account that it will work in 3D, not on every slice separately.