MAGNETIC FIELD SIMULATION OF GOLAY AND MAXWELL COILS CHEW TEONG HAN UNIVERSITI TEKNOLOGI MALAYSIA MAGNETIC FIELD SIMULATION OF GOLAY AND MAXWELL COILS CHEW TEONG HAN A thesis submitted in fulfilment of the requirements for the award of the degree of Master of Science (Physics) Faculty of Science Universiti Teknologi Malaysia MAY 2010 iii To the late Associate Professor Dr Rashdi Shah Ahmad. iv ACKNOWLEDGEMENT I would like to express my gratitude and appreciation towards both my supervisors, the late Assoc Prof Dr Rashdi Shah and Dr Amiruddin for their guidance throughout the research. I would like to thank both my internal examiner, Assoc Prof Dr Ahmad Radzi Mat Isa and external examiner, Assoc Prof Dr Ahmad Nazlim Yusoff, for their advices and useful disscussions in improving my research and especially the report. Apart from that, I would like to thank Kuok Foundation for its financial assistance. I would also wish to acknowledge Universiti Teknologi Malaysia (UTM) for the Initial Research Grant Scheme (IRGS), vote number 78917, through Research Management Center (RMC, UTM) as well as the facilities provided. Special thanks go to family members and close friends for their continuous support. Other personnels we would like to acknowledge include Mr Yap, Mr Teo and Mr Ng for making the thesis writing process easier and Mr Eeu, for introducing Python to me, open-source communities in general for providing great tools (Python, VisIt, Ubuntu) for free. Thank you all. v ABSTRACT Magnetic field gradient coils are essential in obtaining accurate magnetic resonance imaging (MRI) or nuclear magnetic resonance (NMR) signals by generating magnetic field gradient in each x, y and z direction. Two of the parameters to determine the performance of such gradient coils are the magnetic field linearity and magnetic field gradient uniformity. This research emphasizes on the analysis of the geometrical effect of the conventional Golay-Maxwell pair gradient coils to these two parameters through computer simulation. The results show that the geometrical parameters of θ and d affect Golay coil’s magnetic field gradient. Usable volume is improved 50% while gradient strength is increased 11% when θ is 1600 compared to the original 1200 . The increase of d results in increase of usable volume, which is a maximum of 3374 cm3 at 0.8r but a loss of gradient strength of 36% compared to -0.34 mT/m at 0.2r. The other geometrical parameters of Golay coil are found not to affect much on the magnetic field gradient generated because of two reasons; the longitudinal sections of Golay coil do not contribute to Bz generation and the outer arcs are just acting as current return paths. For Maxwell coil, the usable volume can be improved until 19196.128 cm3 when d is 2.0r although the gradient value obtained is lower compared to a maximum of -0.066 mT/m at 1.2r. Application wise, the higher the gradient value and the bigger the usable volume, the better since the resolution can be improved, not to mention, a bigger specimen accomodation. A computer simulation is written fully in Open-source environment and feature variation of output as well as faster vectorized algorithm. The simulation results will definitely provide useful information for gradient coil designers without the need for physical development of prototype. vi ABSTRAK Lingkaran kecerunan medan magnet adalah penting dalam proses untuk mendapatkan isyarat yang jitu dalam pengimejan resonans magnet (PRM) atau resonans magnetik nuklear (RMN) dengan penghasilan kecerunan medan magnet pada paksi x, y dan z. Dua parameter untuk menentukan prestasi lingkaran kecerunan adalah kecerunan medan magnet dan keseragaman kecerunan medan magnet. Kajian in menekankan kepada analisis kesan geometri lingkaran kecerunan konvensional, iaitu Golay-Maxwell, terhadap kedua-dua parameter tersebut menggunakan simulasi komputer. Keputusan menunjukkan bahawa parameter geometri θ dan d menjejaskan kecerunan medan magnet gegelung Golay. Isipadu boleh-guna meningkat 50% manakala nilai kecerunan ditingkatkan 11% apabila θ adalah 1600 berbanding dengan 1200 pada asalnya. Peningkatan nilai d mengakibatkan peningkatan isipadu bolehguna, semaksimum 3374 cm3 pada 0.8r tetapi pengurangan nilai kecerunan sebanyak 36% daripada nilai - 0.34 mT/m pada 0.2r. Parameter geometri gegelung Golay yang lain didapati tidak memberi kesan yang yang nyata kepada kecerunan medan magnet kerana dua sebab; bahagian melintang gegelung Golay tidak menyumbang kepada penghasilan Bz dan lengkok luar hanyalah berfungsi sebagai sambungan untuk menyempurnakan litar. Untuk gegelung Maxwell, isipadu boleh-guna boleh ditingkatkan kepada 19196.128 cm3 apabila d adalah 2.0r namun nilai kecerunan yang didapati rendah berbanding dengan nilai maksimum -0.066 mT/m pada 1.2r. Dari segi aplikasi, nilai kecerunan yang tinggi dan nilai isipadu boleh-guna yang tinggi akan meningkatkan resolusi di samping membolehkan penggunaan sampel yang lebih besar. Simulasi komputer ini dihasilkan menggunakan perisian sumber terbuka dan mempunyai ciri-ciri seperti pelbagai pilihan output dan juga algoritma yang lebih cepat. Keputusan daripada simulasi ini pasti dapat memberi maklumat berguna tanpa pembangunan prototaip secara fizikal. vii TABLE OF CONTENTS CHAPTER TITLE DECLARATION DEDICATION ACKNOWLEDGEMENT ABSTRACT ABSTRAK TABLE OF CONTENTS LIST OF TABLES LIST OF FIGURES LIST OF ABBREVIATIONS LIST OF SYMBOLS LIST OF APPENDICES PAGE ii iii iv v vi vii x xi xiv xv xvii 1 INTRODUCTION 1.1 Introduction to Modeling 1.2 Open Source 1.3 Research Profile 1.3.1 Background of Research 1.3.2 Statement of Problem 1.3.3 Purpose of Research 1.3.4 Objectives of Research 1.3.5 Significance of Research 1.3.6 Scope of Research 1.3.7 Methodology of Research 1.4 Summary 1 1 2 3 3 3 4 4 4 5 5 6 2 LITERATURE REVIEW 2.1 Theory of Nuclear Magnetic Resonance 2.2 Nuclear Magnetic Resonance Hardware 7 7 9 viii 2.2.1 2.2.2 2.3 2.4 2.5 2.6 Main Magnet Gradient Coils 2.2.2.1 Longitudinal Gradient Coil 2.2.2.2 Transverse Gradient Coil 2.2.3 Radio Frequency System Biot-Savart’s Law Biot-Savart’s Law for Finite Length Current Segment Related Research Summary 10 10 11 12 13 13 14 16 19 3 RESEARCH METHODOLOGY 3.1 Simulation Model 3.2 Problem Formulations 3.3 Python Coding 3.4 Data Collection and Analysis Procedures 3.5 Summary 20 20 21 26 28 30 4 RESULTS AND DISCUSSION 4.1 Three-Dimensional Visualization 4.2 Results on Golay Coil 4.2.1 General Results 4.2.2 Variation of θ 4.2.3 Variation of r 4.2.4 Variation of a 4.2.5 Variation of d 4.2.6 Variation of l 4.3 Results on Maxwell Coil 4.3.1 General Results 4.3.2 Variation of r 4.3.3 Variation of d 4.4 Discussion 4.5 Summary 31 31 34 35 38 42 42 48 53 57 57 59 59 63 67 5 CONCLUSIONS 5.1 Conclusions 5.2 Suggestions for Further Works 68 68 69 ix REFERENCES Appendices A – F 71 75 – 103 x LIST OF TABLES TABLE NO. TITLE PAGE 3.1 Calculation Time Comparison 27 4.1 4.2 4.3 4.4 4.5 4.6 Correlation and Gradient value for various θ Usable Volume for various θ Correlation, Gradient value and Usable volume for various a Correlation, Gradient value and Usable volume for various d Correlation, Gradient value and Usable volume for various l Correlation, Gradient value and Usable volume for various d 38 42 44 48 54 60 xi LIST OF FIGURES FIGURE NO. 2.1 2.2 2.3 2.4 2.5 2.6 2.7 TITLE Precession of (a) Nucleus with External Field, B0 and (b) Spinning Top with Gravity Block Diagram of a Simple MRI/NMR Hardware z axis Maxwell Coil x axis Golay Coil y axis Golay Coil Biot-Savart’s Law (a) A Finite Wire Carrying a Current I with the Magnetic Field at M is Out of the Paper and (b) The Limiting Angles θ1 and θ2 PAGE 8 9 11 12 13 14 15 20 21 21 22 22 23 3.8 3.9 3.10 3.11 x axis Golay Coil Simulation Model x axis Golay Coil Simulation Model on xy Plane z axis Maxwell Coil Simulation Model z axis Maxwell Coil Simulation Model on xy Plane Flow Chart of Research Methodology Parameters for Parametric Equation of Circle −−→ Parameters Related to Finite Length Segment AB and Measurement Point, M Execution Flow of the Simulation Example Plot to Determine the Linearity Range Example Plot to Determine the Usable Region on xy Plane Example Plot to Determine the Usable Region on xz Plane 4.1 4.2 4.3 4.4 4.5 4.6 x axis Golay Coil with a Three-dimensional Calculation Grid Three-dimensional Contour Surface Plot Three-dimensional Contour Plot Projected Two-dimensional Contour Plot on xy Plane Projected Two-dimensional Contour Plot on xz Plane Projected Two-dimensional Contour Plot on yz Plane 32 32 32 33 33 33 3.1 3.2 3.3 3.4 3.5 3.6 3.7 24 26 28 29 29 xii 4.7 4.8 4.9 4.10 4.11 4.12 4.13 4.14 4.15 4.16 4.17 4.18 4.19 4.20 4.21 4.22 4.23 4.24 4.25 4.26 4.27 4.28 4.29 4.30 4.31 4.32 4.33 4.34 4.35 4.36 4.37 4.38 4.39 4.40 4.41 4.42 4.43 (a) x axis and (b) y axis Golay Coil x axis Golay Coil with (a) xz Calculation Plane and (b) xy Calculation Plane Bz versus x at (y, z) = (0, 0) Bz versus x at z = 0 for various y Bz versus x at y = 0 for various z 4% Contour Plot on xy Plane at 5% interval at z = 0 4% Contour Plot on xz Plane at 5% interval at y = 0 Bz versus x for various θ at (y, z) = 0 4% Contour Plot on xy Plane at 5% interval at z = 0 for θ = 800 4% Contour Plot on xy Plane at 5% interval at z = 0 for θ = 1000 4% Contour Plot on xy Plane at 5% interval at z = 0 for θ = 1400 4% Contour Plot on xy Plane at 5% interval at z = 0 for θ = 1600 4% Contour Plot on xz Plane at 5% interval at y = 0 for θ = 800 4% Contour Plot on xz Plane at 5% interval at y = 0 for θ = 1000 4% Contour Plot on xz Plane at 5% interval at y = 0 for θ = 1400 4% Contour Plot on xz Plane at 5% interval at y = 0 for θ = 1600 Different Focal Point of Two Arcs of Golay Coil Bz versus x for various a at (y, z) = 0 4% Contour Plot on xy Plane at 5% interval at z = 0 for a = 2.5r 4% Contour Plot on xy Plane at 5% interval at z = 0 for a = 3.0r 4% Contour Plot on xy Plane at 5% interval at z = 0 for a = 3.5r 4% Contour Plot on xy Plane at 5% interval at z = 0 for a = 4.0r 4% Contour Plot on xy Plane at 5% interval at z = 0 for a = 4.5r 4% Contour Plot on xz Plane at 5% interval at y = 0 for a = 2.5r 4% Contour Plot on xz Plane at 5% interval at y = 0 for a = 3.0r 4% Contour Plot on xz Plane at 5% interval at y = 0 for a = 3.5r 4% Contour Plot on xz Plane at 5% interval at y = 0 for a = 4.0r 4% Contour Plot on xz Plane at 5% interval at y = 0 for a = 4.5r Bz versus x for various d at (y, z) = 0 4% Contour Plot on xy Plane at 5% interval at z = 0 for d = 0.2r 4% Contour Plot on xy Plane at 5% interval at z = 0 for d = 0.4r 4% Contour Plot on xy Plane at 5% interval at z = 0 for d = 0.6r 4% Contour Plot on xy Plane at 5% interval at z = 0 for d = 0.8r 4% Contour Plot on xy Plane at 5% interval at z = 0 for d = 1.2r 4% Contour Plot on xy Plane at 5% interval at z = 0 for d = 1.4r 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 0.2r 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 0.4r 34 34 36 36 36 37 37 39 39 39 40 40 40 41 41 41 43 43 44 45 45 45 46 46 46 47 47 47 48 49 49 50 50 50 51 51 51 xiii 4.44 4.45 4.46 4.47 4.48 4.49 4.50 4.51 4.52 4.53 4.54 4.55 4.56 4.57 4.58 4.59 4.60 4.61 4.62 4.63 4.64 4.65 4.66 4.67 4.68 4.69 4.70 4.71 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 0.6r 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 0.8r 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 1.2r 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 1.4r Bz versus x for various l at (y, z) = 0 4% Contour Plot on xy Plane at 5% interval at z = 0 for l = r 4% Contour Plot on xy Plane at 5% interval at z = 0 for l = 2r 4% Contour Plot on xy Plane at 5% interval at z = 0 for l = 4r 4% Contour Plot on xy Plane at 5% interval at z = 0 for l = 5r 4% Contour Plot on xz Plane at 5% interval at y = 0 for l = r 4% Contour Plot on xz Plane at 5% interval at y = 0 for l = 2r 4% Contour Plot on xz Plane at 5% interval at y = 0 for l = 4r 4% Contour Plot on xz Plane at 5% interval at y = 0 for l = 5r z axis Maxwell Coil with (a) xz Calculation Plane and (b) yz Calculation Plane Bz versus z at (x, y) = (0, 0) 4% Contour Plot on xz Plane at 5% interval at y = 0 4% Contour Plot on yz Plane at 5% interval at x = 0 Bz versus z at (x, y) = (0, 0) for various d 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 0.8r 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 1.2r 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 1.4r 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 1.6r 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 1.8r 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 2.0r 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 2.2r Magnetic Field Generated by a Straight Segment Schematic of Gradient Value and Slice Thickness Schematic of Gradient Value and Resolution 52 52 52 53 53 54 54 55 55 55 56 56 56 57 58 58 59 60 60 61 61 61 62 62 62 64 66 66 xiv LIST OF ABBREVIATIONS NMR - Nuclear Magnetic Resonance MRI - Magnetic Resonance Imaging RF - Radio Frequency ROI - Region of Interest VOI - Volume of Interest DSV - Diameter Spherical Volume VTK - Visualization Toolkit xv LIST OF SYMBOLS A - Ampere T - Tesla m - meter mT/m - mili-Tesla per meter mT/m/A - mili-Tesla per meter per Ampere GB - Gigabytes ω - Larmor precession frequency γ - Gyromagnetic ratio µ0 - Permeability of free space I - Current rc −−→ AB - Correlation coefficient - ûAB −−→ −−→ AB • CD −−→ −−→ AB × CD - Vector from A to B −−→ Unit vector of AB - −−→ −−→ Dot product between vector AB and CD −−→ −−→ Cross product between vector AB and CD ~ B - Magnetic field (vector) B - Magnetic field (scalar) Bx - î component of magnetic field By - ĵ component of magnetic field Bz - k̂ component of magnetic field B0 - Main magnetic field B1 - Oscillating magnetic field/RF pulses Gx - Magnetic field gradient in x direction Gy - Magnetic field gradient in y direction xvi Gz - Magnetic field gradient in z direction η - Magnetic field gradient efficiency 4% - Magnetic field gradient uniformity xvii LIST OF APPENDICES APPENDIX A B C D E F TITLE MODULE CODE FOR GOLAY COIL CODE FOR MAXWELL COIL VTK FILE FORMAT PUBLICATION A PUBLICATION B PAGE 75 79 86 92 94 103 CHAPTER 1 INTRODUCTION 1.1 Introduction to Modeling The concept of modeling has a long history of its own, even before the computer exists. Modeling works before the era of computer, however, were limited to the manual theoretical and mathematical formulations. The theories and formulations, usually, are in ideal forms. By using approximations and assumptions, certain specific cases of the theories can be derived. Of course, the possibility of each theory is wide depending of the total parameters involved. While the mathematical formulation still rule the physics world today, a certain depth of knowledge (and imagination) is required for understanding. Fortunately enough, computer modeling or simulation helps in both “visualizing” the mathematics behind the theories and the calculation of each possible cases. Complex modeling may be a daunting tasks for human but that would not be a problem to a computer. As long as there is enough processing power, the computer will be able to execute any number of iterations. One main shortcoming of computer simulation is the inability to model the continuous functions. The most computer simulation can do is to approximate such functions by representating the continuous functions as discrete or finite functions. Numerical techniques such as numerical differentiation or integration, finite element method and finite difference method provide such representation. Generally, the smaller the steps are, the closer the simulation to the actual phenomenon, but with sacrifice in resources and computing time. When such things happens, parallel computing or clustering is preferred in which the job is distributed among few computers. 2 1.2 Open Source Many scientific based software and toolkits are available to aid scientists and engineers in their research. The availability of such software provides useful functions and libraries to cater a wide area of applications. The famous scientific based commercial software includes Matlab, Maple, Electronic Workbench and AutoCAD. These software, without a doubt, come in a complete package as possible. Matlab, for example, has found its way into virtually any area of research; physics, statistics, engineering, to name a few. However, these commercial software share one thing in common, the high price for licensing. A full package of Matlab can cost up to few thousand ringgit. For a medium size of computer lab which consists of 10 to 20 computers, the Matlab installations alone is already pass the tenth thousand mark, not to mention the operating software and others. One more issue involving the commercial scientific based software is the licensing of the research product or outcome. Since the development of the product is based on commercial software, the distribution of the product might be troublesome. Although the research outcome is the effort of the researchers, it is still limited by the commercial licensing. As far as the concept of continuing and collaborative research is concerned, such issue no longer encourage knowledge spreading and sharing, if one do not own a legal copy of the commercial development platform. Fortunately, there are alternatives to this solutions which is the open source software. Commercial software are known as close source software in which the source code of the software are not available to public. Without the source code, the users are not allowed to modify and distribute the software. Open source software are just direct opposite of this. The source codes of the software are available and can be freely modified and distributed as long as they are compiled under the license of the original software. Any programs developed using such software would not face any modification or distribution issue. In such circumstances, open source software are more communities oriented and the communities themselves repay the open source world by providing patches, updates as well as third party extension to the software. Most open source software are freely available. Examples of such software which are scientific based include Octave and Scilab (Matlab alternatives), Python (open source programming language), as well as VisIt and OpenDX (open source visualization programs). With such powerful software minus the price, scientific researchs take a great step forward, needless to always depending on the commercial software. This research takes the opportunity to hightlight the capability and importance of such software. 3 1.3 Research Profile 1.3.1 Background of Research In the field of magnetic resonance imaging (MRI), besides the main magnetic field, B0 , and the radio frequency (RF) subsystem, the magnetic field gradient coils subsystem also play an important role in accurate signal acquisition. The operation of MRI is based on a physical theory known as nuclear magnetic resonance (NMR). In this theory, the spin of nucleus can be altered by manipulating the magnetic field. With the presence of the main magnetic field, B0 , and the magnetic field gradient, Gx = ∂Bz /∂x, Gy = ∂Bz /∂y and Gz = ∂Bz /∂z, the spin at each voxel (grid point in three-dimensional space) can be uniquely characterized in terms of frequency and phase, according to the Larmor equation and detectable by the RF subsystem. The gradient coil subsystem, therefore, is critical in making sure the magnetic field gradient generated is as linear over as large volume as possible. 1.3.2 Statement of Problem Two of the important specifications of a gradient coil system are the field linearity and gradient uniformity. As the name suggests, the main purpose of a gradient coil is to generate a linearly varied magnetic field (linearity) along certain axis, in this case, x, y and z axis. Besides being linear along certain axis, the magnetic field gradient generated have to be uniform within an area as large as possible (uniformity). The conventional coils used for x and y axis (also known as transverse gradient coils) are the Golay coil configuration whereas for the z axis (also known as longitudinal gradient coil), Maxwell coil configuration is used. Turner revolutioned the gradient coil design by introducing what is called target-field method [1]. This method generally involve solving a Fourier-Bassel expansion using Fourier Transforms [2]. Further researches import Turner’s technique by incorporating stream functions by Sanchez et al. [3], using hybrid optimization method by Qi et al. [4], using finiteelement method by Shi et al. [5]. The most recent development in gradient coil design is the three-dimensional toroidal design proposed by White et al. [6]. However, the disadvantage of such methods includes a high level understanding of various mathematical functions since the design method is an inverse problem. Besides, in certain applications, conventional gradient coils are still prefered due to their simplicity [7, 8, 9]. Biot-Savart’s Law offers a simpler and faster forward solution 4 to gradient coil design problem, making the whole gradient coil simulation and design process cost and time effective. 1.3.3 Purpose of Research To map the magnetic field generated by gradient coils with emphasize on field linearity and gradient uniformity. 1.3.4 Objectives of Research The objectives of the research include: 1. To observe how the coil parameters affect the magnetic field gradient, magnetic field linearity and magnetic field gradient uniformity 2. To develop a user friendly, open source and freely distributable magnetic field calculation program 3. To provide valuable information to gradient coils designers without physical prototype development 1.3.5 Significance of Research The research has come out with a user-friendly program to calculate and map the magnetic field generated by the conventional gradient coils used in MRI and NMR. Therefore, this will provide valuable data to coil designers and researchers without physically constructing the whole gradient coils themselves, reducing cost and time in general. Furthermore, those who use this program do not have to go through complex mathematical equations for them to calculate the generated magnetic field. By utilizing open-source software, this program can be freely distributed to promote knowledge sharing and modification to suit their needs. Since the magnetic field calculation in the program is based on Biot-Savart’s Law for finite length current segment, the same algorithm can be used to calculate magnetic field generated by any current carrying conductor as long as the conductors can be divided into a series 5 of finite length segment. This will surely solve the unavailability of analytical BiotSavart’s formulations to calculate the magnetic field generated by current carrying coils at points of interest. 1.3.6 Scope of Research This research focuses on computer simulation of the magnetic field generated by conventional unshielded gradient coils. Both the Golay coil and Maxwell coil have been modeled and their generated magnetic field and gradient were simulated and mapped accordingly. The field linearity and gradient uniformity of the generated magnetic field were calculated and mapped using some of the definitions suggested by Shi et al. [5], Di Luzio et al. [10] and Bowtell et al. [11]. The effect of coil parameters to field linearity and gradient uniformity have been investigated. The research solved problem in a forward manner rather than most of the gradient coil design methods which are based on inverse problem solving. Besides assisting gradient coils designers, the outcome of the research also provide a complete investigation of the geometrical parameters of the gradient coil. 1.3.7 Methodology of Research Biot-Savart’s Law will be used in the research to simulate the magnetic field generated by the conventional gradient coils. Golay coil and Maxwell coil are two of the well-known gradient coils used in conventional system [12]. By refering to the design, the gradient coils are divided into a series of finite length current segment. Using Biot-Savart’s Law for finite length current segment, the calculations in this simulation are iterated and the generated magnetic field are summed up. The results are visualized appropriately in two-dimensional or three-dimensional contour plot. Data has been extracted from the output of the simulation for suitable statistical analysis and tabulated. 6 1.4 Summary From the information, the conventional gradient coils were modeled accordingly. Suitable research methodologies were utilized to match the intentions of the research and come out with relevant results. Conclusions are then drawn from the results and discussions. All these will be discussed in the next few chapters. CHAPTER 2 LITERATURE REVIEW 2.1 Theory of Nuclear Magnetic Resonance In the medical field, MRI is widely used as one of the non-invasive technique to investigate abnormality of human body. Before MRI was introduced, techniques such as X-ray imaging which utilize ionizing sources, were used. These techniques will affect human in long term basis. MRI, on the other hand, make use of the spin properties of nuclei (hidrogen in human body) by applying magnetic field and RF pulses, which is safer. Nuclei that have net spin possess a tiny magnetic moment, similar to those found in bar magnet. When a magnetic field (B0 ) is applied to such nuclei, the magnetic moment will undergo a process called precession. This is analogous to the wobbling (which is caused by the presence of gravity) of a spinning top. This phenomenon can be explained with the fact that the non-zero spin possessed by the nuclei implies circulation of charge. The charge circulation can be represented as a tiny current loop that produce its own magnetic field. When this magnetic field is subjected to an external magnetic field, a “torque” will align the spin, or more specifically the magnetic moment with the external field. This is shown in Figure 2.1. Nuclear magnetic resonance (NMR) is a physical theory that lives behind MRI. Nuclei in a sample (or human body) are randomly arranged. Therefore, a main magnetic field, B0 , is used to align the nuclei inside a sample. As a result, the nuclei align themselves either parallel or anti-parallel with B0 . The aligned nuclei will also precess at certain frequency with B0 . Such frequency is known as the Larmor frequency, shown in Equation 2.1. ω = γB (2.1) 8 Figure 2.1: Precession of (a) Nucleus with External Field, B0 and (b) Spinning Top with Gravity where ω is the Larmor frequency, γ is the gyromagnetic ratio and B is the magnetic field strength. After the nuclei alignment, the B in Equation 2.1 is B0 value. This means that all the nuclei will precess at one Larmor frequency only because they are subjected to the same value of B. The value of γ for 1 H is around 42.58 MHz/T [12]. A typical MRI scanner has a main magnetic field strength of few tesla, resulting in the Larmor frequencies falling in the MHz or the RF region. The main concern now is the Larmor frequencies. If the nuclei in a sample are only subjected to a magnetic field (B0 ), they will only precess at one Larmor frequency. Since the detectable signals depend on Larmor frequencies, the sample will need to be spatially encoded with different values of magnetic field, so that the nuclei in that sample will precess at a frequency range rather than one frequency value only. Magnetic field gradients are applied for this purpose. For example, if B0 is in z direction, and a magnetic field gradient is applied in the same direction, then each point along z direction will have different values of magnetic field (as a result of the superposition of main magnetic field and the magnetic field gradient). The different magnetic field values will result in different precession frequencies. Usually, a magnetic field gradient is applied for each x, y and z direction to spatially encode the sample in three dimensions. MRI or NMR signal acquisition is based on the “tipping” off the nuclear magnetization. Each nucleus has its own magnetic moment. Inside a sample, the vector sum of these magnetic moments is known as nuclear magnetization. When B0 is applied, the magnetic moments of all the nuclei will be aligned, resulting in a net longitudinal magnetization (in the same direction as B0 ). The net longitudinal magnetization will be tipped off of its longitudinal axis by applying a transverse oscillating magnetic field (B1 ) at the Larmor frequency. The transverse component 9 magnetization (as a result of the tipping off) will now rotate at Larmor frequency (hence, the term resonance in NMR). The rotation will produce another oscilating magnetic field, detectable by RF receiver coil. As B1 is switched off, the transversed magnetization will decay back to zero and the signal will disappear. Each point (or voxel) of the sample will have a different value of magnetic field which means a different Larmor frequency. The normal practice, therefore, is to sweep the sample with B1 of a range of RF frequencies. 2.2 Nuclear Magnetic Resonance Hardware Figure 2.2 shows the block diagram of the basic components for a NMR or MRI hardware. It consists of main magnet, gradient coils and RF system. The machine will be controlled by a computer system including the switching on and off the components and the visualization of the output. The main magnet will be responsible for generating the main magnetic field, B0 whereas the gradient system will generate magnetic field gradient along x, y, z or a combination of the axes depending on factors like imaging technique or imaging plane. The RF system will transmit RF pulses (B1 ) and at the same time, detect the RF pulses during the relaxation process. Figure 2.2: Block Diagram of a Simple MRI/NMR Hardware 10 2.2.1 Main Magnet The main magnet in a NMR or MRI machine can be either a permanent magnet or a more advanced superconducting magnet. Permanent magnet can be bulky as the strength of its magnetic field increases besides offering a small region of field uniformity. However, for micro imaging which usually small samples are used, permanent magnet would be a better choice because of its simplicity and pricing [13, 14, 15, 16]. Bigger applications such as in medical field or MRI, superconducting magnet is used as the main magnet. Superconducting magnet is basically specifically shaped coils which are cooled until the resistance of the coils becomes zeros. This is normally done by liquid helium. The current flow inside the coils will generate magnetic field along the coils axis. The advantage of using superconducting magnet is its stable, homogeneous and high strength magnetic field. The construction of superconducting magnet, however, is not simple and requires higher budget. For a typical clinical usage, the main magnet field strength is around 2 T [12]. Other applications sometimes require B0 value to be higher. Some researches reported to have use 7 T for magnetic resonance microscopy [17], a 14.1 T system for NMR microscopy [18] or a lower end MRI system at 0.21 T [13]. 2.2.2 Gradient Coils The introduction of gradient coils into a NMR or MRI machine causes a change in the value of field strength in the imaging region. Based on Equation 2.1, if the field strength is known, then the precession frequency can be determined which means the range of the frequency of the RF pulses (or B1 ) is known (either during excitation or detection). Normally, the process of applying magnet gradient to the existing main magnetic field is known as spatial encoding. There are many designs of gradient coils including the “finger print” type coils [16, 19], planar type coils [20, 21] and the conventional saddle type coils [22]. Two sets of gradient coils are incorporated in a NMR or MRI machine, namely the longitudinal gradient coil and the transverse coil. 11 2.2.2.1 Longitudinal Gradient Coil Longitudinal gradient coil, as its name suggests, produces a magnetic field gradient along the axis of the main magnetic field. A conventional longitudinal coil is shown in Figure 2.3. It is basically two identical coils carrying current in opposite direction with each other separated by a distance. Such configuration is also known as Maxwell coil. Figure 2.3: z axis Maxwell Coil The magnetic field generated along the z axis by a Maxwell coil with radius = a, separated with a distance = d is given by Equation 2.2. Bz = µ0 Ia2 µ0 Ia2 − 2[(d/2 − z)2 + a2 ]3/2 2[(d/2 + z)2 + a2 ]3/2 (2.2) Equation 2.2 is derived from the original Biot-Savart’s Law (which will be discussed later in this chapter). Generally, the Biot-Savart’s Law can be derived for any shape of the current carrying coil for any point of interest. This is, however, will be a difficult task to be accomplished. If every point of interest requires different derivation of BiotSavart’s Law, then for a magnetic field simulation or calculation at a hundred of points would definitely require one hundred set of equations especially at points which are not along the axis of the coil. By using the finite-length current segment approach, 12 though, will solve this complexity, as used in this research. 2.2.2.2 Transverse Gradient Coil Tranverse gradient coil will produce magnetic field gradient along the two orthogonal axes to the main magnetic field. A general case is that normally the main magnetic field will be along the z axis and the tranverse gradient coil will be placed in such a way that a magnetic field gradient is generated along the x and y axis. Figure 2.4 and 2.5 show the conventional Golay coil used as the tranverse gradient coils for x and y axis respectively with the red arrows indicate the direction of the current. There is no an appropriate analytical formulation to calculate the magnetic field generated by the Golay coil shown in Figure 2.4 and 2.5. However, the analysis of such coils can be derived from Equation 2.3. Bz (r, θ, φ) = ∞ X n X rn Pnm (cos θ)(Anm cos mφ + Bnm sin mφ) (2.3) n=0 m=0 Equation 2.3 is written in cylindrical coordinate and the solution require the knowledge of Lengendre polynomial (Pnm (cos θ) with Anm and Bnm as the expansion coefficients). Again, solving Equation 2.3 would require a significant understanding of mathematical functions. Figure 2.4: x axis Golay Coil 13 Figure 2.5: y axis Golay Coil 2.2.3 Radio Frequency System The role of RF system in a NMR or MRI machine is to excite the nuclei and to detect the NMR signal during relaxation process. RF system consists of coils just like gradient coils, only with different functions. Conventional saddle coil and “birdcage” coil are two types of coils that are being used as RF coils in NMR or MRI machine. 2.3 Biot-Savart’s Law ~ generated at a The Biot-Savart Law states that the differential magnetic field dB field point by a steady current I flowing through a differential length d~s of a conductor has the following properties: 1. ~ is perpendicular to both d~s (the direction of the current element) The vector dB and to the unit vector r̂ directed from the element to the field point. 2. ~ is inversely proportional to r2 , where r is the distance from The magnitude of dB the element to the field point. 3. ~ is proportional to the current and to the length d~s of the The magnitude of dB element. 4. ~ is proprotional to sin θ, where θ is the angle between the The magnitude of dB vector d~s and r̂. 14 Equation (2.4) summarizes Biot-Savart Law. ~ = dB µ0 Id~s × r̂ 4π r2 (2.4) ~ is the differential magnetic field induced, µ0 is the permeability of free space where dB which is equal to 4π × 10−7 H/m, I is the current in Ampere, d~s is the differential length vector of current element segment, r̂ is the unit displacement vector from the current element to the field point and r is the distance from the current element to the field point. Equation (2.4) shows only the differential magnetic field generated according to the Biot-Savart’s Law. The total magnetic field generated by a coil is the sum of the magnetic field generated by all of the differential length of the coil, which means the integration of Equation 2.4, resulting in Equation 2.5. ~ = µ0 I B 4π Z d~s × r̂ r2 (2.5) Biot-Savart’s Law can be graphically represented as Figure 2.6. Figure 2.6: Biot-Savart’s Law 2.4 Biot-Savart’s Law for Finite Length Current Segment Biot-Savart’s Law can be further derived for conductor of any shape. In this section, the Biot-Savart’s Law for a finite length segment is derived. Consider Figure 2.7, an element d~s is at distance r from M . The direction of the field at M due to this element is out of the paper, since d~s × r̂ is out of the paper, according to the right-hand rule. In this case, all the elements will give contribution directly out of the paper at M . 15 By taking the origin O and letting M be along the positive y-axis, with k̂ being a unit vector pointing out of the paper, Equation 2.6 is obtained. Figure 2.7: (a) A Finite Wire Carrying a Current I with the Magnetic Field at M is Out of the Paper and (b) The Limiting Angles θ1 and θ2 d~s × r̂ = k̂|d~s × r̂| = k̂(dx sin θ) (2.6) Subtituting Equation (2.6) into Equation (2.4), Equation (2.7) is obtained. ~ = dB µ0 I dx sin θ k̂ 4π r2 (2.7) In order to integrate Equation (2.7), the variables θ, x and r must be related. An easy way to do this is by expressing x and r in terms of θ. From Figure 2.7(b), with some simple trigonometry manipulations, Equation (2.8) is obtained. r= a = a csc θ sin θ (2.8) 16 Since tan θ = −a/x from the right triangle in Figure 2.7(a), x = −a cot θ (2.9) dx = a csc2 θ dθ (2.10) Substitute Equation (2.8) and (2.10) into (2.7) gives, ~ = dB µ0 I a csc2 θ sin θ dθ k̂ 4π a2 csc2 θ (2.11) Now, the expressions have been reduced to one involving only the variable θ. The total field at M can be calculated by integrating Equation (2.11) over all elements subtending angles ranging from θ1 to θ2 as in Figure 2.7(b) and Equation (2.12) is obtained. Z θ2 µ0 I ~ sin θ dθ (2.12) k̂ B= 4πa θ1 And finally the Biot-Savart’s Law for a finite length segment is obtained. ~ = µ0 I (cos θ1 − cos θ2 ) k̂ B 4πa 2.5 (2.13) Related Research Researches on NMR or MRI gradient coils involve variations of methods to design gradient coils, optimization techniques to enhance current design method as well as development of unconventional type of gradient coils. The importance of gradient coils development, especially in medical area can be seen from von Schulthess’s points of view [23], which stated that a disease process is normally 1 cm or less (in resolution), meaning for MRI to be able to detect the abnormalities, the gradient coils have to generated a significant high gradient strength (which will in turn result in higher resolved MRI signals). General consideration of linearity, uniformity, efficiency, inductance and resistance need to be taken care of during gradient coils design [12, 24]. These few parameters are inter-related; the increase of one parameter may result in the decrease of other parameters. Researchers, therefore, are trying to come up with designs or formulations that will minimize parameters such as inductance and torque and at the same time, maximize parameters such as gradient strength and usable region. One of 17 the famous design technique is the target-field method, introduced by Turner [1, 2]. Target-field method is an inverse solution in which at first the region of interest (ROI) with certain gradient strength is determined. The problem is then solved by using Fourier Transforms on a Fourier-Bassel expansion. One of the major disadvantage of Turner’s technique is that it assume the resultant gradient coil to be infinitely long as a result of using Fourier Transforms. This has led to several improvement on Turner’s technique, including the use of finite-element method [3, 5] as well as the use of some optimization methods [4, 20, 25, 26]. There are also some new techniques proposed for designing gradient coils [6, 27, 28]. Turner’s technique originally resulted in “finger-print” gradient coil on cylinder surface. However, there are a number of gradient coils which are not restricted on cylinder surface anymore. There are planar type of gradient coil [13, 20, 29, 30], butterfly coil [10], twin gradient coil [31], gradient coil etched on a printed circuit board (PCB) [32] and even plate type of gradient coil [33]. Although newer geometrical shapes of gradient coils are used, conventional Maxwell-Golay is still used in several cases [7, 8, 9, 15, 18, 22, 34] with slight modifications of their own. The favourable of Maxwell-Golay over other types of gradient coil is because of the simplicity of the coil design and relatively bigger space for RF system accomodation [18]. It, however, offers relatively lower volume of linear gradient compared to the newer types of gradient coil which is why conventional Maxwell-Golay is used when smaller region of interest is concerned. The gradient coil will produce a magnetic field gradient along an axis. Based on the Biot-Savart’s Law mentioned in Section 2.3, a current carrying conductor will generate magnetic field. In three dimensional space, the magnetic field generated will ~ = Bx .î + By .ĵ + Bz .k̂ or simply B = (Bx , By , Bz ). In NMR be in vector form, B or MRI, the main magnetic field, B0 is generated along the z axis and because of this, only Bz generated by the gradient coils is important for frequency encoding, phase encoding or signal acquisition in general [35]. Hence, the magnetic field produced by gradient coil can be defined as in Equation 2.14 to 2.16 with the subscript denoting the axis. ∂Bz (2.14) Gx = ∂x ∂Bz Gy = (2.15) ∂y 18 Gz = ∂Bz ∂z (2.16) Linearity and uniformity (or non-uniformity) are two parameters that are being discussed when dealing with gradient coil related research. Literally, linearity means how “straight” the gradient is within certain range or region and uniformity means how much the difference the gradient value is with a reference point; normally at (x, y, z) = (0, 0, 0). A simple representation of how good the magnetic field gradient linearity is to plot Bz versus x, y or z coordinate. Visually, the “straighter” the plot of the Bz vs x, y or z is, the better the linearity. Statistically, correlation calculation can be used [33]. The value of correlation coefficient, rc , is between −1 and 1. Thus, the closer the value of |rc | to 1, the better the linearity. This is not to be confused with the gradient or the slope of the line. A perfectly linear gradient within certain range would result in constant gradient over the same range. This is where the concept of uniformity comes in. A uniform gradient within certain range means the value of the gradient is the same (or almost the same in actual case) over the same range. The uniformity, 4% , can be defined as in Equation 2.17 [5], with Gx(x,y,z) as the gradient at point (x, y, z) and Gx(0,0,0) is the gradient at reference point, in this case at (x, y, z) = (0, 0, 0). 4% = Gx(x,y,z) − Gx(0,0,0) Gx(0,0,0) (2.17) However, there are other definitions of uniformity. One such definition is that uniformity can be represented as the deviation of the gradient with reference with the mean value of gradient [36]. Another approach is to define the relative error as in Equation 2.18 [37]. Equation 2.18 is claimed to reflect the difference between the true and measured position of an object relative to the true distance from the object to the center of the gradient coil, with ~r is the position vector at that point. Bz (~r) − G~r G~r (2.18) Bowtell et al, on the other hand, used Equation 2.19 to determine the uniformity in their research [11]. Bz −1 (2.19) Gz Graphically, normal two dimensional plot of Bz versus an axis for different distances from the origin can be used [5, 29]. This approach may be simple and 19 straightforward but the information is limited. To obtain additional information, a repetition of such plot is required. Most, however, favour the two dimensional contour plot for the calculation of the previously defined deviation. A good tolerance of uniformity is around 5% of deviation [10, 17, 22, 24, 34]. Most of the contour plots of magnetic field gradient, therefore, show iso-value lines with 5% interval. Some applications can actually tolerate a higher gradient deviation, such as reported by Chronik et al. [38] for magnetic resonance microscopy of mice. 2.6 Summary The gradient coils play an important role in NMR or MRI signal acquisition. Therefore, a certain knowledge of the behaviour of the gradient coils is essential in obtaining suitable gradient coils for specific purposes. Both statistical analysis and normal contour plot will help to determine several important parameters of gradient coils, such as the magnetic field gradient value, its linearity and uniformity and the usable region for an acceptable non-uniformity. CHAPTER 3 RESEARCH METHODOLOGY 3.1 Simulation Model The calculation model used in this research includes the x axis Golay coil and z axis Maxwell coil. The y axis gradient coil is omitted since it is similar to the x axis gradient coil, only with different orientation. Figure 3.1 and 3.2 show the simulation model for x axis Golay coil with several geometrical parameters; namely a, d, l, θ and r (radius). The red arrows denote the current direction. Figure 3.3 and 3.4 show the simulation model for z axis Maxwell coil with its geometrical parameters, d and r (radius). The effect of these parameters on field linearity and gradient uniformity was observed using the simulation written in Python programming language, with the visualization provided by VisIt (three-dimensional) and matplotlib (two-dimensional). The statistical analysis was done in OpenOffice Calc, similar to Microsoft Office Excel. The program development was done in Ubuntu operating system but it was tested in Windows XP as well. Figure 3.1: x axis Golay Coil Simulation Model 21 Figure 3.2: x axis Golay Coil Simulation Model on xy Plane Figure 3.3: z axis Maxwell Coil Simulation Model 3.2 Problem Formulations Figure 3.5 summarizes the methodology of this research. Literature review activities were done before hand so as to find out the current related researches. Different sources of literature were found which mainly were journal articles. It is found out that although most of the researches now are more focused on the higher 22 end type of gradient coils, namely the “finger-print” coils as well as the planar coils, Golay-Maxwell pair still preferred in certain cases of applications. Figure 3.4: z axis Maxwell Coil Simulation Model on xy Plane Literature Review Formula Derivation End Vector Analysis Data Collection & Discussion yes Python Coding Testing OK? no Figure 3.5: Flow Chart of Research Methodology Most of the research also deal the problems in an inverse manner, in this case, settting a region with certain values of linearity and uniformity and then find out the coil or wiring configuration. This research’s appoarch, however, is in the forward manner, pre-defined the gradient coils and calculate the parameters of interest. With this, the formula derivation part of the research activities involve a slightly easier Biot- 23 Savart’s Law (compared to the inverse appoarch which requires additional optimization formulations). A general Biot-Savart’s Law is valid for virtually any current carrying coil or conductor. For a specific shape of coil, such as the solenoid or the single circular coil, relevant Biot-Savart’s Law have been derived. These derived equations, on the other hand, only valid for certain points, which mean, if the magnetic field at other points will require a different form of Biot-Savart’s Law. For complex type of coils, the derivation of specific Biot-Savart’s Law would be difficult, or even more complex if the coil’s configuration is not symmetry. This research uses a more straight forward formulation, which is the Biot-Savart’s Law for finite-length current segment, shown in Section 2.4. The idea is simple yet versatile. For Golay coils, the four straight segments should be not problem since they are finite-length current segment. For the four arcs, extra formulations were done. Consider a circle as shown in Figure 3.6. Figure 3.6: Parameters for Parametric Equation of Circle The parameters shown in Figure 3.6 can be related as, x = j + r cos t (3.1) y = k + r sin t (3.2) Assuming the four arcs in Golay coil have a certain focal point and radius, the arcs can be divided into a series of finite-length current segment by manipulating the parametric equations of a circle. With this step, the magnetic field generated by the arcs can also be calculated using Biot-Savart’s Law for finite-length current segment and by adding up each contribution, magnetic field at any point can be obtained. The derivation in Section 2.4 is mainly in scalar form. The actual magnetic field generated, however, will be in full three-dimensional form. As a result, the formulation in Section 2.4 have to be redo in vector form, shown as follows. Based on Figure 3.7, all the parameters 24 can be derived. −−→ Figure 3.7: Parameters Related to Finite Length Segment AB and Measurement Point, M −−→ First vector of the current segment AB is determined. −−→ −−→ −−→ AB = OB − OA (3.3) and its correspondent unit vector is given by, ûAB −−→ AB = −−→ |AB| (3.4) −−→ −−→ with O is the origin (0, 0). By using similar method, AM and BM as well as their unit vectors are given by, −−→ −−→ −−→ AM = OM − OA (3.5) −−→ −−→ −−→ BM = OM − OB (3.6) −−→ AM ûAM = −−→ (3.7) |AM| −−→ BM ûBM = −−→ (3.8) |BM| The cosines of the angles shown in Figure 3.7, cos θ1 and cos θ2 are calculated from, cos θ1 = ûAB • ûAM (3.9) cos θ2 = ûAB • ûBM (3.10) 25 The distance between the measurement point, M to the current segment is given by the −−→ magnitude of LM, −−→ −−→ −→ LM = AM − AL (3.11) −→ −−→ AL is the projection of AM in the direction of ûAB , Therefore, −→ −−→ AL = (AM • ûAB )ûAB (3.12) −−→ −−→ −−→ LM = AM − (AM • ûAB )ûAB (3.13) The direction of the magnetic field at the measurement point, M is obtained by taking −−→ the cross porduct of the two unit vectors; unit vector of AB and the unit vector along the line joining the current segment to the measurement point, M , ûB = ûAB × ûLM (3.14) Finally, the magnetic field at measurement point, M is obtained. → − B= µ0 I −−→ (cos θ1 − cos θ2 ) ûB 4π|LM| (3.15) Although the formulations above are fully three-dimensional, only the k̂ component of magnetic field, Bz , is analyzed since the other components of magnetic field do not have significant effect on the magnetic field gradient. Once the magnetic field values at each point can be calculated the next step in the simulation is to calculate the magnetic field gradient value at each point. Magnetic field gradient can be calculated based on the fact that gradient is actually the “steepness” of a slope (in this case the “steepness” of the magnetic field). Such computations computer simulation require the usage of numerical differentiation method. For example, the magnetic field gradient along x axis between point x and point (x + h) can be approximate through numerical differentiation as follows. Gx = Bz (x) − Bz (x − h) h (3.16) Equation 3.16 can be used to calculate the magnetic field gradient at point x by decreasing the value of h to as small as possible compared to x. For example, the value of h in this research is fixed at 1 × 10−6 . 26 3.3 Python Coding The formulation in Section 3.2 were translated into Python programming language. Among the reasons Python programming language is chosen because it is free and open source, platform independent as well as extensive third party modules or libraries. Two important modules that were used in this research is Scipy (for computation) and matplotlib (for plotting). The research also comes up with one selfwritten module which mainly consists of a collection of functions used to calculate the magnetic field generated by current carrying conductor based on the Biot-Savart’s Law for finite-length current segment. The general flowchart of the Python program is shown in Figure 3.8. User selection & input no Input enough/ appropriate? End yes Data storage & visualization Importing libraries/modules yes Iteration finished? Start iteration no Figure 3.8: Execution Flow of the Simulation The very first version of the simulation was done using the for loop. The for loop approach is very easy to be implemented due to its easy and straight forward algorithm. However, for each for cycle, the instruction and data will have to be reload into the clock cycle, thus reducing the speed. The advantages of using such approach is the simplicity and the reduction in memory usage to store variables. The improved version of this simulation adopt what is called vectorized processing. The idea is to convert the for loop to a large array. This improves the simulation speed significantly. The 27 setback of vectorized processing includes the large memory usage for storing all the arrays and slightly complicated algorithm. A simple illustration is shown as follows. # for loop for i in range(0:100): c[i] = a[i] + b[i] # vectorized processing c[0:99] = a[0:99] + b[0:99] Table 3.1 shows the calculation time comparison between the two approaches. The result in Table 3.1 is obtained from the simulation run for a certain two-dimensional calculation grid. Table 3.1: Calculation Time Comparison Dimensions 11 × 11 21 × 21 51 × 51 Time (Seconds) for loop vectorized 0.344 0.0 2.422 0.063 35.079 0.938 Due to significant improvement, the final version of the Python program adopted the vectorized algorithm. Based on Figure 3.8, the program requires the users to input some of the variables need for the simulation. Among the variables available as users’ input are the current value, the radius (of the Maxwell coil or of the arcs of the Golay coil), the separation between first coil and second coil and so on. After the variables input, the users are then prompted to choose the calculation plane (whether it will be xy plane, xz plane, yz plane or a full three-dimensional volume). Based on the choosen calculation plane, the users will have to input the range of the calculation. The limit of the calculation range actually depends on the amount of physical memory (RAM) of the personal computer. The program will then verify all the inputs and options before starting the simulation. Only appropriate libraries or modules will be imported based on the options choosen by users. The simulation will start by dividing the coil into a series of finite-length segment. At each point of calculation, the main calculation algorithm will be repeated until the contribution of each finite-length segment is taken account into. After that, the calculation will 28 move to the second calculation. The process will repeat until all calculation points are covered. The program will display the total time elapsed for the simulation as well as the magnetic field gradient generated at point (x, y, z) = (0, 0, 0). The results of the simulation will be saved mainly in a Visualization Toolkit (VTK) file format (as shown as in Appendix D). The output file can then be used for visualization or analysis purposes. The resultant Python programs are shown in Appendix B for Golay coil and Appendix C for Maxwell coil with a self-written module shown in Appendix A. 3.4 Data Collection and Analysis Procedures A few data collection and analysis algorithm were incorporated in the Python program whereas the rest were done using external program manually. The Python program has an option to save a simple xy values pair in a simple text file. The text files were saved and imported into OpenOffice Calc in which the magnetic field linearity analysis was done. First a simple two-dimensional xy graph was plotted. Here, the range at which the gradient is almost the same, was observed. Figure 3.9 shows an example of such plot. The different colour coded plots show a constant gradient at x range roughly between x = −0.05m and x = +0.05m. Hence, the magnetic field linearity for each plot is determined through the calculation of correlation coefficient, rc . Plot with |rc | value closer to 1 will have a good magnetic field linearity. 2e-05 y = 0.00 y = 0.05 y = 0.10 y = 0.15 1.5e-05 1e-05 Bz/Tesla 5e-06 0 -5e-06 -1e-05 -1.5e-05 -2e-05 -0.2 -0.15 -0.1 -0.05 0 x/meter 0.05 0.1 0.15 0.2 Figure 3.9: Example Plot to Determine the Linearity Range 29 The analysis of the magnetic gradient uniformity uses a more graphical approach. Two two-dimensional contour plots were used in this case. The contours represent the gradient values deviation according to Equation 3.17 for x axis Golay coil and Equation 3.18 for z axis Maxwell coil. 4% = Gx(x,y,z) − Gx(0,0,0) Gx(0,0,0) (3.17) 4% = Gz(x,y,z) − Gz(0,0,0) Gz(0,0,0) (3.18) Figure 3.10: Example Plot to Determine the Usable Region on xy Plane Figure 3.11: Example Plot to Determine the Usable Region on xz Plane 30 The magnetic field gradient values at each point will be compared to the maximum gradient value which is at point (x, y, z) = (0, 0, 0). With this, the area or region (which expands from the origin) of acceptable gradient uniformity can be determined. Both Equation 3.17 and 3.18 represent the gradient uniformity in percentage or fraction. These calculation were incorporated into the Python program during the analysis and the output will be the mentioned contour plots at 5% interval. For x axis Golay coil, the contour plots of xy and xz planes were used and for z axis Maxwell coil, the contour plots of xz and yz planes were used. The values shown in the contours in Figure 3.10 and 3.11 are the deviation of gradient values in percentage as explained previously. The analysis of gradient uniformity was based on the normal practise of MRI which is ±5%. In Figure 3.10 and 3.11, the hatched areas are the areas within ±5% of gradient deviation. In Figure 3.10, the hatched area appears to be a circle with certain radius whereas in Figure 3.11, the hatched area looks like a rectangle. From the figures, the volume of usable region is calculated by combining the usable regions (which are the hatched areas). The calculations were based on the values (radius, width, and so on) of the contour plots. In this example, if the usable regions from Figure 3.10 and 3.11 are combined, the three-dimensional usable region would be a cylinder. The gradient uniformity analysis was represented in two values; one is the exact value of the usable volume (which is in cm3 ) and the other, the ratio of usable volume with the total volume occupied by the respective Golay or Maxwell coil. That concludes the data collection and analysis of this research. 3.5 Summary Appropriate simulation model of Golay coil and Maxwell coil were determined based on the literature review. All the geometrical parameters of the gradient coils were pre-defined. The computer simulation program was written using Python programming language, based on the Biot-Savart’s Law for finite-length current segment. Additional equations were derived, mainly the vector version of all the Biot-Savart’s Law. The Python program features some variables input from the user as well as several simulation options. The output from the simulation were then collected and analyzed. Both the analysis of magnetic field linearity and gradient uniformity use different approach. CHAPTER 4 RESULTS AND DISCUSSION 4.1 Three-Dimensional Visualization Both the simulation codes written as in Appendix B and C are capable of calculating a full three-dimensional grid in cartesian coordinates. Since the simulation codes are written using vectorized processing, there is an disadvantage of total memory usage (but significantly faster than normal for loop). In this simulation, grid is defined as an array and the total memory of that array is the memory occupied by a single element inside the array times the size of the array. In a 32-bit platform, typically, a process would only have access to around 2 gigabytes (GB) of the system’s memory. The maximum physical memory recognizable by a 32-bit platform is 4 GB which means the total variables inside this simulation must not exceed 4 GB. The possible solution to this is either to decrease the steps so that the grid can expanded or to opt for 64-bit platform, provided the platform have enough memory to accomodate the large arrays. An example of three-dimensional calculation grid is shown in Figure 4.1 with the calculation grid shown as a yellow coloured cube. A simulation is executed based on Figure 4.1, covering x ranged from -0.1 m to +0.1 m, y ranged from -0.1 m to +0.1 m and z ranged from -0.1 m to +0.1 m. Figure 4.2 shows a three-dimensional contour surface plot generated from VisIt visualization program using VTK file output generated from the simulation. In Figure 4.2, the usable region in three-dimensional is plotted, bounded by the green (+5%) and red (-5%) coloured surface. Figure 4.2 can be set to be viewed in a normal contour line plot rather than contour surface plot, shown in Figure 4.3. By observing either Figure 4.2 or Figure 4.3, the size of usable region can be determined. Relevant parameters can be set within VisIt, such as the value and colour of the contours, different view angle of the plot as well as even projected two-dimensional plot for a clearer view such as Figure 4.4 to 4.6. 32 Figure 4.1: x axis Golay Coil with a Three-dimensional Calculation Grid Figure 4.2: Three-dimensional Contour Surface Plot Figure 4.3: Three-dimensional Contour Plot 33 Figure 4.4: Projected Two-dimensional Contour Plot on xy Plane Figure 4.5: Projected Two-dimensional Contour Plot on xz Plane Figure 4.6: Projected Two-dimensional Contour Plot on yz Plane 34 4.2 Results on Golay Coil The results in this section and the next one will be focusing on two-dimensional plot (generated by matplotlib) to ensure better investigations and observations of the coil’s geometrical parameters to the generated magnetic field gradient. For the Golay coil simulation, only the x axis Golay coil is investigated since the y axis Golay coil is only the 900 degree rotation version of the x axis Golay coil. This is illustrated by Figure 4.7. Figure 4.7: (a) x axis and (b) y axis Golay Coil Figure 4.8: x axis Golay Coil with (a) xz Calculation Plane and (b) xy Calculation Plane 35 Note that the current flow in Figure 4.7 is not the same as in Figure 2.5. This is not a major concern as long as the current flow in the upper saddle pair is anti parallel with the current flow in the lower saddle pair. The only difference is that either the positive magnetic field gradient or negative magnetic field gradient is generated. The results in the next few sections will be based on the two-dimensional calculation grid based on Figure 4.8. The simulation on x axis Golay coil will be run for x ranged from -0.1 m to +0.1 m, y ranged from -0.15 m to +0.15 m and z ranged from -0.2 m to +0.2 m. The simulation is not run on yz plane since it would not provide any relevant information about the x axis magnetic field gradient. 4.2.1 General Results For the following sections, the geometrical parameters of the x axis Golay coil, as shown in Figure 3.1 and 3.2, are related as follows, unless stated otherwise: 1. θ = 1200 2. r = 0.2 m 3. a = 2r 4. d=r 5. l = 3r with r = radius. Such configuration is chosen so as to simulate the accomodation of a typical human body. Figure 4.9 shows the resultant Bz versus x. The linear region of Bz exists roughly in between x = −0.1 m and x = +0.1 m. Alternatively speaking, a magnetic field gradient along x axis, Gx , is generated. In Figure 4.9, the magnetic field gradient generated is around -0.18 mT/m. Figure 4.9 is based on (y, z) = (0, 0). The linear region generally decreases as (y, z) increases as shown in Figure 4.10 and 4.11. Both Figure 4.10 and 4.11 are plotted for positive y and z respectively. Similar results will be obtained if the Bz is plotted for negative y and z because of the symmetry of Golay coil. Refering to Figure 4.10, the magnetic field gradient value decreases along y axis and the usable region (the x range where magnetic field gradient is linear) decreases too. Figure 4.11, however, shows some slight difference in z direction. Based on Figure 4.11, the magnetic field gradient value increases but then decreases as z increases. The linear region appear to be unchanged. 36 2e-05 1.5e-05 1e-05 Bz/Tesla 5e-06 0 -5e-06 -1e-05 -1.5e-05 -2e-05 -0.2 -0.15 -0.1 -0.05 0 0.05 0.1 0.15 0.2 x/meter Figure 4.9: Bz versus x at (y, z) = (0, 0) 2e-05 y = 0.00 y = 0.05 y = 0.10 y = 0.15 1.5e-05 1e-05 Bz/Tesla 5e-06 0 -5e-06 -1e-05 -1.5e-05 -2e-05 -0.2 -0.15 -0.1 -0.05 0 x/meter 0.05 0.1 0.15 0.2 Figure 4.10: Bz versus x at z = 0 for various y 6e-05 z = 0.0 z = 0.1 z = 0.2 z = 0.3 4e-05 Bz/Tesla 2e-05 0 -2e-05 -4e-05 -6e-05 -0.2 -0.15 -0.1 -0.05 0 x/meter 0.05 0.1 0.15 Figure 4.11: Bz versus x at y = 0 for various z 0.2 37 The two-dimensional xy-plot might look confusing. Figure 4.12 and 4.13 provide a better picture of this. Both Figure 4.12 and 4.13 are plotted on a 2dimensional plane stated, using contour plotting. The contour shown is no longer the values of Bz but the iso value lines of the deviation of gradient value, 4% , which is the more appropriate parameter to be plotted. By using such plot, the usable region within certain percentage of tolerance can be determined. Figure 4.12: 4% Contour Plot on xy Plane at 5% interval at z = 0 Figure 4.13: 4% Contour Plot on xz Plane at 5% interval at y = 0 Figure 4.12 and 4.13 are plotted at 5% interval of 4% . Based on Figure 4.12, if the tolerance of the gradient deviation is 5% (which is generally the case), a elliptical 38 shape of usable region is obtained on the xy plane at z = 0. This region is roughly ±0.041 m in the x direction and ±0.065 m in the y direction. In Figure 4.13, such region is in rectangular shape, ±0.042 m in the x direction and ±0.041 m in the z direction. By combining the results from Figure 4.12 and 4.13, the usable region in 3-dimension volume would be an elliptical cylinder, subjected to 5% of gradient deviation. For MRI or NMR application that can tolerate a higher gradient deviation, then the usable region would become bigger. The usable volume is around 0.207% of the total volume. If the 10% gradient deviation tolerance is considered, the usable volume can be increased to 0.464% of the total volume, which is 124% improvement. 4.2.2 Variation of θ In this section, the simulation will be ran for various value of θ with the other geometrical parameters fixed at the original value. Table 4.1 shows the correlation calculation for each θ simulation mentioned, between x = −0.1 m and x = +0.1 m. It is found that as θ increases, the correlation coefficient, rc , decreases which also means the linearity decreases. A high linearity is desired as this affects the gradient uniformity. If a perfect linearity is obtained, the |rc | value would be 1, then the gradient at any point would be the same, leading to 0% gradient deviation and perfect gradient uniformity. Table 4.1: Correlation and Gradient value for various θ r between x = −0.1 m θ (0 ) c Gx (mT/m) and x = +0.1 m 80 -0.999647 -0.13 100 -0.999329 -0.16 120 -0.998978 -0.18 140 -0.998667 -0.19 160 -0.998455 -0.20 Figure 4.14 shows the plot of Bz versus x for various θ at (y, z) = 0. From Figure 4.14 and Table 4.1, the gradient value increases as θ increases. Figure 4.15 to 4.18 show the contour plots of 4% on xy plane whereas Figure 4.19 to 4.22 show the same plots on xz plane. Table 4.2 shows the summary of the usable volume in each case. The usable volume defined here is the region where the gradient deviation is within the 5% tolerance. 39 2e-05 θ = 800 θ = 10000 θ = 1200 θ = 1400 θ = 160 1.5e-05 1e-05 Bz/Tesla 5e-06 0 -5e-06 -1e-05 -1.5e-05 -2e-05 -0.2 -0.15 -0.1 -0.05 0 0.05 0.1 0.15 0.2 x/meter Figure 4.14: Bz versus x for various θ at (y, z) = 0 Figure 4.15: 4% Contour Plot on xy Plane at 5% interval at z = 0 for θ = 800 Figure 4.16: 4% Contour Plot on xy Plane at 5% interval at z = 0 for θ = 1000 40 Figure 4.17: 4% Contour Plot on xy Plane at 5% interval at z = 0 for θ = 1400 Figure 4.18: 4% Contour Plot on xy Plane at 5% interval at z = 0 for θ = 1600 Figure 4.19: 4% Contour Plot on xz Plane at 5% interval at y = 0 for θ = 800 41 Figure 4.20: 4% Contour Plot on xz Plane at 5% interval at y = 0 for θ = 1000 Figure 4.21: 4% Contour Plot on xz Plane at 5% interval at y = 0 for θ = 1400 Figure 4.22: 4% Contour Plot on xz Plane at 5% interval at y = 0 for θ = 1600 42 θ (0 ) 80 100 120 140 160 Table 4.2: Usable Volume for various θ Percentage of usable volume Actual usable volume (cm3 ) to total volume (%) 435.304 0.158 554.117 0.179 703.277 0.207 893.017 0.256 1061.434 0.304 As the θ increases, the percentage of usable volume and the actual usable volume increases. In this simulation, generally, the best configuration would be the Golay coil with θ = 1600 since it generates the highest magnetic field gradient besides providing the highest usable volume. Higher θ value is expected to provide a bigger usable volume. High gradient value will result in high contrast in the MRI or NMR images since a small increment in distance will cause a high value in magnetic field (Bz ) value difference. 4.2.3 Variation of r Simulation on variation of r is not run although it is one of the geometrical parameter of Golay coil. This is because other geometrical parameters are quoted as the function of r. Generally, when r increases, d and l will increase. It would be more appropriate to run the simulation for a certain ratio of d/r and l/r as this will represent the results better. 4.2.4 Variation of a Original configuration of Golay coil is shown in Figure 3.1 and 3.2 in which the two arc section shown in Figure 3.2 have the same focal point, thus, the value of a is 2r. Variation of a will mean that the two arc will not have the same focal point, shown in Figure 4.23. Figure 4.24 shows the plot of Bz versus x for various a mentioned. From Figure 4.24, as the a is increased, the gradient tend to switch from negative value to positive value. Normally, the negative or positive value of gradient is not a big concern, as 43 long as the region with certain tolerance of gradient deviation is available. For positive valued gradient in Figure 4.24, the gradient value increases and then drops as a is further increased as a function or r. Figure 4.23: Different Focal Point of Two Arcs of Golay Coil 4e-05 3e-05 a = 2.5r a = 3.0r a = 3.5r a = 4.0r a = 4.5r 2e-05 Bz/Tesla 1e-05 0 -1e-05 -2e-05 -3e-05 -4e-05 -0.2 -0.15 -0.1 -0.05 0 x/meter 0.05 0.1 0.15 0.2 Figure 4.24: Bz versus x for various a at (y, z) = 0 Table 4.3 shows the correlation coefficient, rc , between between x = −0.05 m and x = +0.05 m for each a, their respective gradient value, Gx , the actual usable volume and the percentage of usable volume. When a = 3.5r, the gradient value and 44 rc is maximum. However, the percentage of usable volume is greatly affected from the original 0.207% (for a = 2r) to less than 0.1% as a is further increased. The similar observation occurs as with the actual usable volume. Although, it may seem that a high gradient is obtainable when a = 3.5r which also resulted in high linearity, the usable volume is smaller compared to the original configuration (703.277 cm3 ). Table 4.3: Correlation, Gradient value and Usable volume for various a a (m) rc between x = −0.05 m and x = +0.05 m Gx (mT/m) 2.0r 2.5r 3.0r 3.5r 4.0r 4.5r -0.998978 -0.999364 -0.926008 0.999990 0.997483 0.999750 -0.18 -0.19 -0.08 0.35 0.72 0.30 Actual usable volume (cm3 ) 703.277 138.970 3.530 197.696 37.962 60.103 Percentage of usable volume to total volume (%) 0.207 0.034 0.001 0.009 0.007 0.003 Figure 4.25 to 4.34 show the contour plots produced by varying a. The shape of usable regions change too. From a general shape of elliptical cylinder into a rectangular cubic. From Figure 4.29, although the usable region within 5% is a rectangular shape, the region is expected to be split into two non-continuous regions (left and right), making the usable region “useless”. As for the xz plane, the usable region shrinks quite significantly besides the contour shape begins to change into something unrecognizable (Figure 4.32 to 4.34). Figure 4.25: 4% Contour Plot on xy Plane at 5% interval at z = 0 for a = 2.5r 45 Figure 4.26: 4% Contour Plot on xy Plane at 5% interval at z = 0 for a = 3.0r Figure 4.27: 4% Contour Plot on xy Plane at 5% interval at z = 0 for a = 3.5r Figure 4.28: 4% Contour Plot on xy Plane at 5% interval at z = 0 for a = 4.0r 46 Figure 4.29: 4% Contour Plot on xy Plane at 5% interval at z = 0 for a = 4.5r Figure 4.30: 4% Contour Plot on xz Plane at 5% interval at y = 0 for a = 2.5r Figure 4.31: 4% Contour Plot on xz Plane at 5% interval at y = 0 for a = 3.0r 47 Figure 4.32: 4% Contour Plot on xz Plane at 5% interval at y = 0 for a = 3.5r Figure 4.33: 4% Contour Plot on xz Plane at 5% interval at y = 0 for a = 4.0r Figure 4.34: 4% Contour Plot on xz Plane at 5% interval at y = 0 for a = 4.5r 48 4.2.5 Variation of d In this section, the parameter d will be manipulated and its effect on gradient linearity and uniformity are observed. Figure 4.35 summarized the Bz versus x plot for the mentioned respective d. From Figure 4.35, the gradient value decreases as d increases. Table 4.4 shows some interesting observations. 0.00015 d = 0.2r d = 0.4r d = 0.6r d = 0.8r d = 1.2r d = 1.4r 0.0001 Bz/Tesla 5e-05 0 -5e-05 -0.0001 -0.00015 -0.2 -0.15 -0.1 -0.05 0 x/meter 0.05 0.1 0.15 0.2 Figure 4.35: Bz versus x for various d at (y, z) = 0 Table 4.4: Correlation, Gradient value and Usable volume for various d d (m) rc between x = −0.1 m and x = +0.1 m Gx (mT/m) 0.2r 0.4r 0.6r 0.8r 1.0r 1.2r 1.4r -0.998677 -0.999460 -0.999967 -0.999804 -0.998978 -0.997682 -0.996075 -0.34 -0.31 -0.27 -0.22 -0.18 -0.13 -0.10 Actual usable volume (cm3 ) 302.669 565.044 1212.572 3374.389 703.277 300.048 175.854 Percentage of usable volume to total volume (%) 0.102 0.185 0.766 2.090 0.207 0.086 0.050 Although, high gradient value is obtained at d = 0.2r both the actual usable volume and the percentage of usable volume are rather poor. The usable volume peaked at around a = 0.8r which is 2.090% (3374.389 cm3 ) which is higher than the original 49 configuration (where a = r). High linearity is, however, obtained at a = 0.6r. Further simulation is ran for d = 0.7r and the usable volume increases to 2.26%. From Figure 4.36 to 4.47, it can be seen that the change of d directly affects the usable region on both xy and xz plane. Figure 4.36: 4% Contour Plot on xy Plane at 5% interval at z = 0 for d = 0.2r Figure 4.37: 4% Contour Plot on xy Plane at 5% interval at z = 0 for d = 0.4r 50 Figure 4.38: 4% Contour Plot on xy Plane at 5% interval at z = 0 for d = 0.6r Figure 4.39: 4% Contour Plot on xy Plane at 5% interval at z = 0 for d = 0.8r Figure 4.40: 4% Contour Plot on xy Plane at 5% interval at z = 0 for d = 1.2r 51 Figure 4.41: 4% Contour Plot on xy Plane at 5% interval at z = 0 for d = 1.4r Figure 4.42: 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 0.2r Figure 4.43: 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 0.4r 52 Figure 4.44: 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 0.6r Figure 4.45: 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 0.8r Figure 4.46: 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 1.2r 53 Figure 4.47: 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 1.4r 4.2.6 Variation of l The l parameter will affect the total length of the Golay coil. Since both saddle coils are identical, the total length would be 2l + d. Figure 4.48 shows the Bz versus x plot for various l as a function of r. There is hardly any difference shown in Figure 4.48. Data in Table 4.5 confirm this observation. However, the usable volume decreases as l increases. Figure 4.49 to 4.56 show the results obtained for various l. Similar size of usable regions are observed in Figure 4.49 to 4.56. 2e-05 l=r l = 2r l = 4r l = 5r 1.5e-05 1e-05 Bz/Tesla 5e-06 0 -5e-06 -1e-05 -1.5e-05 -2e-05 -0.2 -0.15 -0.1 -0.05 0 x/meter 0.05 0.1 0.15 Figure 4.48: Bz versus x for various l at (y, z) = 0 0.2 54 Table 4.5: Correlation, Gradient value and Usable volume for various l l (m) rc between x = −0.1 m and x = +0.1 m Gx (mT/m) r 2r 3r 4r 5r -0.999185 -0.999012 -0.998978 -0.998964 -0.998957 -0.176 -0.179 -0.177 -0.175 -0.174 Actual usable volume (cm3 ) 855.723 721.722 703.277 699.444 698.814 Percentage of usable volume to total volume (%) 0.604 0.311 0.207 0.166 0.135 Figure 4.49: 4% Contour Plot on xy Plane at 5% interval at z = 0 for l = r Figure 4.50: 4% Contour Plot on xy Plane at 5% interval at z = 0 for l = 2r 55 Figure 4.51: 4% Contour Plot on xy Plane at 5% interval at z = 0 for l = 4r Figure 4.52: 4% Contour Plot on xy Plane at 5% interval at z = 0 for l = 5r Figure 4.53: 4% Contour Plot on xz Plane at 5% interval at y = 0 for l = r 56 Figure 4.54: 4% Contour Plot on xz Plane at 5% interval at y = 0 for l = 2r Figure 4.55: 4% Contour Plot on xz Plane at 5% interval at y = 0 for l = 4r Figure 4.56: 4% Contour Plot on xz Plane at 5% interval at y = 0 for l = 5r 57 Further simulation was run for l = 0.1r. The gradient value obtained is −0.048 mT/m with a 0.74% of usable volume. The gradient value is poor although the percentage of usable volume might be acceptable. Further increasing the l parameter is almost useless, since this will only decrease the percentage of usable volume. 4.3 Results on Maxwell Coil Maxwell coil is used to generate a magnetic field gradient along the z axis, Gz , in a conventional setup. Figure 4.57 shows the xz and yz plane in which the simulation will be ran on. Both the planes are actually identical because of the symmetry of Maxwell coil. Therefore, the simulation is only needed to be ran once on either plane. The simulation covered x from −0.3 m to +0.3 m, y from −0.3 m to +0.3 m and z from −0.3 m to +0.3 m. Figure 4.57: z axis Maxwell Coil with (a) xz Calculation Plane and (b) yz Calculation Plane 4.3.1 General Results There are only two geometrical parameters involved in Maxwell coil; the radius, r and the separation distance between the two circular coils, d. In this section, r is fixed at 0.4 m whereas d = r. Such configuration is chosen to accomodate the 58 Golay coil’s width (which is fixed at 0.4 m) in Section 4.2. The original Maxwell coil √ setup requires d to be 3r [7], however, in this research, d is the geometrical parameter for observation, it is then fixed at d = r before it is varied from less than r to more √ than r. Furthermore, some researches did not use the separation d = 3r based on several optimization, such as based on image distortion [39] and based on application [8]. Figure 4.58 to 4.60 show the typical results obtained for this setup. Figure 4.58 confirms that a magnetic field gradient is generated along the z direction. Figure 4.59 and 4.60 are identical, as expected, with usable volume in a rectangular cubic shape. The gradient value is approximately -0.067 mT/m with a high percentage of usable volume over total volume of 0.961% (1962.668 cm3 ). 1.5e-05 1e-05 Bz/Tesla 5e-06 0 -5e-06 -1e-05 -1.5e-05 -0.3 -0.2 -0.1 0 z/meter 0.1 0.2 0.3 Figure 4.58: Bz versus z at (x, y) = (0, 0) 4% 0.3 Contour Plot on xz plane at y = 0 0.2 0 .000 -20 -1-15.000.0000-5.000 05.0.00000 .00 0 1 1 20.50.000 00 0.0 152.0.000 000 z/meter 0.1 0.1 .000 0.2 -5 0.30.3 10 .000 00 50.0.000 00 .0 0 1 - 0.2 0 5.00 -1-20 .000 0.1 0.0 x/meter 0.1 0.2 0.3 Figure 4.59: 4% Contour Plot on xz Plane at 5% interval at y = 0 59 4% 0.3 Contour Plot on yz plane at x = 0 0.2 0 .000 -20 -1-15.000.0000-5.000 05.0.00000 .00 0 1 1 20.50.000 00 0.0 152.0.000 000 z/meter 0.1 0.1 .000 0.2 -5 0.30.3 00 10.0 00 50.0.000 00 -10.0 0.2 0 5.00 -1-20 .000 0.1 0.0 y/meter 0.1 0.2 0.3 Figure 4.60: 4% Contour Plot on yz Plane at 5% interval at x = 0 4.3.2 Variation of r The z gradient coil simulation is not run directly for the variation of r since the other geometrical parameters, d, is quoted as a function of r. The results presented in the next section should reflect the effect of the ratio of d/r to the linearity and uniformity. 4.3.3 Variation of d The parameter d basically determines how far both the circular coils are being separated in a Maxwell coil configuration. A general effect of d to the magnetic field generated is shown in Figure 4.61. The correlation coefficient, gradient value and usable volume are tabulated in Table 4.6. A perfect correlation is obtained when d = 1.8r (|rc | = 1, true to 6 decimal points) but the maximum percentage of usable volume to total volume occurs at d = 1.6r. The percentage of usable volume increases when d is increased to a certain value and then drops as it is further increased. The same trend happens with the value of correlation coefficient. The gradient value, however, continues to drop as d is increased. Figure 4.62 to 4.68 show the contour plot obtained on xz plane. The results on xy plane are not shown since they are identical to their xz plane counterparts. 60 1.5e-05 d = 0.8r d = 1.2r d = 1.4r d = 1.6r d = 1.8r d = 2.0r d = 2.2r 1e-05 Bz/Tesla 5e-06 0 -5e-06 -1e-05 -1.5e-05 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 z/meter Figure 4.61: Bz versus z at (x, y) = (0, 0) for various d Table 4.6: Correlation, Gradient value and Usable volume for various d d (m) rc between x = −0.1 m and x = +0.1 m Gz (mT/m) 0.8r 1.0r 1.2r 1.4r 1.6r 1.8r 2.0r 2.2r -0.999657 -0.999810 -0.999913 -0.999970 -0.999995 -1.000000 -0.999995 -0.999987 -0.065 -0.067 -0.066 -0.061 -0.055 -0.048 -0.042 -0.036 4% 0.3 Actual usable volume (cm3 ) 1201.734 1962.668 3777.962 10610.302 19174.800 19164.600 19196.128 11907.174 Percentage of usable volume to total volume (%) 0.744 0.961 1.543 3.842 6.043 5.205 4.744 2.697 Contour Plot on xz plane at y = 0 0.2 0 00.00 00 0 -20.0 .00 0 .000 .0100 -15 -10.000-5.00 0 01.500 2 z/meter 0.1 0.0 0.1 -5.000 00 0.00 00 520.0050.0.000 1 0 0 10. 0 0.00 -1-15 .00000 -20.0 5.00 0 0.2 0.30.3 0.2 0.1 0.0 x/meter 0.1 0.2 0.3 Figure 4.62: 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 0.8r 61 4% 0.3 Contour Plot on xz plane at y = 0 0.2 -2-10.500.0000 000 .000000 0 . 0 5. -10.00 -5 10. 0 15.0000 0 20.000 0.0 15.00 0 20.000 z/meter 0.1 0.1 00 0 5.00.00 .0.00000 000 -1-015 10. 0.2 0.30.3 0.2 -20.000 -5.00 0 0.1 0.0 x/meter 0.1 0.2 0.3 Figure 4.63: 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 1.2r 10.00 .0000 2105.00 0.2 0.000 5.000 20.00 15.000 0 05.10.000.000 00 0 0.2 00 2105.0 .000 0 10.00 0.1 0.000 5.000 z/meter -20.05.0000000 000 -1 10.0 -5. - 0 0.1 0.0 Contour Plot on xz plane at y = 0 0 5 .0 10.0.000000 15.000 20.000 0 4% 0.3 -20.000 .000 00-015 -10. 0.30.3 -5.0 00 0.2 0.1 0.0 x/meter 0.1 0.2 0.3 Figure 4.64: 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 1.4r 4% 0.3 0.000 -10.000 -5.000 -10.000 -5.000 5.0 00 -20.000000 -15. 0.000 .000 -1 -5 0.000 z/meter 0.1 0. 5.00000 10.0000 15.000 20.000 10.00 00 15.000 20.00 0.2 0.0 Contour Plot on xz plane at y = 0 0.30.3 000 -15.-20 .000 00 .0 -10 0.2 20.000 15.000 10.0000 5.00 0.2 20.000 15.000 10.000 05.0.000 00 0.1 0.1 0.0 x/meter 0.1 0.2 -5.00 00.3 Figure 4.65: 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 1.6r 62 4% 0.1 -20.000 -15.000 -10.000 -5.000 000 20.5.000 1 00 10.0 5.000 0.2 Contour Plot on xz plane at y = 0 152. 0.000 10.0000 00 5.00 0 0.3 00 0.0 -5.000 -20.000 -15.000 -10.000 -20.000 -15.000 -10.000 -5.000 z/meter 0.000 0.0 0.000 0.2 5.000 00 10.0 00 0 15.0.000 2 0.30.3 0.2 00 0.0 -5.000 -10.000 -15.000 -20.000 0.1 0.0 x/meter 5.000 10. 15. 000 20. 000 000 0.1 0.1 0.2 0.3 Figure 4.66: 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 1.8r 4% 0.3 0.2 -5.000 -20.000 -15.000 -10.000 -20.000 -15.000 -10.000 1 20 10. 5.000.000 000 0.000 0.1 10. 20. 15.00 000 000 0 0.2 0.000 -5.000 -10.000 -15.000 -20.000 00 0.30.3 00 5.0 -5.000 z/meter -20.000 -15.000 -10.000 -5.000 0.000 000 0 20. 15.00 .000 10 5.000 0.000 0.1 0.0 Contour Plot on xz plane at y = 0 5.0 0.2 0.1 0.0 x/meter 000 10. 5.000000 1 20. 5.0 00 0.1 0.2 0.3 Figure 4.67: 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 2.0r 4% 0.3 0.2 -10.000 -20.000 -15.000 z/meter -10.000 00 -5.0 0.000 5.000 20.00015.000 0.2 0.30.3 2 15.000 0.000 0.2 0.1 -5.0 10.000 -20.000 -15.000 0.1 5.000 10.000 20.000 15.000 10.000 5.00 0.00 0 0 0.1 0.0 Contour Plot on xz plane at y = 0 00 15.000 0.000 2 10.000 5.000 0.0 x/meter 0.1 0.2 0.3 Figure 4.68: 4% Contour Plot on xz Plane at 5% interval at y = 0 for d = 2.2r 63 4.4 Discussion The usable volumes obtained in this research are either cylindrical (for Golay coil) or cuboid (for Maxwell coil) in shape. These shape generally provide the neccessary working area for MRI in which superconducting main magnets are in cylinder shape. There have been reports on the similar shape of usable region obtained such as a z gradient coil with usable volume of diameter = 6 cm and length = 12 cm [10], a z gradient coil with usable volume of diameter = 4.5 mm and length = 4.5 mm [11], a z gradient coil with usable volume of diameter = 16.4 cm and length = 21.8 cm [40] and others [24, 36]. Cuboid shaped usable region is not unusual, too. For example, y and z gradient coils with usable region of 36.3 cm × 17.2 cm × 24.4 cm cuboid [21] as well as a cuboid of 12 cm × 15 cm × 1.8 cm [20]. Beside cylinder and cuboid shaped usable volume, spherical usable region is also a common one, reported by Rinard et. al. [41], Dodd et al. [17] and Harvey [31]. The size and shape of the usable region can be varied based on the gradient coils design itself (whether they are the conventional one or the more advanced planar type and “finger print” type) and also the application (whether it is for medical imaging or micro imaging). There are some reports which prefer the observation on the region of interest (ROI), volume of interest (VOI) or diameter spherical volume (DSV). With this definitions, the researchers first fixed a region in which the magnetic gradient uniformity is to be optimized (the size of ROI, VOI or DSV is most likely based on the application in which mentioned by DeMesster et al. [42]), and then the gradient coil is designed to achieve best possible condition in that predefined region. For example, White et al reported a 1.56% field error inside their DSV [6], Du et al. with VOI of diameter = 34 cm, length = 40 cm and maximum 5% of deviation [39], Lopez et al. with a DSV of diamter = 21 cm and nonuniformity of 2.63% [25] among others [10, 16, 29]. For comparison purposes, the maximum cylindrical usable volume observed in this research is approximately a elliptical cylinder with major axis = 5.31 cm, minor axis = 3.15 cm and length = 5.71 cm (Golay coil) whereas the maximum cuboid usable region observed is 28.4 cm × 28.4 cm × 23.8 cm (Maxwell coil). The magnetic gradient values obtained only serve as comparison to show the trend affected by the geometrical parameters. The magnetic gradient value can be very different based on applications. A typical magnetic gradient value can range between 20 mT/m and 100 mT/m for medical imaging [6, 7, 13, 25, 26, 43, 40] and it is directly affected by the current supply. Higher gradient values are reported but not in medical imaging, such as 2000 mT/m for magnetic resonance microscopy [38] and 52 T/m for high spatially resolved NMR [24]. Some also prefer to quote the gradient efficiency, η 64 = gradient/current, rather that the gradient value. In this simulation, the lower magnetic field gradient values are mainly because of the current is only 10 Ampere. Again, here the trend is highlighted rather than the absolute gradient value instead. The analysis for the Maxwell coil is clearly easier compared to the analysis of Golay coil. This is mainly due to the geometrical parameters involved. Maxwell coil only consists of two identical circular coil whereas Golay coil consists of a combination of arcs as well as straight segments. In the simulation of Maxwell coil, as the d increases, the gradient value drops. This is because as the distance increases, the magnetic field value generated by individual coil is reduced based on the Biot-Savart’s Law. The usable volume, however, generally increases as d increases since when the gradient value decreases, the range of linear gradient increase, resulting in a bigger usable region in general as shown as in Figure 4.58. The behaviour of Golay coil is slightly complicated. First the straight segments of the Golay coil do not contribute to the magnetic field gradient generated. This can be seen very easily from the result shown in Figure 4.48. This can be explained using Figure 4.69. Figure 4.69: Magnetic Field Generated by a Straight Segment By using the right hand rule in Figure 4.69, there would not be any magnetic field generated in the z direction. Thus, only the arcs in the Golay coil setup play the role of generating the magnetic field gradient. The arcs can be further divided into two sets; one, the inner arcs (which are the arcs situated near to the origin (0, 0, 0)) and the outer arcs (those situated further away from the origin). The inner arcs actually affect the gradient generated as can be seen in Section 4.2.5. The difference in d affects the gradient generated (linearity, gradient value and uniformity) significantly. The outer arcs, however, do not actually affect the gradient to any considerable extent. This is observed as in Section 4.2.6. As l increases, the distance between the inner arcs 65 and the outer arcs also increases. However, the results show no significant change in the gradient value, linearity and usable region. The outer arcs can be said to be merely as the current return paths as with the straight segments of Golay coil. The behavior in which the inner arcs are able to generate a gradient can be seen from the fact that a circular coil generating a uniform field in the axial direction. If the circular coil is splited into two concentric arcs, each carrying current in the same direction, then a gradient will be generated. This also explain why when the θ of Golay coil increases, the usable region increases since as the θ increases, it will move closer to the actual circular coil but then again, a complete circular coil carrying current in opposing direction in one half of the circular is impossible (because it is a closed loop). This is the same case with Maxwell coil which is exact opposite of Helmholtz coil. The gradient generated by Golay coil generally lose its uniformity rather quickly in the z direction as oppose to x or y direction. This most likely is due to the effect of the outer arcs. The increases of z also mean the nearer to the outer arcs. The magnetic field generated by the outer arcs might be superposed with the magnetic field generated by the inner arcs and thus causing the lost in uniformity. All the simulations ran are based on manipulating one parameter while others being fixed at certain value. The combination of two or more geometrical parameters might prove otherwise. For example, from Table 4.2, when θ = 1600 , the usable volume is higher compared to the rest but if the simulation is ran for θ = 1600 and d = 0.8r (from Table 4.4 which have high usable volume), the usable volume is not optimum. This is mainly because the geometrical parameters involved are being related to each other. Optimized coil should be made from simulation run on simultaneous parameters, rather than one parameter at a time. The general preference is a large region of gradient uniformity within certain acceptable deviation. However, larger usable region is normally resulted from larger gradient coil which will face problem concerning the torque and inductance. The usable region produced over the total region covered by the gradient coil, therefore, reflects the optimum of such ratio when constructing conventional gradient coils. The importance of the gradient value can be explained as shown in Figure 4.70 and 4.71. Refering to Figure 4.70, the higher the gradient value, the “thinner” the slice thickness. This means that for a fixed number of voxels (or grid points), the thinner slice will have a higher resolution than the thicker slice. A more detailed imaging of the sample can be done since the thinner slice imaging might provide information 66 about the sample that the thicker slice imaging could not. Figure 4.71 shows a different point of view. If there are two points in the sample that undergo the imaging process, the difference of the magnetic field values between those two points will determine how well resolved they are. As seen in Figure 4.71, the higher the gradient value, the higher the resolution between two fixed points. Figure 4.70: Schematic of Gradient Value and Slice Thickness Figure 4.71: Schematic of Gradient Value and Resolution 67 4.5 Summary Results on the Golay coil and Maxwell coil are presented. Four geometrical parameters of Golay coil and one geometrical of Maxwell coil are being investigated in term of their effects on the magnetic field gradient generated. This is found out that the configuration of Golay coil and Maxwell coil can be improved for better gradient values and usable regions. Some geometrical effects on the gradient are also being discussed with comparison with related reference. CHAPTER 5 CONCLUSIONS 5.1 Conclusions The effects of a total of four geometrical parameter for Golay coil and one geometrical parameters for Maxwell coil to the magnetic field gradient generated respectively have been investigated through a computer simulation written fully in Python programming language. The geometrical parameter, r (radius), for Golay coil and Maxwell coil, is omitted from the simulation since the other parameters are expressed as a function of r. The field linearity is illustrated by two-dimensional normal xy-plot and also expressed in the form of correlation coefficient, rc . The straighter the line in xy-plot or the closer the value of |rc | to 1, the higher the field linearity is. The gradient uniformity is highlighted using contour plot of the gradient deviation, 4% , on specified plane. A good gradient deviation, which is around 5%, is used to determined the usable region for that configuration. The usable region is expressed as percentage of usable volume to the total volume covered by the gradient coil as well as the actual usable region in cm3 . Such definition of usable volume can provide data on another form of usable volume optimization. Although bigger usable volume is always desirable, bigger coil generally create bigger usable volume and bigger coil means longer coil windings which might cause problem with the inductance, heat dissipation, coil efficiency among other parameters. Because of the similar reason, the other geometrical parameters involved are expressed as a function of r. As shown in the results, the parameters that affects the gradient significantly are the θ, a and d for Golay coil and the parameter d for Maxwell coil. Comparing to the original configuration, with the increase of θ, the improvement of 50% in the usable region and 11% in gradient value, is observed. The increase of a in Golay coil, however, can reduced the usable region up to 99% although it can improved the 69 gradient value by 200%, as compared to the original configuration. The interesting parameter is d which shows that the usable region can be increase from 703.277 cm3 to a siginificant 3374.389 cm3 . The improvement of gradient value is around 50%. As for Maxwell coil, the parameter d play an important role in usable region but not in gradient value. The biggest improvement in usable region is from 1962.668 cm3 to a staggering 19196.128 cm3 . The improvement of gradient value is not much, only around 0.002 mT/m from original’s 0.065 mT/m. The program was written in a vectorized processing way so as to improve the calculation time. User defined functions are stored in a Python module. By using this module, gradient coil with virtually any shape can undergo the simulation as long as the position of coil is known. This is possible because the simulation adopted the BiotSavart’s Law for finite length segment and coil of any shape can be simplified into a series of finite length segment, either manually or using parametric equations. The module also provides calculations along x, y and z axis, xy, xz and yz plane as well as 3-dimensional xyz volume. The main program itself provides user with interactive features whereby user can input their desired geometrical parameters and selection of calculation mode. The output of simulation can be exported to a widely used VTK file format (supported by a large number of visualization program) in case user prefers to visualize their outputs using other programs. 5.2 Suggestions for Further Works A multiple geometrical parameters optimization is missing from this simulation. Since the geometrical parameters are inter-related, it would be a more complete investigation if such simulation is carried out. Other missing features in the Python program would include the development of the graphical user interface (GUI) and also more option and control to the simulation being run. A computer simulation would not be complete with a physical experiment. A prototype based on the simulation can be developed in order to justify the results obtained in a computer simulation. However, without proper simulation, developing a test prototype based on a trial-and-error concept could be disastrous. The developed prototype might not be feasible which leads to another prototype being developed. The prototype development based on computer simulation can help reducing the cycle significantly. The original intention of the research is to map the magnetic field or 70 gradient generated by conventional gradient coil. The simulation can be modified so that it is not a normal simulation but a optimizing simulation for conventional gradient coil. A number of 6 geometrical parameters are able to undergo the optimization process which can help in designing a gradient coil with optimum usable volume, with optimum efficiency and etc. A modification of conventional gradient coil (such as multiple layers of coils) can also be done using the same simulation to observe whether the modification will improve the gradient or not. REFERENCES 1. Turner, R. Gradient Coil Design: A Review of Methods. Magnetic Resonance Imaging, 1993. 11: 903–920. 2. Turner, R. A Target Field Approach to Optimal Coil Design. Journal of Physics D: Applied Physics, 1986. 19: L147–L151. 3. Sanchez, H., Liu, F., Trakic, A., Weber, E. and Crozier, S. Three-Dimensional Gradient Coil Structures for Magnetic Resonance Imaging Designed Using Fuzzy Membership Functions. IEEE Transactions on Magnetics, 2007. 43(9): 3558–3566. 4. Qi, F., Tang, X., Jin, Z., Jiang, Z. D., Shen, Y. F., Meng, B., Zu, D. L. and Wang, W. M. A Hybrid Optimization Method for Biplanar Transverse Gradient Coil Design. Journal of Physics D: Applied Physics, 2007. 40: 2988– 2993. 5. Shi, F. and Ludwig, R. Magnetic Resonance Imaging Gradient Coil Design by Combining Optimization Techniques with the Finite Element Method. IEEE Transactions on Magnetics, 1998. 34(3): 671–683. 6. White, P., Forbes, L. and Crozier, S. 3D Gradient Coil Design - Toroidal Surfaces. Journal of Magnetic Resonance, 2009. 198: 31–40. 7. Yuan, J. and Shen, G. Gradient Coil Design using Bi-2223 High Temperature Superconducting Tape for Magnetic Resonance Imaging. Medical Engineering and Physics, 2007. 29: 442–448. 8. Steidle, G., Graf, H. and Schick, F. Sodium 3D MRI of the Human Torso using a Volume Coil. Magnetic Resonance Imaging, 2004. 22: 171–180. 9. Du, Y. and Parker, D. Studies on the Performance of Circular and Elliptical ZGradient Coils using a Simulated Annealing Algorithm. Magnetic Resonance Imaging, 1997. 15(2): 255–262. 10. Di Luzio, S., Placidi, G., Di Giuseppe, S., Alecci, M. and Sotgiu, A. A Novel, Cylindrical, Transverse Gradient Coil Design for Magnetic Resonance 72 Imaging of Large Samples. Measurement Science Technology, 1998. 9: 1663– 1671. 11. Bowtell, R. and Robyr, P. Multilayer Gradient Coil Design. Journal of Magnetic Resonance, 1998. 131: 286–294. 12. Jin, J. M. Electromagnetic Analysis and Design in Magnetic Resonance Imaging. Florida: CRC Press. 1999. 13. Wright, S., Brown, D., Porter, J., Spence, D., Esparza, E., Cole, D. and Huson, F. A Desktop Magnetic Resonance Imaging System. Magnetic Resonance Materials in Physics, Biology and Medicine, 2002. 13: 177–185. 14. Chang, W., Chen, J. and Hwang, L. Single-Sided Mobile NMR Apparatus using the Transverse Flux of a Single Permanent Magnet. Magnetic Resonance Imaging (Article in Press), 2009. xx: xxx–xxx. 15. Meriles, C. A., Sakellariou, D. and Trabesinger, A. H. Theory of MRI in the Presence of Zeros to Low Magnetic Fields and Tensor Imaging Field Gradients. Journal of Magnetic Resonance, 2006. 182: 106–114. 16. Petropoulos, L. S. and Morich, M. A. Novel Gradient Coil Set with an Interstitial Gap for Interventional Nuclear Magnetic Resonance Applications. IEEE Transactions on Magnetics, 1997. 33(5): 4107–4109. 17. Dodd, S. and Chien, H. Short Planar Gradient Coils for MR Microscopy Using Concentric Return Paths. Journal of Magnetic Resonance, 2002. 156: 1–9. 18. Lee, S. C., Kim, K. S., Kim, J. H., Lee, S. C., Yi, J. H., Kim, S. W., Ha, K. S. and Cheong, C. J. One Micrometer Resolution NMR Microscopy. Journal of Magnetic Resonance, 2001. 150: 207–213. 19. Barbara, T. M. and Bronnimann, C. E. Target Field Design for Magic Angle Gradient Coils. Journal of Magnetic Resonance, 1999. 140: 285–288. 20. Fisher, B. J., Dillon, N., Carpenter, T. A. and Hall, L. D. Design of a Biplanar Gradient Coil using a Genetic Algorithm. Magnetic Resonance Imaging, 1997. 15(3): 369–376. 21. Williams, G. B., Fisher, B. J., Huang, C. L.-H., Carpenter, T. A. and Hall, L. D. Design of Biplanar Gradient Coils for Magnetic Resonance Imaging of the Human Torso and Limbs. Magnetic Resonance Imaging, 1999. 17(17): 739–754. 22. Siebold, H. Gradient Field Coils for MR Imaging with High Spectral Purity. IEEE Transactions on Magnetics, 1990. 26: 897–900. 73 23. von Schulthess, G. Clinical MR in Year 2010. Magnetic Resonance Materials in Physics, Biology and Medicine, 1999. 8: 133–145. 24. Snaar, J. E. M., Robyr, P. and Bowtell, R. Strong Gradients for Spatially Resolved Diffusion Measurements. Magnetic Resonance Imaging, 1998. 16(5/6): 587–591. 25. Lopez, H., Liu, F., , Poole, M. and Crozier, S. Equivalent magnetization current method applied to the design of gradient coils for magnetic resonance imaging. IEEE Transactions on Magnetics, 2009. 45(2): 767–775. 26. Mansfield, P., Bowley, R. and Haywood, B. Controlled E-field Gradient Coils. Magnetic Resonance Materials in Physics, Biology and Medicine, 2003. 16: 113–120. 27. Marin, L., Power, H., Bowtell, R., Sanchez, C., Becker, A., Glover, P. and Jones, I. Application Of Engineering Analysis Techniques To The Design Of Magnetic Resonance Imaging (MRI) Coils. Journal of Physics: Conference Series 105 (2008) 012004. 2008, vol. 105. 28. Forbes, L. and Crozier, S. Novel Target-Field Method for Designing Shielded Biplanar Shim and Gradient Coils. IEEE Transactions on Magnetics, 2004. 40(4): 1929–1938. 29. Chapman, B. L. and Mansfield, P. A Quiet Gradient-Coil Employing Optimized, Force-Shielded, Distributed Coil Design. Journal of Magnetic Resonance. Series B, 1995. 107: 152–157. 30. Forbes, L., Brideson, M. and Crozier, S. A Target Field Method to Design Circular Biplanar Coils for Asymmetric Shim and Gradient Fields. IEEE Transactions on Magnetics, 2005. 41(6): 2134–2144. 31. Harvey, P. R. The Modular (Twin) Gradient Coil - High Resolution, High Contrast, Diffusion Weighted EPI at 1.0 Tesla. Magnetic Resonance Materials in Physics, Biology and Medicine, 1999. 8: 43–47. 32. Goloshevsky, A., Walton, J., Shutov, M., de Ropp, J., Collins, S. and McCarthy, M. Integration of Biaxial Planar Gradient Coils and an RF Microcoil for NMR Flow Imaging. Measurement Science and Technology, 2005. 16: 505–512. 33. Wu, K., Huang, C. G., Cong, J. B., Xian, H. and Wang, S. K., C. Z.and Gao. Plate Form Three-Dimensional Gradient Coils for L-band ESR Imaging Experiment. Journal of Magnetic Resonance, 2005. 175: 256–263. 34. Andrew, E. R. and Szczesniak, E. Low Inductance Tranverse Gradient System 74 of Restricted Length. Magnetic Resonance Imaging, 1995. 13(4): 607–613. 35. Han, B., Park, S. and Lee, S. Gradient Waveform Sythesis for Magnetic Propulsion using MRI Gradient Coils. Phyiscs in Medicine and Biology, 2008. 53: 4639–4649. 36. Hakansson, B., Jonsson, B., Linse, P. and Soderman, O. The Influence of a Nonconstant Magnetic-Field Gradient on PFG NMR Diffusion Experiments. A Brownian-Dynamics Computer Simulation Study. Journal of Magnetic Resonance, 1997. 124: 343–351. 37. Brey, W. W., Mareci, T. H. and Dougherty, J. A Field-Gradient Coil Using Concentric Return Paths. Journal of Magnetic Resonance. Series B, 1996. 112: 124–230. 38. Chronik, B., Alejski, A. and Rutt, B. Design and Fabrication of a ThreeAxis Multilayer Gradient Coil for Magnetic Resonance Microscopy of Mice. Magnetic Resonance Materials in Physics, Biology and Medicine, 2000. 10: 131–146. 39. Du, Y. and Parker, D. Evaluation of Gradient Inhomogeneity in the Optimal Design of Gradient Coils. Magnetic Resonance Imaging, 1996. 14(2): 201– 207. 40. Sanchez, H., Liu, F., Trakic, A. and Crozier, S. A Simple Relationship For High Efficiency - Gradient Uniformity Tradeoff In Multilayer Asymmetric Gradient Coils For Magnetic Resonance Imaging. IEEE Transactions On Magnetics, 2007. 43(2): 523–532. 41. Rinard, G. R., Quine, R. W., Eaton, G. R., Eaton, S. S., Barth, E. D., Pelizzari, C. A. and Halpern, H. J. Magnet and Gradient Coil System for LowField EPR Imaging. Concepts in Magnetic Resonance (Magnetic Resonance Engineering), 2002. 15: 51–58. 42. DeMesster, G., Morich, M., Byrne, A., Davies, F., Melotte, D. and Thomas, A. Challenges of Short Magnet Design. Magnetic Resonance Materials in Physics, Biology and Medicine, 2002. 13: 193–198. 43. Hu, G., Peng, Y., Zhao, W. and Tang, X. Gradient Coil Design in Permanent Magnet MRI. Proceedings of 19th International Workshop on Rare Earth Permanent Magnets and Their Applications. 2008. 419–422. APPENDIX A MODULE 1 2 3 4 5 6 # # # # # # file name written by date written description last modified : : : : grad.py chew teong han (teonghan@yahoo.com) 04/01/2009 collection of functions to calculate B using biot-savart’s law : 05/01/2009 7 8 9 # import module(s) import scipy as s 10 11 12 # constant(s) mu_0=4.0*s.pi*1.0e-7 13 14 15 16 17 18 19 20 # module 1: to calculate vector cross product def vecCro (vecA,vecB): a=vecA[1]*vecB[2]-vecB[1]*vecA[2] b=vecA[2]*vecB[0]-vecA[0]*vecB[2] c=vecA[0]*vecB[1]-vecA[1]*vecB[0] vecC=s.array([a,b,c]) return vecC 21 22 23 # module 2: to calculate B for a general case def calB(vOA,vOB,vOM,current): 24 25 26 27 28 i j k l = = = = vOM.shape[1] vOM.shape[2] vOM.shape[3] vOA.shape[1] 29 30 31 vAM = s.zeros([3,i,j,k,l],dtype=float) vBM = s.zeros([3,i,j,k,l],dtype=float) 32 33 34 35 vAB = s.array([vOB[0]-vOA[0], vOB[1]-vOA[1], vOB[2]-vOA[2]]) magAB = s.sqrt(vAB[0]*vAB[0] + vAB[1]*vAB[1] + vAB[2]*vAB[2]) uAB = s.array([vAB[0]/magAB, vAB[1]/magAB, vAB[2]/magAB]) 36 37 38 39 40 for a in range(0,l): vAM[0,::,::,::,a] = vOM[0,::,::,::]-vOA[0,a] vAM[1,::,::,::,a] = vOM[1,::,::,::]-vOA[1,a] vAM[2,::,::,::,a] = vOM[2,::,::,::]-vOA[2,a] 41 42 vBM[0,::,::,::,a] = vOM[0,::,::,::]-vOB[0,a] 76 43 44 vBM[1,::,::,::,a] = vOM[1,::,::,::]-vOB[1,a] vBM[2,::,::,::,a] = vOM[2,::,::,::]-vOB[2,a] 45 46 47 magAM = s.sqrt(vAM[0]*vAM[0] + vAM[1]*vAM[1] + vAM[2]*vAM[2]) uAM = s.array([vAM[0]/magAM, vAM[1]/magAM, vAM[2]/magAM]) 48 49 50 magBM = s.sqrt(vBM[0]*vBM[0] + vBM[1]*vBM[1] + vBM[2]*vBM[2]) uBM = s.array([vBM[0]/magBM, vBM[1]/magBM, vBM[2]/magBM]) 51 52 53 cos_theta1=s.array(uAM[0]*uAB[0] + uAM[1]*uAB[1] + uAM[2]*uAB[2]) cos_theta2=s.array(uBM[0]*uAB[0] + uBM[1]*uAB[1] + uBM[2]*uAB[2]) 54 55 56 57 58 59 60 61 62 vLM = s.array([vAM[0]-(vAM[0]*uAB[0] + vAM[1]*uAB[1] + vAM[2]*uAB[2])*uAB[0], vAM[1]-(vAM[0]*uAB[0] + vAM[1]*uAB[1] + vAM[2]*uAB[2])*uAB[1], vAM[2]-(vAM[0]*uAB[0] + vAM[1]*uAB[1] + vAM[2]*uAB[2])*uAB[2]]) magLM = s.sqrt(vLM[0]*vLM[0] + vLM[1]*vLM[1] + vLM[2]*vLM[2]) uLM = s.array([vLM[0]/magLM, vLM[1]/magLM, vLM[2]/magLM]) 63 64 65 66 uB = vecCro(uAB,uLM) magB = (mu_0*current*(cos_theta1-cos_theta2))/(4*s.pi*magLM) B = s.array([uB[0]*magB,uB[1]*magB,uB[2]*magB]) 67 68 return B 69 70 71 72 73 74 # module 3: to calculate B at one point def calB_point(vOA,vOB,x,y,z,current): vOM = s.mgrid[x:x+1:1,y:y+1:1,z:z+1:1] B = calB(vOA,vOB,vOM,current) return B 75 76 77 78 79 80 # module 4: to calculate B along x-axis def calB_x(vOA,vOB,xMin,xMax,stepX,y,z,current): vOM = s.mgrid[xMin:xMax+stepX:stepX,y:y+1:1,z:z+1:1] B = calB(vOA,vOB,vOM,current) return B 81 82 83 84 85 86 # module 5: to calculate B along y-axis def calB_y(vOA,vOB,x,yMin,yMax,stepY,z,current): vOM = s.mgrid[x:x+1:1,yMin:yMax+stepY:stepY,z:z+1:1] B = calB(vOA,vOB,vOM,current) return B 87 88 89 90 91 92 # module 6: to calculate B along z-axis def calB_z(vOA,vOB,x,y,zMin,zMax,stepZ,current): vOM = s.mgrid[x:x+1:1,y:y+1:1,zMin:zMax+stepZ:stepZ] B = calB(vOA,vOB,vOM,current) return B 93 94 95 96 97 98 # module 7: to calculate B on xy plane def calB_xy(vOA,vOB,xMin,xMax,stepX,yMin,yMax,stepY,z,current): vOM = s.mgrid[xMin:xMax+stepX:stepX,yMin:yMax+stepY:stepY,z:z+1:1] B = calB(vOA,vOB,vOM,current) return B 99 100 # module 8: to calculate B on xz plane 77 101 102 103 104 def calB_xz(vOA,vOB,xMin,xMax,stepX,y,zMin,zMax,stepZ,current): vOM = s.mgrid[xMin:xMax+stepX:stepX,y:y+1:1,zMin:zMax+stepZ:stepZ] B = calB(vOA,vOB,vOM,current) return B 105 106 107 108 109 110 # module 9: to calculate B on yz plane def calB_yz(vOA,vOB,x,yMin,yMax,stepY,zMin,zMax,stepZ,current): vOM = s.mgrid[x:x+1:1,yMin:yMax+stepY:stepY,zMin:zMax+stepZ:stepZ] B = calB(vOA,vOB,vOM,current) return B 111 112 113 114 115 116 117 # module 10: to calculate B in xyz volume def calB_xyz(vOA,vOB,xMin,xMax,stepX,yMin,yMax,stepY,zMin,zMax,stepZ,current): vOM = s.mgrid[xMin:xMax+stepX:stepX,yMin:yMax+stepY:stepY,zMin:zMax+stepZ:stepZ] B = calB(vOA,vOB,vOM,current) return B 118 119 120 # module 11: to generate vOA & vOB for a saddle coil def saddle(startTheta,endTheta,thetaStep,zU,zL,radius,j,k): 121 122 123 124 125 if startTheta > endTheta: thetaStep = -thetaStep else: thetaStep = thetaStep 126 127 128 vOA = s.array([[],[],[]],dtype=float) vOB = s.array([[],[],[]],dtype=float) 129 130 131 132 133 134 135 136 137 for theta in s.arange(startTheta,endTheta,thetaStep): VOA = s.array([[radius*s.cos(theta*s.pi/180.0)+j], [radius*s.sin(theta*s.pi/180.0)+k], [zU]]) vOA = s.append(vOA,VOA,axis=1) theta = theta + thetaStep VOB = s.array([[radius*s.cos(theta*s.pi/180.0)+j], [radius*s.sin(theta*s.pi/180.0)+k], [zU]]) vOB = s.append(vOB,VOB,axis=1) 138 139 140 141 142 143 144 VOA=s.array([[radius*s.cos((endTheta)*s.pi/180.0)+j], [radius*s.sin((endTheta)*s.pi/180.0)+k], [zU]]) vOA = s.append(vOA,VOA,axis=1) VOB=s.array([[radius*s.cos((endTheta)*s.pi/180.0)+j], [radius*s.sin((endTheta)*s.pi/180.0)+k], [zL]]) vOB = s.append(vOB,VOB,axis=1) 145 146 147 148 149 150 151 152 153 for theta in s.arange(endTheta,startTheta,-thetaStep): VOA = s.array([[radius*s.cos(theta*s.pi/180.0)+j], [radius*s.sin(theta*s.pi/180.0)+k], [zL]]) vOA = s.append(vOA,VOA,axis=1) theta = theta - thetaStep VOB = s.array([[radius*s.cos(theta*s.pi/180.0)+j], [radius*s.sin(theta*s.pi/180.0)+k], [zL]]) vOB = s.append(vOB,VOB,axis=1) 154 155 156 157 158 VOA=s.array([[radius*s.cos((startTheta)*s.pi/180.0)+j], [radius*s.sin((startTheta)*s.pi/180.0)+k], [zL]]) vOA = s.append(vOA,VOA,axis=1) VOB=s.array([[radius*s.cos((startTheta)*s.pi/180.0)+j], 78 159 160 [radius*s.sin((startTheta)*s.pi/180.0)+k], [zU]]) vOB = s.append(vOB,VOB,axis=1) 161 162 return vOA,vOB 163 164 165 #module 12: to generate vOA & vOB for a circular coil def circle(thetaStep,z,radius,j,k): 166 167 168 vOA = s.array([[],[],[]],dtype=float) vOB = s.array([[],[],[]],dtype=float) 169 170 if thetaStep > 0: 171 172 173 174 175 176 177 178 179 for theta in s.arange(0,360,thetaStep): VOA = s.array([[radius*s.cos(theta*s.pi/180.0)+j], [radius*s.sin(theta*s.pi/180.0)+k], [z]]) vOA = s.append(vOA,VOA,axis=1) theta = theta + thetaStep VOB = s.array([[radius*s.cos(theta*s.pi/180.0)+j], [radius*s.sin(theta*s.pi/180.0)+k], [z]]) vOB = s.append(vOB,VOB,axis=1) 180 181 else: 182 183 184 185 186 187 188 189 190 for theta in s.arange(360,0,thetaStep): VOA = s.array([[radius*s.cos(theta*s.pi/180.0)+j], [radius*s.sin(theta*s.pi/180.0)+k], [z]]) vOA = s.append(vOA,VOA,axis=1) theta = theta + thetaStep VOB = s.array([[radius*s.cos(theta*s.pi/180.0)+j], [radius*s.sin(theta*s.pi/180.0)+k], [z]]) vOB = s.append(vOB,VOB,axis=1) 191 192 return vOA, vOB APPENDIX B CODE FOR GOLAY COIL 1 2 3 4 5 # # # # # file name written by date written description : : : : x-golay.py chew teong han (teonghan@yahoo.com) 05/01/2009 to calculate Bz of x-gradient coil + visualization + vtk output 6 7 8 9 import time import scipy as s from grad import saddle 10 11 12 13 14 # universal constant thetaStep = 1.0 gridStep = 0.01 h = 1e-6 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 print "==============================================================" print "Welcome to Magnetic Field Calculation Program for Golay Coil" print "==============================================================" print "Please input the required parameters" print "==============================================================" coilTheta = raw_input("Please input the theta of the arc: ") current = raw_input("Please input the current value (in Ampere): ") radius = raw_input("Please input the radius value (in meter): ") d = raw_input("Please input the d value (in meter): ") l = raw_input("Please input the l value (in meter): ") j1 = raw_input("Please input the x coordinate of the 1st arc: ") k1 = raw_input("Please input the y coordinate of the 1st arc: ") j2 = raw_input("Please input the x coordinate of the 2nd arc: ") k2 = raw_input("Please input the y coordinate of the 2nd arc: ") 30 31 32 33 34 35 36 37 38 39 40 41 42 # user-defined variables conversion thetaOffset = 90.0-(float(coilTheta)/2.0) current = float(current) radius = float(radius) d = float(d) l = float(l) zU2 = (d/2)+l zL2 = (d/2) zU1 = -zL2 zL1 = -zU2 j1 = float(j1) k1 = float(k1) 80 43 44 j2 = float(j2) k2 = float(k2) 45 46 47 48 49 50 51 52 53 54 55 56 57 58 # theta calculation # saddle 1 startS1 = 90.0+thetaOffset endS1 = 270.0-thetaOffset # saddle 2 startS2 = 90.0-thetaOffset endS2 = -90.0+thetaOffset # saddle 3 startS3 = 270.0-thetaOffset endS3 = 90.0+thetaOffset # saddle 4 startS4 = -90.0+thetaOffset endS4 = 90.0-thetaOffset 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 print "==============================================================" print "Please select the calculation plane/volume" print "==============================================================" plane = input("Enter 1 for xyz volume, 2 for xy plane or 3 for xz plane: ") print "==============================================================" if plane == 1: from grad import calB_xyz print "Please input the calculation grid parameters" print "==============================================================" xMin = raw_input("Please input the xMin value (in meter): ") xMax = raw_input("Please input the xMax value (in meter): ") yMin = raw_input("Please input the yMin value (in meter): ") yMax = raw_input("Please input the yMax value (in meter): ") zMin = raw_input("Please input the zMin value (in meter): ") zMax = raw_input("Please input the zMax value (in meter): ") print "==============================================================" print "Processing..." 77 78 79 80 81 82 83 84 85 86 87 # grid xMin = xMax = yMin = yMax = zMin = zMax = dimX = dimY = dimZ = float(xMin) float(xMax) float(yMin) float(yMax) float(zMin) float(zMax) int((xMax-xMin)/gridStep)+1 int((yMax-yMin)/gridStep)+1 int((zMax-zMin)/gridStep)+1 88 89 then = time.time() 90 91 92 93 94 95 96 # saddle 1 vOA,vOB = saddle(startS1,endS1,thetaStep,zU1,zL1,radius,j1,k1) B1 = calB_xyz(vOA,vOB,xMin,xMax,gridStep,yMin,yMax,gridStep,zMin,zMax,gridStep, current) Bh1 = calB_xyz(vOA,vOB,xMin-h,xMax-h,gridStep,yMin,yMax,gridStep,zMin,zMax, gridStep,current) 97 98 99 100 # saddle 2 vOA,vOB = saddle(startS2,endS2,thetaStep,zU1,zL1,radius,j2,k2) B2 = calB_xyz(vOA,vOB,xMin,xMax,gridStep,yMin,yMax,gridStep,zMin,zMax,gridStep, 81 101 102 103 current) Bh2 = calB_xyz(vOA,vOB,xMin-h,xMax-h,gridStep,yMin,yMax,gridStep,zMin,zMax, gridStep,current) 104 105 106 107 108 109 110 # saddle 3 vOA,vOB = saddle(startS3,endS3,thetaStep,zU2,zL2,radius,j1,k1) B3 = calB_xyz(vOA,vOB,xMin,xMax,gridStep,yMin,yMax,gridStep,zMin,zMax,gridStep, current) Bh3 = calB_xyz(vOA,vOB,xMin-h,xMax-h,gridStep,yMin,yMax,gridStep,zMin,zMax, gridStep,current) 111 112 113 114 115 116 117 # saddle 4 vOA,vOB = saddle(startS4,endS4,thetaStep,zU2,zL2,radius,j2,k2) B4 = calB_xyz(vOA,vOB,xMin,xMax,gridStep,yMin,yMax,gridStep,zMin,zMax,gridStep, current) Bh4 = calB_xyz(vOA,vOB,xMin-h,xMax-h,gridStep,yMin,yMax,gridStep,zMin,zMax, gridStep,current) 118 119 120 121 122 123 124 125 126 127 128 129 130 131 # adding up each B component B = B1 + B2 + B3 + B4 Bh = Bh1 + Bh2 + Bh3 + Bh4 i = B.shape[0] j = B.shape[1] k = B.shape[2] l = B.shape[3] m = B.shape[4] BT = s.zeros([i,j,k,l],dtype=float) BTh = s.zeros([i,j,k,l],dtype=float) for a in range(0,m): BT = BT + B[::,::,::,::,a] BTh = BTh + Bh[::,::,::,::,a] 132 133 134 135 136 137 138 BZ = s.transpose(BT[2]) BZh = s.transpose(BTh[2]) G = ((BZ-BZh)/h) G0 = G[(dimZ-1)/2,(dimY-1)/2,(dimX-1)/2] delG = (G-G0)*100/G0 delG = s.ravel(delG) 139 140 141 142 143 # printing time and G0 now = time.time() print ’time =’,now-then print ’G0 =’,G0*1e3 144 145 146 147 148 149 150 151 152 153 154 155 elif plane == 2: from grad import calB_xy print "Please input the calculation grid parameters" print "==============================================================" xMin = raw_input("Please input the xMin value (in meter): ") xMax = raw_input("Please input the xMax value (in meter): ") yMin = raw_input("Please input the yMin value (in meter): ") yMax = raw_input("Please input the yMax value (in meter): ") z = raw_input("Please input the z value (in meter): ") print "==============================================================" print "Processing..." 156 157 158 # grid xMin = float(xMin) 82 159 160 161 162 163 164 165 xMax yMin yMax zMin dimX dimY dimZ = = = = = = = float(xMax) float(yMin) float(yMax) float(z) int((xMax-xMin)/gridStep)+1 int((yMax-yMin)/gridStep)+1 1 166 167 then = time.time() 168 169 170 171 172 # saddle 1 vOA,vOB = saddle(startS1,endS1,thetaStep,zU1,zL1,radius,j1,k1) B1 = calB_xy(vOA,vOB,xMin,xMax,gridStep,yMin,yMax,gridStep,zMin,current) Bh1 = calB_xy(vOA,vOB,xMin-h,xMax-h,gridStep,yMin,yMax,gridStep,zMin,current) 173 174 175 176 177 # saddle 2 vOA,vOB = saddle(startS2,endS2,thetaStep,zU1,zL1,radius,j2,k2) B2 = calB_xy(vOA,vOB,xMin,xMax,gridStep,yMin,yMax,gridStep,zMin,current) Bh2 = calB_xy(vOA,vOB,xMin-h,xMax-h,gridStep,yMin,yMax,gridStep,zMin,current) 178 179 180 181 182 # saddle 3 vOA,vOB = saddle(startS3,endS3,thetaStep,zU2,zL2,radius,j1,k1) B3 = calB_xy(vOA,vOB,xMin,xMax,gridStep,yMin,yMax,gridStep,zMin,current) Bh3 = calB_xy(vOA,vOB,xMin-h,xMax-h,gridStep,yMin,yMax,gridStep,zMin,current) 183 184 185 186 187 # saddle 4 vOA,vOB = saddle(startS4,endS4,thetaStep,zU2,zL2,radius,j2,k2) B4 = calB_xy(vOA,vOB,xMin,xMax,gridStep,yMin,yMax,gridStep,zMin,current) Bh4 = calB_xy(vOA,vOB,xMin-h,xMax-h,gridStep,yMin,yMax,gridStep,zMin,current) 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 # adding up each B component (each coil) B = B1 + B2 Bh = Bh1 + Bh2 # adding up each B component (each vAB) i = B.shape[0] j = B.shape[1] k = B.shape[2] l = B.shape[3] m = B.shape[4] BT = s.zeros([i,j,k,l],dtype=float) BTh = s.zeros([i,j,k,l],dtype=float) for a in range(0,m): BT = BT + B[::,::,::,::,a] BTh = BTh + Bh[::,::,::,::,a] 203 204 205 206 207 208 BZ = s.transpose(BT[2]) BZh = s.transpose(BTh[2]) G = ((BZ-BZh)/h) G0 = G[(dimZ-1)/2,0,(dimX-1)/2] delG = (G-G0)*100/G0 209 210 211 212 213 # printing time and G0 now = time.time() print ’time = ’,now-then print ’G0 =’,G0*1e3 214 215 216 # 2D plot using matplotlib import matplotlib.pyplot as plt 83 217 218 219 220 221 222 223 224 225 226 plt.xlabel(’x (meter)’) plt.ylabel(’z (meter)’) x = s.arange(xMin,xMax+gridStep,gridStep) y = s.arange(yMin,yMax+gridStep,gridStep) delG = s.reshape(delG,[len(y),len(x)]) cs = plt.contour(x,y,delG,[-20,-15,-10,-5,0,5,10,15,20]) plt.clabel(cs, inline=1, fontsize=10) plt.title(r’$\bigtriangleup_{\%}$ on $xy$ plane at z = ’+str(zMin)) plt.grid("true") plt.show() 227 228 delG = s.ravel(delG) 229 230 231 232 233 234 235 236 237 238 239 240 elif plane == 3: from grad import calB_xz print "Please input the calculation grid parameters" print "==============================================================" xMin = raw_input("Please input the xMin value (in meter): ") xMax = raw_input("Please input the xMax value (in meter): ") y = raw_input("Please input the y value (in meter): ") zMin = raw_input("Please input the zMin value (in meter): ") zMax = raw_input("Please input the zMax value (in meter): ") print "==============================================================" print "Processing..." 241 242 243 244 245 246 247 248 249 250 # grid xMin = xMax = yMin = zMin = zMax = dimX = dimY = dimZ = float(xMin) float(xMax) float(y) float(zMin) float(zMax) int((xMax-xMin)/gridStep)+1 1 int((zMax-zMin)/gridStep)+1 251 252 then = time.time() 253 254 255 256 257 # saddle 1 vOA,vOB = saddle(startS1,endS1,thetaStep,zU1,zL1,radius,j1,k1) B1 = calB_xz(vOA,vOB,xMin,xMax,gridStep,yMin,zMin,zMax,gridStep,current) Bh1 = calB_xz(vOA,vOB,xMin-h,xMax-h,gridStep,yMin,zMin,zMax,gridStep,current) 258 259 260 261 262 # saddle 2 vOA,vOB = saddle(startS2,endS2,thetaStep,zU1,zL1,radius,j2,k2) B2 = calB_xz(vOA,vOB,xMin,xMax,gridStep,yMin,zMin,zMax,gridStep,current) Bh2 = calB_xz(vOA,vOB,xMin-h,xMax-h,gridStep,yMin,zMin,zMax,gridStep,current) 263 264 265 266 267 # saddle 3 vOA,vOB = saddle(startS3,endS3,thetaStep,zU2,zL2,radius,j1,k1) B3 = calB_xz(vOA,vOB,xMin,xMax,gridStep,yMin,zMin,zMax,gridStep,current) Bh3 = calB_xz(vOA,vOB,xMin-h,xMax-h,gridStep,yMin,zMin,zMax,gridStep,current) 268 269 270 271 272 # saddle 4 vOA,vOB = saddle(startS4,endS4,thetaStep,zU2,zL2,radius,j2,k2) B4 = calB_xz(vOA,vOB,xMin,xMax,gridStep,yMin,zMin,zMax,gridStep,current) Bh4 = calB_xz(vOA,vOB,xMin-h,xMax-h,gridStep,yMin,zMin,zMax,gridStep,current) 273 274 # adding up each B component (each coil) 84 275 276 277 278 279 280 281 282 283 284 285 286 287 B = B1 + B2 Bh = Bh1 + Bh2 # adding up each B component (each vAB) i = B.shape[0] j = B.shape[1] k = B.shape[2] l = B.shape[3] m = B.shape[4] BT = s.zeros([i,j,k,l],dtype=float) BTh = s.zeros([i,j,k,l],dtype=float) for a in range(0,m): BT = BT + B[::,::,::,::,a] BTh = BTh + Bh[::,::,::,::,a] 288 289 290 291 292 293 BZ = s.transpose(BT[2]) BZh = s.transpose(BTh[2]) G = ((BZ-BZh)/h) G0 = G[(dimZ-1)/2,0,(dimX-1)/2] delG = (G-G0)*100/G0 294 295 296 297 298 # printing time and G0 now = time.time() print ’time = ’,now-then print ’G0 =’,G0*1e3 299 300 301 302 303 304 305 306 307 308 309 310 311 # 2D plot using matplotlib import matplotlib.pyplot as plt plt.xlabel(’x (meter)’) plt.ylabel(’z (meter)’) x = s.arange(xMin,xMax+gridStep,gridStep) z = s.arange(zMin,zMax+gridStep,gridStep) delG = s.reshape(delG,[len(z),len(x)]) cs = plt.contour(x,z,delG,[-20,-15,-10,-5,0,5,10,15,20]) plt.clabel(cs, inline=1, fontsize=10) plt.title(r’$\bigtriangleup_{\%}$ on $xz$ plane at y = ’+str(yMin)) plt.grid("true") plt.show() 312 313 delG = s.ravel(delG) 314 315 316 else: print "Wrong input. Please re-run the program." 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 # writing output file f=open("z-maxwell.vtk","w") f.write("# vtk DataFile Version 3.0\n") f.write("Magnetic Field of Maxwell Coil\n") f.write("ASCII\n") f.write("DATASET STRUCTURED_POINTS\n") f.write("DIMENSIONS " + str(dimZ) + " " + str(dimY) + " " + str(dimX) + "\n") f.write("ORIGIN " + str(zMin) + " " + str(yMin) + " " + str(xMin) + "\n") f.write("SPACING " + str(gridStep) + " " + str(gridStep) + " " + str(gridStep) + "\n") f.write("POINT_DATA " + str(dimZ*dimY*dimX) + "\n") f.write("SCALARS BZ float\n") f.write("LOOKUP_TABLE default\n") for i in range(0,delG.shape[0]): f.write(str(delG[i]) + "\n") 85 333 334 f.close() APPENDIX C CODE FOR MAXWELL COIL 1 2 3 4 5 6 # # # # # # file name written by date written description last modified : : : : z-maxwell.py chew teong han (teonghan@yahoo.com) 15/08/2008 to calculate Bz of z-gradient coil + visualization + vtk output : 21/01/2009 7 8 9 10 import time import scipy as s from grad import circle 11 12 13 14 15 16 17 # universal constant(s) thetaStep = 1.0 gridStep = 0.01 j = 0.0 k = 0.0 h = 1e-6 18 19 20 21 22 23 24 25 26 print "==============================================================" print "Welcome to Magnetic Field Calculation Program for Maxwell Coil" print "==============================================================" print "Please input the required parameters" print "==============================================================" current = raw_input("Please input the current value (in Ampere): ") radius = raw_input("Please input the radius value (in meter): ") d = raw_input("Please input the d value (in meter): ") 27 28 29 30 31 32 33 # user-defined variables conversion current = float(current) radius = float(radius) d = float(d) zU = +d/2 zL = -zU 34 35 36 37 38 39 40 41 42 print "==============================================================" print "Please select the calculation plane/volume" print "==============================================================" plane = input("Enter 1 for xyz volume, 2 for xz plane or 3 for yz plane: ") print "==============================================================" if plane == 1: from grad import calB_xyz print "Please input the calculation grid parameters" 87 43 44 45 46 47 48 49 50 51 print "==============================================================" xMin = raw_input("Please input the xMin value (in meter): ") xMax = raw_input("Please input the xMax value (in meter): ") yMin = raw_input("Please input the yMin value (in meter): ") yMax = raw_input("Please input the yMax value (in meter): ") zMin = raw_input("Please input the zMin value (in meter): ") zMax = raw_input("Please input the zMax value (in meter): ") print "==============================================================" print "Processing..." 52 53 54 55 56 57 58 59 60 61 62 # grid xMin = xMax = yMin = yMax = zMin = zMax = dimX = dimY = dimZ = float(xMin) float(xMax) float(yMin) float(yMax) float(zMin) float(zMax) int((xMax-xMin)/gridStep)+1 int((yMax-yMin)/gridStep)+1 int((zMax-zMin)/gridStep)+1 63 64 then = time.time() 65 66 67 68 69 70 71 # maxwell 1 vOA,vOB = circle(-thetaStep,zU,radius,j,k) B1 = calB_xyz(vOA,vOB,xMin,xMax,gridStep,yMin,yMax,gridStep,zMin,zMax,gridStep, current) Bh1 = calB_xyz(vOA,vOB,xMin,xMax,gridStep,yMin,yMax,gridStep,zMin-h,zMax-h, gridStep,current) 72 73 74 75 76 77 78 # maxwell 2 vOA,vOB = circle(thetaStep,zL,radius,j,k) B2 =calB_xyz(vOA,vOB,xMin,xMax,gridStep,yMin,yMax,gridStep,zMin,zMax,gridStep, current) Bh2 = calB_xyz(vOA,vOB,xMin,xMax,gridStep,yMin,yMax,gridStep,zMin-h,zMax-h, gridStep,current) 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 # adding up each B component (each coil) B = B1 + B2 Bh = Bh1 + Bh2 # adding up each B component (each vAB) i = B.shape[0] j = B.shape[1] k = B.shape[2] l = B.shape[3] m = B.shape[4] BT = s.zeros([i,j,k,l],dtype=float) BTh = s.zeros([i,j,k,l],dtype=float) for a in range(0,m): BT = BT + B[::,::,::,::,a] BTh = BTh + Bh[::,::,::,::,a] 94 95 96 97 98 99 100 BZ = s.transpose(BT[2]) BZh = s.transpose(BTh[2]) G = ((BZ-BZh)/h) G0 = G[(dimZ-1)/2,(dimY-1)/2,(dimX-1)/2] delG = (G-G0)*100/G0 delG = s.ravel(delG) 88 101 102 103 104 105 # printing time and G0 now = time.time() print ’time = ’,now-then print ’G0 =’,G0*1e3 106 107 108 109 110 111 112 113 114 115 116 117 elif plane == 2: from grad import calB_xz print "Please input the calculation grid parameters" print "==============================================================" xMin = raw_input("Please input the xMin value (in meter): ") xMax = raw_input("Please input the xMax value (in meter): ") y = raw_input("Please input the y value (in meter): ") zMin = raw_input("Please input the zMin value (in meter): ") zMax = raw_input("Please input the zMax value (in meter): ") print "==============================================================" print "Processing..." 118 119 120 121 122 123 124 125 126 127 # grid xMin = xMax = yMin = zMin = zMax = dimX = dimY = dimZ = float(xMin) float(xMax) float(y) float(zMin) float(zMax) int((xMax-xMin)/gridStep)+1 1 int((zMax-zMin)/gridStep)+1 128 129 then = time.time() 130 131 132 133 134 # maxwell 1 vOA,vOB = circle(-thetaStep,zU,radius,j,k) B1 = calB_xz(vOA,vOB,xMin,xMax,gridStep,yMin,zMin,zMax,gridStep,current) Bh1 = calB_xz(vOA,vOB,xMin,xMax,gridStep,yMin,zMin-h,zMax-h,gridStep,current) 135 136 137 138 139 # maxwell 2 vOA,vOB = circle(thetaStep,zL,radius,j,k) B2 = calB_xz(vOA,vOB,xMin,xMax,gridStep,yMin,zMin,zMax,gridStep,current) Bh2 = calB_xz(vOA,vOB,xMin,xMax,gridStep,yMin,zMin-h,zMax-h,gridStep,current) 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 # adding up each B component (each coil) B = B1 + B2 Bh = Bh1 + Bh2 # adding up each B component (each vAB) i = B.shape[0] j = B.shape[1] k = B.shape[2] l = B.shape[3] m = B.shape[4] BT = s.zeros([i,j,k,l],dtype=float) BTh = s.zeros([i,j,k,l],dtype=float) for a in range(0,m): BT = BT + B[::,::,::,::,a] BTh = BTh + Bh[::,::,::,::,a] 155 156 157 158 BZ = s.transpose(BT[2]) BZh = s.transpose(BTh[2]) G = ((BZ-BZh)/h) 89 159 160 G0 = G[(dimZ-1)/2,0,(dimX-1)/2] delG = (G-G0)*100/G0 161 162 163 164 165 # printing time and G0 now = time.time() print ’time = ’,now-then print ’G0 =’,G0*1e3 166 167 168 169 170 171 172 173 174 175 176 177 178 # 2D plot using matplotlib import matplotlib.pyplot as plt plt.xlabel(’x (meter)’) plt.ylabel(’z (meter)’) x = s.arange(xMin,xMax+gridStep,gridStep) z = s.arange(zMin,zMax+gridStep,gridStep) delG = s.reshape(delG,[len(z),len(x)]) cs = plt.contour(x,z,delG,[-20,-15,-10,-5,0,5,10,15,20]) plt.clabel(cs, inline=1, fontsize=10) plt.title(r’$\bigtriangleup_{\%}$ on $xz$ plane at y = ’+str(yMin)) plt.grid("true") plt.show() 179 180 delG = s.ravel(delG) 181 182 183 184 185 186 187 188 189 190 191 192 elif plane == 3: from grad import calB_yz print "Please input the calculation grid parameters" print "==============================================================" x = raw_input("Please input the x value (in meter): ") yMin = raw_input("Please input the yMin value (in meter): ") yMax = raw_input("Please input the yMax value (in meter): ") zMin = raw_input("Please input the zMin value (in meter): ") zMax = raw_input("Please input the zMax value (in meter): ") print "==============================================================" print "Processing..." 193 194 195 196 197 198 199 200 201 202 # grid xMin = yMin = yMax = zMin = zMax = dimX = dimY = dimZ = float(x) float(yMin) float(yMax) float(zMin) float(zMax) 1 int((yMax-yMin)/gridStep)+1 int((zMax-zMin)/gridStep)+1 203 204 then = time.time() 205 206 207 208 209 # maxwell 1 vOA,vOB = circle(-thetaStep,zU,radius,j,k) B1 = calB_yz(vOA,vOB,xMin,yMin,yMax,gridStep,zMin,zMax,gridStep,current) Bh1 = calB_yz(vOA,vOB,xMin,yMin,yMax,gridStep,zMin-h,zMax-h,gridStep,current) 210 211 212 213 214 # maxwell 2 vOA,vOB = circle(thetaStep,zL,radius,j,k) B2 = calB_yz(vOA,vOB,xMin,yMin,yMax,gridStep,zMin,zMax,gridStep,current) Bh2 = calB_yz(vOA,vOB,xMin,yMin,yMax,gridStep,zMin-h,zMax-h,gridStep,current) 215 216 # adding up each B component (each coil) 90 217 218 219 220 221 222 223 224 225 226 227 228 229 B = B1 + B2 Bh = Bh1 + Bh2 # adding up each B component (each vAB) i = B.shape[0] j = B.shape[1] k = B.shape[2] l = B.shape[3] m = B.shape[4] BT = s.zeros([i,j,k,l],dtype=float) BTh = s.zeros([i,j,k,l],dtype=float) for a in range(0,m): BT = BT + B[::,::,::,::,a] BTh = BTh + Bh[::,::,::,::,a] 230 231 232 233 234 235 BZ = s.transpose(BT[2]) BZh = s.transpose(BTh[2]) G = ((BZ-BZh)/h) G0 = G[(dimZ-1)/2,(dimY-1)/2,0] delG = (G-G0)*100/G0 236 237 238 239 240 # printing time and G0 now = time.time() print ’time = ’,now-then print ’G0 =’,G0*1e3 241 242 243 244 245 246 247 248 249 250 251 252 253 # 2D plot using matplotlib import matplotlib.pyplot as plt plt.xlabel(’y (meter)’) plt.ylabel(’z (meter)’) y = s.arange(yMin,yMax+gridStep,gridStep) z = s.arange(zMin,zMax+gridStep,gridStep) delG = s.reshape(delG,[len(z),len(y)]) cs = plt.contour(y,z,delG,[-20,-15,-10,-5,0,5,10,15,20]) plt.clabel(cs, inline=1, fontsize=10) plt.title(r’$\bigtriangleup_{\%}$ on $yz$ plane at x = 0’) plt.grid("true") plt.show() 254 255 delG = s.ravel(delG) 256 257 258 else: print "Wrong input. Please re-run the program." 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 # writing output file f=open("z-maxwell.vtk","w") f.write("# vtk DataFile Version 3.0\n") f.write("Magnetic Field of Maxwell Coil\n") f.write("ASCII\n") f.write("DATASET STRUCTURED_POINTS\n") f.write("DIMENSIONS " + str(dimZ) + " " + str(dimY) + " " + str(dimX) + "\n") f.write("ORIGIN " + str(zMin) + " " + str(yMin) + " " + str(xMin) + "\n") f.write("SPACING " + str(gridStep) + " " + str(gridStep) + " " + str(gridStep) + "\n") f.write("POINT_DATA " + str(dimZ*dimY*dimX) + "\n") f.write("SCALARS BZ float\n") f.write("LOOKUP_TABLE default\n") for i in range(0,delG.shape[0]): f.write(str(delG[i]) + "\n") 91 275 f.close() APPENDIX D VTK FILE FORMAT 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 #vtk DataFile Version 2.0 Bz in xyz volume ASCII DATASET STRUCTURED_POINTS DIMENSIONS nx ny nz ORIGIN x y z SPACING sx sy sz SCALARS Bz LOOKUP_TABLE default data(0) data(1) . . . data(n-1) Explanations: 1. Line 1 shows the version of the VTK data file (header) 2. Line 2 shows the user-defined name (title) for the VTK data file 3. Line 3 shows the type of the VTK data file (ASCII or BINARY) 4. Line 4 shows the dataset format (STRUCTURED POINTS, STRUCTURED GRID, RECTILINEAR GRID, POLYGONAL DATA or UNSTRUCTURED GRID) 5. Line 5 to 7 shows the required field based on the dataset format 93 6. Line 8 shows dataset attribute format (SCALARS, VECTORS, NORMALS, TEXTURE COORDINATES, TENSORS or FIELD DATA), followed by userdefined dataset name 7. Line 9 shows the table that will be used to color-code the dataset 8. Line 10 and above shows the dataset components based on the type of DATASET Note that there are other options available for different form of data but for this research, the above format is sufficient. APPENDIX E PUBLICATION A Journal of Fundamental Sciences Magnetic Field Simulation of Golay Coil * Rashdi Shah Ahmad, Amiruddin Bin Shaari, Chew Teong Han Department of Physics, Faculty of Science, Universiti Teknologi Malaysia, 81310 UTM Skudai, Johor, Malaysia. * Author to whom correspondence should be addressed; E-mail: rashdishah@yahoo.com, amiryeng@yahoo.com and teonghan@yahoo.com Received: 30 October 2008 ABSTRACT In the field of magnetic resonance imaging (MRI), besides the main magnetic field and the radio frequency (RF) system, the gradient coils system also plays an important role in signal acquisition. Generally, there are 2 transverse gradient coils and 1 longitudinal gradient coil. In this research, the magnetic field (or gradient) generated by the conventional transverse coil, namely the Golay coil was mapped. The calculation algorithm of the magnetic field generated was written in C-programming language, compiled by the GNU-compiler collection (GCC) and was based on a forward analytical approach by using the Biot-Savart Law. The data was then visualized by Gnuplot. The magnetic field was successfully calculated and plotted using open-source softwares running under Ubuntu operating system and will provide valuable data especially for gradient coil designer. | Magnetic resonance imaging (MRI) | Golay coil | simulation | GCC | Gnuplot | 1. Introduction Gradient coils play an important role in magnetic resonance imaging (MRI) since they directly affect the resolution of the signal. There are usually three sets of gradient coils in a MRI system, each generating a magnetic gradient along each orthogonal axis, namely x, y and z. The longitudinal gradient coil will generate a magnetic gradient along z-direction which is derived from the shape of Maxwell coil. The two other transverse gradient coils however consist of double saddle configuration, known as the Golay coil [1], made up from two saddle coils. The main purpose of gradient coils in a MRI system is to produce a magnetic gradient along each axis, helping in slice selection, frequency encoding and phase encoding. Technically speaking, the gradient would be preferred to be as linear as possible over a large volume. However, due to several constraints such as the inductance and the size of the coil, these few characteristics will have to be traded off with each other. 2. Methodology The magnetic field generated by a finite current segment can be calculated using an analytical approach by using the Biot-Savart Law [2]. Any coil shape can be divided into a series of finite current segment and by using the Biot-Savart Law for finite current segment, the magnetic field generated by the coil at any point can be Article Available online at http://www.ibnusina.utm.my/jfs 95 354 Rashdi Shah Ahmad et al. / Journal of Fundamental Sciences 4 (2008) 353-361 calculated. Equation 1 shows the Biot-Savart Law for a finite current segment [3] with Figure 1 showing the related parameters. B= µ0 I (cos θ 1 − cos θ 2 ) 4πa (1) From Figure 1, the magnetic field induced by the finite segment AB at point M can be calculated using Equation 1. However, before doing any calculation, further vector analysis is required to obtain all the necessary parameters. Figure 1: Parameters Related to Finite Segment with Calculation Point, M B is obtained by taking the cross product of the unit vector of AB and the unit vector M ( LM ). The vector of the current segment, AB and its unit vector, û AB , are given by Equation 2 and 3: The direction of along a line joining the current segment to the calculation point, AB = OB − OA uˆ AB = Similarly, AB (2) (3) AB AM and BM as well as their respective unit vectors are given by Equation 4 to 7: AM = OM − OA (4) BM = OM − OB (5) uˆ AM = uˆ BM = AM (6) AM BM BM (7) 96 355 Rashdi Shah Ahmad et al. / Journal of Fundamental Sciences 4 (2008) 353-361 The cosine of the angles θ1 and θ 2 are calculated from Equation 8 and 9: cosθ1 = uˆ AB • uˆ AM (8) cos θ 2 = uˆ AB • uˆ BM (9) The distance between the calculation point, Equation 10: M to the segment is given by the magnitude of LM in LM = AM − AL (10) AL is the projection of AM in the direction of û AB , given by Equation 12: AL = ( AM • uˆ AB )uˆ AB (11) LM = AM − ( AM • uˆ AB )uˆ AB (12) Therefore, The direction of the magnetic field at the calculation point, M is shown in Equation 13: uˆ B = uˆ AB × uˆ LM Finally, the magnetic field at point (13) M is obtained as: B= µ0 I 4π LM (cos θ1 − cos θ 2 )uˆ B (14) Figure 2 shows the calculation model used in this simulation. The arrows denote the current flow in the Golay coil. The calculations are done on the xy-plane, divided in grids, shown in Figure 2. The calculation grid for both xy-plane and xz-plane will be the size of (0.4 m X 0.4 m) with a step of 0.01 m. A total of five coil parameters will be varied and simulated accordingly, namely the separation between two saddle coils, a, the length of Golay coil, b (as shown in Figure 2), the arc angle of the coil, θ, the radius of the coil, r and the separation between each half of saddle coil, c (as shown in Figure 3). For each simulation, only one parameter will be varied while the rest will be fixed at certain value. The C-code of the program would iterate the calculation and export the data into a text file which was then visualized by Gnuplot. 3. Results and Discussions Figure 4 to 9 show the some of the results obtained by the simulation. Figure 4 to 6 show the magnetic contour plot of the results to show how uniform is the gradient generated by altering one of the coil geometry 97 356 Rashdi Shah Ahmad et al. / Journal of Fundamental Sciences 4 (2008) 353-361 mentioned above. Figure 7 to 9 show the normal xy-plot of the same results to show how linear is the gradient, the gradient value itself and also the gradient uniformity. Figure 4 to 9 were plotted for an x-range with different values of y. The graphs were then plotted on the same axis, overlapping each other. The idea was that for different values of y, if the xy-plots were perfectly overlapped, and then one can consider the gradient was very uniform along the y-direction. Figure 2: Calculation Model Figure 3: Top View of Calculation Model with z-axis pointing out From Figure 4 and 7, as a increases, the gradient uniformity decreases, the gradient linearity increases whereas the gradient value decreases. From Figure 5 and 8, as b increases, the gradient uniformity slightly decreases almost no change in gradient linearity whereas the gradient value slightly changes. From Figure 6 and 98 Rashdi Shah Ahmad et al. / Journal of Fundamental Sciences 4 (2008) 353-361 357 9, as c increases, the gradient uniformity decreases, almost no change in gradient linearity whereas the gradient value decreases. Figure 4: Magnetic Contour Plot for Various a Figure 5: Magnetic Contour Plot for Various b 99 358 Rashdi Shah Ahmad et al. / Journal of Fundamental Sciences 4 (2008) 353-361 Figure 6: Magnetic Contour Plot for Various c Figure 7: xy-plot for various a 100 Rashdi Shah Ahmad et al. / Journal of Fundamental Sciences 4 (2008) 353-361 Figure 8: xy-plot for various b Figure 9: xy-plot for various c 359 101 360 Rashdi Shah Ahmad et al. / Journal of Fundamental Sciences 4 (2008) 353-361 Other results obtained by varying the r parameter and the θ parameter. As r increases, almost no change in gradient uniformity, gradient linearity increases whereas the gradient value decreases. As expected, θ = 1200 offered the best gradient uniformity among the values of θ. Figure 10 and 11 show the ideal data plot generated. Analytically speaking, if the magnetic field mapping obtained, both experimentally or theoretically (through computer simulation), is as similar to these plots, the better the gradient coil is, in terms of both field linearity and gradient uniformity. Figure 10: Ideal Contour Plot for x-Golay Coil Figure 11: Ideal xy-plot for x-Golay Coil 102 Rashdi Shah Ahmad et al. / Journal of Fundamental Sciences 4 (2008) 353-361 361 4. Conclusion The simulation is considered success with few rooms for improvement including numerical analysis for more accurate gradient calculations, mapping for magnetic gradient values rather than the magnetic field and etc. The simulation also proves to be a great tool and to provide assistance especially to gradient coil designers. 5. References and Citations [1] Adamiak, K., Rutt, B. K., and Dabrowki, W. J., Design of Gradient Coils for Magnetic Resonance Imaging, IEEE Transactions on Magnetics, Vol 28, pg 2403-2405, 1992 [2] Rashdi Shah Ahmad and Chew, T. H., Algorithm for Magnetic Field Visualization of a Flat Plane Induced by Finite Dipole Segment Using GCC and Gnuplot, Regional Annual Fundamental Science Seminar, 2007 [3] Sadiku, M., 1995. Elements of Electromagnets. Oxford University Press. APPENDIX F PUBLICATION B Magnetic Field Simulation of Maxwell Coil 1 1 1,* R. S. Ahmad , A. Shaari and T. H. Chew 1 Department of Physics, Faculty of Science, Universiti Teknologi Malaysia, 81310 UTM Skudai, Johor, Malaysia. *email: teonghan@yahoo.com Abstract A configuration of two identical circular coils, carrying current with anti-parallel direction, separated by a distance of 1.73 times its radius, is known as Maxwell coil. Such configuration is able to generate a magnetic field gradient along the axis of the coil. Because of this characteristic, Maxwell coil is widely used in magnetic resonance imaging (MRI) or nuclear magnetic resonance (NMR) instruments; to generate longitudinal magnetic field gradient. This research investigates the effect of the geometrical parameters of Maxwell coil to the magnetic field gradient generated. For this purpose, a computer simulation is written in Python programming language. It is found that with certain configuration, the magnetic field gradient generated can be improved within certain range compared to the original configuration of Maxwell coil. Besides that, the simulation also visualizes a full 3-dimensional magnetic field gradient generated. In short, the research provides useful information without actually constructing the physical prototype of gradient coil which maybe costly and time consuming. rents with anti parallel direction, separated at a distance equal to 3 of the coil’s radius. METHODOLOGY This simulation will emphasize the mapping of the generated magnetic field gradient in 2 dimensions with the capability of extending to 3 dimensions. Besides contour plotting, data for simulation is extracted for correlation calculation to determine the linearity of the magnetic field gradient generated. Current carrying conductor is able to generate magnetic field according to Biot-Savart’s Law. The Biot-Savart’s Law can be further derived for finite length current segment shown in Equation 1[1]. µ0 I (cos θ 1 − cos θ 2 ) (1) 4πa The parameters in Equation 1 are related as shown in Figure 1. B= Keywords Gradient Coil, Maxwell Coil, magnetic resonance imaging (MRI), Python INTRODUCTION Magnetic resonance imaging (MRI) is a well known noninvasive imaging technique widely used in medical area which is based on nuclear magnetic resonance (NMR). In NMR phenomenon, atomic spin is manipulated by external magnetic field and excited by the matching radio frequency pulses based on the Larmor equation. In actual practice, a main magnetic field is applied to align the spins in the sample with a magnetic field gradient applied in certain direction to “encode” the spins in terms of phases and frequencies. RF system will then transmit RF pulses to excite the spins. RF pulses released after the spins undergo relaxation processes are picked up for mapping. Gradient coils are responsible for generating the magnetic field gradient; one coil for each x, y and z axis. Conventionally, the Maxwell coil configuration is used as the z axis gradient coil, known also as longitudinal gradient coil. A Maxwell coil configuration consists of two identical circular coils carrying cur- Figure 1: Finite Current Segment AB and Measurement Point, M Vector analysis is used in order to obtain all necessary parameters needed to execute the calculations. The idea of this simulation is to divide the Maxwell coil into a series of finite current segments. The calculation planes (or volume) are then split into grids of points. For each point in the grid, the magnetic field contribution of each current segment is calculated and summed up. The Biot-Savart’s Law after undergoing vector analysis is shown in Equation 2 [2]. µ0 I B= 4π LM (cosθ 1 − cos θ 2 )uˆ B (2) With, uˆ B = uˆ AB × uˆ LM (3) 104 Figure 2 and 3 show the simulation model with the arrows denoting the current direction. Original Maxwell coil configuration The result for original Maxwell coil configuration is shown in Figure 4. Figure 2: Maxwell Coil in 3D view Figure 4: Gradient Deviation on xz Plane at 5% interval for d = 1.73r Figure 3: Maxwell Coil viewed on xy plane For data analysis, the simulation is ran for xz plane and yz plane. No simulation is ran on xy plane since z axis is not involved (since Maxwell coil in Figure 2 and 3 will only generate magnetic field gradient along z direction). Simulation will be ran for variation of d as a function of r (radius) to observe the effect on the gradient generated. RESULTS AND DISCUSSIONS Magnetic field gradient along z direction can be defined as in Equation 4. The result on yz plane is not shown since the contour plot is the same as on xz plane because of the symmetry of Maxwell coil. The gradient generated with this configuration is approximately -0.050 mT/m (subjected to current = 10 A). The correlation coefficient, r, between z = -0.1 m and z = +0.1m is -1 (true to 6 decimal points), meaning the magnetic field is perfectly linear within the range. The usable region within 5% is defined in this research as the ratio of usable volume within 5% to the total volume covered by the entire Maxwell coil (which is a cylinder). The usable region for this configuration is around 5.83%. Variation of d The same simulation is ran for various d as a function of r. Table 1 summarized the results for each variation. Table 1: Correlation, gradient and usable volume for various d d (m) r G z (mT/m) Usable volume (%) 0.8r -0.999657 -0.065 0.744 (4) 1.2r -0.999913 -0.066 1.543 The magnetic field linearity in this research is determined by the correlation coefficient, r, for a certain range. The closer the value to 1 or -1, the more linear the magnetic field is. The gradient uniformity is calculated based on Equation 5 [3]. 1.4r -0.999970 -0.061 3.842 1.6r -0.999995 -0.055 6.043 1.8r -1.000000 -0.048 5.205 2.0r -0.999995 -0.042 4.744 2.2r -0.999987 -0.036 2.697 ∂B Gz = z ∂z ∆% = G z ( x , y , z ) − G z (0,0,0 ) G z ( 0 , 0, 0 ) (5) A good gradient uniformity is within 5% tolerance [4, 5]. Therefore, the contour plot of magnetic field gradient is usually done in 5% interval to determine the usable region within acceptable tolerance. From Table 1, as d increases, the gradient value decreases. Both r and usable volume, however, increase and the decrease as d is further increased. The usable volume for d = 1.6r is 6.043% which is better than the original Maxwell coil configuration. If the application is not usable-regioncritical, but gradient-value-critical, the d of Maxwell coil can be decrease to achieve higher gradient value. This, however, will decrease the usable volume and also the linearity of the magnetic field. Practically, higher gradient 105 value will result in higher resolution during the imaging process. Higher usable volume basically means larger usable area for samples whereas higher linearity literally will affect the accuracy of the image representation. 3 dimensional visualization The simulation written has the capability of visualizing the magnetic field or gradient generated in 3 dimensional volume. The main problem, however, is due to the limitation of 32 bit platform. The simulation is written using the vectorized processing method in which resulting in faster execution of code significantly compared to the normal “for” loop. The disadvantage of using vectorized processing is the high usage of system memory in which a 32 bit platform limits it to be around 2 Gigabytes. This is almost equivalent to calculating around 10 thousand grid points. Anything beyond this will result in “memory error”. The practical solution would be switching to 64 bit platform or to reduce the grid size. Figure 5 show the sample 3 dimensional visualization. simulation can be ran for a full 3 dimensional analysis in one shot. CONCLUSIONS A simulation has been written in Python programming language to map the magnetic field and gradient generated by Maxwell coil. The geometrical parameter, d, is found to affect the magnetic field gradient generated in terms of linearity and also the usable region. With d = 1.6r compared to original d = 1.73r, the usable region within 5% gradient deviation can be improved as long as the ratio between the region and overall volume is concerned. The simulation is written based on the Biot-Savart’s Law for finite length current segment. This generally mean as long as the shape of coil is known and can be divided in series of finite length current segment, the same simulation code can be used to simulate the magnetic field generated regardless of the application. Since the whole simulation is written using open-source software, it can be freely modified and distributed and the most important is that the simulation will provide valuable data without physically construct the actual Maxwell coil. ACKNOWLEDGMENTS The authors would like to acknowledge Kuok Foundation for its financial assistance and Faculty of Science, UTM for its facilities. REFERENCES [1] Sadiku, M., Elements of Electromagnets. Oxford University Press. 1995 Figure 5: 3 Dimensional Contour Plot of Gradient Deviation Figure 5 is generated by VisIt visualization program developed as open-source software by the Lawrence Livermore Laboratory. The simulation exported the data calculated into VTK file format, supported by VisIt (and many more visualization programs). With 3 dimensional visualization program and appropriate working platform (64 bit), the [2] Ahmad, R. S., Shaari, A., and Chew, T. H., Magnetic Field Simulation of Golay Coil, Journal of Fundamental Sciences, 2008. 4: 353-361 [3] Shi, F. and Ludwig, R., Magnetic Resonance Imaging Gradient Coil Design by Combining Optimization Techniques with the Finite Element Method. IEEE Transactions on Magnetics, 1998. 34(3): 671-683 [4] Di Luzio, S. e. a., A Novel, Cylindrical, Transverse Gradient Coil Design for Magnetic Resonance Imaging of Large Samples. Measurement Science Technology, 1998. 9: 1663-1671. [5] Dodd, S. and Chien, H. Short Planar Gradient Coils for MR Microscopy Using Concentric Return Paths. Journal of Magnetic Resonance, 2002. 156: 1-9.