Exemple #1
0
gz_reph = pp.make_trapezoid(channel='z', system=system, area=-gz.area / 2, duration=pre_time)
# Do not need minus for in-plane prephasers because of the spin-echo (position reflection in k-space)
gx_pre = pp.make_trapezoid(channel='x', system=system, area=gx.area / 2 - delta_k / 2, duration=pre_time)
gy_pre = pp.make_trapezoid(channel='y', system=system, area=Ny / 2 * delta_k, duration=pre_time)

# Phase blip in shortest possible time
dur = math.ceil(2 * math.sqrt(delta_k / system.max_slew) / 10e-6) * 10e-6
gy = pp.make_trapezoid(channel='y', system=system, area=delta_k, duration=dur)

# Refocusing pulse with spoiling gradients
rf180 = pp.make_block_pulse(flip_angle=np.pi, system=system, duration=500e-6, use='refocusing')
gz_spoil = pp.make_trapezoid(channel='z', system=system, area=gz.area * 2, duration=3 * pre_time)

# Calculate delay time
TE = 60e-3
duration_to_center = (Nx / 2 + 0.5) * pp.calc_duration(gx) + Ny / 2 * pp.calc_duration(gy)
rf_center_incl_delay = rf.delay + pp.calc_rf_center(rf)[0]
rf180_center_incl_delay = rf180.delay + pp.calc_rf_center(rf180)[0]
delay_TE1 = TE / 2 - pp.calc_duration(gz) + rf_center_incl_delay - pre_time - pp.calc_duration(
    gz_spoil) - rf180_center_incl_delay
delay_TE2 = TE / 2 - pp.calc_duration(rf180) + rf180_center_incl_delay - pp.calc_duration(gz_spoil) - duration_to_center

# ======
# CONSTRUCT SEQUENCE
# ======
# Define sequence blocks
seq.add_block(rf, gz)
seq.add_block(gx_pre, gy_pre, gz_reph)
seq.add_block(pp.make_delay(delay_TE1))
seq.add_block(gz_spoil)
seq.add_block(rf180)
Exemple #2
0
                           system=system)
gz_reph = pp.make_trapezoid(channel='z',
                            area=-gz.area / 2,
                            duration=1e-3,
                            system=system)
phase_areas = (np.arange(Ny) - Ny / 2) * delta_k

# gradient spoiling
gx_spoil = pp.make_trapezoid(channel='x', area=2 * Nx * delta_k, system=system)
gz_spoil = pp.make_trapezoid(channel='z',
                             area=4 / slice_thickness,
                             system=system)

# Calculate timing
delay_TE = np.ceil(
    (TE - pp.calc_duration(gx_pre) - gz.fall_time - gz.flat_time / 2 -
     pp.calc_duration(gx) / 2) / seq.grad_raster_time) * seq.grad_raster_time
delay_TR = np.ceil((TR - pp.calc_duration(gz) - pp.calc_duration(gx_pre) -
                    pp.calc_duration(gx) - delay_TE) /
                   seq.grad_raster_time) * seq.grad_raster_time

assert np.all(delay_TE >= 0)
assert np.all(delay_TR >= pp.calc_duration(gx_spoil, gz_spoil))

rf_phase = 0
rf_inc = 0
# demo slice profile
gz.channel = 'x'
# ======
# CONSTRUCT SEQUENCE
# ======
Exemple #3
0
rf, gz, gzr = pp.make_sinc_pulse(flip_angle=alpha * math.pi / 180, duration=3e-3, slice_thickness=slice_thickness,
                                 apodization=0.5, time_bw_product=4, system=system, return_gz=True)
# Define other gradients and ADC events
delta_k = 1 / fov
gx = pp.make_trapezoid(channel='x', flat_area=Nx * delta_k, flat_time=3.2e-3, system=system)
adc = pp.make_adc(num_samples=Nx, duration=gx.flat_time, delay=gx.rise_time, system=system)
gx_pre = pp.make_trapezoid(channel='x', area=-gx.area / 2, duration=1e-3, system=system)
gz_reph = pp.make_trapezoid(channel='z', area=-gz.area / 2, duration=1e-3, system=system)
phase_areas = (np.arange(Ny) - Ny / 2) * delta_k

# gradient spoiling
gx_spoil = pp.make_trapezoid(channel='x', area=2 * Nx * delta_k, system=system)
gz_spoil = pp.make_trapezoid(channel='z', area=4 / slice_thickness, system=system)

# Calculate timing
delay_TE = np.ceil((TE - pp.calc_duration(gx_pre) - gz.fall_time - gz.flat_time / 2 - pp.calc_duration(
    gx) / 2) / seq.grad_raster_time) * seq.grad_raster_time
delay_TR = np.ceil((TR - pp.calc_duration(gz) - pp.calc_duration(gx_pre) - pp.calc_duration(
    gx) - delay_TE) / seq.grad_raster_time) * seq.grad_raster_time

assert np.all(delay_TE >= 0)
assert np.all(delay_TR >= pp.calc_duration(gx_spoil, gz_spoil))

rf_phase = 0
rf_inc = 0

# ======
# CONSTRUCT SEQUENCE
# ======
# Loop over phase encodes and define sequence blocks
for i in range(Ny):
Exemple #4
0
                  duration=gx.flat_time,
                  delay=gx.rise_time,
                  system=system)
adc.delay = adc.delay - 0.5 * adc.dwell  # compensate for the 0.5 samples shift
gx_pre = pp.make_trapezoid(channel='x',
                           area=-(gx.area - ro_area) / 2 - ro_area / 2 *
                           (1 - ro_asymmetry),
                           system=system)

# Gradient spoiling
gx_spoil = pp.make_trapezoid(channel='x',
                             area=0.2 * Nx * delta_k,
                             system=system)

# Calculate timing
TE = gz.fall_time + pp.calc_duration(
    gx_pre, gz_reph) + gx.rise_time + adc.dwell * Nxo / 2 * (1 - ro_asymmetry)
delay_TR = np.ceil(
    (TR - pp.calc_duration(gx_pre, gz_reph) - pp.calc_duration(gz) -
     pp.calc_duration(gx)) / seq.grad_raster_time) * seq.grad_raster_time
assert np.all(delay_TR >= pp.calc_duration(gx_spoil))

print(f'TE = {TE * 1e6:.0f} us')

if pp.calc_duration(gz_reph) > pp.calc_duration(gx_pre):
    gx_pre.delay = pp.calc_duration(gz_reph) - pp.calc_duration(gx_pre)

rf_phase = 0
rf_inc = 0

# ======
# CONSTRUCT SEQUENCE
Exemple #5
0
spoil_factor = 1.5  # Spoiling gradient around the pi-pulse (rf180)

# Set system limits
system = pp.Opts(max_grad=32, grad_unit='mT/m', max_slew=130, slew_unit='T/m/s', rf_ringdown_time=30e-6,
                 rf_dead_time=100e-6)

# ======
# CREATE EVENTS
# ======
# Create fat-sat pulse
B0 = 2.89
sat_ppm = -3.45
sat_freq = sat_ppm * 1e-6 * B0 * system.gamma
rf_fs = pp.make_gauss_pulse(flip_angle=110 * np.pi / 180, system=system, duration=8e-3, bandwidth=abs(sat_freq),
                            freq_offset=sat_freq)
gz_fs = pp.make_trapezoid(channel='z', system=system, delay=pp.calc_duration(rf_fs), area=1 / 1e-4)

# Create 90 degree slice selection pulse and gradient
rf, gz, gz_reph = pp.make_sinc_pulse(flip_angle=np.pi / 2, system=system, duration=t_RF_ex,
                                     slice_thickness=slice_thickness, apodization=0.5, time_bw_product=4,
                                     return_gz=True)

# Create 90 degree slice refocusing pulse and gradients
rf180, gz180, _ = pp.make_sinc_pulse(flip_angle=np.pi, system=system, duration=t_RF_ref,
                                     slice_thickness=slice_thickness, apodization=0.5, time_bw_product=4,
                                     phase_offset=np.pi / 2, use='refocusing', return_gz=True)
_, gzr1_t, gzr1_a = pp.make_extended_trapezoid_area(channel='z', Gs=0, Ge=gz180.amplitude, A=spoil_factor * gz.area,
                                                    system=system)
_, gzr2_t, gzr2_a = pp.make_extended_trapezoid_area(channel='z', Gs=gz180.amplitude, Ge=0,
                                                    A=-gz_reph.area + spoil_factor * gz.area, system=system)
if gz180.delay > (gzr1_t[3] - gz180.rise_time):