Image allignment


Hi Team,

I would like to know how can we align a set of images, each time to the last aligned image. For example align #1 to #2 and then align the result to #3 and so on. I didnt figure it out how to do that.

Also is there any way to specify that a module will run only at the first cycle and not at all cycles?

Thanks in advance’



Hi Maya,

Re: 1st question - Have you tried using the Align module? You can align the 1st two images, and save the result as template. Then use a pipeline to loop through all the images to be aligned, using a LoadSingleImage module to load the template, align it to the image loaded from LoadImages in the current cycle, then save the aligned image as the new template (with the same filename as the old template). This way, you can update the image to align to with each new loaded image.

Re: 2nd question - Only a few modules are specifically designed to run on the 1st cycle only (e.g. LoadImages, CorrectIllumination_Calc with the proper settings, etc). It is not a standard option for modules in general.


Hi Mark,

Thanks for your reply. I have tried this already. The thing is that if the LoadSingleImage is also in the pipeline just before the align module it will load again the template file and not the new template (which is the aligned saved with the same name). That is the reason why I think we need the LoadSingleImage module to be out of the loop. Is there any solution for that?




Hi Maya,

Hopefully, I’m understanding things correctly…

I think that this is why the 1st two images need to be aligned first, and then save that result as a template first, before running through the rest of the images. In short, you’ll need to initialize the template with images 1 and 2, and then run the alignment procedure with images 3 onwards, and so on with 1st template image. You may need separate pipelines, (1) for the initialization step and (2) the full alignment step.

So your pipeline for (1) would be something like:

LoadImages (for images 1 and 2) Align SaveImages (to initialize the template)
and the pipeline for (2) would be:

LoadImages (for images 3 onwards) LoadSingleImage (the first cycle, it will load the template for 1 and 2) Align SaveImages (to save the new template)
The trick is to start pipeline (2) at image 3, which you may be able to do using the filename exclusion setting in LoadImages in the latest version of CellProfiler.

Hopefully, this makes sense. Is this something like what you already tried and it wasn’t working?


Hi Mark,

Thanks for your help, finally it worked and all the image sequence was aligned correctly.
The question is, if I aligned the images of one channel (say, the RFP) can I use the same output shifts in the x-y coordinates to align the same images in another channel (YFP)? This is important, as I segment the cells using the RFP channel and measure the YFP images that should be aligned exactly as the RFP. For this reason I don’t want to run a second alignment pipeline based on the YFP channel but to use the same shifts of the RFP to rotate the YFP images.

Thanks in advance,



You can align this shift to two more images using the setting towards the bottom that are labeled with “(Two image alignment only): If you aligned an image or a sequence with a template, to what other image/sequence do you want to apply the shift calculated above?”