Using CPA rules in CP 2.0.0 - PROBLEM error

Hi all!

I’m attempting to filter objects based upon measurements collected and rules identified using CPA. I’ve run a general pipeline to first obtain the measurements, classified and identified rules in CPA, saved rules in a *.txt file and loaded these rules in FilterObjects module using the same pipeline HOWEVER I recieve the below error message…Thoughts?

Traceback (most recent call last):
File “cellprofiler\gui\pipelinecontroller.pyc”, line 1019, in do_step
File “cellprofiler\modules\filterobjects.pyc”, line 393, in run
File “cellprofiler\modules\filterobjects.pyc”, line 646, in keep_by_rules
File “cellprofiler\utilities\rules.pyc”, line 133, in score
File “cellprofiler\utilities\rules.pyc”, line 58, in score
File “cellprofiler\measurements.pyc”, line 528, in get_current_measurement
File “cellprofiler\measurements.pyc”, line 553, in get_measurement
File “cellprofiler\utilities\hdf5_dict.pyc”, line 194, in getitem

When I roll my curser over the ‘Rules file name’ It claims that some measurements have yet to be collected…however ALL measurement modules are listed BEFORE the FilterObjects module. Am I missing something obvious such as a simple ordering of modules?

Please help! Thank you!

Please post your pipeline plus the rules file so we can diagnose the issue. Thanks!


I’ve attached my pipeline and rules. I’m attempting to filter 3 separate object types from this pipeline. My problem now being that the measurements will NOT follow those objects post filtering. Meaning i’ll get separate csv files for each filtering step BUT only the metadata and location information will be included…


The rules cannot be attached…I’m not sure what to do about that.

Bovine Ut D0-D42_LE GE RULES.cp (133 KB)

Give a try at posting the rules directly into the text of your message.

The fact that the remaining objects that pass the filtering step do not inherit the measurements from the original objects is expected behavior. Since the filtering step is creating a completely new set of objects, you will need to apply the desired measurement modules to them anew.


Thank you for your response.

How would you properly use the ‘filterObjects by rules’ module/option? I would understand the benefit if the measurements of such filtered objects were able to be exported, but since new measurements must be taken of the filtered objects…why use the rules option?

I like the classifier and rule developer in CellProfiler Analyst but I don’t see the compatibility with CellProfiler, when the goal is to essential dissect a group of objects (based on rules) from the greater population. Thoughts, I would love to incorporate the rules option in order to stream line our projects and experiments…but i believe i’ve hit a snag…

Thank you for your time and collaboration on these topics.


The basic premise behind using the CPA rules option in CP is that in some cases, it is not straightforward to come up with a set of measurements plus cutoff values for those measurements that delineate one phenotype from another. CPA lets you do this, and the rules option in FilterObjects let you benefit from that classification.

I’m guessing that what you’re experiencing may come from the lack of integration between CP and CPA? That is, you have to produce measurements on the objects in CP so CPA on classify based on them, but then you have to loop back around to CP to actually use them for what you want. Unfortunately , there’s no straightforward means around this at this point.

As an aside, you might have noticed that the behavior of measurements not getting passed to new objects is common across all modules. That is, any module which creates a new object set from an old one does not pass along the old measurements to the new objects; each one starts out fresh. The reason for this is we simply don’t know what the user intends to do with the new objects! :smiley: So we we make no assumptions on our part.