Reliable two-dimensional phase unwrapping method using region growing and local linear estimation



In MRI, phase maps can provide useful information about parameters such as field inhomogeneity, velocity of blood flow, and the chemical shift between water and fat. As phase is defined in the (−π,π] range, however, phase wraps often occur, which complicates image analysis and interpretation. This work presents a two-dimensional phase unwrapping algorithm that uses quality-guided region growing and local linear estimation. The quality map employs the variance of the second-order partial derivatives of the phase as the quality criterion. Phase information from unwrapped neighboring pixels is used to predict the correct phase of the current pixel using a linear regression method. The algorithm was tested on both simulated and real data, and is shown to successfully unwrap phase images that are corrupted by noise and have rapidly changing phase. Magn Reson Med, 2009. © 2009 Wiley-Liss, Inc.

An MRI signal is composed of real and imaginary components. Mathematically, a complex image can be expressed as s(m,n) = |s(m,n)|exp(iϕ(m,n)), where |s(m,n)| denotes the magnitude image and ϕ(m,n) denotes the phase image. Magnitude images are widely used, while the phase components are often discarded. However, phase images can provide useful information about field inhomogeneity (1, 2), velocity of blood flow (3), or the chemical shift between water and fat (4). Unfortunately, extracting the values of physical parameters from phase images is not trivial because phase ϕ(m,n) is defined in the range (−π,π]. If the values of physical parameters vary across a wider range, the corresponding phase values will be outside this interval and are wrapped back into the range, resulting in so-called phase wrapping. Thus, the main difficulty of utilizing phase information is that the relationship between the physical parameters and the wrapped phase values is unknown. To obtain this information, a procedure called phase unwrapping is needed. A variety of different phase unwrapping algorithms have been developed. Most of them make the assumption that the true phase difference between two adjacent pixels is smaller than π. If this condition is satisfied, the unwrapped phase can be easily determined. However, in MRI this condition may be violated by noise, rapidly varying phase values, or even phase discontinuity. Phase discontinuity may be encountered in velocity-encoded imaging and field mapping (5). In this case, phase unwrapping becomes a difficult problem.

Existing phase unwrapping methods (some of which are 3D) can be classified into four different categories: path-following (5–10), cost function optimization (11–14), Bayesian (15), and parametric modeling methods (16). Since the presented method belongs to the first category, a brief introduction of path-following methods follows.

Path-following methods apply line integration over a phase gradient map. If there are no poles (17), the integration path is arbitrary. Otherwise, the phase unwrapping result is dependent on the integration path. Most path-following methods attempt to handle this inconsistency by optimizing the integration path: Goldstein's branch cut algorithm (6), for example, identifies the poles and connects them with branch cuts. The phase can then be unwrapped along any path that does not cross the branch cuts according to the residue theorem. Buckland (10) used a minimum-cost-matching method to find the set of cuts that minimizes the total cut length. Chavez et al. (5) developed a method that detects “cutlines” and distinguishes between noise-induced poles and signal undersampling poles based on the length of the “fringelines.” Quality-guided algorithms rely on quality maps to guide the integration path; they unwrap the high-quality pixels first and avoid the low-quality pixels until the end of the integration procedure. In MRI phase unwrapping, phase derivative variance is a useful quality map in practice, but in some cases classifies as “low quality” the areas that have rapidly changing phase, but high signal-to-noise ratio (SNR). Several hybrid quality maps are also available but they suffer from similar problems (7).

Xu and Cumming (8) proposed a region-growing algorithm for interferometric synthetic aperture radar phase unwrapping. This method uses the phase information from unwrapped neighbor pixels to predict the correct phase of the new pixel to be unwrapped. A reliability check is also applied to make sure that the phase unwrapping follows a robust path. Based on this, Zhu et al. (9) presented a quality-guided fitting plane algorithm, which uses phase derivative variance as a quality map. Plane fitting in a 3 × 3 window also reduces computation time and increases the reliability.

This work presents a phase unwrapping algorithm called UNwrapping using Region grOwing and Local Linear estimation (UNROLL). This algorithm combines a region-growing technique using pixel stacks, used for image domain phase correction (18, 19), with the local plane fitting scheme mentioned above. The variance of the second-order partial derivatives of the phase, rather than the phase derivative variance, is applied as a quality map. As follows from the results presented and discussed below, this quality map is able to correctly classify the areas with a rapidly changing phase, but a high SNR, as “high quality.” When this is combined with the region-growing strategy using pixel stacks, unwrapping can be done pixel-by-pixel and the fitting plane can be extended to an n × n window, which is important to improve reliability in the presence of strong noise.


Quality Map

A quality map is an array of values that define the quality parameter of each pixel of the given phase data. Note that in this article quality maps indicate the badness rather than the goodness of the phase data. The quality map presented here uses the variance of the second-order partial derivatives of the phase as the quality criteria, which is defined as follows:

equation image(1)

where for each sum the indexes (i,j) range over the k × k (k = 3 in this work) window centered at the pixel (m,n). The terms Δi,jxx and Δi,jyy are the second-order partial derivatives wrapped into the (−π,π] interval and Δxxm,n and Δyym,n are the averages of these partial derivatives in the k × k windows. In high SNR areas the quality value is close to zero, even when phase changes rapidly, while in low SNR regions the quality value is larger. At the border where phase discontinuities exist the quality value also becomes larger. Therefore, this quality criterion can detect low SNR and discontinuity areas.

Linear Regression Prediction

The true phase of pixels can be considered a parametric surface and over a small region (an mwin × mwinwindow), the phase values can be approximated by a fitted plane. Here we use the pixels within the window that have already been unwrapped to fit the plane. Assuming that there are N pixels that have been unwrapped in the mwin × mwin small window centered at the current pixel, we can solve the linear model:

equation image(2)

using a least squares fit to return the estimated equation image, where Φunwrapped, Xunwrapped, and E are the phases, coordinates, and residual errors of the N unwrapped pixels, respectively. As a result, the true phase of the current pixel can be estimated using:

equation image(3)

Here Xcurrent pixel is the coordinate of the current pixel. Then the unwrapped phase of the current pixel is computed as:

equation image(4)

where φ is the wrapped phase of the current pixel and round(x) is the integer closest to x.

Unwrapping Procedure

In the present work we use pixel stacks to optimize the growing path following Ma (18, 19), who used this method in his phase correction algorithm. The first step is to calculate the quality map of the image as described above. Then nstack pixel stacks are created and initialized to zero. The rationale for choosing a particular number of pixel stacks is discussed later. The quality value range is split into nstack steps: each step has a quality value range of (QmaxQmin)/nstack and corresponds to one pixel stack. Here, Qmax and Qmin are the maximum and minimum values of the quality map, respectively. These pixel stacks are populated and depopulated during the region-growing stage and aid the determination of an optimal growth path. Additionally, two mask flags, Chk and Vst, are created and set to zero for each pixel of the image. To start region growing, an initial seed is selected from a high-quality area and placed onto the first pixel stack. Then we begin the region growing by iterating through the following steps:

  • Step 1: A seed pixel is selected from the pixel stack that has the lowest stack order and is not empty. When the pixel stack contains more than one pixel, the seed is selected on a first-in, first-out basis.

  • Step 2: The four nearest neighbors of the seed pixel are sequentially “visited.” Any of the four neighbors that have not been visited before are marked as visited by setting their Vst flag. Additionally, each of these pixels is placed on one of the nstack stacks, according to its quality value. Pixels with smaller quality values will be placed on a lower stack and pixels with greater quality values will be placed on a higher stack.

  • Step 3: The phase of the current seed pixel is unwrapped using the linear regression prediction mentioned above. Then this pixel is marked as “checked” by setting its Chk flag. For the initial seed pixel the unwrapped phase simply takes the wrapped phase. After the seed pixel is checked a new seed is selected from the pixel stacks as in Step 1. This three-step process is repeated until all the pixel stacks are empty.

Implementation and Testing

The UNROLL method was implemented in MatLab (MathWorks, Natick, MA). Both simulated data and acquired MRI data were used to test the algorithm. For comparison, the phase region expanding labeler for unwrapping discrete estimates (PRELUDE) algorithm (13) was also used to unwrap the same datasets. PRELUDE uses a region-merging technique to optimize a cost function that penalizes phase differences across boundaries. Since it has been widely used and shown to be robust and fast, we have chosen it to compare with UNROLL. PRELUDE can operate on n-dimensional datasets and here it was used in a 2D mode. Masks were not applied to the data for either method. The test was performed on a Linux PC with an Intel Pentium 4 1.6 GHz CPU.

The simulated datasets were Gaussian phase surfaces, which are usually used as a means of evaluating phase unwrapping algorithms under controlled conditions (14, 15). They were used to quantitatively compare UNROLL and PRELUDE.

To test the performance in the presence of noise, a Gaussian phase surface (256 × 256) with height of 50 rad and standard deviation (SD) of 30 pixels was generated and then wrapped into the range of (−π,π]. Gaussian noise with SD varying from 0.62 rad to 1.52 rad was then added to the wrapped phase, generating a set of images with different SNR levels. The phase images without noise and with noise SDs of 0.62 rad, 1.05 rad, and 1.32 rad are shown in the first row of Fig. 1.

Figure 1.

Results from the first of the 12 datasets with varying SNR: (a) the wrapped phase images, (b) unwrapped phase images using UNROLL, and (c) unwrapped phase images using PRELUDE. The noise SDs are 0 rad, 0.62 rad, 1.05 rad, and 1.32 rad from the left column to the right column, respectively.

To test the performance when an image contains rapid phase changes, Gaussian phase surfaces (256 × 256) with SDs of 30 pixels and heights from 100 rad to 250 rad were generated and then wrapped into the range of (−π,π]. Gaussian noise with an SD of 0.62 rad was then added to the wrapped phases, generating a set of phase images with the same noise level but with different phase gradients. These images are displayed in Fig. 2a. Note that in some regions of the Gaussian phase surfaces with heights of 200 rad and 250 rad, phase differences between two adjacent pixels are larger than π.

Figure 2.

Results from the first of the 12 datasets with varying phase gradients: (a) the wrapped phase images, (b) unwrapped phase images using UNROLL, and (c) unwrapped phase images using PRELUDE. The heights of the original Gaussian phase surfaces are 100 rad, 150 rad, 200 rad, and 250 rad from the left column to the right column, respectively, corresponding to different phase gradients. Rows (d) and (e) visualize quality maps generated from the corresponding phase images using (d) the first derivative variance and (e) the second derivative variance proposed in this study.

For quantitative comparison, the misclassification ratio (MCR) was calculated and the computation time was recorded for both of the two methods. MCR is the number of pixels that were incorrectly unwrapped divided by the total number of pixels, as defined in Ref. (13).

MR data were acquired from the head of a healthy volunteer using a 3T Siemens Trio scanner (Siemens Medical Solutions, Erlangen, Germany) and a gradient echo sequence. Sequence parameters were TR = 100 ms, TE = 25 ms, and a matrix size of 256 × 256. The magnitude and phase images are shown in Fig. 3a,b, respectively.

Figure 3.

In vivo results: (a) magnitude image, (b) wrapped phase image, (c) unwrapped phase image using UNROLL, (d) unwrapped phase image using PRELUDE, and (e) unwrapping result using the algorithm of Zhu et al. (9). The image (e) demonstrates poor performance in the low SNR areas. Some residual wrapping exists in the PRELUDE result (panel (d), see arrows). Note that masks created by thresholding the magnitude image were not used to facilitate comparison of the results of both methods over the entire image.


Twelve noisy sets of test data were generated and unwrapped. Quantitative results are given in Table 1, and unwrapped phase images for the first dataset are shown in Fig. 1b,c for UNROLL and PRELUDE, respectively. For UNROLL, nstacks = 5 in this case. The window sizes for phase prediction were optimized for each SNR value and were 7, 11, 15, 17, 19, 21, 21, and 21. Both methods gave satisfactory results when the noise standard deviations were not larger than 1.05 rad, while UNROLL gave a lower MCR. When the noise SDs were 1.20 rad and 1.32 rad, the mean MCR for the two methods was similar. UNROLL failed for one of the 12 test sets when SD = 1.20 rad and SD = 1.32 rad and the MCR reached 27.43% and 39.60%, respectively. This is why the average MCR of the two methods is similar but the SD of the MCR of UNROLL is higher than that for PRELUDE. For even stronger noise, the MCR of UNROLL was higher than PRELUDE, but in fact both algorithms failed to deliver any usable results at SD ≥ 1.32 rad.

Table 1. Test Results in the Presence of Noise
Standard deviation of phase noise (rad)00.620.861.051.201.321.421.52
  • a, b

    Unwrapping failed for only 1 out of 12 test images in these two noise levels, but the incorrectly unwrapped datasets deviated dramatically from the original.

% MCR for UNROLL0 ± 00 ± 00.04 ± 0.010.34 ± 0.023.87 ± 7.59a7.43 ± 10.50b22.51 ± 16.4939.38 ± 21.31
% MCR for PRELUDE0 ± 00 ± 00.11 ± 0.010.73 ± 0.043.60 ± 2.257.60 ± 2.6916.91 ± 6.6426.64 ± 7.07
Time for UNROLL (s)74 ± 1112 ± 6155 ± 15191 ± 27218 ± 31238 ± 28240 ± 24233 ± 30
Time for PRELUDE (s)2.4 ± 0.2200 ± 4345 ± 4425 ± 6483 ± 8528 ± 8554 ± 10575 ± 5

Table 2 gives a comparison of results obtained by unwrapping the 12 datasets containing phase images with different gradients; the unwrapped images from the first dataset are also displayed in Fig. 2b,c. It is clear that UNROLL has a lower MCR than PRELUDE when the phase changes rapidly: unwrapping was accurate even when the phase difference between two adjacent pixels was larger than π (the third and fourth columns). The properties of the quality map based on the second-order derivative variance used to guide UNROLL are also visualized in Fig. 2e and compared to the commonly used first derivative variance (Fig. 2d). UNROLL quality map treats areas of rapidly but smoothly changing phase as high quality and is insensitive to “phase aliasing effects,” seen in Fig. 2e.

Table 2. Test Results Using Different Phase Gradients
Height of Gaussian surface (rad)100150200250
% MCR for UNROLL0 ± 00 ± 00.06 ± 0.071.47 ± 1.56
% MCR for PRELUDE0.36 ± 1.237.13 ± 0.3111.31 ± 0.1714.23 ± 0.14
Time for UNROLL (s)111 ± 11109 ± 9107 ± 6107 ± 6
Time for PRELUDE (s)218 ± 4238 ± 2251 ± 6256 ± 3

Figure 3c,d displays the results of unwrapping the phase image obtained by scanning the human subject. These two methods gave the same result in most areas of the image. However, in the image produced by PRELUDE some phase wrapping is still visible in areas where the phase is changing rapidly, while UNROLL gave a better result. The phase unwrapping algorithm by Zhu et al. (9) was also implemented in MatLab and tested using the simulated and in vivo data. The unwrapping result using this algorithm is shown in Fig. 3e. As seen, it provides satisfying results in high-SNR regions but fails when noise appears and errors propagate to other regions. UNROLL shows a superior performance in low SNR regions as it uses a larger plane-fitting window.


A 2D phase unwrapping algorithm, called UNROLL, is presented here. It can cope with relatively high levels of noise and is robust against regions containing rapid phase changes.

The calculation time of PRELUDE depends on the SNR. This also applies to UNROLL: the SNR affects the choice of the window size that is used to predict the phase of the current pixel and this window size affects calculation time. At certain noise levels the UNROLL method is faster than PRELUDE. However, if the phase image is of high quality, PRELUDE is much faster than UNROLL (see the first column in Table 1).

Significant performance differences between PRELUDE and UNROLL appeared for images containing rapid phase changes. This is because PRELUDE makes the assumption that the true phase difference between two adjacent pixels is smaller than π. If this condition is not satisfied, PRELUDE will fail (see the third and fourth columns in Fig. 2 and the arrows in Fig. 3). On the other hand, UNROLL is based on local fitting, which for a smooth phase evolution can predict the true phase of the current pixel using the phase change trend of the unwrapped phase. Note that in these cases the seed point of UNROLL should be selected to lie in areas where phase changes reasonably slowly.

The selection of nstack (the number of pixel stacks) and mwin (the size of the window used for phase prediction) is not automatic, which is a weakness of the present algorithm. For most cases, nstack = 5 is suitable, while the size of the window mwin used for phase prediction depends on the SNR of the phase image. For high SNR phase images, using mwin = 7 produces satisfactory results, while for low SNR cases larger windows are needed. As mentioned above, the maximum window size used in this study was 21. The assumption that the local phase can be represented as a plane is limited by both the window size of the linear fit and the smoothness of the data. Larger window size can improve the unwrapping reliability, but it might not satisfy the plane assumption and so cause failure. This was observed upon increasing of the window size larger than 11 when unwrapping Gaussian phase surfaces shown in Fig. 2.

A significant difference between first-order and second-order phase derivative variance appears when phase gradient is high. As can be seen from Fig. 2d,e, high values are assigned to areas with high phase gradient, while actually the phase map has a uniform noise level. As shown in Fig. 2e, the second-order phase derivative variance provides a more faithful quality criterion.

Compared to PRELUDE, a commonly used phase unwrapping algorithm, the UNROLL method produces more accurate results and performs faster at certain noise levels and in cases when phase changes rapidly. The main disadvantage of the method is that it is not yet fully automated, as parameters must be chosen manually. It is also slower than PRELUDE for low noise levels. Extending UNROLL to 3D is conceptually simple and a 3D, fast, and fully automatic implementation of this algorithm is planned.


In this work, UNROLL, a quality-guided region-growing method for phase unwrapping is presented. The variance of the second-order partial derivatives of the phase is used to detect high-quality and low-quality areas. Linear regression is applied to predict the true phase of the current pixel. The use of these methods allows the unwrapping of phase maps that are corrupted by noise and have rapidly changing phase. Such phase maps were previously considered to be difficult for phase unwrapping. UNROLL may potentially be applied to phase images from echo-planar imaging, phase contrast MR angiography, and other phase-sensitive methods in MRI.


The authors thank Dr. Julian Maclaren for help with the preparation of the article.