Using PMA.start with CellProfiler

Using PMA.start with CellProfiler

In addition to the first example, where we displayed how to fetch a snapshot of an image from PMA.start using Python, we can extend the example slightly so that we can feed the snapshot image to CellProfiler for further analysis.

CellProfiler can be invoked by the command line and instructed to execute a pipeline against a particular image. To achieve this, first we have to download an image from PMA.start and create an accompanying CSV file for it that contains required meta data. A simple case for an RGB image is to print the path to the image file inside the CSV.

For example if we want to feed the image at c:\slides\slide1.svs to CellProfiler, we first fetch a snapshot using the attached Python program by issuing:

python CellProfiler.py c:/slides/slide1.svs

This will fetch a snapshot of the image and save it as slide1.jpg in the current directory. It will also create a CSV file named input.csv, again in the current directory.

Next we invoke CellProfiler, provided that we have our pipeline ready, in the following manner:

CellProfiler.exe -c -r --data-file input.csv -o /output_directory -p my_pipe_line.cppipe

This will start CellProfiler in headless mode and execute “my_pipe_line.cppipe” against the image we fetched. The results will be stored in a folder named “output_directory”.

Click here to download the script to load images from PMA.start into CellProfiler