FilterObjects error - No rules found in rule file

Hi guys,

I hope you can help me with what should hopefully be a simple problem to solve.

I am running a pipeline to identify nematodes from fluorescence images. I ran a large training set and used classifier to generate a set of rules to identify correctly-thresholded worms based on the shape features of the worm. I want to use these rules in ‘FilterObjects’ in future pipelines so that I only export measurements from correctly identified worms.

My problem is that in the ‘FilterObjects’ module, when I specify the location of my rules file, it always tells me there are no rules contained in the file.

As there does not seem to be a means of directly saving the rules generated in classifier, I copied them from the ‘EditRules’ window and pasted them into a .txt file. I have tried this multiple times, as .txt or .rtf, with no luck.

I have attached an example pipeline with some sample images. As .txt files cannot be attached, I have pasted below my rules.

Many thanks, both for your help on this specific issue and for your excellent program.


IF (worms_AreaShape_Eccentricity > 0.99165185419599999, [0.86035636311534036, -0.86035636311534036], -0.7079644281798223, 0.7079644281798223])
IF (worms_AreaShape_FormFactor > 0.11701999824000001, [0.47602969452078758, -0.47602969452078758], -0.91619429454306767, 0.91619429454306767])
IF (worms_AreaShape_Compactness > 4.5819733529700004, [0.37728428193760938, -0.37728428193760938], -0.83689604220686775, 0.83689604220686775])
IF (worms_AreaShape_FormFactor > 0.105114680436, [0.1443046260951889, -0.1443046260951889], -0.95406478642880077, 0.95406478642880077])
IF (worms_AreaShape_Zernike_8_8 > 0.0075700869622100002, -0.88531928869492738, 0.88531928869492738], [0.2607195809846628, -0.2607195809846628])
IF (worms_AreaShape_FormFactor > 0.12831285431200001, [0.27537785537926401, -0.27537785537926401], -0.68580271077787225, 0.68580271077787225])
IF (worms_AreaShape_Zernike_2_0 > 0.040535188316400003, -0.60919510057714032, 0.60919510057714032], [0.40720032695026404, -0.40720032695026404])
IF (worms_AreaShape_Zernike_6_6 > 0.0125753498505, -0.999999999999997, 0.999999999999997], [0.12970510786295036, -0.12970510786295036])
IF (worms_AreaShape_FormFactor > 0.13599893993199999, [0.31367721085796124, -0.31367721085796124], -0.52659571728567867, 0.52659571728567867])
IF (worms_AreaShape_Eccentricity > 0.99634635980099995, [0.89638764790906889, -0.89638764790906889], -0.27144201805661633, 0.27144201805661633])
20130714-FilterObjectsProblem-example.cp (10.5 KB)
MFPerez FilterObjects Rules problem example (1.72 MB)

Hmm, this pipeline and rules seem to work fine with me. I’m posting the rules you give me, placed into a file (rename the extension from .zip to .txt); let me know if this still gives you the same error.
-Mark (1.41 KB)

Hi Mark,

This seems to have worked. I still have no idea what the problem with my file was but the issue is solved now. Thanks a lot for the speedy reply!

If you could post the rules file you used in the same way I did (rename the extension from .txt to .zip), I could take a look and see if it’s something about the file itself.

Hi Mark,

Here is the file I was trying with. I think I used TextEdit on a Mac to originally create the file, which doesn’t save in .txt format, which could be a source of the problem. However I also tried with Word and saving to .txt with no luck either.

Thanks again for all your help,

M. Perez (1.74 KB)

OK, now I see the error you’re talking about. Whatever editor you’re using, it’s appending some header information to the file, and that’s screwing things up.

If you’re using TextEdit, can you follow the instructions here ( … plain-text) and give it another try?


Hi Mark,

That does indeed solve the problem. Chalk it up to my inexperience with a Mac.

When I was trying to sort this out, I did notice that the CP2 manual, although mentioning a rules file for this module, never specifies what the format of the file should be. It was obvious it should be a .txt file or similar, but I found the ambiguity confusing when this wasn’t working.

Thank you very much for all your help,

M. Perez

Good point! We’ll update our help accordingly.