Correcting variable X shift in confocal bidirectional scanning images

Hi all,

I’d like to correct pixel shifts in confocal images acquired with bidirectional scanning. The problem is that the shift is variable, as in this example where the shift varies in severity from right to left:

Does anyone know of a way to analyze the local X phase shift and correct it?



Although it doesn’t seem impossible, it will be costly.
It’s perhaps better to redo the aquisition using an intact device.

Follow up…I know I can fast-Fourier transform the image and mask out the high frequencies on the Y axis with pretty good results (below), but does anyone have a method that is restorative?


This can’t be a valid solution of the problem, not even an approximation of such.

A possible solution is local correlation of successive rows and corresponding local shifts …
As I wrote, this is costly (and doesn’t work perfectly).

LOL it’s a wonderful approximation for our application! But like you it doesn’t sit well with me either as it’s nowhere near correcting the artifact. I agree that the trivial solution of not getting the artifact in the first place is the best; I believe instrument service is in order…


Please accept the fact that even properly chosen vertical lowpass-filtering does not compensate for the row-shifts but only removes the periodicity introduced by the shifts. This means that the shifts are still there but their appearance is different.

In short, please stay away from this method.
It is signal-theoretically unfounded and its effects may lead to false conclusions.

I wish you the very best with the serviced device.

Thanks so much for your advice; I agree. For that particular image my user just cares about “pretty picture” appearance and they’re zooming way out so it should be ok. I’ll make sure they understand the limitations and disclose the filtering if they publish it.

I’ve seen the variable shift on systems from different manufacturers, though not this severe, so maybe a correction algorithm would have broad appeal. Might you be able to point me to more info about a local correlation approach as you suggest? Would like to at least give a try to coding it myself. Maybe offline at and I can post a solution if anything ever comes of it.

Thanks again.


I wouldn’t allow somebody to publish such data.
Does it have any medical relevance?

I should like to stay on the Forum for the usual reasons.

As mentioned before, a solution will be costly and I can’t estimate how good the results will be.
If the shifts in question are really due to the scanners, then you should complain to the manufacturers. I can hardly believe that they ship such products. At least they should comment on the very results and perhaps control there production and deliver assistance. For now the best I can recommend is that you carefully watch the servicing process and finally run a scan to check if the image quality is flawless. If not, don’t accept the servicing.

Just take part of a row and compute the 1D-correlation functions with the corresponding part in the row above and in the row below. The maxima of the correlation functions should give you an estimate of the local offset.

Here is an example that allows “correlation by eye”
(gray squares denote single pixels):

The maxium of the correlation function computed from the middle row and the top row is at 3 (shifts to the right positive).
The maxium of the correlation function computed from the middle row and the bottom row is at 4 (shifts to the right positive).
Consequenly, the estimated shift for the middle row is 3.5 pixels to the right, which would require interpolations.

It may however be that the shifts are in fact scale changes …

I don’t think it is worthwhile bothering with remedies if devices are malfunctioning. The effort you put into such undertaking is better spent in constructive research.