 Research
 Open Access
 Published:
Strategies for optimizing the phase correction algorithms in Nuclear Magnetic Resonance spectroscopy
BioMedical Engineering OnLine volume 14, Article number: S5 (2015)
Abstract
Nuclear Magnetic Resonance (NMR) spectroscopy is a popular medical diagnostic technique. NMR is also the favourite tool of chemists/biochemists to elucidate the molecular structure of small or big molecules; it is also a widely used tool in material science, in food science etc. In the case of medical diagnosis it allows for determining a metabolic composition of analysed tissue which may support the identification of tumour cells. Precession signal, that is a crucial part of MR phenomenon, contains distortions that must be filtered out before signal analysis. One of such distortions is phase error.
Five popular algorithms: Automics, Shanon's entropy minimization, Ernst's method, Dispa and eDispa are presented and discussed. A novel adaptive tuning algorithm for Automics method was developed and numerically optimal solutions to automatic tuning of the other four algorithms were proposed. To validate the performance of the proposed techniques, two experiments were performed  the first one was done with the use of in silico generated data. For all presented methods, the fine tuning strategies significantly increased the correction accuracy. The highest improvement was observed for Automics algorithm, independently of noise level, with relative phase error dropping by average from 10.25% to 2.40% for low noise level and from 12.45% to 2.66% for high noise level. The second validation experiment, done with the use of phantom data, confirmed the in silico results. The obtained accuracy of the estimation of metabolite concentration was at 99.5%.
Conclusions
The proposed strategies for optimizing the phase correction algorithms significantly improve the accuracy of Nuclear Magnetic Resonance spectroscopy signal analysis.
Introduction
Magnetic resonance spectroscopy (abr. MRS) is a technique widely used in, among the others, modern oncology to determine metabolic profile of the tissues. It is especially useful to differentiate between healthy tissues and tumours. However the differences in metabolic profiles are in many cases slight, thus signal must be carefully preprocessed in order to accurately estimate amount of metabolites in examined tissues. One of the distortions that affects MR spectrum mostly is phase error. The first simplest mathematical model of phase error was proposed by Ernst [1] where the assumption on linearity of phase error along the spectrum, described by two factors frequency dependent and frequency independent one, was made. Such a model posits the phase error to be mainly a consequence of eddy current induction in the scanner. The extension of linear model is bilinear one, incorporating multiplicatory factor that stands for phase error fraction caused by magnetic field inhomogeneity [2, 3]. In contrast to the linear models, higher order models were proposed assuming the nonlinearity of the phase error with respect to the frequency.
While considering MRS in clinical diagnosis, the influence of field inhomogeneity may be neglected due to small spectrum complexity (low dimensionality) and significantly lower field strength (than in chemical measurements), leaving the phase error related to the induction of eddy currents in coils only [4].
The linear model of phase error consists of two parts: zero and first order and it is given by:
Zero order component φ_{0} is representing the offset between absorption and dispersion spectrum while first order component φ_{1} is representing the frequency dependant shift where dependency is modelled by straight line with slope coefficient k/N, where k denotes index of the point in spectrum and N is total number of points.
There are two possible approaches of phasing MR spectra. The first one is manual and requires expert knowledge about zero and first order component. Such a procedure is time consuming and requires an experienced human operator. The drawback of the manual method is the fact that it is hard to estimate the correction effect for the whole spectrum [5]. It is then done for small parts of spectrum and leads to overcorrection of analysed fragments and no correction of other fragments.
The second possible approach that is free of the mentioned drawback is the automatic correction. For such an approach the correction is done accordingly to the linear model, but the quality of spectrum is evaluated and maximized automatically, mostly with the use of optimization techniques. The automatic phase correction algorithms are still less popular than manual approach, which is partially caused by unsatisfactory accuracy of the existing techniques.
The most popular techniques of automatic phasing of MR spectra are: Automics [6], Shanons Entropy minimization [7], Ernst's method [1], Dispa [8] and eDispa [9]. The aim of this paper is to design, implement and verify the automatic tuning strategies for the above mentioned methods that will result in efficiency increase of phase error correction for 1H (Hydrogen isotope Protium) NMR spectra.
Methods
While looking at the algorithms designed for phase error correction in MR spectra, one can notice two groups of them: model based and model free techniques. In the family of methods that derive direct value of phase error (without a priori assumed error model) the most popular are: [5] which is based on filter diagonalisation method and [10] which performs the phase correction with the use of separately measured water signal. The newest approach of direct phase error correction seems to be the method by [11] requiring the registration of series of spectra.
The five chosen linear model based methods: Automics, Shanon's, Ernst's, Dispa and eDispa, as being the most popular in clinical approaches, were implemented following the description included in the original publications. The mechanism of finding optimal solution was examined for each technique and tuning of algorithms, by means of tuning of parameters or application of efficient numerical solution, was performed.
Automics
The first analysed algorithm, proposed by [6], is based on estimating linear model parameters φ_{0} and φ_{1} dependent on a phase evaluated at the tails of spectrum. The original method assumes definition of two intervals at each tail. For each pair of intervals a mean phase is calculated. Than having two values of phase: at the beginning and end of the spectrum, phase error is estimated. It is assumed that phase error in these intervals does not differ significantly. The length of the intervals may be understood as a parameter for the algorithm that may be optimized to find the best solution [6].
The developed procedure for interval length estimation starts with the initial interval as a single point and then extends stepwise the interval by other points as long as there is no significant trend in the data within the interval. To verify no trend hypothesis a linear regression model is constructed within each interval and statistical test on signal gradient being equal to zero is applied. For the purpose of this study significance level was set to 5% (α = 0.05). The procedure is repeated for each of two intervals  at the beginning and at the end of the spectrum. If a significant change of signal magnitude (and consequently phase error) is found in one of the intervals the procedure is terminated and the found length is treated as the optimal one. The parameters of phase error model are calculated by solving the set of two equations (for each tail) in the form given by equation below.
Where index j stands for the location of the interval: j = 1 for the interval located at the beginning of the spectrum; while j = 2 for the interval located at the end of the spectrum. R_{j,2} and I_{j,2} are the real and imaginary part of an element at the end of the interval; and R_{j,1} and I_{j,1} are the real and imaginary part of an element at the beginning of the interval, k_{j,1} and k_{j,2} are the indices of the beginning and the end of the j_{th} interval, and N is a length of the spectrum.
Methods based on reformulation to the optimization problem
Three of the above mentioned algorithms might be tuned by application of a properly chosen numerical method for solving their optimization problem.
Shanon's entropy minimization
The Shanon's entropy minimization method is based on the assumption that ideal absorption spectrum should be positive. Such a spectrum has smaller Shanon's entropy than spectrum that contains points that are both: positive and negative [7]. The problem for this method is to find set of parameters φ_{0}, φ_{1} for which the spectrum phased with linear model has the smallest error of correction. The minimization problem is given by equation.
where H is the Shannon entropy of given spectrum, S_{A}(k,...) is a magnitude of the absorption spectrum at k_{th} data point and P is a penalty factor.
Ernst
Ernst method is based on the axiom that the integral of single line (peak) dispersion spectrum should be equal to zero. Since the spectrum is a composition of peaks it is clear that for no phase error the dispersion integral of whole spectrum should be zero [1]. Because of the noise it is rarely to be true. In the Ernst method the optimization problem is to find parameters of linear model for which the dispersion integral will be minimal.
where I is an integral value, S_{D} is a magnitude of the dispersion spectrum; a and b are the integration limits equivalent to the minimum and maximum values on the frequency [Hz] or [ppm] scale of the spectrum.
eDispa
In eDispa method authors use linear model as well and perform the twostep quality calculation [9]. The first step is based on calculation of defined η functional of the form given below.
Q is a functional defined as:
where S_{A} denotes the magnitude of the absorption spectrum, k is the index of data point, N is a length of the spectrum.
Solutions to the optimization problems
The solution to three above mentioned algorithms could be found with the use of classical optimization algorithms. In case of Shanon's entropy minimization and eDispa problem the NelderMead algorithm can be applied [12]. As for Ernst's method the problem is more complex, and it may be solved with the use of integral global optimization [13].
One of the crucial steps during the NelderMead optimization, due to the strong nonlinearity of the optimized functions, is setting of parameter initial values. To improve accuracy of tuned algorithms and to make whole optimization process faster the procedure for setting of initial conditions has been proposed. It is based on observation that water peak is located in the middle of spectrum and it is with no doubt the peak of maximal amplitude both in absorption and magnitude spectrum. As described in previous paragraph, a phase angle between absorption and dispersion part measured at peak maximum should be equal 0. If it is not, the measured value is a rough estimate of phase error at the half of spectrum:
where Δφ^{0} is an initial estimate of the phase error, and S stands for the MR spectrum, index k_{max} denotes the spectrum data point with maximum of magnitude spectrum.
Knowing the value of Δφ^{0} it is easy to estimate φ_{0} and φ_{1} just using the equation for linear phase error model and additional assumption that ratio of phase error components is equal ¼. This value is empirical and it was chosen after set of experiments done on clinical spectra. Example of effectiveness of the proposed initial condition is shown in Figure 1.
The proposed initial condition may be used even when water signal is partially suppressed during measurement procedure. When water signal is not present in the data (full water suppression) the maximum of signal may be used, however it is definitely not as good as water peak.
Dispa
Dispa method is based on the assumption that phase at the maximum of the peak should, in an ideal case, be equal 0 [8]. Assuming the linear model of Δφ it is then easy to estimate φ_{0} and φ_{1} with use of just two neighbouring peaks. It was noticed that such approach might lead to wrong estimates because of noise presence and its influence on maximal point of peak. An idea for Dispa method is to evaluate phase value at max points of all significant peaks and then estimate Δφ model with use of linear regression model.
Quality criterion
In order to properly estimate value of phase error that remains in the data after phase correction, a quality criterion was proposed. The assumed criterion uses the phase plot (relation between dispersion and absorption spectrum), obtained for last significant peak in the analysed spectrum. Because of signal sampling a peak and consequently phase plot is not a continuous line but a set of points. Because the criterion uses major radius of phase plot, an estimates of ellipse parameters are obtained from the data points. Having ellipse equation it is then easy to derive the equation for its major and minor radius. The assumption is that in case of no phase error, major radius of an ellipse phase plot should lay exactly on the real axis. The remaining phase error is the angle between real axis of the phase plane and major radius of an ellipse phase plot. The idea of the assumed quality criterion is shown in Figure 2.
Data
To verify the quality of spectra phasing two data sets were collected. The first one consists of numerically simulated spectra (named as synthetic data), while the second data set consists of 27 measurements obtained for a brain phantom that contained: 5 mM of Lactates at 0.5 ppm, 12.5 mM of Nacetylaspartate (abr. NAA) at 2.0 ppm, 10 mM of Creatine at 3.0 ppm, 3 mM of Choline at 3.2 ppm and 7.5 mM of myoInositol located at 4.6 ppm. The data were measured with the use of Philips Achieva scanner of 1.5 T magnetic field induction. The echo and repetition time were equal to 35 and 1500 ms. Every spectrum was averaged over 128 replicates. The number of points was equal to 1024 and the sequence type was PRESS.
To obtain the synthetic data set being similar in structure to the brain data, randomly chosen single spectrum was taken from phantom data and it was manually phased by human expert. Then the absorption spectrum was extracted and preprocessed to filter out noise and baseline. The smoothed signal was used as the reference for synthetic signal generator.
Single synthetic spectrum was generated with the use of the following procedure:

1)
To ensure signal complexity similar to the clinical spectra, additional peaks together with additive noise were randomly added to the reference signal in frequency domain.

2)
The dispersion spectrum was reconstructed with the use Hilbert transformation.

3)
Signal was disturbed with additive phase error of parameters: φ_{0} = {2.5, 5.0, 7.5, 10.0, 12.5} degrees and φ_{1} = {2.5, 5.0, 7.5, 10.0, 12.5} degrees.

4)
Additionally, signal was disturbed by additive noise with SNR equal to: 30.75 dB (named low noise) and 8.52 dB (named high noise).
Since the noise component was purely random each combination of φ_{0} and φ_{1} was repeated 50 times. In total 1250 simulations were performed. Exemplary simulated spectrum is presented in Figure 3.
Evaluation
To evaluate the efficiency of the proposed strategies for algorithm tuning, every spectrum was corrected twice, by original and tuned algorithm. The residual post correction error was calculated following the procedure described in Quality criterion section. The error residuum expressed as a percentage of the applied phase distortion value was named a relative error.
The block diagram describing performed comparison study is shown in Figure 4.
Results
Experiment I  synthetic data
The experiment was performed for 9 values of Δφ = {5.0, 7.5, 10.0, 12.5, 15.0, 17.5, 20.0, 22.5 and 25.0} degrees (obtained for different combination of φ_{0} and φ_{1} in a range: 2.5, 5, 7.5, 10 and 12.5 degrees each). Each combination of Δφ was distorted with an additive noise of 30.75 dB (low) or 8.52 dB (high) and repeated 50 times what results in 1250 simulations in total. The correction was applied to every generated spectrum in both manners: with the use of original algorithm and with applied tuning routines. The relative error was calculated, and the results were grouped with respect to the total Δφ value. For each group mean value, standard deviation and coefficient of variation CV were calculated.
Low level of additive noise
Basing on the above results it may be noticed that proposed tuning routines improve phase correction quality for each of the analysed algorithm. The highest increase was observed for algorithm Automics and the lowest increase was observed for Ernst algorithm. By looking at a mean value of relative error it may be concluded that with the increase of Δφ the remaining phase error after the correction increases in both cases (before and after tuning). By looking at descriptive statistics, for correction with the use of tuned algorithms the dispersion of results among spectra with different noise is much lower for Automics, Shanon's and Ernst but remains at the same level for Dispa and eDispa.
High level of additive noise
The second part of the synthetic data experiment differs from the first by a much larger additive noise that was applied to all generated spectra. As previously a huge improvement in results obtained for with tuning was noticed. For all five algorithms the values of relative phase error are worse while compared to the low noise level results. The best results were obtained for Automics algorithm. It was also observed that addition of higherlevel noise increases the dispersion of spectra generated for same combination of φ_{0} and φ_{1} values. With low noise this value was equal to ~1% for all methods without tuning, while by increase of the noise level it doubles. By application of tuning it was possible to decrease the dispersion to about 1%.
Experiment II  brain phantom data analysis
In the second part of validation procedure a data obtained on brain phantom was analysed. The number of processed spectra was equal to 27. All signals were collected at different time frames with use of Philips Achieva (1.5 T) with parameters: echo time = 35 ms, repetition time = 1500 ms, number of averages = 128, number of points = 1024 and the sequence type PRESS. Thus it was assumed that the distortions such as phase errors or noise would be different from spectrum to spectrum. Following the results of the analysis performed on synthetic data, each phantom spectrum phase was corrected with the use of Automics algorithm only. The correction was performed twice: with and without parameter tuning. The spectra were then decomposed into Gaussian Mixture Model (abr. GMM) and the concentrations of metabolites were calculated [14]. The obtained estimates of concentrations are presented in the form of boxplots in Figure 7 and their descriptive statistics are included in table 5.
One can conclude that the tuning routine applied to the Automics algorithms improves the results of phase correction giving more accurate estimates of metabolite concentrations. In comparison to the algorithm before tuning the increase is significant for each analysed metabolite. After application of tuning procedure the maximum difference between estimated mean and the true values of metabolite concentration is 0.4% (10.04 vs. 10.00 mM for Creatine and 5.02 vs. 5.0 for Lactate). Estimated mean concentration of Choline is exactly at desired value of 3.0 mM. By looking at the values of standard deviation and coefficient of variation it may be noticed that for all metabolites dispersion of results among 27 spectra is smaller while compared to not tuned version (highest increase for myoInositol: standard deviation for not tuned Automics was 0.73 while 0.06 for tuned algorithm).
Discussion
The in silico experiment was performed to verify effectiveness of the proposed tuning for five popular phase correction algorithms. Parameter tuning increases the correction efficiency by at least 4%. The higher impact of tuning algorithm is observed for higher phase errors. The highest impact was observed for Automics algorithm for which modification was the most complex. The adaptive definition of interval length is more efficient than the fixed length option. Additionally, it minimizes the risk that interval contains points that significantly differ in magnitude and phase error. For the group of methods based on the reformulation to the optimization problem it was observed that implementation of efficient simplex algorithm increased accuracy of all three of them. It is also a result of efficient setting of the initial condition. The high (around 5%) improvement was observed for the tuned version of Dispa algorithm. It is a result of accurate estimation of Δφ parameters with the use of all peaks not just selected two. Because of the noise presented in the data, the position of maximal point in the peak is shifted. If the observed maximum is not a true maximum, the phase evaluated at that point is also wrong. For lower noise the correction accuracy is slightly better but that was expected.
In the analysis of clinical phantom data it was proven that tuned algorithm outperforms not tuned version. Only the Automics algorithm was used for phase correction, as it was demonstrated to be the best performing during the synthetic data analysis. Its original version gives results that are satisfactory however we have proven that tuning may increase accuracy and may decrease the dispersion of metabolite concentration estimates among the spectra.
Conclusions
The proposed tuning routines significantly increase the accuracy of phase error correction for all examined algorithms: Automics, Shanon's entropy minimization, Ernst's, eDispa and Dispa. To understand the importance of proper spectrum phasing twostep validation experiment was performed. The first one was based on the analysis of spectra with known phase error disturbed by additional random noise (synthetic data), while the second validation experiment was performed on spectra with unknown phase error but known original concentration of metabolites. Both validation experiments showed that tuning routines increase the accuracy. The second, phantom based validation experiment has shown that phase error correction the crucial role in determining the metabolite concentration and may lead to more accurate clinical diagnosis.
References
 1.
Ernst R: Numerical Hilbert transform and automatic phase correction in magnetic resonance spectroscopy. Journal of Magnetic Resonance. 1969, 1 (1): 726.
 2.
Moussavi A, Untenberger M, Uecker M, Frahm J: Correction of gradientinduced phase errors in radial MRI. Magnetic Resonance in Medicine. 2014, 71 (1): 308312. 10.1002/mrm.24643.
 3.
Roebuck J, Hearshen D, O'Donnell M, Raidy T: Correction of phase effects produced by eddy currents in solvent suppressed 1 HCSI. Magnetic Resonance in Medicine. 1993, 30 (3): 277282. 10.1002/mrm.1910300302.
 4.
Worley B, Powers R: Simultaneous Phase and Scatter Correction for NMR Datasets. Chemometrics and Intelligent Laboratory Systems. 2014, 131: 16.
 5.
Hu H, Van Q, Mandelstham V, Shaka A: Reference deconvolution, phase correction, and line listing of NMR spectra by the 1D filter diagonalization method. Journal of Magnetic Resonance. 1998, 134 (1): 7687. 10.1006/jmre.1998.1516.
 6.
Wang T, Kang S, Chu Q, Ren Y, Mu Y, Qu L, et al: Automics: an integrated platform for NMRbased metabolomics spectra processing and data analysis. BMC Bioinformatics. 2009, 10: 8310.1186/147121051083.
 7.
Chen L, Weng Z, Lai G, Garland M: An efficient algorithm for automatic phase correction of NMR spectra based on entropy minimization. Journal of Magnetic Resonance. 2002, 158 (12): 164168. 10.1016/S10907807(02)000691.
 8.
Craig E, Marshall A: Automated phase correction of FT NMR spectra by means of phase measurement based on dispersion versus absorption relation (DISPA). Journal of Magnetic Resonance. 1998, 76 (13): 458475.
 9.
Cobas C, Sykora S: Extended dispersionabsorption approach to automatic phasing of HRNMR spectra. 48th ENC Conference. 2007, Daytona Beach, USA
 10.
Hernando D, Hines C, Yu H, Reeder S: Addressing phase errors in fatwater imaging using a mixed magnitude/complex fitting method. Magnetic Resonance in Medicine. 2012, 67 (3): 638644. 10.1002/mrm.23044.
 11.
Near J, Edden R, Evans C, Paquin R, Harris A, Jezzard P: Frequency and phase drift correction of magnetic resonance spectroscopy data by spectral registration in the time domain. Magnetic Resonance in Medicine. 2015, 73 (1): 4450. 10.1002/mrm.25094.
 12.
Lagarias J, Reed J, Wright M, Wright P: Convergance properties of the NelderMead simplex method in low dimensions. SIAM Journal of Optimization. 1998, 9 (1): 112147. 10.1137/S1052623496303470.
 13.
Zheng Q, Zhuang D: Integral global minimization: Algorithms, implementations and numerical tests. Journal of Global Optimization. 1995, 7 (4): 421454. 10.1007/BF01099651.
 14.
Binczyk F, Tarnawski R, Polanska J: Mixture model of NMR and its application to diagnosis and treatment of brain cancer. Archives of Control Science. 2010, 20 (4): 457472.
 15.
Binczyk F, Tarnawski R, Polanska J: Improvement in the accuracy of Nuclear Magnetic Resonance spectrum analysis by automatic tuning of phase correction algorithms. Proceedings of International WorkConference Bioinformatics and Biomedical Engineering. 2014, 778788.
 16.
Bharti K, Raja R: Quantitative 1H NMR spectroscopy. Trends in Analytical Chemistry. 2012, 35: 526.
 17.
Cieslar C, Clore M, Groneborn A: Automatic phasing of pure phase absorption twodimensional NMR spectra. Journal of Magnetic Resonance. 1988, 79 (1): 154157.
 18.
Bao Q, Feng J, Chen L, Chen F, Liu Z, Jiang B, Liu C: A robust automatic phase correction method for signal dense spectra. Journal of Magnetic Resonance. 2013, 234: 8289.
Declarations
Publication of this article was supported by NCN grant Harmonia 4 no. DEC2013/08/M/ST6/00924. Calculations were carried out using infrastructure of GeCONiI (POIG.02.03.0124099/13).
This article has been published as part of BioMedical Engineering OnLine Volume 14 Supplement 2, 2015: Select articles from the 2nd International WorkConference on Bioinformatics and Biomedical Engineering (IWBBIO 2014). The full contents of the supplement are available online at http://www.biomedicalengineeringonline.com/supplements/14/S2.
Author information
Affiliations
Corresponding author
Additional information
Competing interests
We hereby confirm that the authors of this manuscript do not have any competing financial, professional or personal interests.
Authors' contributions
We hereby declare that FB contributed in the developing methodology for data analysis and performed the numerical experiments. JP contributed in designing the experiment, developing methodology for data analysis and analysed and discussed results. RT contributed in the NMR methodology part.
Rights and permissions
This article is published under license to BioMed Central Ltd. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. The Creative Commons Public Domain Dedication waiver (http://creativecommons.org/publicdomain/zero/1.0/) applies to the data made available in this article, unless otherwise stated.
About this article
Cite this article
Binczyk, F., Tarnawski, R. & Polanska, J. Strategies for optimizing the phase correction algorithms in Nuclear Magnetic Resonance spectroscopy. BioMed Eng OnLine 14, S5 (2015). https://doi.org/10.1186/1475925X14S2S5
Published:
DOI: https://doi.org/10.1186/1475925X14S2S5
Keywords
 Synthetic Data
 Phase Error
 Phase Correction
 Automics Algorithm
 Phantom Data