Error loading images in CPA

After running a simple pipeline through CellProfiler, and pulling up the resulting data in CPA, this error appears whenever we try to view the images. In addition to the error, the images appear as grey boxes in the classifier

An error occurred in the program:
DBException: ERROR: Database query failed for connection “MainThread” and failed to reconnect
Query was: "SELECT Image_PathName_rawGFP, Image_FileName_rawGFP FROM Per_Image WHERE ImageNumber IN (6)"
First exception was: no such column: Image_PathName_rawGFP
Second exception was: ERROR: Database query failed for connection "MainThread"
Query was: "SELECT Image_PathName_rawGFP, Image_FileName_rawGFP FROM Per_Image WHERE ImageNumber IN (6)"
Exception was: no such column: Image_PathName_rawGFP

Traceback (most recent call last):
File “platemappanel.pyc”, line 449, in OnDClick
File “imagetools.pyc”, line 61, in ShowImage
File “imagetools.pyc”, line 51, in FetchImage
File “dbconnect.pyc”, line 665, in GetFullChannelPathsForImage
File “dbconnect.pyc”, line 64, in fn
File “dbconnect.pyc”, line 512, in execute

Any suggestions would be appreciated


If you could post the CPA “.properties” file that would be the most expeditious way for us to help you. The blank thumbnails in CPA mean that an ImageNumber and ObjectNumber pair are being found in the database but there is no data associated (or NULL), or possibly there is something wrong with the Location_X/Y column(s).

But from what you sent the specific error is because CPA cannot find the column “Image_PathName_rawGFP” in your database. This might happen because:
(1) An error occurred in CP before the database was generated. Ensure that there were no error/warning dialogs in running the CellProfiler pipeline (don’t just click “continue”!).
(2) Are you extracting metadata in LoadImages? If so, then the PathName might not be extracted properly – please see this for some ideas: viewtopic.php?f=14&t=3333&p=9325&hilit=+no+such+column+#p9337
(3) Look in your output database for these columns. There are free tools to look at MySQL (e.g. SQLyog for Windows or SequelPro for Mac) or SQLite databases (e.g. SQLite Database Browser for Windows). It is a good idea to look at the data as a sanity check regardless!
(4) Are all the thumbnails blank in CPA Classifier, or only selected ones? If selected ones, that may indicate that you are outputting multiple objects to a single Per_Object table, in which case there may be a non 1-to-1 relationship between the objects. This can cause the yellow warning in ExportToDatabase, in which case you may want to export to multiple per_object tables. See the documentation for ExportToDatabase.
(5) Inspect your properties file. This can be a very “fragile” file, and inspection is a good sanity check.

  • Look for the Location settings, e.g. “cell_x_loc = Nuclei_Location_Center_X” . Ensure that the object named here is the one you intend to classify! In newer versions of CP you can specify this object, but in older versions the default was chosen to be the last object defined in the pipeline.
  • Is the “image_path_cols = Image_PathName_…” setting there, and looks correct? If the metadata wasn’t extracted for this, I think it is possible for this setting not to have been written, which you can fix by creating the database column and populating it with the full pathname.
  • CPA simply concatenated the PathName and the FileName columns to get the location of your files, so ensure that they concatenate to a valid path (are they perhaps on a network server that is inaccessible?)

Hope this helps, and please post your properties file if not.


Here is the per object table that is coming up now. Something has been fixed, as some images will now pull up in CPA, while others present a different error, posted below. What exactly is causing this change I am not sure.

An error occured in the program:
TypeError: unsupported operand type(s) for *: ‘NoneType’ and ‘float’

Traceback (most recent call last):
File “imageviewer.pyc”, line 117, OnPaint.

Once again, I am not sure what this means, and I cannot see anything obviously wrong with the per object table.
Run5.csv (26.1 KB)


(Sorry, I had typed up an answer quite while ago, but I see that it is not here - apologies.)

The short answer is that your Per_Object CSV has two objects, “Cells” and “Stress_Fibers”. This is ok only if the objects have a 1-to-1 relationship, e.g. nuclei to cytoplasm. However, for example, if you have two independent IdentifyPrimaryObjects then the Per_Object table will in general have many blocks of empty or NULL values. Yours has these empty blocks and this will be a problem. When CPA tries to look up the object info from some of these rows in the CSV/database table, it may not find the Location_X/Y values or other data it needs.

To fix this, we highly recommend that in ExportToDatabase you export these as separate per_object tables, rather than a single Per_Object table (In CellProfiler, there is a yellow warning sign that tries to alert you to these issues, though I can understand how this may not be clear to all). You can only classify on one object type at a time anyway, so you need to decide on whether it will be Cells or Stress_Fibers. After CP is run again, you will have multiple Properties files, one corresponding to each object. Ensure that in the properties file that all the object identifiers refer to the correct object (just in case). You could alternatively “fix” the CSV/database manually, but it is more robust to not have this manual intervention.

Hopefully that will fix it.


That fixed the problem. Thank you very much for your help!