How to measure deviation from a geometry?

Assume that you were expecting you cell to take a special geometry like to become ellipse or square but it took different geometry. Any idea how to measure the deviation from that geometry?
From the image, the pink plot is what was expected and black is what happened in real.
I need to write a macro code to find this deviation automated. I have the Xs and Ys of the boundary of the black plot of the image. The expected geometries are not always simple like rectangle. If I find the Xs and Ys of the expected geometry, I will be able to subtract the Xs of real and expected when Ys are the same and vice versa and sum all the deviations. But I am not sure how to find the Xs and Ys of the expected geometries.
Thank you!

Capture32
3

Are there two questions in here?

You expect that pink geometry. There must be something that leads you to expect that shape. That may be another image, a general rule, a theory. Isn’t that able to let you generate the pixels for the pink boundary?
For instance ‘the cell will always try to minimise its surface area therefore it will try to look circular when observed from above’, or 'the cell will try to elongate its philopodia, therefore it will try to stretch until its surface to perimeter ration is P. From there, it must be possible to set a formula for the pink boundary and generate a numerical representation.

Once you have both boundaries, you can calculate the differences in various ways, depending on what exactly you expect or need. This might be simple a difference in surface area (growth, decay) by a logic operation on the two filled ROIs, or it might be the least cost to transform the one ROI of pixels into the other one by summing the distance of each pixel of the one outline to the nearest pixel in the other outline. And these are only 2D examples.

1 Like

e.g.: Ellipse
Measurements will give you the parameters of an ‘expected’ ellipse.
(check fitEllipse() in ImageStatistics.java for more details)

From this values it should be a small step to the contour of the ellipse.
(see EllipseRoi() )

1 Like