I often have circular cells which IdentifyPrimaryObjects (with Intensity-based declumping) splits in 2 or three pieces. Unfortunately, many of my cells also have dim spots in the middle, making the Centroid method of ReassignObjectNumbers only work in some cases.
There are two characteristics of these inappropriate divisions: long and nearly-straight dividing lines, and the curvature of the cell continues smoothly past the vertex where the two objects and background (meaning both other objects or no objects) meet.
So I’ve been working on adding this shape-based approach to ReassignObjectNumbers.
What I am doing is finding the vertices, and then within a window around the vertex, I count the number of non-object-pair pixels and divide it by the total expected if the surface were flat, which would yield a value of 0.5; > 0.5 would mean the surface was convex with respect to the background; < 0.5 would mean the surface was concave.
Additionally, I’m considering the perimeter shared by the boundary between the object pairs by dividing it by the diameter of a circle with the same perimeter as the smaller of the objects.
Then I average the maximum vertex value for an object pair and this extent of contact value and joining objects with a score of >= 0.5.
This seems to work very well. Though I’m certain there are more formal improvements I could be making that better match image processing best practices, which I’d appreciate the help with. And one other stumbling block for me is I’m still trying to grasp using array manipulations instead of loops through pixels, so its somewhat slow at the moment. Would anyone be willing to assist me on this?