Running CP Pipelines on images stored as Numpy arrays in Python



Hello to the CellProfiler community!

I would like to apply an existing CellProfiler pipeline on a dataset that I have as part of my research. The pipeline that I would like to use is publically available to download here:

Briefly, this pipeline is able to extract image features from H&E stained histology images of lung tissue. The pipeline works on small image tiles that are taken from areas of the tissue that contain tissue. I have a selection of histology images to which I would like to apply this pipeline and extract image features in the same way.

I am using the Python programming environment, and the format of my histology images are 3-channel Numpy arrays of pixel intensities. e.g. a (128,128,3) Numpy array contains values between (0,255), which describes the RGB channels of the image.

What I would like, is to run the pipeline directly on my data in Python, without saving my histology patches as (128,128,3) images as .TFF files, for example. I have installed the CellProfiler Python interface).

In pseudocode, I would like to know if this is possible.

#image_array -> (128, 128, 3) numpy array representing a image tile.
#RunPipline -> Function that runs the CellProfiler pipeline.
For each image_array in image_array_set:
- Features = RunPipline(image_array)

I would like to know if this is possible, and how best to achieve this. Thank you very much in advance.

All the best,



Hi, @willgdjones!

It should be straightforward. You linked the appropriate instructions. Is there a confusing step?


Hi @agoodman - thank you for the reply!

My understanding is that this command would run and existing pipeline end to end, rather than give me the ability to run sequential steps the pipeline step by step.

For example, the pipeline that I link uses .TIFF images. I would like to run the pipeline on input images that I have stored as Numpy arrays.

What would be the appropriate Python commands to use my images as input and run the pipeline on these images? I can’t seem to figure it out!

Thank you very much,