Load images problem with loading .lif database

Hi, I am trying to load a database of images that I took using a Leica confocal microscope on CP 2.2.0 - it only sees the first image in the database and I cannot figure out how to make it see all the images in the dataset and analyse them one by one?


Can you give us some examples or the screenshot of what happens in your pipeline?


This is where I am stuck - I am trying to use the LoadImages module to load all images from a .lif project file and I cannot get it to load all 60 images I have in there. It loads the first one, but the first one only.

Is there some reason downstream you need to use LoadImages? I wonder if you use the standard input modules and tell Metadata to “Extract metadata from file header” if that might work better?

For some reason the images input module and all others seem to be blocked for me…Now I exported all the lif files to tif, but now I bumped into this error:
Traceback (most recent call last):
File “/Applications/CellProfiler.app/Contents/Resources/lib/python2.7/cellprofiler/gui/pipelinecontroller.py”, line 2826, in do_step
File “/Applications/CellProfiler.app/Contents/Resources/lib/python2.7/cellprofiler/pipeline.py”, line 2067, in run_module
File “/Applications/CellProfiler.app/Contents/Resources/lib/python2.7/cellprofiler/modules/colortogray.py”, line 309, in run
File “/Applications/CellProfiler.app/Contents/Resources/lib/python2.7/cellprofiler/modules/colortogray.py”, line 355, in run_split
IndexError: index 3 is out of bounds for axis 2 with size 3
It seems like the cause is trying to read in the fourth channel, and the pipeline just stops there. Is there a quick fix for this instead of going back to the images and exporting them with a different channel order?
Thanks a million!

I wrote a new pipeline, where the standard input modules are active, and tried your suggested method, but it still only sees the first image within the project file, not the other 59 that are in there… :frowning:

Can you upload your image here (or to Google Drive/Dropbox etc and post a link)? The .lif and the .tif both would be great.

The reason you’re not able to split your TIF image into 4 channels is that your exported it as an RGB tif, which only has 3 channels- R,G, and B. You’d need to export it in a different way that preserves the channels to extract all 4.

Extracting the metadata in the LIF in CellProfiler worked fine for me though- see first figure below. Make sure you hit first the “Updata metadata” button under “Extract metadata from -> All images”, then the “Update” button at the bottom in the pane displaying what images have been found.

It seems like some of your series only have 3 channels, while most have 4; this is likely going to cause CellProfiler some problems if you’re trying to apply a 4 channel analysis to all of your series. You may want to do something that limits it only to series which have 4 channels explicitly in NamesAndTypes- see second figure below.

1 Like

Hi, it’s working now! The RGB was a silly oversight on my side…the last thing I can’t figure out is how to extract the file name, which is in the format of a number (10 or 14 or 16)_left or right_number(1-10)? Thanks a million :slight_smile:

As far as I know, there’s no way to directly extract these in CellProfiler- it only extract metadata it needs to the analysis. I’m afraid you’ll have to get that information separately.

If you want CP to have access to the information, you can add it as a CSV- I recently described elsewhere in the forum how to do it, though in this case your first Metadata extraction method is “From file header” rather than “From file name”, and you’d be mapping to “Series” rather than to “Well”.


I could get the file order in excel, but to me it doesn’t seem to be doing them in order? What is the logic behind the order of loading the files?

If you open the file in FIJI/ImageJ, it should show you a list of your images as they’re broken down into Series inside your .lif database; outside of the fact that ImageJ names the Series 1,2,3,etc and CP names them 0,1,2,etc, the order of loading AFAIK should be the same.

All clear now, thank you!!!