Feed a CP pipeline with an image from Python

From a previous post, it seems like using the CP inside a Python script is possible but I didn’t find specific examples from the GitHub page. Also, since I’ve developed a pipeline, is it possible for me to use python to feed specific images into that pipeline rather than drag and drop into the GUI? If possible, could you show an example or the syntax of doing so? Thanks!


You may be interested in this thread from last month; the notebook they link (quoted below for ease of you finding it) is the best example for how to do it.

I am using the sample notebook cellprofiler_demo.ipynb at https://github.com/CellProfiler/notebooks and modifying it to run my pipeline.

In general, though, it’s not something that’s super well documented because it’s not often that working in that way is the most efficient thing to do. Running an imported cellprofiler project inside a script you’ll have to handle parallelization, threading, grouping, etc yourself, whereas we’ve already handled all that if you just want to call it through shell scripts, as I stated in the linked post.

cc @lakshmi

1 Like