I am a programmer and I am new to CellProfiler.
I am checking feasibility of writing an application that combines elements of cell image analysis.

  • Is it possible to run a pipeline for sequence of images in one “hit”?

  • In my application I want to receive a list of images and perform sequence of actions for each one of them.
    Can I use cellprofiler services within my application? for example: execute a pre-saved pipeline for each image.

Shaul Geva
IDEA development & Production


Hi Shaul,

CellProfiler is designed for high-throughput use. You create a pipeline which includes the image analysis you want to perform, and this same pipeline is run on all of your images.

I am not sure what you mean by using CellProfiler services. You could essentially copy the code to load and execute our modules, but the CellProfiler software has been developed for several years and it seems unlikely that you would want to write essentially the same program as we are already developing. You could just take the CellProfiler software and adapt it to whatever function you need since it is free and open-source. CellProfiler is already capable of saving/loading pipelines which you have made in the past.

I hope this helps.

Mike Lamprecht


If you wanted to use CellProfiler as a stand-alone application on hundreds of images, you could simply put those images in a folder and run a CellProfiler pipeline on them. CellProfiler will cycle through all the images. This is the standard way most people use CellProfiler.

But, it sounds like you want to use your own software and call CellProfiler ‘headless’, that is - you want to run CellProfiler without its graphical user interface (GUI) and just use CellProfiler as an image processing back-end for your own software. This is feasible.

It’s a little sneaky - What you should do is first use CellProfiler in the normal way: set up a pipeline and process a few example images until the settings are appropriate. Then, add CreateBatchScripts module to the end of your pipeline and run the pipeline. At the end of the first cycle, this last module will create a text file that is essentially the sort of code you will need to add to your program to process individual images using the pipeline. You will also have created a handles structure (the output file) that you will need to provide as a variable to CellProfiler when you run it from within your own software. The major changes you will need to make to the output file is to remove the CreateBatchScripts module itself from the pipeline that is in this handles structure, and you will need to change the way images are fed into CellProfiler. Whereas the output file will have a few example images listed as the images to be processed, you will need to have your software tell CellProfiler which images to be processed. Lastly, you will have to handle the measurements which CellProfiler makes, which I imagine will feed into your own software somehow. There are other groups working on getting this to work with their own software. If you are successful and have more tips on accomplishing this, please post your advice here!

If, by contrast, you want to run an individual CellProfiler module by itself on an image, there are some instructions in Help > Programming Notes at the end (I’ve pasted the relevant part below) which describe how to do this. You basically set up a fake little handles structure and feed in the appropriate variables.


% In order to run CellProfiler modules without the GUI you must have the
% following variables:
% handles.Settings.ModuleNames (for all modules in pipeline)
% handles.Settings.VariableValues (for all modules in pipeline)
% handles.Current.CurrentModuleNumber (must be consistent with pipeline)
% handles.Current.SetBeingAnalyzed (must be consistent with pipeline)
% handles.Current.FigureNumberForModuleXX (for all modules in pipeline)
% handles.Current.NumberOfImageSets (set by LoadImages, so if it is run
% first, you do not need to set it)
% handles.Current.DefaultOutputDirectory
% handles.Current.DefaultImageDirectory
% handles.Current.NumberOfModules
% handles.Preferences.IntensityColorMap (only used for display purposes)
% handles.Preferences.LabelColorMap (only used for display purposes)
% handles.Preferences.FontSize (only used for display purposes)
% You will also need to have the CPsubfunctions folder, since our Modules
% call CP subfunctions for many tasks. The CurrentModuleNumber needs to be
% set correctly for each module in the pipeline since this is how the
% variable values are called. In order to see what all of these variables
% look like, run a sample analysis and then go to File -> Tech Diagnosis.
% This will let you manipulate the handles variable in MatLab.


Has some body have advanced any further on this?
Is it possible to give us an example ?
Thank you
Marie Laure