assignment 5 k - university of california,...

18
EE225E/BIOE265 Spring 2012 Miki Lustig Principles of MRI Assignment 5 Due Feb 26, 2012 1. Finish reading Nishimura Ch. 5. 2. For the 16 turn spiral trajectory, plotted below, what is the a) Spatial resolution, and b) FOV given that k x,max = k y,max =2.5 cycles/cm. Assume that the sampling rate along the spiral trajectory is not limiting. k y k x 2k x,max 2k y,max Solution: The resolution and FOV are the same in each dimension, so let W k = W kx = W ky , and δ = δ x = δ y , etc. a) The k-space extent is W k 2k max = (2)(2.5 cycles/cm) = 5 cycles/cm This gives a spatial resolution of δ = 1 W k = 1 5 cycles/cm =0.2 cm = 2 mm. b) The FOV is determined by the sampling interval in the radial direction. This is Δk =2k max /(2 * 16) = (5 cycles/cm)/32 = 0.16 cycles/cm where we have used the fact that an N turn spiral crosses (samples) any diameter 2N times. The FOV is then FOV = 1 δ = 1 0.16 cycles/cm =6.4 cm. 1

Upload: others

Post on 03-Aug-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Assignment 5 k - University of California, Berkeleyinst.eecs.berkeley.edu/~ee225e/sp12/hw/hw5_soln.pdfAssignment 5 Due Feb 26, 2012 1. Finish reading Nishimura Ch. 5. 2. For the 16

EE225E/BIOE265 Spring 2012 Miki LustigPrinciples of MRI

Assignment 5

Due Feb 26, 2012

1. Finish reading Nishimura Ch. 5.

2. For the 16 turn spiral trajectory, plotted below, what is the

a) Spatial resolution, and

b) FOV

given that kx,max = ky,max = 2.5 cycles/cm. Assume that the sampling rate along the spiral trajectoryis not limiting.

ky

kx

2kx,max

2ky,max

Solution: The resolution and FOV are the same in each dimension, so let Wk = Wkx = Wky, andδ = δx = δy, etc. a) The k-space extent is

Wk2kmax = (2)(2.5 cycles/cm) = 5 cycles/cm

This gives a spatial resolution of

δ =1

Wk=

1

5 cycles/cm= 0.2 cm = 2 mm.

b) The FOV is determined by the sampling interval in the radial direction. This is

∆k = 2kmax/(2 ∗ 16) = (5 cycles/cm)/32 = 0.16 cycles/cm

where we have used the fact that an N turn spiral crosses (samples) any diameter 2N times. TheFOV is then

FOV =1

δ=

1

0.16 cycles/cm= 6.4 cm.

1

Page 2: Assignment 5 k - University of California, Berkeleyinst.eecs.berkeley.edu/~ee225e/sp12/hw/hw5_soln.pdfAssignment 5 Due Feb 26, 2012 1. Finish reading Nishimura Ch. 5. 2. For the 16

3. Consider the 2DFT pulse sequence, shown below on the left, with the following timing

Gx

Gy

Gz

RF

A/D

2 ms

4 ms

FOV

FOV

The amplitude of the readout gradient is 0.94 G/cm, as is the maximum of the phase encode gradient.Also, 256 samples are acquired during the readout, and 256 phase encode steps are used. The initialmagnetization is fully relaxed for each acquisition. The RF pulse is a +90◦ rotation about +x.

The object being imaged is shown above on the right. It is a triangle that is larger than half theFOV in each dimension. The reconstructed image is the magnitude of the inverse FT of the sampleddata.

(a) What are the resolution and FOV of the pulse sequence? Solution:The k-space extent in thereadout direction is

Wkx =γ

2πGxτx = (4.257 kHz/G)(0.94 G/cm)(4 ms) = 16 cycles/cm

This corresponds to a resolution

δx =1

Wkx=

1

16 cycles cm= 0.0625 cm

The sampling in kx is

∆kx =Wkx

Nr=

16 cycles/cm

256= 0.0625 cycles/cm

and the FOV in x is then

FOVx =1

∆kx=

1

0.0625 cycles/cm= 16 cm.

Along the y axis, the k-space extent is

Wky = 2ky,max =γ

2πGyτy = 2(4.257 kHz/G)(0.94 G/cm)(2 ms) = 16 cycles/cm

which is the same as in the x dimension, so the resolution is again δy = 0.0625 cm Since thenumber of phase encodes is the same as the number of readout samples, the FOV is also thesame in x and y, so FOVy = 16 cm.

2

Page 3: Assignment 5 k - University of California, Berkeleyinst.eecs.berkeley.edu/~ee225e/sp12/hw/hw5_soln.pdfAssignment 5 Due Feb 26, 2012 1. Finish reading Nishimura Ch. 5. 2. For the 16

(b) Sketch the image that would be produced if we just used the even numbered phase encodes.

Solution: This only effects the y dimension.

If we only use the even numbered phase encodes, the k-space extent remains the same, so theresolution δy stays the same. The spacing of the phase encodes is now twice as large

∆ky,n = 2∆ky

so that the new FOVy,n is half of what it was.

FOVy,n =1

∆ky,n=

1

2∆ky= FOVy/2

Since FOVy is now half as big, the image replicas are twice as close, and overlap the originalFOV. If we reconstruct using the acquired even phase encodes, and zero out the odd phaseencodes, we get the image of the left. If we reconstruct using Np/2 phase encodes, the result isthe image on the right.

FOV

FOV/2

FOV

FOV/2

(c) What does the image look like if we doubled the x gradient, and used the original phase encodegradient?

Solution: This only effects the x dimension.

If we double Gx, then

Wkx =γ

2πGxτx

is also doubled. This means that δx = 1Wkx

is halved. The pixels are twice as small in x. Sincewe’ve kept the same number of samples, the FOV in x has also been halved. Since the readoutdirection is the axis where we have the anti-aliasing filter, there is no aliasing.

If we reconstruct the image using a 256x256 2DFT the image looks like the one on the leftbelow. If we compensate for the pixel size, we get the image on the right.

FOV FOV

FOV/2 FOV/2

3

Page 4: Assignment 5 k - University of California, Berkeleyinst.eecs.berkeley.edu/~ee225e/sp12/hw/hw5_soln.pdfAssignment 5 Due Feb 26, 2012 1. Finish reading Nishimura Ch. 5. 2. For the 16

(d) What does the image look like if we doubled the maximum y gradient, and used the originalreadout gradient?

Solution: This only effects the y dimension.

Doubling Gy doubles Wky, and halves δy. In addition the k-space sample spacing ∆ky,n isdoubled, so the FOVy is halved.

If we reconstruct by doing a 256x256 2DFT, and don’t compensate for pixel size, the result isthe image on the left. If we do compensated for the smaller pixel size in y, we get the image onthe right.

FOV

FOV/2

FOV

FOV/2

(e) Assume that the sign of the RF is alternated every other phase encode, so that it produces a+90◦ rotation about the +x axis on the even phase encodes, and a −90◦ rotation on the oddphase encodes. We reconstruct as usual with an inverse FT. What does the image look like?

Solution: There are many ways to look at this. The alternating RF pulse results in the signalfor every other phase encode being multiplied byt ±1, so that the new acquired data is

Mxy,n(u∆kx, v∆ky) =Mxy(u∆kx, v∆ky)(−1)v

where Mxy(u, v) is the original sampled data, and Mxy,n(u, v) is the new data. The new datais the original data multiplied by (−1)v, where v is the integer index of the phase encode.

One approach is to use the modulation theorem. Multiplication in the spatial frequency domaingoes to convolution in the image domain, so the result will be the original image convolved withthe 2D inverse Fourier transform of (−1)v.

We can also just work through the problem directly, which is what we will do here. As weshowed in class,

Mxy,n(aδx, bδy) =∑u

∑v

Mxy(u∆kx, v∆ky)(−1)vej2π(au/Nr+bv/Np)

where u is summed from −Nr/2 + 1 to Nr/2, and v is summed from −Np/2 + 1 to Np/2. If wewrite (−1)v as eivπ, and collect terms,

Mxy,n(aδx, bδy) =∑u

∑v

Mxy(u∆kx, v∆ky)ejvπe

j2π

(auNr

+ bvNp

)

=∑u

∑v

Mxy(u∆kx, v∆ky)ej2π( v

2)ej2π

(auNr

+ bvNp

)

=∑u

∑v

Mxy(u∆kx, v∆ky)ej2π

(auNr

+

(b

Np+ 1

2

)v

)

4

Page 5: Assignment 5 k - University of California, Berkeleyinst.eecs.berkeley.edu/~ee225e/sp12/hw/hw5_soln.pdfAssignment 5 Due Feb 26, 2012 1. Finish reading Nishimura Ch. 5. 2. For the 16

=∑u

∑v

Mxy(u∆kx, v∆ky)ej2π

(auNr

+(b+Np/2)v

Np

)= Mxy,n(aδx, (b+Np/2)δy)

The new reconstructed image is the original image shifted by Np/2 pixels in y, or one-half ofthe FOV. Note that since we are sampled in spatial frequency, the image domain is perioidic.As we shift the object out of the FOV in one dimension, the next replicated image comes infrom the opposite direction.

The image that results is shown below:

FOV

FOV

(f) Now consider the case where we are using the original acquisition gradients, but are imagingsodium, which has a γ/2π of 1.126 kHz/G. What is the resolution and FOV? What does theimage now look like?

Solution: Since γ is now small by a factor of 4.257/1.126 = 3.78, almost 4, the same gradientwaveform produces one quarter the spatial frequency encoding. This means that Wkx and Wky

are both reduced to one quarter of the original, and that the resolution element δx and δy arenow both four times as large. The k-space sampling is also reduce to one quarter the original,so the FOV is now four times as large. The result is an image that looks like this:

3.78×FOV

3.78×FOV

5

Page 6: Assignment 5 k - University of California, Berkeleyinst.eecs.berkeley.edu/~ee225e/sp12/hw/hw5_soln.pdfAssignment 5 Due Feb 26, 2012 1. Finish reading Nishimura Ch. 5. 2. For the 16

4. Given a 2DFT pulse sequence with 256×256 samples over a 24 cm FOV, how would you modify thereceiver frequency and phase for each acquisition in the scan to shift the FOV by 6 cm in both +xand +y? Assume the duration of the readout gradient is 8 ms.

Solution: First consider the readout direction. The A/D window is 8 ms, and we have 256 samplesover that time, so that the sampling period is (8 ms)/256 = 31.2 µs, and the sampling frequency is32 kHz. The edges of the FOV in x are then at 16 kHz., and this corresponds to ± 12 cm. If wewant to shift the FOV by 6 cm, or 1/4 the FOV, we need to increase the receiver frequency by (32kHz)/4 = 8 kHz.

Next, consider the phase encode dimension. Again we want to shift by FOV/4. This correspondsto multiplying the k-space data with a complex exponential that has a period 4∆ky, which is thesequence of phases

(0, π/2, π, 3π/2, 2π · · · 2πv/4 · · ·)

where v is the phase encode index.

6

Page 7: Assignment 5 k - University of California, Berkeleyinst.eecs.berkeley.edu/~ee225e/sp12/hw/hw5_soln.pdfAssignment 5 Due Feb 26, 2012 1. Finish reading Nishimura Ch. 5. 2. For the 16

5. Matlab assignmentThe assignment will be concerned with reconstructing 2DFT MR data. Two raw data files areavailable on the web site. These are

• se t1 sag data.mat Sagittal (midline) T1 weighted spin-echo image of the head of a normalvolunteer, acquired at 0.5T. The data set has 256 phase encodes, and 256 samples. CSF is darkdue it its very long T1, white matter is brighter than gray matter. Fat is very bright due to it’sshort T1.

• phantom.mat This is an axial gradient-echo image of a phantom (test object) acquired at1.5T.

These data files are in the class website.

Centered 2DFT’s Generally in medical image reconstruction, the origin for both the k-space dataand the reconstructed image is the center of the image or data array. The usual convention for thefft is that the origin is at the beginning of the array, or the corner of a 2D array. To do a centeredfft, you want to do an fftshift both before and after the fft. In homework 2 we wrote the functionsfftc and ifftc, which you should use here.

Displaying Images For displaying images the best option is “imshow” which is part of the imageprocessing toolbox. If you have a complex image “im”, you display it with

>> imshow(abs(im),[]).

This automatically scales the image from the image minimum to maximum. If you want to explicitlyspecify these, use

>> imshow(abs(im),[win min win max]).

This is quite common. Often the brightest part of the image is of little interest (a vessel, or fat, forinstance). You will often want to specify a narrower window to accentuate the part of the image thatis of interest.

The built in “image” function in Matlab does a remarkably poor job of displaying images. If youdon’t have the image processing toolbox, this is what you will need to use. Matlab assumes you wanta pseudocolor image, which is almost never true. To set the colormap to grayscale,

>> colormap(’gray’);

Also, you want the image to be displayed with a square aspect ratio, and you probably don’t careabout the axes,

>> axis(’square’);

>> axis(’off’);

The default colormap has 64 gray levels. The image(im) function uses the value of im at each pixelas an index into the colormap. Hence, you want im to be real valued, and scaled from 1 to 64.

>> imx = max(max(abs(im)));

>> image(abs(im)*64/imx);

You will want to incorporate all of these steps into an m-file, since you will do this often.

7

Page 8: Assignment 5 k - University of California, Berkeleyinst.eecs.berkeley.edu/~ee225e/sp12/hw/hw5_soln.pdfAssignment 5 Due Feb 26, 2012 1. Finish reading Nishimura Ch. 5. 2. For the 16

Orientation Conventions In displaying medical images there are conventions about the orienta-tions the images are presented. The axes are described in “subject” space. These are right-left (R/L)for subject right and left, anterior-posterior (A/P) for subject front and back, and superior-inferior(S/I) for subject up and down. For axial slices, the image is oriented as it would appear if you werelooking at the subject from the feet. The subject’s left is on the right side of the image, and theirfront is up. For a sagittal slice (down the middle) you are viewing the subject from their left side, soup is up, the subject’s front is to the left, and back is to the right. For coronal slices you are viewingthe subject from the front, and up is up, and left is right. This all clear, right? It is important,though. You want to make sure they take out the diseased kidney, and not the healthy one.

There are several ways to flip images in matlab. You can flip an image about the diagonal with thetranspose

>> imt = im.’;

Note the “ . ”. The default transpose (i.e., just “ ’ ”) also takes the conjugate, and that can causeproblems when we care about the phase. You can flip images left-right and/or up-down by indexingthe image in the reverse order

>> im tb flip = im(256:-1:1,:);

>> im lr flip = im(:,256:-1:1);

The “:” is a placeholder meaning that dimension is in the usual order. You can also rotate animage with the image processing toolbox function “imrotate” which rotates an image in the counter-clockwise direction

>> im rot = imrotate(im,ang);

where “ang” is specified in degrees.

Once you have the image displayed, you can save it in eps format with

>> print -deps your filename.eps

This produces an eps file in the current directory. Another option, that I prefer, is to save in pdfformat,

>> print -dpdf your filename.pdf

This can be imported into most word processing programs, such as LATEX.

Questions

1. For the first data set, se_t1_sag_data.mat, load the raw data into matlab. This will give youa 256 by 256 complex array d, which contains the raw data.

a) Make an image of the log of the magnitude of the raw data,

>> imshow(log(abs(d)),[])

Is the largest signal at the origin? Find where the largest signal is (the max function withtwo output arguments is useful here).Solution: The image of the log magnitude of the raw data is shown below,

8

Page 9: Assignment 5 k - University of California, Berkeleyinst.eecs.berkeley.edu/~ee225e/sp12/hw/hw5_soln.pdfAssignment 5 Due Feb 26, 2012 1. Finish reading Nishimura Ch. 5. 2. For the 16

The maximum can be found by using the max function twice,

>> [mx nc] = max(max(abs(d)));

>> [mx nr] = max(max(abs(d)’));

The result is the the maximum is in column 128, and row 132. If the data were perfect(with respect to ifft2() and fftshift()) the maximum would be at 129, 129.

b) Reconstruct the MR image with your ifft2c m-file.

>> im = ifft2c(d);

and show the real part of the reconstructed image

>> imshow(real(im)),[])

If you are using image, you will need to account for the fact that the real part is bothpositive and negative, Imshow does this for you. Explain the appearance of the real partbased on the location of the maximum signal you found in (a).Solution: The image of the real part of the reconstructed data is

We see several cycles cosinusoidal modulation across the real part of the image. Thiscorresponds to a translation in k-space. From part (a) we expect three cycles of phase shiftin y, and one cycle in x, since a one sample displacement in k-space is one cycle of phasein image space. We see a little more than that in y, and less in x, due to the fact that thek-space shift can fall between samples.

c) Show magnitude of the reconstructed image,

9

Page 10: Assignment 5 k - University of California, Berkeleyinst.eecs.berkeley.edu/~ee225e/sp12/hw/hw5_soln.pdfAssignment 5 Due Feb 26, 2012 1. Finish reading Nishimura Ch. 5. 2. For the 16

>> imshow(abs(im)),[])

This is what is usually presented. Which direction is the phase encode direction? Whichdirection is the largest signal shifted in k-space (readout or phase encode?).Solution: The image of the magnitude of the reconstructed data is

The phase encode direction can be identified by the aliasing in the left-right direction, whichcan only occur in the phase encode direction. Note the back of the head aliased on the left,and the nose on the right. You can also see the frequency response of the anti-aliasing filterin the way that the very large signals from fat in the base of the neck fade to zero at thebottom of the image.

You can combine these plots on a single page using subplot. to save paper.

2. The second data set is phantom.mat. First clear matlab with clear to eliminate your previousdata. Then load the phantom data set. The k-space data is again in the matlab variable d, andis 256 readout samples by 256 phase encodes.

a) Make an image of the log of the magnitude of the raw data. What sort of features wouldyou expect to see in the image (e.g. round objects, square objects, periodic structures).Solution: The image of the log magnitude of the raw data is

The strong components along the kx and ky axes indicate the image will have strong hor-izontal and vertical edges. The blobs along the kx = ky diagonal correspond to a periodicstructure along the x = −y diagonal. Then there are also strong edges along the perpen-dicular diagnonal (signal along kx = −ky corresponding to edges parallel to x = y).

10

Page 11: Assignment 5 k - University of California, Berkeleyinst.eecs.berkeley.edu/~ee225e/sp12/hw/hw5_soln.pdfAssignment 5 Due Feb 26, 2012 1. Finish reading Nishimura Ch. 5. 2. For the 16

b) Reconstruct the image using ifft2c, and show the magnitude of the result.Solution: The image of the log magnitude of the raw data is

c) The result of (b) doesn’t look like you would expect. This is due to way the acquisition wasperformed. What sequence of RF pulses would produce this?Solution: This is exactly the data from HW2 problem, where the RF was alternated insign each line. This multiplies the k-space datae by (−1)v, where v is the phase encodeindex. As you showed in that homework, this shifts the image by FOV/2. The sequence ofRF pulses is then

(+π/2,−π/2,+π/2 · · ·)

d) Correct the k-space data to compensate for the RF excitation sequence in (c), and performthe reconstruction again. Show the magnitude of the result. What direction is the phase-encode direction? Solution: The data is corrected by multiplying each phase encode lineby (−1)v. After reconstructing with ifft2c(), the result is shown below:

Again, you can combine plots using subplot. to save paper. Use publish to submit.

11

Page 12: Assignment 5 k - University of California, Berkeleyinst.eecs.berkeley.edu/~ee225e/sp12/hw/hw5_soln.pdfAssignment 5 Due Feb 26, 2012 1. Finish reading Nishimura Ch. 5. 2. For the 16

6. Matlab Exercise: 2DFT Pulse sequence design.In this assignment we will write functions to design a 2DFT pulse sequence, and then simulate thedesign on a Bloch simulator.

The first step is to design a readout gradient. The readout gradient is composed of a prewinder, anda readout part. In the readout, we are interested in having a portion of the gradient that will scanthe desired k-space length (gradient area) in which the gradient waveform is constant. This will giveus a steady linear scan in k-space. For the prewinder, we are only interested in generating a gradientarea that is half the area of the readout part. This should be as fast as possible to minimize the scantime. In addition, the ramps for the readout part should also be as fast as possible.

a. Write a function genReadoutGradient.m that designs a readout gradient given the sequenceparameters and the system constraints.

>> [gro,rowin] = genReadoutGradient(Nf, FOVr, bwpp, Gmax, Smax, dt);

The inputs to the function are :Nf is the number of frequency encodes.FOVr (in cm) is the desired field-of-view.bwpp (in Hz/pixel) is the desired bandwidth per pixelGmax (in Gauss/cm) is the maximum gradient.Smax (in Gauss/cm/s) is the maximum slew-rate.dt (in s) is the duration for each sample.

The outputs of the function are:gro - an array containing the gradient waveform.rowin - an array containing the indexes in gro that correspond to the readout portion of thegradient. This will be used to crop the interesting part of k-space for reconstruction.

bwpp is something we have not discussed before. It basically defines the gradient amplitude weare going to use during the flat portion of the readout gradient. In essence, bwpp = γ

2πGFOVNf .

Now, the A/D has a sampling bandwidth of 1/dt. So, the effective number of digital readoutsamples may be higher than our desired Nf frequency encodes. This is OK, since after we get allthe samples, we will filter them to a bandwidth of Nf*bwpp and subsample to get Nf samples.

(Hint: You should first design a trapezoid that meets the criteria and then use the minimum-time-gradient function you wrote in previous homework to deign the prewinder. Remember tocompensate for the ramp of the readout in the prewinder!!!!)

12

Page 13: Assignment 5 k - University of California, Berkeleyinst.eecs.berkeley.edu/~ee225e/sp12/hw/hw5_soln.pdfAssignment 5 Due Feb 26, 2012 1. Finish reading Nishimura Ch. 5. 2. For the 16

Solutions:

There are many ways of implementing this. Here’s one:

function [gro,rowin] = genReadoutGradient(Nf, FOVr, bwpp, Gmax, Smax, dt);

%[gro,rowin] = genReadoutGradient(Nf, FOVr, bwpp, Gmax, Smax, dt);

gamma = 4257;

res = FOVr/Nf;

Wkx = 1/res;

area = Wkx/gamma;

G = bwpp/res/gamma;

Tro = Wkx/gamma/G;

Tramp = G/Smax;

t1 = Tramp;

t2 = t1+Tro;

T = Tramp*2+Tro;

N = floor(T/dt);

t = [1:N]’*dt;

idx1 = find(t < t1);

idx2 = find((t>=t1) & (t < t2));

idx3 = find(t>=t2);

gro = zeros(N,1);

gro(idx1) = Smax*t(idx1);

gro(idx2) = G;

gro(idx3) = T*Smax - Smax*t(idx3);

areaTrapz = (T+Tro)*G/2; % area of readout trapezoid

gpre = minTimeGradientArea(areaTrapz/2, Gmax, Smax, dt);

rowin = length(gpre) + 1 + idx2;

gro = [-gpre(:);0;gro(:)];

13

Page 14: Assignment 5 k - University of California, Berkeleyinst.eecs.berkeley.edu/~ee225e/sp12/hw/hw5_soln.pdfAssignment 5 Due Feb 26, 2012 1. Finish reading Nishimura Ch. 5. 2. For the 16

b. To design a phase encode gradient, we only need to design the gradient for the largest phase-encode and then scale it accordingly for the others.Write a function genPEGradient.m that designs the gradient phase encode gradient for thelargest phase encode and a phase encode table to scale it.

>> [grpe, petable] = genPEGradient(Np, FOVp, Gmax, Smax, dt);

The inputs to the function are :Np is the number of phase encodes.FOVp (in cm) is the desired phase-encode field-of-view.Gmax (in Gauss/cm) is the maximum gradient.Smax (in Gauss/cm/s) is the maximum slew-rate.dt (in s) is the duration for each sample.

The outputs of the function are:grpe - an array containing the gradient waveform.petable - Npe x 1 array containing the phase encode table to scale the phase-encode gradientfor each phase-encode. The array entries should be bounded between [-1 : 1]

Solutions:

There are several choices how to distribute the phase encodes. In this case, I chose to distributethem such that there isn’t a phase encode with amplitude zero. This way, k-space is sampledaround the DC line and kx=ky=0 is not sampled. This is often done in practice to improve thedynamic range, since the DC point has a very high amplitude.

The code uses the minTimeGradientArea function from previous homework. Here’s the code:

function [grpe, petable] = genPEGradient(Np, FOVp, Gmax, Smax, dt)

gamma=4257;

kmax = 1/(FOVp/Np)/2;

area = kmax/gamma;

grpe = minTimeGradientArea(area, Gmax, Smax, dt);

petable = [Np/2-0.5:-1:-Np/2+0.5].’/(Np/2);

14

Page 15: Assignment 5 k - University of California, Berkeleyinst.eecs.berkeley.edu/~ee225e/sp12/hw/hw5_soln.pdfAssignment 5 Due Feb 26, 2012 1. Finish reading Nishimura Ch. 5. 2. For the 16

Now that we have a way to generate the waveforms of a 2DFT sequence, we will simulate such asequence for a distribution of spins. Download the file hw5 img.mat from the class website. Thisfile contains the arrays dp [7715x2], mx [7715x1], my[7715x1], and mz[7715x1],. These arrayrepresents the positions of 7715 spins in space and their magnetization. We will now imagethem!

c. Design a 2DFT sequence with readout/phase-encode FOV of 14/7 cm, Nf/Np of 64/32 (givinga resolution of ≈ 2.2mm. Use a bandwidth per pixel of about 1.8624 Khz/cm. Use dt = 4µs,Gmax=4G/cm and Smax=15000G/cm/s. Design a hard-pulse RF with 90 degree excitation touse with the gradient sequence. Plot k-space by integrating the gradient waveforms. Make sureit makes sense!

Solutions:

Here’s the code:

Nf = 64;

Np = 32;

Nrf = 92;

FOVr = 14;

FOVp = 7;

Gmax = 4;

Smax = 15000;

dt = 4e-6;

bwpp = 1862.4;

gamma = 4257;

flip = 90;

[gx,rowin] = genReadoutGradient(Nf, FOVr, bwpp, Gmax, Smax, dt);

[gpe,petable] = genPEGradient(Np, FOVp, Gmax, Smax, dt);

RF90 = ones(Nrf,1)*(flip/360)/(Nrf*dt*gamma);

gy = zeros(length(gx),1);

gy(1:length(gpe)) = gpe;

load hw5_img.mat

G = [];

res = zeros(Np,length(rowin));

for n=1:Np

g = [gx(:),gy(:)*(-petable(n))];

G(:,n) = g*[1;i];

% simulate Excitation first

[mx1,my1,mz1] = bloch(RF90,RF90*0,dt,100,100,0,dp,0,mx,my,mz);

% simulate Readout

[mx1,my1,mz1] = bloch(gx*0,g,dt,100,100,0,dp,2,mx1,my1,mz1);

mxy = sum(mx1,2) + i*sum(my1,2);

res(n,:) = mxy(rowin);

end

figure, plot(cumsum(G*dt*gamma));

15

Page 16: Assignment 5 k - University of California, Berkeleyinst.eecs.berkeley.edu/~ee225e/sp12/hw/hw5_soln.pdfAssignment 5 Due Feb 26, 2012 1. Finish reading Nishimura Ch. 5. 2. For the 16

figure, plot(real(G),’b’); hold on, plot(imag(G),’r’);

im = crop(ifft2c(res),[Np,Nf]);

figure, imshow(abs(im),[]);

Here’s the resulting gradient waveform:

And the k-space trajectory:

DC line is not sampled

Samling the DC line is also fine.

16

Page 17: Assignment 5 k - University of California, Berkeleyinst.eecs.berkeley.edu/~ee225e/sp12/hw/hw5_soln.pdfAssignment 5 Due Feb 26, 2012 1. Finish reading Nishimura Ch. 5. 2. For the 16

d. Simulation: Simulate the sequence acquisition using the Bloch simulator one phase encode ata time (The simulation takes about 1-2sec per phase encode). Use T1=T2=100. The outputof the simulator needs to be integrated across all the spins to get the signal. The code for thesimulation part should look like:

>> ....

>> g = [gro, gpe*phtable(n)];

>> [mx,my,mz] = bloch(rf,g,4e-6,100,100,0,dp,2,mx,my,mz);

>> mxy = sum(mx,2) + sqrt(-1)*sum(my,2);

>> ...

You will find that the number of readout samples is bigger than Nr because we sampled at250Khz (dt = 4µs). Scanners also sample at that rate and then apply a digital filter to get thedesired number of readout points. There are two options, to do the filtering and subsamplingof k-space or cropping the image. For simplicity, we will take the 2nd approach.

take a 2D centered IFFT of the resulting k-space data. Crop the image to the desired FOV.You should be able to read something. If you can’t, .... then something is wrong. Submit a plotof the gradient waveforms and the image.

Enjoy!

Solutions:

The resulting image is:

17

Page 18: Assignment 5 k - University of California, Berkeleyinst.eecs.berkeley.edu/~ee225e/sp12/hw/hw5_soln.pdfAssignment 5 Due Feb 26, 2012 1. Finish reading Nishimura Ch. 5. 2. For the 16

e. Reduce the FOV by a factor of 1.5 in the phase encode and repeat the scan. What do you get?submit the image.

Solutions:

In this case, the gradient area for the phase encode is twice as big. We need to make sure thatthe it does not overlap with the readout portion. Fortunately it doesn’t.

The resulting image is aliased. The polarity or the phase of the alias depends on the exactphase encode scheme ( if the DC line is sampled or not). If the DC line is sampled, the alias ispositive. If it is not, then it is negative. Here it is negative, so some of the signal cancels.

And here’s when DC line is sampled:

18