The detection of immunoglobulin G (IgG) oligoclonal bands (OCB) in cerebrospinal fluid (CSF) by isoelectric focusing (IEF) is a valuable tool for the diagnosis of multiple sclerosis. Over the last decade, the results of our clinical research have suggested that tears are a non-invasive alternative to CSF. However, since tear samples have a lower IgG concentration than CSF, a sensitive OCB detection is therefore required. We are developing the first automatic tool for IEF analysis, with a view to speeding up the current visual inspection method, removing user variability, reducing misinterpretation, and facilitating OCB quantification and follow-up studies. The removal of band distortion is a key image enhancement step in increasing the reliability of automatic OCB detection. Here, we describe a novel, fully automatic band-straightening algorithm. The algorithm is based on a correlation directional warping function, estimated using an energy minimization procedure. The approach was optimized via an innovative coupling of a hierarchy of image resolutions to a hierarchy of transformation, in which band misalignment is corrected at successively finer scales. The algorithm’s performance was assessed in terms of the bands’ standard deviation before and after straightening, using a synthetic dataset and a set of 200 lanes of CSF, tear, serum and control samples on which experts had manually delineated the bands. The number of distorted bands was divided by almost 16 for the synthetic lanes and by 7 for the test dataset of real lanes. This method can be applied effectively to different sample types. It can realign minimal contrast bands and is robust for non-uniform deformations.