Count black and white cells in the same image

Hello everyone.
I’m new to imageJ so I have some doubts.

The purpose is to evaluate the cell adhesion to a certain surface from a sequence of images during 30 min.
So, I have stacks with 61 slices.I created already a macro (attached below) to count the cells on that slices.

rename("Original");
run("32-bit");
run("Subtract Background...", "rolling=20 light stack");
run("8-bit");
makeRectangle(2, 0, 1000, 1000);
run("Align slices in stack...", "method=5 windowsizex=998 windowsizey=1000 x0=2 y0=0 swindow=0 subpixel=false itpmethod=0 ref.slice=1 show=true");
run("Smooth", "stack");
setAutoThreshold("Default");
setAutoThreshold("Default");
setOption("BlackBackground", false);
run("Convert to Mask", "method=Default background=Light calculate");
run("Analyze Particles...", "size=1-Infinity show=Outlines display exclude clear summarize stack");

Now I want to vary the slices color that allows me to count the cells that remain from one slice to another, the ones that come out and the ones that come and stay in the surface.I already managed to get this image with the following macro (the image is attached below):

rename("cells");
setOption("BlackBackground", false);
run("Make Binary", "method=Default background=Default calculate");
run("Fill Holes", "stack");
run("32-bit");
run("Duplicate...", "title=cells-TMIN1 duplicate range=2-61");
selectWindow("cells");
run("Duplicate...", "duplicate range=1-60");
imageCalculator("Subtract create stack", "cells-TMIN1","cells-1");
selectWindow("Result of cells-TMIN1");
run("Divide...", "value=2 stack");
run("Add...", "value=127.5 stack");
run("Color Balance...");


However, I can not count the black and white cells.

Any help is very much appreciated.
Thank you

HI,

I think it’s easier if you use 3D object counter. Instead of treating the stack as 2D time series, process it as a 3D volume and a connected cell (as a single volume) = a cell that was resident on the glass surface. by detecting the top and the bottom slices of that volume, you can tell when that cell attached/detached to/from the surface.

good luck
Kota

1 Like