• Home

Currently coreMRI is based on .mat files (MATLAB files). The .mat file of the pulse sequence should include the following variables:

dt: is the temporal step of the MR simulation experiment (in sec)

N_pulse: it holds the number of the total timesteps of the pulse sequence

pulse_sequence: it is an [8xN_pulse] matrix. The first row (pulse_sequence(1,:)) holds the time sequence of the magnitude of the RF events (B1), the second row (pulse_sequence(2,:)) holds the time sequence of the phase of the RF events (RFP), the third row (pulse_sequence(3,:)) holds the time sequence of the frequency of the RF events (RFfreq), the fourth row (pulse_sequence(4,:)) holds the time sequence of the gradients on the x axis, the fifth row (pulse_sequence(5,:)) holds the time sequence of the gradients on the y axis and the sixth row (pulse_sequence(6,:)) holds the time sequence of the gradients on the z axis. The last two rows are identical and each one is an array with increasing number from 1 to N_pulse (pulse_sequence(7,:) = 1:N_pulse and pulse_sequence(8,:) = 1:N_pulse). The last two rows are being used by an algorithm that allows for compression of the pulse sequence in order to accelerate the MR simulations.

B1 is given in T (Tesla), RFP is given in radians, RFfreq is given in Hz and gradients are given in T/m (Tesla per meter).

soft_crushers: it is an array of 0s or 1s and of size [1xN_pulse]. This array is pointing out when a nullification of the transverse components of the magnetization should be induced. It is being used to avoid the introduction of strong gradients in the pulse sequence.

isInKspace: it is an array of non-zero elements with incrementing values for the time points when the receiver is ON. When the receiver is OFF, the corresponding time-points are 0. For example, given that thedt=0.000001 sec (1μsec), if the receiver turns ON from the timepoint 4μsec till the timepoint 6μsec, then it turns OFF from the timepoint 7μsec till the timepoint 8μsec and then turns ON again from the timepoint 9μsec till the timepoint 15μsec the isInKspace array will be [0,0,0,1,2,3,0,0,4,5,6,7,8,9,10] 

Extra parameters:

info: it is a structure array that holds information for the pulse sequence and for the reconstruction.

This tutorial will guide you through the basic steps of creating a simple Gradient Echo (GRE) pulse sequence using the Pulse Sequence Designer provided by coreMRI. Before you continue with this article, it is highly recommended to get familiar with the template of the Pulse Sequence Designer by clicking here [@@@ Action is required].

The GRE pulse sequence has the following characteristics: 

  • excitation RF pulse: sinc RF pulse of 3ms duration and 15 degrees flip angle
  • slice thickness: 0.010m
  • kspace matrix: 256 x 256 (kspacex x kspacey)
  • field-of-view (FOV): 0.4m x 0.4m (FOVx x FOVy)
  • receiver bandwidth (rBW): 100kHz
  • maximum gradient strength: 40mT/m
  • repetition time: 10msec

Step 1: Create a new pulse sequence and add the user-defined variables

Select the Sequence Designer from the left-side menu (Pulse Sequences -> Sequence Designer) and click on the "Create new" button (figures below - step 1). Add the name (figures below - step 2) and the description (figures below - step 3) of your pulse sequence and press the Save button (figures below - step 4 - icon of floppy disk). Once the new pulse sequence is created, select from the tree view on the left the name of the pulse sequence (figures below - step 5) and select then the "Edit object parameters" mode from the top middle menu (figures below - step 6). Then, make the following changes (figures below - red box).

The User Defined 1 holds the kspacex value, the User Defined 2 holds the kspacey value, the User Defined 3 holds the FOVx value, the User Defined 4 holds the FOVy value, the User Defined 5 holds the slice thickness value, the User Defined 6 holds the receiver bandwidth value and the User Defined 7 holds the maximum gradient strength value.  

Step 2: Create a Group of Blocks (GoB)

In this example, the GoB will work as a single repetition time (TR) which will hold the RF and gradient events for the acquisition of a single kspace line. In order to create one, right-click on the name of your pulse sequence (figure below - step 1) and select "Add group of blocks" (figure below - step 2). In the popup window, pick a name and click the save button.

Step 3: Create three different blocks within the GoB

For the design of this pulse sequence, three different blocks will be required. The first one will hold the slice selection process (across the Z axis), the second one will hold the phase-encoding (PE) process (along the Y axis), the refocusing gradient for the slice selection process (across the Z axis) and the readout prephasor gradient (across the X axis). In order to do that, perform the following:

  • Right click on the GoB (first figure below - step 1) that we created on the previous step and select "Add block" (first figure below - step 2). Give the name "Slice Selection" and click the save button.
  • Right click again on the GoB that we created on the previous step and select "Add block". Give the name "PE + GR_Z ref. + GR_X pref." and click the save button.
  • Right click again on the GoB that we created on the previous step and select "Add block". Give the name "Frequency Encoding" and click the save button.

The pulse sequence GUI should look now like the second figure below.

Step 4: Add the RF object in the "Slice Selection" block

This block will hold the RF excitation pulse and the slice selection gradient (along the Z axis). To add the RF excitation pulse, do the following:

  • Right click on the "Slice Selection" block (first figure below - step 1) and select "Add RF" (first figure below - step 2)
  • On the popup window, select the "Magnitude Shape" to be sinc (second figure below - step 1), the "Sinc Angle" to be 15 (second figure below - step 2), the "Sinc Cycles" to be 2 and the "Sinc Duration (μs)" to be 3000 (second figure below - step 3)
  • Click the save button

Step 5: Add the slice selection gradient in the "Slice Selection" block

To add the slice selection gradient, do the following:

  • Right click on the "Slice Selection" block and select "Add GR"
  • On the popup window, select the "Axis" to be Z (figure below - step 1), select the "Shape" to be Trapezoid (figure below - step 2), the "Trapezoid Flat Time (μs)" to be 3000 (figure below - step 3) and keep the "Trapezoid Rise Time (μs)" and the "Trapezoid Fall Time (μs)" equal to 0.
  • Click the save button

There are still two remaining tasks for this block:

  1. Define the amplitude of the gradient so as the selected RF pulse to induce a slice thickness of 0.010m. A custom expression should be added in order to update automatically the amplitude of the gradient every time the bandwidth of the RF excitation pulse or the slice thickness value changes
  2. The duration of the trapezoid to be updated automatically ("Trapezoid Flat Time (μs)") in cases we change the duration of the RF excitation pulse

In order to make these changes, select the "Edit object parameters" mode from the top middle menu. The amplitude of the gradient will be defined using the following equation:

In order to add the custom expression for the calculation of the "Peak Amplitude (Tesla/m)", click on the padlock icon (figure below - step 1) next to the label "Peak Amplitude (Tesla/m)". Once the padlock looks locked, a module will appear at the bottom of the page (figure below - step 2). Using this module, formulate the custom expression according to the formula above. Your custom expression should look like the second figure below. Once the custom expression has been defined (second figure below - step 1), click the "Use it" button (second figure below - step 2) to calculate the custom expression and update the value of the field "Peak Amplitude (Tesla/m)". The full custom expression can be seen in the dashed line box.

In order to add the custom expression for the automatic update of the duration of the trapezoid, click on the padlock icon (figure below - step 1) next to the label "Trapezoid Flat Time (μs)". Once the padlock looks locked, a module will appear at the bottom of the page (figure below - step 2). Using this module, set the custom expression to be equal to the duration of the sinc-shaped RF pulse. Once the custom expression has been defined, click the "Use it" button (figure below - step 3) to calculate the custom expression and update the value of the field "Trapezoid Flat Time (μs)". The full custom expression can be seen in the dashed line box.

Step 6: Add the phase encoding gradient in the "PE + GR_Z ref. + GR_X pref." block

Phase encoding is implemented by applying a gradient before the readout. The number of phase-encoding lines (N = kspacey) will define the total number of TRs for the selected pulse sequence. The phase encoding order of the GRE pulse sequence has been selected to be sequential. For N phase encoding steps that are acquired sequentially, the top phase-encoding line of kspace is given by:

where Δky is the phase encoding step size when moving from one TR to the next TR and is given by:

The phase-encoding k-space locations are given by:

where m = 1, 2,..., N

The area covered by the maximal phase encoding gradient should be ky(1)/gamma. Given that we are allowed to use gradients of maximum gradient amplitude equal to 0.040T/m (User Defined 7 variable), the duration of the phase encoding gradient can be equal to:

So, the peak amplitude of the phase encoding gradient should be:

Based on the above analysis, in order to add the phase encoding gradient the following steps should be performed:

  • Right click the "PE + GR_Z ref. + GR_X pref." block and select "Add GR" (first figure below - step 1)
  • On the popup window, select the "Axis" to be Y, select the "Shape" to be Trapezoid and add a random number (e.g 100μs) for the "Trapezoid Flat Time (μs)". We will change this in the next steps.
  • Click the save button
  • Select the "Edit object parameters" mode from the top middle menu (first figure below - step 2)
  • Click on the padlock icon (first figure below - step 3) next to the label "Trapezoid Flat Time (μs)". Once the padlock looks locked, a module will appear at the bottom of the page (first figure below - step 4). Using this module, set the custom expression to be equal to the duration given by the equation above. The custom expression should look like the expression in the dashed line box in the figure below. Once the custom expression has been defined, click the "Use it" button (first figure below - step 5) to calculate the custom expression and update the value of the field "Trapezoid Flat Time (μs)". The custom expression should look like the following expression (be aware of the round() function and the multiplier 1000000 - the round function will return an integer number whereas the multiplier will transform the output from seconds to microseconds):

round(1000000*((((([pulseq->user_defined_2]-1)/2)/[pulseq->user_defined_4])/[pulseq->pulseq_gamma])/[pulseq->user_defined_7])) 

  • Click on the padlock icon (second figure below - step 1) next to the label "Peak Amplitude (Tesla/m)". Once the padlock looks locked, a module will appear at the bottom of the page (second figure below - step 2). Using this module, formulate the custom expression according to the formula given by the equation above. The custom expression should look like the expression in the dashed line box in the figure below. Once the custom expression has been defined, click the "Use it" button (second figure below - step 3) to calculate the custom expression and update the value of the field "Peak Amplitude (Tesla/m)". The custom expression should look like the following expression:

((((([pulseq->user_defined_2]-1)/2)-[tr->pulseq_index]+1)/[pulseq->user_defined_4])/[pulseq->pulseq_gamma])/((round(1000000*((((([pulseq->user_defined_2]-1)/2)/[pulseq->user_defined_4])/[pulseq->pulseq_gamma])/[pulseq->user_defined_7])))*0.000001)

Step 7: Add the refocusing gradient in the "PE + GR_Z ref. + GR_X pref." block

In this step we are going to add the refocusing gradient for the slice selection process (Z axis). The duration of this gradient should be equal to the duration (that is, the "Trapezoid Flat Time (μs)") of the phase encoding gradient whereas its area should be half the area of the slice selection gradient. In order to add this gradient in this block, the following steps should be performed:

  • Right click the "PE + GR_Z ref. + GR_X pref." block (first figure below - step 1) and select "Add GR"
  • On the popup window, select the "Axis" to be Z, select the "Shape" to be Trapezoid and add a random number (e.g 100μs) for the "Trapezoid Flat Time (μs)". We will change this in the next steps.
  • Click the save button
  • Select the "Edit object parameters" mode from the top middle menu (first figure below - step 2)
  • Click on the padlock icon (first figure below - step 3) next to the label "Trapezoid Flat Time (μs)". Once the padlock looks locked, a module will appear at the bottom of the page (first figure below - step 4). Using this module, set the custom expression to be equal to the duration of the phase encoding gradient (variable "Trapezoid Flat Time (μs)"). The custom expression should look like the expression in the dashed line box in the first figure below. Once the custom expression has been defined, click the "Use it" button (first figure below - step 5) to calculate the custom expression and update the value of the field "Trapezoid Flat Time (μs)".
  • Click on the padlock icon next to the label "Peak Amplitude (Tesla/m)". Once the padlock looks locked, a module will appear at the bottom of the page. Using this module, formulate the custom expression according to the formula given by the following equation. For than reason, we calculate manually the area of the slice-selection gradient, we divide it by 2 (half of the area) and then we divide it again by the duration of the phase-encoding gradient (parameter trap_flat of the GR_y gradient). The custom expression should look like -Area/[gr_y->trap_flat]. Once the custom expression has been defined, click the "Use it" button to calculate the custom expression and update the value of the field "Peak Amplitude (Tesla/m)".

Step 8: Add the readout gradient in the "Frequency Encoding" block

The magnitude of the readout gradient is given by:

whereas its duration is given by:

In order to add this gradient in this block, the following steps should be performed:

  • Right click the "Frequency Encoding" block and select "Add GR"
  • On the popup window, select the "Axis" to be X, select the "Shape" to be Trapezoid and add a random number (e.g 100μs) for the "Trapezoid Flat Time (μs)". We will change this in the next steps.
  • Click the save button
  • Select the "Edit object parameters" mode from the top middle menu (first figure below - step 2)
  • Click on the padlock icon (first figure below - step 3) next to the label "Trapezoid Flat Time (μs)". Once the padlock looks locked, a module will appear at the bottom of the page (first figure below - step 4). Using this module, set the custom expression to be equal to the first equation above. The custom expression should look like the expression in the dashed line box in the first figure below. Once the custom expression has been defined, click the "Use it" button (first figure below - step 5) to calculate the custom expression and update the value of the field "Trapezoid Flat Time (μs)" (be aware of the multiplier 1000000 - the multiplier will transform the output from seconds to microseconds).
  • Click on the padlock icon (second figure below - step 1) next to the label "Peak Amplitude (Tesla/m)". Once the padlock looks locked, a module will appear at the bottom of the page (second figure below - step 2). Using this module, formulate the custom expression according to the formula given by the second equation above. The custom expression should look like the expression in the dashed line box in the second figure below. Once the custom expression has been defined, click the "Use it" button (second figure below - step 3) to calculate the custom expression and update the value of the field "Peak Amplitude (Tesla/m)".

Step 9: Add the readout prephasor gradient in the "PE + GR_Z ref. + GR_X pref." block

In this step we are going to add the prephasor gradient for the readout process (X axis). The duration of this gradient should be equal to the duration (that is, the "Trapezoid Flat Time (μs)") of the phase encoding gradient whereas its area should be half the area of the readout gradient. In order to add this gradient in this block, the following steps should be performed:

  • Right click the "PE + GR_Z ref. + GR_X pref." block and select "Add GR"
  • On the popup window, select the "Axis" to be X, select the "Shape" to be Trapezoid and add a random number (e.g 100μs) for the "Trapezoid Flat Time (μs)". We will change this in the next steps.
  • Click the save button
  • Select the "Edit object parameters" mode from the top middle menu (first figure below - step 2)
  • Click on the padlock icon (first figure below - step 3) next to the label "Trapezoid Flat Time (μs)". Once the padlock looks locked, a module will appear at the bottom of the page (first figure below - step 4). Using this module, set the custom expression to be equal to the duration of the phase encoding gradient (variable "Trapezoid Flat Time (μs)"). The custom expression should look like the expression in the dashed line box in the first figure below. Once the custom expression has been defined, click the "Use it" button to calculate the custom expression (first figure below - step 5) and update the value of the field "Trapezoid Flat Time (μs)".
  • Click on the padlock icon (second figure below - step 1) next to the label "Peak Amplitude (Tesla/m)". Once the padlock looks locked, a module will appear at the bottom of the page (second figure below - step 2). Using this module, formulate the custom expression according to the formula given by the following equation:

The custom expression should look like the expression in the dashed line box in the second figure below (it is the negative of the half area of the readout gradient, as described in step 8). Once the custom expression has been defined, click the "Use it" button (second figure below - step 3) to calculate the custom expression and update the value of the field "Peak Amplitude (Tesla/m)". The custom expression should look like the following expression:

-((([pulseq->user_defined_6]/([pulseq->pulseq_gamma]*[pulseq->user_defined_3]))*[pulseq->user_defined_1]/[pulseq->user_defined_6])/2)/([gr_y->trap_flat]*0.000001) 

Step 10: Add an acquisition (ACQ) object in the "Frequency Encoding" block

The receiver will open during the readout process. Moreover, each kspace line should take a unique index. These indexes will be used later for reconstruction purposes. In order to do that, the following steps should be performed:

  • Right click the "Frequency Encoding" block (first figure below - step 1) and select "Add ACQ" (first figure below - step 2)
  • Just click the save button. We will change the parameters of this object in the next steps.
  • Select the "Edit object parameters" mode from the top middle menu (second figure below - step 2)
  • Click on the padlock icon (second figure below - step 3) next to the label "Dwell Time (μs)". Once the padlock looks locked, a module will appear at the bottom of the page (second figure below - step 4). Using this module, set the custom expression to be equal to the duration of the readout gradient (given in step 8 of this guide). The custom expression should look like the expression in the dashed line box in the second figure below. Once the custom expression has been defined, click the "Use it" button (second figure below - step 5) to calculate the custom expression and update the value of the field "Dwell Time (μs)".
  • Click on the padlock icon (third figure below - step 1) next to the label "ky". Once the padlock looks locked, a module will appear at the bottom of the page (third figure below - step 2). Using this module, the ky will take the unique value of the index of the GoB. The custom expression should look like the expression in the dashed line box in the third figure below. Once the custom expression has been defined, click the "Use it" button (third figure below - step 3) to calculate the custom expression and update the value of the field "ky".

Step 11: Add a software crusher gradient in the "Frequency Encoding" block

Usually the crusher gradients are placed at the end of each TR in order to null the signal on the transverse plane. The crusher gradients are usually strong gradients that may induce artificial spurious echoes in MR simulations. For this purpose, instead of using true crusher gradients we will add software crushers at the end of each TR. In order to do this, the following steps should be performed:

  • Right click the "Frequency Encoding" block (first figure below - step 1) and select "Add soft crusher" (first figure below - step 2)
  • Just click the save button. We will change the parameters of this object in the next step.
  • Select the "Edit object parameters" mode from the top middle menu (second figure below - step 1)
  • Click on the padlock icon (second figure below - step 2) next to the label "Time point (μs)". Once the padlock looks locked, a module will appear at the bottom of the page (second figure below - step 3). Using this module, we will add a custom expression so as a software crusher to be added at the end of each TR (every 10ms). In order to do that, the custom expression should look like the expression in the dashed line box in the second figure below. Please be aware that the times of the objects within a block are relative to the start time of the block. Once the custom expression has been defined, click the "Use it" button (second figure below - step 4) to calculate the custom expression and update the value of the field "Time point (μs)".

The pulse sequence should look like the following figure:

Step 12: Copy the group of blocks (GoB) N times to create the entire pulse sequence

In this example, the kspace consists of 256 kspace lines. This requires the group of blocks that was developed in the previous steps to be copied 255 times. In order to do that, the following steps should be performed:

  • Right click on the GoB (figure below - Step 1) and select Copy
  • In the popup window, add 255 in the field "How many copies?" (figure below - Step 2)
  • Select the box "Maintain custom expressions?" (figure below - Step 3). Learn here the reason why this box should be selected [@@@ Action is required]
  • Click the OK button

[@@@ Action is required - Add a screen capture of the entire pulse sequence]

The user can further accelerate the performance of simulations by "compressing" the pulse sequence through the reduction of the total number of discrete time-steps. Before you upload your pulse sequence on coreMRI, run the MATLAB function coreMRI_qMR_pulse_optimization() and save your pulse sequence with the matrices and variables extracted from this function. Follow these steps:

  1. Load the pulse sequence in MATLAB
  2. Download the MATLAB function coreMRI_qMR_pulse_optimization (click HERE) and save it into the MATLAB working directory
  3. Execute the following command in the command window:
    [pulse_sequence, times_fitting_single_point, soft_crushers, N_pulse] =  coreMRI_qMR_pulse_optimization(pulse_sequence, times_fitting_single_point, soft_crushers, N_pulse);
  4. Save the variables found in the workspace under a new .mat file
  5. Upload the newly created .mat file to coreMRI

Currently coreMRI is based on .mat files (MATLAB files). All the coordinates are given in the Device Coordinate System (DCS). The .mat file should include the following variables:

dt: is the temporal step of the MR simulation experiment (in sec)

N_pulse: it holds the number of the total timesteps of the pulse sequence

pulse_sequence: it is an [8xN_pulse] matrix. The first row (pulse_sequence(1,:)) holds the time sequence of the magnitude of the RF events (B1), the second row (pulse_sequence(2,:)) holds the time sequence of the phase of the RF events (RFP), the third row (pulse_sequence(3,:)) holds the time sequence of the frequency of the RF events (RFfreq), the fourth row (pulse_sequence(4,:)) holds the time sequence of the gradients on the x axis, the fifth row (pulse_sequence(5,:)) holds the time sequence of the gradients on the y axis and the sixth row (pulse_sequence(6,:)) holds the time sequence of the gradients on the z axis. The last two rows are identical and each one is an array with increasing number from 1 to N_pulse (pulse_sequence(7,:) = 1:N_pulse and pulse_sequence(8,:) = 1:N_pulse). The last two rows are being used by an algorithm that allows for compression of the pulse sequence in order to accelerate the MR simulations (read more here CODE\fast-algorithm).

B1 is given in T (Tesla), RFP is given in radians, RFfreq is given in Hz and gradients are given in T/m (Tesla per meter).

times_fitting_single_point: it is an array of the timepoints for which the MR signal will be recorded in the database/dictionary of the simulated signals (for example the times_fitting_single_point = [1000, 2000, 3000, 4000, 5000] will record the simulated MR signal for timepoints 1000, 2000, 3000, 4000 and 5000. For a dt=0.000001 sec (1μsec), the simulated MR signal will be recorded for t = 1msec, 2msec, 3msec, 4msec and 5msec.)

soft_crushers: it is an array of 0s or 1s and of size [1xN_pulse]. This array is pointing out when a nullification of the transverse components of the magnetization should be induced. It is being used to avoid the introduction of strong gradients in the pulse sequence.

 

Extra parameters:

gamma: the gyromagnetic ratio in Hz/T. For example, the gyromagnetic ratio for the hydrogen nucleus is 42560000 Hz/T.

coordCenterSlice_mm: it is a [1x3] array that holds the center of the slice in millimeters.

normalVectorSlice: it is a [1x3] array that holds the normal vector of the slice. For example, a transversal slice would have a normalVectorCenterSlice equal to [0,0,1] in the DCS.