\documentclass[11pt]{article}
\usepackage{palatino,graphicx}
%\pagestyle{empty}
\pagestyle{headings}
\input hdr_jmp

\topmargin=-0.5in
\textheight=9in
\evensidemargin 0.0in
\oddsidemargin 0.0in
\setlength{\textwidth}{6.5in}

\begin{document}
\ 
\hdr{1}

\begin{center}
{\Large\em EE469B:  Assignment 3} \\[0.15in]
{\em Due Thursday Oct 17}
\end{center}



\paragraph{1. 2D Spiral Pulse Design}  Automate the process you went through in assignment 2, to produce a single m-file that produces any spiral windowed jinc 2D RF pulse you want.  Choose any sufficient set of inputs,  and output the RF and gradient waveforms.

Choose a test case that demonstrates you can design an arbitrary 2D spiral pulse, design and plot the RF pulse, and simulate and plot the result.

\paragraph{2. Shifting the Volume}  Modulate your pulse to a position $x=2$ cm, $y = 2$ cm.  Simulate and plot the result, and show that the volume has shifted to the correct location.  

Don't worry about signs.  Just make sure it moves the right distance along each axis.  This may be harder than you might expect.  If you have trouble, look at your RF waveform, and think about how many cycles of phase you expect.

\paragraph{3. Density Compensation}  So far we have been using the magnitude of the gradient as an approximation to the density compensation.  This can contribute errors with spiral 2D pulses, but the effects are often subtle.  In this problem we'll look at another trajectory where the density correction is much more problematic.  The trajectory is plotted below
\begin{center}
\includegraphics[width=3in]{as3_figs/ktr}
\end{center}
This is described by the equation
\[
k(t) = k_{max} \cos(2\pi 8 t)e^{i2\pi7t}
\]
where $k(t) = k_x(t) + i k_y(t)$ and $k_{max} =1$ cycle/cm for the plot.  This corresponds to a resolution of 0.5 cm, which we will use in this problem.


\subparagraph{a) Estimate the FOV}  From the k-space plot, estimate roughly what the FOV should be.  Describe your reasoning.

\subparagraph{b) Gradient waveforms}  Design gradient waveforms that meet the amplitude and slew rate limits of 4 G/cm and 15 G/cm/ms. Use 4096 samples over the pulse duration.  Plot gradient and slew rate waveforms, along with the magnitude of the gradient and slew rate.  Note the length of the pulse, and the sample dwell time \verb+dt+.  Your waveforms should always be very close to the slew rate limit.

\subparagraph{c) Simple RF Design}  Design an RF waveform to produce a uniform k-space weighting using the magnitude of the gradient as the density compensation factor, as we did in Assignment 2.  Simulate and plot the absolute value of 1D profile over a range of $\pm4$ cm.  The result is not so beautiful. Why does the gradient magnitude weighting fail here?

\subparagraph{d) Voronoi Compensation} Recompute the RF pulse using  a Voronoi estimate of the density compensation.  This divides the plane into small regions that are closest to each sample, and returns the area associated with each sample. This area is inverse of the density, so the area is the density compensation required. Samples at the edge have infinite area, so we need to enclose the samples we want so that all areas are well defined.  For example, if the k-space trajectory goes to $\pm  k_{max}$, then
\begin{verbatim}
>> kp = [k kmax*(1+1e-3)*exp(i*2*pi*[1:1024]/1024)];
\end{verbatim}
encloses the trajectory in a circle slightly larger than radius $k_{max}$.  Use
\begin{verbatim}
>> plot(kp)
\end{verbatim}
to ensure that the circle tightly encloses the trajectory samples.  The Voronoi density compensation estimate is then computed as
\begin{verbatim}
>> dp = voronoidens(real(kp),imag(kp))
\end{verbatim}
The \verb+voronoidens.m+ function is available on the class web site. Then discard the last 1024 samples of \verb+dp+ to make \verb+d+.  

Use this density compensation in place of the magnitude of the gradient in your RF pulse design.  Plot the RF pulse, and simulate and plot the absolute value of the 1D profile from $\pm$ 4 cm. This should look more like you might  expect.

\subparagraph{e) 2D Simulation}  Simulate the 2D profile over a range of $\pm$ 8 cm in both x and y. Choose your number of samples carefully, so that the computation time is not excessive.   Plot as an image using
\begin{verbatim}
>> imshow(abs(mxy),[0 0.5])
\end{verbatim}
to show the main lobe, and
\begin{verbatim}
>> imshow(abs(mxy),[0 0.1])
\end{verbatim}
to show the sidelobes.  Do the resolution and FOV match what you expect?  Use the 1D profile from (d) to help you estimate the resolution.
\end{document}

