I have a problem with running CP headless when using it with OMERO.
If I run:
> python CellProfiler.py -r -c --omero-credentials host=localhost,port=4064,session-id=session_id --data-file=image_list.csv -p pipe.cppipe result.mat
CP starts the Display and fails to run in the server environment without a Display Server.
After adding this:
if '-c' in args: import cellprofiler.preferences as cpprefs cpprefs.set_headless()
as the first 3 lines in main() in CellProfiler.py and this:
import cellprofiler.preferences as cpprefs cpprefs.set_headless()
as the first 2 lines in run_pipeline_headless() in CellProfiler.py it runs headless without calling display server.
As far as I can tell the first addition disables calls to the display from set_omero_credentials_from_string() (or in fact from bioformats/formatreader.py) when the first connection to OMERO happens and then the second addition disables it for all the subsequent calls. Since I’m not very familiar with the CP code I’m not sure whether it will not break something elsewhere.