Valueerror: first argument of bincount must be non-negativ

Dear CellProfiler-Team

Thank you very much for this wonderful software – it is awesome!

I’m writing to you, because I run in a problem with my pipeline, which I cannot fix myself and I don’t know where the problem is…

In brief, I do an image illumination correction followed by identification of primary objects in the corrected image. If I save the corrected image to disk and subsequently run the primary object identification on the corrected image, all works fine. However, if I put both steps together - the following error appears: “Error while processing identifyprimaryobjects: (worker) valueerror: the first argument of bincount must be non-negative…”. i do not understand, how negative values can appear? i’m dividing possitive numbers…

Example images and pipeline are attached; and should just run fine if saved to the desktop.

You’re help is very much appreciated!
Best
Josua
project_1.cpproj (297 KB)



Hi Josua,

The problem is that you are dividing your original image of the grid pattern by your illumination function, however the illumination function is mostly 0 (dark). I’m not sure how you created the illum function, but perhaps you want to Subtract in CorrectIlluminationApply?

Alternatively, you can divide but you must ensure that your illumination function values vary from 1-to-infinity, so that when you divide your original image, you are left with values that range from 0-to-1. The way we usually do this is to save in the .mat format (Matlab) which allows values > 1, and then use LoadImage on that .mat file.

Hope that helps!
David

thank you very much :smile:

it solved the problem!