XY center coordinates for objects and all their neighbors

How can I get the (x,y) center coordinates for all the neighbors, not just the 2 closest ones, of each object?

What are the coordinates in Location_Center_X and Location_Center_Y (in the CSV output file from the ExportToExcel module) relative to? Most images use (0,0) as the coordinate for the upper left corner of the image and measure in pixels. Is that the case here?

Are the units for Location_Center_X and Location_Center_Y in pixels? If not, how would I convert them?

I’m a decent programmer, so if there’s no solution in CellProfiler, I can write a script for post-CellProfiler analysis/calculations. I just would need a suggestion on how.

BTW, here’s my general CellProfiler status/info:

Current pipeline and sample images attached.
Current version of CellProfiler is the one labeled 5811 Bugfix.
I am using an Intel Mac Pro with OS X Leopard.

pipe_5811bugfix_01.mat (1.7 KB)


The Location_Center_X and Location_Center_Y are the centroids of the objects as defined by Matlab’s regionprops function, performed on the label matrix of objects identified by IdentifyPrimAutomatic. (0,0) is in the lower left-hand corner of the image. Location_Center_X and Location_Center_Y will tell you the center coordinates for all objects.

For neighbors, the corresponding labels for each objects’ neighbors are stored in handles.Measurements.Neighbors.IdentityOfNeighbors. Since this measurement doesn’t fit with the normal CellProfiler structure, it isn’t output in ExportToExcel or ExportToDatabase, so it can only be viewed by opening the .mat output file in Matlab. For example, to extract the number of neighbor for objects called Cells, use code like this:
where 1 is the image number and 3 is the object number. This yields a list of the objects who are neighbors with Cell object 3. The ‘list’ is a set of labels, so to get the actual center coordinates you would have to compare the ObjectNumber (which is output in the Export modules). For example, if the above code yielded the list [13 32], you would look up the value of Location_Center_X and Location_Center_Y for objects 13 and 32 in image 1. Those would be the centroids of the neighbors of object #3.