# Identifying Angles between Object Neighbors

Hi,

I am trying to identify object neighbors for a given image.

Currently, I am using Adjacent type in my module, assuming that the cells in concern, between whom I want to find the angle, are overlapping to a small extent.
However, the angle that I want to calculate is the one between the major axes of the two objects only (Not between the object of concern and closest object 1, 2, which will bring it to a total of 3 objects)

How can I do the same? I have attached the module I am working with and the results obtained.

PS: My objective is to ultimately use the pipeline to locate angles between cells such that it calculates angles (identifying neighbors) only between adjacent ones which are along a flow direction of the chain (and not between other surrounding cells).

Yash Khemka
IIT Bombay

Hi Yash,

cellprofiler.org/forum/viewtopic … 7c40#p9915

Does that help?
David

Yes Sir. It looks like the same things I have been trying to figure out.

Since I am busy with my midsems currently, I will let you know about the results sometime later.

Thanks again!

Sir,

When I am using the identify neighbor function (based on expanding to a specified distance), I do receive the number of objects a cell has as it neighbors.
But I am not getting which objects are the first and second closest neighbors. Instead I get the closest 2 objects based on distance between centers.

For eg. In the image below, cell 2 has cell 1 and 4 as its neighbors, because of which the number of neighbors are two. The second closest NEIGHBOR is cell 4. However, it is showing output as first and second closest object based on distance between centers of cells. Thus, the second closest object is cell 3!

I want the output module such that it shows the first and second closest neighbors (if they exist!) and not the closest objects in general.
What should I do?

Regards,
Yash Khemka
IIT Bombay

Sir,

Any update on the last query posted above?

Hi Yash,

I see the issue, and have reported it to our Github tracker github.com/CellProfiler/CellPro … ssues/1214 . Indeed the objects labeled as “closest” are not necessarily neighbor objects. I don’t know of a way around this without rewriting MeasureObjectNeighbors (anyone else have thoughts?) so we’ll let you know if/when we add this feature. (I am not calling it a “bug”, per se, but we could definitely clarify how we define these closest objects). My suggestion is to add an option to filter the closest objects as those that are only counted as neighbor objects.

Thanks,
David

David Sir,

I wanted to clarify an extremely crucial point here.

1.) The function MeasureClosestObject is completely correct because it is defined for the distance between object centers and gives output as those 2 cells which have the smallest distance between their centers.

The only point I was trying to make is whether we can add a function of MeasureClosestNeighbor. I mean CellProfiler identifies number of neighbors depending on the type we add (Adjacent/Expand till a distance etc). Since it is already identifying them, can’t we add something to the software so that it can also give output as the cell number which has been identified as the neighbor? (without confusing it with MeasureClosestObject)

2.) Also, you suggested to add an option to filter the closest objects as those that are only counted as neighbor objects. How can we do that?

Regards,
Yash Khemka

David Sir,

Any update on adding a function of MeasureClosestNeighbor?

Also, I couldn’t figure out how to add an option to filter the closest objects as those that are only counted as neighbor objects. How to do it?

Yash Khemka

Hello Yash,

Does the description here capture your issue? It is not our highest priority since you are the first to request this, but it is in our “Future-Sooner” queue, I would guess on the months timescale.

And to answer your second question, my “suggestion” was directed toward our software engineer for how to change the code, not for you, the user. But feel free to change the code yourself, and we do accept code suggestions when warranted!

Thanks,
David