Introduction to CellProfiler

Peter Sobolewski (he/him)

Systems Analyst, Imaging Applications

Research IT

CellProfiler logo https://cellprofiler.org/home

Plan

What is CellProfiler?

CellProfiler is an open-source image analysis program


Key feature:
CellProfiler has a graphical user interface (GUI) for assembling image processing and analysis workflows (called pipelines) using a sequence of modular analysis modules

A bit of background

Strengths of CellProfiler

  • It was designed for batch image analysis using reproducible workflows—without scripting

  • It includes advanced algorithms for image (pre)processing, segmentation, etc. as modular modules

  • It includes in-app documentation for module parameters plus extensive help menu

  • End-to-end workflows: images go in, data tables go out

Limitations

  • Limited viewing capabilities:
    • single planes, single channels only
  • No annotation tools
  • Limited out-of-memory performance
    • lacking support for multiscale (“pyramidal”) images
    • lacking built-in tiling/chunking
  • Limited OMERO support
  • Problematic OME.TIFF handling

The CellProfiler concept

  • Create a project that has an associated image file list of locations and an associated pipeline
  • Use the GUI to add a sequence of modules to implement your analysis—these form a pipeline
    • Start with input images and end with measurements in a spreadsheet (.csv) or a MySQL database
  • run in batches over large number of images
  • analyze measurement data in the downstream tool of your choice (Python, R, Excel, etc.)

CellProfiler projects & pipelines

  • projects contain a list of the locations of your image files plus an associated CellProfiler analysis pipeline
    • projects will also contain some cached computed results


  • pipelines can be exported, but do not contain image locations—this is ideal for sharing or reuseing workflows

Typical pipeline

  • start with setting up Input modules
  • Add Image Processing modules to facillitate segmentation
  • Add Object Processing modules to segment the image (identify objects) and manipulate objects
  • Add Measurement modules to get quantified information you’re interested in
  • Finish with Data Tools and File Processing to export data or images

CellProfiler UI

Screenshot of empty CellProfiler UI with menu bar
Screenshot of empty CellProfiler UI with menu bar. At the top right, the Notes box is emphasized with red text. Below, in the middle-right, the Image list drag-and-drop is emphasized with red text.
Screenshot of empty CellProfiler UI with menu bar. In the top left, the four Input modules are highlighted with a red box and red text.
Screenshot of empty CellProfiler UI with menu bar. On the middle-left, the area for adding pipeline modules is highlighted with red text. Below, the module buttons are highlighted with a red box.
Screenshot of CellProfiler UI with menu bar and a single module (ColorToGrey) open. At the top, the Test menu is open and the `Start Test Mode` option is highlighted with a red box. At the bottom left, the `Start Test Mode` button is highlighted with a red box.
Screenshot of CellProfiler UI with menu bar and a single module (ColorToGrey) open. Test mode is now active. At the top of the modules area, the Test mode buttons next to the ColorToGrey module are highlighted with a red box. At the bottom left, the Run and Step buttons are highlighted with a red box.
Screenshot of CellProfiler UI with menu bar and a single module (ColorToGrey) open. Test mode is now active. At the top, the Test menu is open and the Image set menu items are highlighted with a red box. At the bottom left, the `Next Image Set` button is highlighted with a red box.
Screenshot of CellProfiler UI with menu bar and a single module (ColorToGrey) open. In the middle right, the ColorToGrey module options are showing with the input image selection and output image naming highlighted with red boxes.

Keys to success

  • ensure image inputs are properly set up (NamesAndTypes) and that they and intermediate step outputs have meaningful names
  • use Test mode to see the outputs of individual modulues (pipeline steps) one-at-a-time
    • let’s you test parameters on a single image or any number of images (even a randomly selected one)
    • can run the whole pipeline or just individual modules

Getting more help

Segmentation Tutorial

  • Ensure you have the tutorial materials downloaded. If not, download the .zip file
  • Inside the folder is a PDF walkthrough, if you want to follow along on your own

Import the starting pipeline

  • Inside the folder are also two .cppipe files, which define the CellProfiler pipelines
    • segmentation_start.cppipe is our starting point, it handles the initial image importing and set up.
    • Drag-and-drop it onto the Pipeline Modules section (middle left pane) to import it.

Tip

The segmentation_final.cppipe is the final pipeline, which you can use to see the completed analysis pipeline!

Import the images

  • Import the images by drag-and-dropping the images_Illum-corrected folder onto the central image list pane
  • Click on Apply filters to the file list to filter out non-images

Tip

Double-click an image in the list to open and view it

Completed setup

Screenshot of CellProfiler UI with menu bar and the segmentation_start pipeline imported. The image list is populated with images and an example is open.

Input Modules Tutorial

This tutorial will introduce you to Input Modules in CellProfiler: Images, Metadata, NamesAndTypes, and Groups. These modules are crucial for loading and organizing your input data so CellProfiler manages it properly in the analysis pipeline.

Important

Setting up Input Modules properly is crucial to being able to analyze your data!

Input Modules

  • Images module: set where your images are located, apply filters to include/exclude certain files
  • Metadata module [optional]: extract and associate metadata with your images, e.g. well plate layout, treatment, time points
  • NamesAndTypes module: give each image a meaningful name by which modules in the analysis pipeline will refer to it
  • Groups module [optional]: group images together to be analyzed independently, typically by field-of-view, e.g. z-stack, time course

Getting started

Tip

Each example has .cppipe file, which has the “solution”

Metadata regex tips

  • The https://regex101.com/ website is great! Just ensure you have one of the PCRE flavors selected.
  • Copy-paste the file name you want to parse into the test string box
  • Capture groups are always of the format:
    (?P<Name>[what]{how many})
    • Name is what you will refer to in the Metadata module
    • what can be digits, e.g. 0-9, or capital letters, e.g. A-Z, etc.
    • how many is an integer, e.g. 1, 2, 3, etc.

A few more regex tips

  • . is a wildcard for any character
  • * is a quantifier for 0 or more consecutive of the preceding character/token, e.g.: [A-Z]* to match any number of capital letters
  • ^ is an anchor for the start of the string
  • $ is an anchor for the end of the string–don’t forget about extensions!
  • \ is an escape character, e.g. \. to match a period, rather than any character