# Joint RF & gradient waveform design

### Citation

Davids M, Schad LR, Wald LL and Guérin B (2015). "Fast three-dimensional inner volume excitations using parallel transmission and optimized k-space trajectories." Magnetic Resonance in Medicine, DOI: 10.1002/mrm.26021

### What this code does

This framework was developed to jointly optimize k-space trajectories and RF waveforms for a set of given B0/B1+ maps to excite a target flip angle pattern. The k-space trajectory to be optimized is parameterized by a small set of so-called shape parameters that control the general structure of the trajectory (we provide the code for shells, stack-of-spirals, and cross trajectories but different types of trajectories can be included easily by the user). E.g., for the shells trajectory these shape parameters control the number of shells, the extent of the shells along the different k-space axes, the number of revolutions, etc. These shape parameters (i.e., the k-space trajectory) are then optimized along with the associated RF waveforms to achieve the best possible excitation quality, subject to a number of constraints (such as gradient system constraints, peak RF power constraints, pulse duration constraints). The joint RF and trajectory optimization itself is implemented as a nested optimization loop: in the fast inner loop we solve a small tip angle least-squares RF pulse design problem on a fixed k-space trajectory (i.e., a constant set of shape parameters). The outer loop is a constrained optimization problem of the shape parameters. In the outer loop we include an additional term that penalizes pulse durations exceeding the anticipated maximum pulse duration that is specified by the user.

### Download files

Download the zip file with all Matlab code here. The zip file includes the following data:

**1)** Matlab library that implements the joint RF and k-space trajectory optimization. This includes a script *Example.m* that illustrates how to set up the optimization for the three types of k-space trajectories and two exemplary flip angle target
patterns (cube and brain-only excitation).

**2)** The time-optimal k-space trajectory design method in the subfolder *GradientBasisFunction_v1* that we have published earlier [Davids et al. "Fast and robust design of time-optimal k-space trajectories in MRI". IEEE Trans Med Imaging 2014;34:564–577.]. The method computes time-optimal k-space trajectories based on an ordered set of k-space control points, subject to gradient magnitude and slew rate constraints.

**3)** A set of B0 and B1+ maps that is loaded in the *Example.m* script and used by the shape optimization method. These maps can be replaced by the user.

### Instructions

**1)** Download the zip file and unpack everything to your destination folder, switch to the folder *JointRFandGradientOptimization_v1*.

**2)** If you are using a Windows PC you will be able to use the mex'ed version of the k-space trajectory design methods provided by *GradientBasisFunction_v1*. Otherwise you should change the line 185 in CheckOptions.m from *UseMex,1,...* to *UseMex,0,...* which disables the mex'ed feature of the k-space trajectory design library. Note that all properties can also be changed directly in the *Exmple.m* script.

**3)** Run the script.

During the shape optimization a subfolder will be created in *SavedIterations*. In this folder results and temporary files will be saved automatically. After each iteration a figure will be generated and saved to illustrate the progress of the shape optimization. This figure shown the k-space trajectory, flip angle maps and profiles, and gradient and RF waveforms of the current optimization stage.