Object Identification in Resized Images

Hi everybody,

I am currently performing an analysis based on the segmentation of cells using CellProfiler followed by classification with CPAnalyst. Since my images are quite big and so are my cells, I perform noise removal and primary object identification using a downsized (4x) version of my images with no significant loss of performance. My problem is I would like to perform the subsequent object measurements on the original images (not downsized) but since I did object identification on the downsized ones, my object coordinates/data… refers to these images and will not match the original ones.

My question is if there’s any way to overcome this problem, like “resizing” the objects. For me it’s really important to perform the measurements on the originals for classification purposes as well as the processing time reduction achieved by downsizing the images (it gets around 10x faster) since I’m doing high throughput microscopy.

I know that this may not have a straight solution with the current version of CellProfiler but thanks anyway for your help and for the great tool CellProfiler is.

Juan Escribano

We don’t have a means for doing this explicitly. However, a possible workaround is to add the CalculateMath module (located under the Data Tools category) to your pipeline. Try the following:

  • Set the operation as “Add”

  • Select Object as the 1st operand object

  • Select the X Location as the measurement.

  • Multiply the 1st operand by whatever factor you scaled by (e.g, if downsized by 4x, multiply by 4).

Since at least two operands are required (for now), the 2nd operand needs to be zero for this to do the right thing.

  • Select whatever measurement you want as the 2nd operand

  • Multiply the 2nd operand by zero.

  • Give the result an appropriate name.

  • Repeat the above steps for the Y coordinate location.

Note that this is only for the object locations in the image, which is required by CPA by specifying the measurement column in the properties file. If you wanted to upscale the measurements as well, you would have to do something similar for all the measurements and of course, the type of scaling will vary depending on the measurement (perimeter vs. area for instance). However, if the measurements scale linearly between the phenotypes of interest, this should make no difference to the effectiveness of the machine learning tool, so you should be able to leave them as they are.

Hope this helps!

Hi Mark,

Thank you for the help! However, I tackled the problem directly and programmed a CP module myself to do this. I used Resize as a starting point so much of the work was done.

I’m still testing testing the module to see that everything works ok. In case you find this feature useful, I can send you the script when I finish the tests.


Sure, we’d appreciate it if you post the script when you’re done.