IEEE TRANSACTIONS ON MEDICAL IMAGING, VOL. 19, NO. 8, AUGUST 2000 805 Correspondence________________________________________________________________________ A Fast Implementation of the Minimum Spanning Tree Method for Phase Unwrapping Li An*, Qing-San Xiang, and Sofia Chavez Abstract—A new implementation of the minimum spanning tree (MST) phase unwrapping method is presented. The time complexity of the MST method is reduced from to , where is the number of pixels in the phase map. Typical 256 256 phase maps from magnetic resonance imaging can be unwrapped in seconds, compared with tens of minutes with the implementation. This makes the pixel-level MST method time efficient and practically attractive. Index Terms—Image processing, magnetic resonance imaging, medical imaging, phase unwrapping. I. INTRODUCTION In magnetic resonance imaging (MRI), the detected signal comes from revolving magnetization vectors. The reconstructed images are complex images in nature, which can be decomposed into amplitude images and phase maps. Although the amplitude images are mostly used in diagnosis, the phase maps are of great use in applications such as flow imaging, magnetic field mapping, and chemical shift imaging. Consequently, phase unwrapping plays an important role in these ap- plications. Among many phase unwrapping algorithms, the MST approach is one of the most powerful methods [1]–[4]. It is conceptually simple and often offers satisfactory results. However, the conventional imple- mentation of the pixel-level MST method is inefficient for large-size phase maps as its time complexity is [3], where is the number of pixels in the phase map. We developed a fast implementation of the pixel-level MST method with a time complexity of . This improvement in time efficiency is achieved by using a linked data structure red–black tree [5] to dynamically store the edges and search for the minimum weight in the process of growing the MST. Because this new implementation does not change the phase unwrapping result of the conventional implementation of MST, this paper focuses on the time-efficient implementation rather than on the correctness and ro- bustness of the MST method. II. THE MST METHOD In order to help understand the MST method, we introduce some basic concepts in graph theory. A graph comprises a set of vertices and another set of edges . A tree is a connected graph that contains no cycles. In our case, each pixel in a phase map is considered to be a vertex and the link between two connected pixels an edge. Fig. 1 shows an example of a tree. In a Manuscript received June 10, 1999; revised June 17, 2000. This work was supported in part by a Whitaker Foundation grant. The Associate Editor respon- sible for coordinating the review of this paper and recommending its publication was M. Vannier. Asterisk indicates corresponding author. *L. An and S. Chavez are with the Department of Physics and Astronomy, The University of British Columbia, Vancouver, BC V6T 1Z1 Canada (e-mail: li-an@sugar-land.spc.slb.com). Q.-S. Xiang is with the Department of Physics and the Department of Radi- ology, The University of British Columbia, Vancouver, BC V6T 1Z1 Canada. Publisher Item Identifier S 0278-0062(00)07995-7. Fig. 1. An example of a tree in a phase map. weighted graph, a weight is associated with each edge. A spanning tree in a graph is a tree connecting all of the vertices of , and its weight is defined as the sum of the weights of all edges in the tree. If the weight of a spanning tree is the minimum among all of the spanning trees in the graph, this spanning tree is called a minimum spanning tree (MST). In the pixel-level MST phase unwrapping application, the edge weight is calculated as the absolute value of the phase difference between the two pixels that form the edge. Experiments show that a phase unwrapping path following an MST usually avoids going through dipole structures [6] and, thus, yields reliable phase unwrapping results. In the conventional implementation of the pixel-level MST method, the MST is grown with the following procedure [2]. Before starting the growing process, a table with rows is generated, where is the number of pixels in the phase map. Each row contains the location of a pixel and its four neighbors, as well as the weights of the four edges formed by the pixel and its four neighbors. The growing process starts from an arbitrary pixel whose information is stored in row of the table. Pixel is connected to its nearest neighbor , which has the smallest weight entry in row . Now consider and as one subgraph, and connect it to its nearest neighbor that has the smallest weight among all entries in rows and . Then, , and are considered as one subgraph and connect it to its nearest neighbor. This process continues until all pixels are connected by edges. The time complexity of this process is [3]. III. FAST IMPLEMENTATION OF THE MST METHOD The basic method of growing the MST in our fast implementation is the same as in the conventional one. The difference is in how the edge weights are being stored and searched. The following is a detailed de- scription of our implementation. A graphical illustration of the growing process is also given in Fig. 2. Given a wrapped phase map , an ar- bitrary pixel in the phase map is selected as the original seed to start the growing process. This process can be considered as growing both edges and pixels because when a new edge is added to the MST, a new pixel is also added to the grown region. For the selected seed, its un- wrapped phase is simply set to be its wrapped phase . Different selection of the original seed may result in a multiples of 2 phase shift for the unwrapped phase map. The original seed and its four-connected neighbors form four edges. The phase difference for each edge is calculated by (1) where is the wrapping operator that wraps its argument into the range by adding or subtracting an integral number of 2 from its argument and is the wrapped phase of a neighbor. The edge weight and the edge index are added to an initially empty red–black tree . After the four edges are added, a search of the 0278–0062/00$10.00 © 2000 IEEE Authorized licensed use limited to: National Instiute of Health. Downloaded on June 10,2010 at 13:16:13 UTC from IEEE Xplore. Restrictions apply.