Automatic calculation or adjustment of object size Min/Max?



Dear all,

It seems that right now you have to explicitly set Min and Max parameters for object boundaries. Would it make sense to try to figure it out or adjust it dynamically in the following way:

  1. Run IdentifyPrimAutomatic method using threshold-only technique to
    determine the edges.
  2. Build a statistical distribution of object sizes. In the assumption that most of the nuclei are dispersed and of similar size the resulting histogram should contain a big peak. Parameters of this peak such as mean value and variance can help to set ro readjust Min and Max parameters.
  3. Run IdentifyPrimAutomatic method again with adjusted Min and Max parameters.


That is an interesting idea.

We often allow the user to enter “Automatic” for certain settings, making CellProfiler calculate a reasonable guess. Here is a question, though - would you want it to calculate a reasonable minimum and maximum size based on the first image and then apply those settings to ALL images, or would the min/max be calculated separately for each image? The latter could be a bit dangerous because if you are looking for samples that are unusual, their distributions of areas might be unusual (and non-Gaussian). And what to do when there are few (or even zero) objects in the image?

FYI, the min/max size is used for two things: throwing out objects that are too small or too large (if the user chooses to do so), and setting some of the filter sizes for smoothing as part of the identify process.

Perhaps you could flesh out your idea a bit more to help us think whether it would be a good addition.



Hi Anne,

Do you know if it’s possible to configure a pipeline in such a way that it produces object sizes as part of its output? I tried to play with “Colonies” and SBS examples posted on web site but couldn’t figure out where to get this information from. Maybe simply manual inspection of object sizes histogram may help a user to decide if there is a need to rerun the analysis with different parameters?

You are right that for there will be unusual and non-Gaussian distributions in some cases. Maybe in these cases one can simply use mean value and standard deviation of the entire histogram?

When analyzing series of images, I think that it’s better to make min/max estimates for each image separately. However, min/max estimates made for previous images can be used as “seed” min/max values for the current image.



Hm, I am not entirely sure what you are asking. Individual object sizes can be measured by MeasureObjectAreaShape which will deposit the measurements into the output file. You can then export the sizes to an Excel file using the data tool ExportToExcel or you can show the sizes on one of your images using the ShowDataOnImage data tool. Note that the MeasureObjectAreaShape module records size measurements like area, major axis, minor axis, etc. It does not directly record diameter, which is the measurement that the IdentifyPrimAutomatic uses. IdentifyPrimAutomatic uses diameter because it is convenient to use the ShowPixelData option from the CellProfiler ImageTools menu (in a figure window, this option is available) to measure your cells in images by their width/diameter (whereas it is very tough to ‘eyeball’ cell area!) However, diameter only makes sense for a circular object, and objects are rarely circular, so diameter is not a measurement that is stored in the output by MeasureObjectAreaShape.

When you enter min/max sizes in the IdentifyPrimAutomatic module, it internally converts those diameter values to area values, based on a circle. In its display window after processing an image, it shows you the range of sizes of objects that are found, in diameter units (It shows the 5th and 95th percentile diameter values; again the diameter is calculated from the area of the objects, as if they were circular).

To show a histogram you could use the data tool Histogram. I’d recommend plotting the area measurements, then you could calculate sizes in your head.

Hopefully that explains everything you wanted to know about sizes in CellProfiler. But it’s all a little unclear why this is such a concern to see what the answers are - usually people determine if the settings are good by looking at the figure window of IdentifyPrimAutomatic and deciding whether the cells look properly identified, and in the bottom left corner seeing whether the cells are discarded by size properly (the red outlines are the cells discarded by size).

We typically want the settings to be consistent from image to image for scientific reasons, so I don’t think most users would want the min and max sizes to change from image to image, especially given that those parameters affect the cell identification itself, and not just whether the cells are thrown out of analysis or not. You are welcome to add the feature to the code yourself, if you like! :smile: