\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 2} \\[0.15in]
{\em Due Thursday Oct 10}
\end{center}

\paragraph{Introduction} This assignment concerns the design of small-tip-angle 2D excitation pulses based on spiral k-space trajectories.  You will design the gradient waveforms, the RF and different density compensation method and simulate the excitation profiles.  You will also look at the characteristics of the first aliasing sidelobe.

We are going to pick a particular set of design parameters.  The goals of this design are
\begin{itemize}
\item Gradient waveform that would allow 0.5 cm diameter cylinder to be excited when no k-space apodization is used, 
\item First sidelobe at 8 cm,
\item Gradient system with 4 G/cm amplitude, 15 G/cm/ms slew rate (SR 150),
\item RF waveform that excites 4 cm cylinder with minimal ripple.
\end{itemize}
This is an example of a 2D pulse you might use to restrict the FOV for high-resolution imaging of an interior volume.


\paragraph{1. Design of 2D Spiral Gradients}
We will design the gradient waveform in three steps.  The gradient will be in inward going spiral. 
\begin{itemize}
\item[a)] How far out in k-space ($k_{max}$) should the trajectory go for 0.5  cm resolution?
\item[b)] How many turns $N$ should the spiral have to put the sidelobe at 8 cm?
\item[c)] Design a constant-angular rate k-space trajectory with this $k_{max}$ and number of turns $N$ with 2048 samples.
\begin{verbatim}
>> t = [1:2048]/2048;
>> ka = kmax * (1-t) .* exp(i*2*pi*N*(1-t));
\end{verbatim}
where \verb+real(ka)+ is $k_x$ and \verb+imag(ka)+ is $k_y$.
\item[d)] This  k-space trajectory can be traced out at different rates, to produce different gradient waveforms.  If the rate is constant and the duration of the trajectory is $T$ ms, the gradient and slew rates required can be computed using \verb+ktog(k,dt)+ and \verb+ktos(k,dt)+. These are available on the web site.  For example if the pulse were 5 ms long,
\begin{verbatim}
>> dt = 5 / 2048;
>> g = ktog(ka,dt);
>> s = ktos(ka,dt);
\end{verbatim}
where g is in G/cm, and s is G/cm/ms. How long should the trajectory be to meet the gradient system limits?  Which constraints are in effect?  Plot \verb+ka+, \verb+g+, and \verb+s+ verses time, with the axes properly labeled.
\item[e)] The constant angular rate trajectory doesn't use the gradient system efficiently.  Ideally we want to always be operating at either the slew or amplitude limit.  The m-file \verb+csg(k,gmax,smax)+ computes a new k-space trajectory that meets the amplitude and slew limits, and reports the new (shorter) duration of the pulse.  Redesign your gradients using
\begin{verbatim}
>> k = csg(ka,4,15)
\end{verbatim}
How long is the pulse now? Plot the k-space trajectory, gradients, and slew rate as a function of time, with properly labeled axes.  Make sure the \verb+rf_tools+ directory is not in your path.  The class version of \verb+csg+ is different than the \verb+rf_tools+ version.
\end{itemize}
You now have a gradient waveform for the RF pulse.

Note that the gradients you've designed are not quite ready for the scanner, the waveforms don't start and end at zero.  That would have to be fixed before we could play these waveforms.  We'll come back to this later in the course.


\paragraph{2. Design of RF Pulse} Next we turn to designing the RF waveform. If the desired weighting is flat, the RF waveform should be the same as the density compensation used for reconstructing spiral data. As we discussed in class, a good approximation for a single-shot spiral is to use the inverse of the magnitude of the gradient as the density, and the magnitude of the gradient as the density compensation
\begin{verbatim}
>> rf = abs(g)
>> rf = rf/sum(rf)
\end{verbatim}
This normalizes the rf to a flip angle of 1 radian.  Plot this RF pulse.  Note that since this pulse corresponds to uniform k-space weighting, it will have the smallest selective volume, but will ring excessively. Plot your RF pulse with the axes properly labeled.

\paragraph{3. Simulation of 2D Pulses}
Next we simulate our RF pulse.  The simulator you used last time will also handle 2D pulses and 2D simulations.  As before, the RF is scaled so that \verb+sum(rf)+ is the flip angle in radians.  The gradient waveform is supplied as a complex waveform.  If  \verb#g = gx+ i*gy# in G/cm, then the input to the simulator is
\begin{verbatim}
>> gs = gamma*g*dt;
\end{verbatim}
where \verb+gamma = 2*pi*4.257+ krad/G, and \verb+dt+  the same as above. Finally, the vector of positions to simulate is \verb+x+, in cm.
To simulate a 1D profile through the 2D volume, 
\begin{verbatim}
>> x = [-8:0.25:8];
>> mxy1 = ab2ex(abrm(rf,gs,x));
\end{verbatim}
This simulates the response from -8 cm to 8 cm in 0.25 cm steps.  Do the simulation, and plot magnitude of the response as a function of \verb+x+.  Are the sidelobes in the right places compared to where you would calculate them to be?  Is the mainlobe the right width?

We can also simulate the 2D profile.  In this case we provide an additional \verb+y+ vector for the second dimension.  Each \verb+x,y+ pair is simulated, and the result stored in a 2D matrix,
\begin{verbatim}
>> x = [-8:0.5:8];
>> y = [-8:0.5:8]];
>> mxy2 = ab2ex(abrm(rf,gs,x,y));
>> mesh(abs(mxy2))
\end{verbatim}
Plot the absolute value, the real part, and the imaginary part of the excitation profile (you may need to multiply by -1 to make it more visible).

%Repeat the simulation zooming in on the central 4 by 4 cm region around the main lobe, and plot the real and imaginary components using \verb+mesh+.

\paragraph{4.  Single shot sidelobe is in quadrature with the main lobe}
From the simulations in the previous section, you should have noticed that the main lobe was in the imaginary component, and the sidelobe is in the real component (i.e. they are in quadrature). Provide an argument that this is always true for a single shot spiral gradient waveform.

{\em Hint:} Would this also be true of a two interleave spiral? This problem is closely related to the partial k-space reconstruction problem for spirals.

\paragraph{5. Improved profile}
Design an RF pulse that is approximately 4 cm in diameter that produces a windowed jinc k-space weighting.  Plot the RF pulse as a function of time, the magnitude of the 1D profile from -8 to 8 cm,  and mesh plots  of the real and imaginary components over the same range. 

\end{document}

