Page 1

John von Neumann Institute for Computing

HPC Simulation of Magnetic Resonance

Imaging

Tony St¨ ocker, Kaveh Vahedipour, N. Jon Shah

published in

Parallel Computing: Architectures, Algorithms and Applications ,

C. Bischof, M. B¨ ucker, P. Gibbon, G.R. Joubert, T. Lippert, B. Mohr,

F. Peters (Eds.),

John von Neumann Institute for Computing, J¨ ulich,

NIC Series, Vol. 38, ISBN 978-3-9810843-4-4, pp. 155-164, 2007.

Reprinted in: Advances in Parallel Computing, Volume 15,

ISSN 0927-5452, ISBN 978-1-58603-796-3 (IOS Press), 2008.

c ? 2007 by John von Neumann Institute for Computing

Permission to make digital or hard copies of portions of this work for

personal or classroom use is granted provided that the copies are not

made or distributed for profit or commercial advantage and that copies

bear this notice and the full citation on the first page. To copy otherwise

requires prior specific permission by the publisher mentioned above.

http://www.fz-juelich.de/nic-series/volume38

Page 2

HPC Simulation of Magnetic Resonance Imaging

Tony St¨ ocker, Kaveh Vahedipour, and N. Jon Shah

Institute of Medicine

Research Centre J¨ ulich, 52425 J¨ ulich, Germany

E-mail: {t.stoecker, k.vahedipour, n.j.shah}@fz-juelich.de

High performance computer (HPC) simulations provide helpful insights to the process of mag-

netic resonance image (MRI) generation, e.g. for general pulse sequence design and optimisa-

tion, artefact detection, validation of experimental results, hardware optimisation, MRI sample

development and for education purposes. This manuscript presents the recently developed sim-

ulator JEMRIS (J¨ ulich Environment for Magnetic Resonance Imaging Simulation). JEMRIS is

developed in C++, the message passing is realised with the MPI library. The approach provides

generally valid numerical solutions for the case of classical MR spin physics governed by the

Bloch equations. The framework already serves as a tool in research projects, as will be shown

for the important example of multidimensional, spatially-selective excitation.

1 Introduction

Bloch equation-based numerical simulation of MRI experiments is an essential tool for a

variety of different research directions. In the field of pulse sequence optimisation, e.g. for

artefact detection and elimination, simulations allow one to differentiate between effects

related to physics and hardware imperfection. Further, if the simulation environment is

able to simulate the hardware malfunction, then results may be used for the optimisation of

the hardware itself. Another prominent application is the design of specialised RF pulses

which is often based on numerical simulations of the excitation process. In general, the

interpretation and validation of experimental results benefit from comparisons to simulated

data, which is especially important in the context of MRI sample development, e.g. for the

development of implants. Another important direction of application is image generation

for the purpose of image processing – here, complete control of the properties of the input

data allows a tailored design of image processing algorithms for certain applications.

The numerical simulation of an MRI experiment is, in its most general form, a de-

manding task. This is due to the fact that a huge spin ensemble needs to be simulated

in order to obtain realistic results. As such, several published approaches have reduced

the size of the problem in different ways. The most prominent method is to consider

only cases in which analytical solutions to the problem exist1. However, for the case

of radiofrequency (RF) excitation in the presence of time varying gradient fields no

analytical solution exists and, thus, the important field of selective excitation cannot be

studied with such an approach. Apart from the computational demand, the complexity

of the MRI imaging sequence is an additional obstacle. The difficulty of MRI sequence

implementation using the software environments of commercial MRI scanner vendors –

painfully experienced by many researchers and pulse programmers – can be significantly

reduced with appropriate software design patterns.

The JEMRIS project was initiated taking all the aforementioned considerations into

155

Page 3

account. It takes advantage of massive parallel programming on HPC (high performance

computing) architectures. The aim of the project was to develop an MRI simulator which

is general, flexible, and usable. In detail, it provides a general numerical solution of the

Bloch equations on a huge ensemble of classical spins in order to realistically simulate the

MRI measurement process. Further, it takes various important off-resonance effects into

account.

2 Theory

2.1MR Signal Evolution

The JEMRIS simulator is based on a classical description of MRI physics by means of the

Bloch equations, describing the sample by its physical properties of equilibrium magneti-

sation, M0, and the longitudinal and transverse relaxation times, T1and T2, respectively.

It provides an exact description for the magnetisation vector, M(r,t), of non-interacting

spin isochromates under the influence of an external magnetic field. For MRI, the field

decomposes to the strong static component, B0, a temporally and spatially varying field

along the same direction (the imaging gradients G) and the orthogonal components of the

RF excitation field, B1. The total field is thus given by

B(r,t) = [B0+ G(t) · r]ez+ B1x(r,t)ex+ B1y(r,t)ey.

A mathematical and numerical treatment is greatly simplified in the rotating frame of ref-

erence, in which the effect of the main field is not seen since the coordinate system rotates

with the speed of the spin precession. Here, the formulation of the Bloch equation in

cylindrical coordinates is very well suited for a numerical implementation

0

˙ Mz

001

γBy −γBx −1

(2.1)

@

˙ Mr

˙ ϕ

1

A=

0

@

cosϕ sinϕ 0

−sin ϕ

Mr

cos ϕ

Mr

0

1

A·

2

4

0

@

−1

−γBz −1

T2

γBz −γBy

T2

γBx

T1

1

A·

0

@

Mrcosϕ

Mrsinϕ

Mz

1

A+

0

@

0

0

M0

T1

1

A

3

5

(2.2)

where γ is the gyromagnetic ratio of the nuclei (usually protons) under consideration. The

complex MR signal is then described by the signal equation

?

which integrates all components within the RF coil volume, V . For the description of

the MR measurement process, the time evolution of each spin isochromate is completely

different and the problem is ideally suited for numerical treatment with parallel processing.

In MRI, the measurement process is expressed by the MRI sequence2which describes the

timing of pulsed currents in various coils to produce the RF field for excitation and the

gradient field for encoding spatial information to the phase/frequency of the MR signal:

ϕ(r,t) = γ?G(t)dt · r ≡ k(t) · r. Inserting this expression in Eq. (2.3) shows that

image, Mr(r), is given by the Fourier transformation of the acquired signal. Thus, the

timing of the gradient pulses defines the so called k-space trajectory, k(t), along which

the necessary information for image generation is acquired during the measurement. In

S(t) ∝

V

Mr(r,t)exp[iϕ(r,t)] d3r

(2.3)

the MR signal, S(t), can be reordered as a function of the k-vector, S(k). Then, the MR

156

Page 4

general the MR image, Mr(r) = Mr(M0(r),T1(r),T2(r)), depends on the timing of

the MRI sequence through the time evolution of the Bloch equation. In this way, images

with various desirable properties such as soft-tissue contrast can be obtained. The image

contrast is based on differences in the proton density, M0, and/or the relaxation times,

T1,T2, in biological tissue components; this unique feature provides a variety of medical

imaging applications and it is the basis for the success of MRI in medicine.

2.2Selective Excitation

Multidimensional, spatially-selective excitation4is an important concept of growing inter-

est in MRI, e.g. in the field of in vivo spectroscopy or for the challenging task of correcting

subject-induced B1field inhomogeneities at ultra high fields5. However, thus far the com-

putation of these pulses is based on a simplified physical model neglecting relaxation and

off-resonance effects during the pulse. Under such conditions, the calculation of the un-

known RF pulse shape, B1, from a given target excitation pattern, Mp, reduces to a linear

system:

?T

where M0is the equilibrium magnetisation and k(t) is a given k-space trajectory. A spa-

tially and temporally discrete version of Eq. (2.4) can be solved for B1by suitable gen-

eralised matrix inversion methods. In contrast, the present approach provides a numerical

method to design selective pulses under realistic experimental conditions. The simulator

computes the effective transverse magnetisation, Me(r,t), which is used to correct the RF

pulse in order to account for effects not governed by Eq. (2.4). Thus, a minimisation prob-

lem is formulated and individually solved for all time steps n∆t (n = 1,...,N) , where

N∆t = T equals the pulse length:

Mp(r) = iγM0(r)

0

B1(t)exp[ir · k(t)] dt

(2.4)

||Mp(r) − Me[M0(r),T1(r),T2(r),∆ω(r),B1(t),k(t)]|| = min

Here, the difference between the desired magnetisation pattern and the effective magneti-

sation pattern is minimised with respect to the real and the imaginary parts of B1 =

B1x+ iB1y. The starting point (B1x,B1y) for each of the N consecutive 2D minimi-

sation problems is taken from the solution of Eq. (2.4). Note that the temporal sampling

of B1is taken from the discrete version of Eq. (2.4), whereas the time evolution of the ef-

fective magnetisation is computed with much higher accuracy by the simulator, i.e. within

each interval ∆t the Bloch equation is individually solved for each spin to compute the

norm in Eq. (2.5) for the minimisation routine. Once a minimum is found for the n-th step

of the RF pulse, the final magnetisation states are taken as the starting condition for the

next step.

B1

(2.5)

3Software Engineering

3.1General Design of the Framework

The software design of JEMRIS had to meet two competing premises: Obviously, the ob-

ject design had to reflect the physical world. At the same time the objects and members

157

Page 5

were to remain highly maintainable, reusable and yet easy to handle.

A simple reflection of the class hierarchy is presented in Fig. 1. The object model in

JEMRIS is based on the definition of the four main classes: Sample, Signal, Model, and

Sequence, respectively. The Sample class describes the physical properties of the object,

currently defined by the set P = (M0,T1,T2) at every spatial position r = (x,y,z)

of the sample. Since MPI has no functionality for object serialisation, send/receive of

sub-samples is realised with appropriate MPI data-types. Similarly, the Signal holds

information about the ‘MR signal’ consisting of the net magnetisation vector M(t) =

[Mx(t),My(t),Mt(t)] at every sampled time point. MPI functionality is implemented in

the same way as for the Sample class. The Model class contains the functionality for solv-

ing the physical problem.

The design of the Sequence class and its underlying sequence framework proved to be a

very demanding task. It supplies the most complex part of the simulator. For this a novel

object-oriented design pattern for MRI is introduced which derives the basic parts, Se-

quences (loopable branch nodes) and Pulses (leaf nodes) from an abstract Module class.

To further reduce the complexity in, and promote the encapsulation of, the objects in this

part of the framework, an abstract factory approach using prototypes is implemented as

suggested by Gamma et al6.

A sequence represents a left-right ordered tree. Fig. 2 depicts by example how the different

modules of the well-known EPI sequence2, loops and pulses, can be arranged in an ordered

tree. Trees can be effectively accessed by recursion and are very well suited for building

as well as accessing values of the sequence. The atomic sequences are containers for the

pulses and, thus, display the functionality to emit pulses of various types. The pulses them-

selves are defined in a seceded class hierarchy.

The sequence tree is internally handled via XML. Thus, sequences themselves in turn can

Figure 1. Class hierarchy of the basic JEMRIS components, Sample, Signal, Model, and Sequence class, respec-

tively.

158