Edge lengths and vertex locations

cellprofiler

#1

I know that CP produces perimeter statistics for each cell, but is anyone aware of a method for locating vertices and/or determining edge lengths?

I have a few ideas for doing it myself using the pixel matrix (“image” in the “CPlabel2rgb.m” subfunction), but anything I can think of involves some extra coding that I’m trying to avoid.

I’d imagine that vertices and edge lengths are common enough that someone has them figured out… please please!! :smiley: :smiley:


#2

Hi,

CellProfiler doesn’t have any means for calculating vertices and edge lengths, but it seems like a more general issue is exactly what counts as an “edge” or a vertex.

As it stands now, you can easily get the pixels that comprise the perimeter of an object. Each of these pixels could be considered a vertex with edges of unit length connecting them. But if you had a square object (for example), it’s not unnecessarily intuitive which of these pixels you want to count as a vertex (i.e., corner).

One possibility is to use regionprops (the MATLAB function which computes morphological statistics, and is used quite a bit in CP) to also return the convex hull, the minimum envelope of points which encloses a polygon. This might give you something closer to what you want.

Let us know if you find anything!
-Mark


#3

Thanks Mark. I’ve actually come up with a scheme that suits my purposes for the time being. I’m working out bugs/kinks… but if I get it up and running I’ll forward it to you. You may find a way to generalize the work I’ve done to apply directly into a future version of CellProfiler.


#4

That’s good to hear. Keep us posted!
-Mark