How to save/export outlines coordinates?




Thanks for making this program and from making it available for free.

I have 3 short questions. First question, I looked on the manual and on this forum and it is not clear to me how I can save/export the outline of identified objects (for example for objects which were identified using the IdentifyPrimAutomatic module)? I would like to save the pixel coordinates of each pixel composing the outline of an object.

Second question, how can I make calculations with the LOCATION_CENTER_X (or Y) using the CalculateMath module? Which category of measurement should I use and which feature? I know that Location_Center_X is saved in an excel file when calling the ExportToExcel module, but how can I access Location_Center_X values within CellProfiler and make calculation with it?

Third question, is it possible to label the identified objects directly on the image (for example with label numbers 1, 2 ,3 ect.) in the same order the objects are saved when using the ExportToExcel module?

Thanks a lot for your help,


How to obtain outline coordinates for each cell in an image

Hi Vincent,

I’ll address the questions in order:

]The created outlines are basically a binary image in which the perimeter pixels are 1 and everythign else is 0. So saving the outlines of objects in this context means using the SaveImages module to export an image in your desired format. If you want the individual pixel coordinates, this would require a post-processing step on this image outside of CellProfiler./]
]The ability to make calculations with the Location measure is not supported in 5811Bugfix version, but we have a newer version coming out soon which will support it. In this case, “Location” will show up as a category (or if not, you can chose “Other…” category and type in Location) and then use 1 or 2 for Feature for X or Y, respectively /]
]It is not straightforwardly possible, but it can be done with a workaround. You can use Relate to relate the objects to themselves, and then use DisplayDataOnImage to display the labels of the parents (which is the same as the object labels themselves). To do this in DisplayDataOnImage, select “Other…” for category and type “Parent.” Leave the feature as ‘1’ and it should then work./]



Hi Mark,

Thanks a lot for the clear answers.

Where or what should I keep an eye on to know when the new version allowing calculations with the LOCATION category is out?




We’ll be posting an announcement on the main CP website (we anticipate that it will be within a week from now, so good timing on your part :smiley: ). Also, I can post under this thread when we release (I just have to remember :wink: )


Hi Mark,

I’ll keep an eye on the web site if the new release is already for next week…

I tried what you suggested for displaying label numbers over object but it did not seem to work… Here is what I did:

  • I used IdentifyPrimAutomatic to identify objects, let’s say Nuclei
  • I used the Relate module with the following setting:
    Children objects: Nuclei
    Parent objects: Nuclei
    Other object: None
  • I used the DisplayDataOnImage module with the following setting:
    Which objects would you like to use for the data: Nuclei
    Category: Parent
    Feature: 1
    and the rest of the settings as default settings

but I got the following error message:

There was a problem running the analysis module DisplayDataOnImage which is number 06.
Attempted to access FieldnumsCategory(1); index out of bounds because numel(FieldnumsCategory)=0. Image processing was canceled in the DisplayDataOnImage module (#6) because an error ocurred when retrieving the data. Likely the category of measurement you chose, Parent, was not available for Tablets with feature number 1, possibly specific to image ‘Colored’ and/or Texture Scale = 1.

DisplayDataOnImage in C:\Program Files\Cell Profiler\CellProfiler_mcr\Modules\DisplayDataOnImage.m (117)
AnalyzeImagesButton_Callback in C:\Program Files\Cell Profiler\CellProfiler_mcr\CellProfiler\CellProfiler.m (10424)
gui_mainfcn in C:\Program Files\Cell Profiler\CellProfiler_mcr\CellProfiler\CellProfiler.m (12164)
CellProfiler in C:\Program Files\Cell Profiler\CellProfiler_mcr\CellProfiler\CellProfiler.m (57)

Am I doing anything wrong?
Thanks a lot for your help,



Hi Vincent,

Can you check whether ‘Nuclei’ is selected in DisplayDataOnImage, perhaps selecting it from the drop-down box again, or alternately re-loading the changed pipeline? The error message indicates that a different object, Tablets, is selected. Sometimes, unbeknownst to the user, CellProfiler needs to refresh the list of objects.



Hi Mark,

The name ‘Nuclei’ I gave to the object was for the example. The real object I used in my pipeline was ‘Tablets’… But it’s all the same if you replace Nuclei by Tablets. For clarity I joined the pipeline I use and which leads to the error.
I tried to attach the image as well but it would not let me because it is too big…
So basically, I still have the same problem I descibed in my previous post.
I hope you can point towards what I do wrong with the help of the mat file I sent you.

I am using Version 1.0.5811 on Windows (not through Matlab).

Thanks a lot,

TEST_PIPE.mat (981 Bytes)


Quick question: If you go to Help > Getting Started, what version do you see at top of the window?


I read: CellProfiler version 1.0.5811 Compiled



Ah, your version of CellProfiler is slightly out of date. If you go to the CellProfiler website, you’ll that there is a bugfix version (v.6027) that should solve the problem (another user had a similar issue). Check it out and see if solves your other problem as well.



Hi Mark,

I updated CellProfiler with the latest version (1.0.6031). The DisplayDataOnImage module now works fine. Thanks.

However the error I reported in a separate thread has not disapeared with the latest version… I uploaded 2 test images to use with the pipeline I uploaded in this other thread. I hope you can help me to locate the other error.




Hi Vincent,

I just posted in the other thread with the answer to that question as well.