Running cellprofiler modules separately in headless mode

I started looking at cellprofiler in headless mode. I could run it with command like
‘cellprofiler -r -c -i /input -o /output --pipeline=…’

As I understand, each pipeline involves multiple modules so is it possible to execute each module alone in commandline? For example, can we do something like

‘python -m cellprofiler.identifyprimaryobjects -i /input-image-dir/ -o /output-dir’

if this is not possible, what is the best approach to execute individual module alone?

Thanks very much for any help
Yi

Hi Yi,

I think this would depend on what you’re hoping to get out of running an individual module. I’m not sure if the modules are designed to be able to be run independently of CellProfiler itself. In theory you could just create a pipeline containing one module, such as identifyprimaryobjects, but I expect you’d want to use additional modules to export or make use of the segmentation that this produces. Do you have a particular use case in mind?

Hi @DStirling,
Thanks very much for the advice.
I was exploring the possibility of making cellprofiler available in galaxy platform…so ideally users would be able to build a cellprofiler pipeline in galaxy…but it seems not easy…

Hi Yi,

We have some EXTREMELY limited documentation on how to do this in CP 3.X (you can also search the forum for other threads on this); as we’re building CP4.0 for release by end of year, we’re stabilizing and documenting the API much better, so it will be easier to do this by early 2020.

I share David’s hesitancy in why you would want to do this; an image analysis workflow is typically very interdependent, and tweaking one module might cause cascading effects on others, which is why we typically tweak module parameters in the GUI and then only run complete pipelines headless. You could of course then re-implement all our viewing stuff, but that seems more difficult than just dispatching completed pipelines… it’s extremely possible though I don’t understand the use case.