3D turbo spin-echo
A three-dimensional image volume is acquired with a turbo spin-echo (TSE) sequence and reconstructed by a 3D Fourier transform. The data are additionally exported in the ISMRMRD format for reconstruction with external frameworks.
Sequence
The constructor tse_3d.constructor acquires etl phase-encoding steps per excitation (echo train). Key parameters are the number of encoding steps n_enc and the field of view fov (both Dimensions), the phase-encoding order trajectory (in-out, out-in or linear) and the assignment of readout and phase-encoding directions to the logical gradient axes (channel_ro, channel_pe1, channel_pe2). Setting a phase-encoding dimension of n_enc to 1 yields a 2D sequence.
The constructor returns the sequence and an ISMRMRD header with the encoding description. Each ADC event is labelled with its phase-encoding indices (LIN, PAR), which are used for k-space sorting and in the ISMRMRD export.
Procedure
- Construct the sequence and set the number of averages (it is assumed, that Larmor frequency and B1 scaling are already set, e.g. from SE experiment).
- Unroll the sequence and run the acquisition.
- Sort the acquired readouts into k-space with
sort_kspace, which returns an array of shape(averages, coils, enc_z, enc_y, enc_x). - Reconstruct the image by a 3D FFT and display the slices.
- Add k-space and image to the acquisition data, store it with
save()and export it withsave_ismrmrd(header=header).
Script
"""3D turbo spin echo sequence."""
# %%
import logging
import matplotlib.pyplot as plt
import numpy as np
import console
from console.interfaces.acquisition_data import AcquisitionData
from console.interfaces.acquisition_parameter import Dimensions
from console.spcm_control.acquisition_control import AcquisitionControl
from console.utilities.sequences import tse_3d
# Create acquisition control instance, adapt the path to the device configuration of your system
config_file = "example_device_config.yaml"
acq = AcquisitionControl(configuration_file=config_file,
file_log_level=logging.DEBUG,
console_log_level=logging.DEBUG)
# %%
# Create sequence
params = {
"echo_time": 20e-3,
"repetition_time": 600e-3,
"etl": 7,
"gradient_correction": 80e-6,
"rf_duration": 200e-6,
"fov": Dimensions(x=240e-3, y=240e-3, z=240e-3),
"channel_ro": "y",
"channel_pe1": "z",
"channel_pe2": "x",
"ro_bandwidth": 20e3,
"n_enc": Dimensions(x=13, y=120, z=14),
}
seq, header = tse_3d.constructor(**params)
console.parameter.num_averages = 2
# Calculate sequence and perform acquisition
acq.set_sequence(sequence=seq, parameter=console.parameter)
# %%
# Execute the sequence and sort kspace array
acq_data: AcquisitionData = acq.run()
# %%
ksp = tse_3d.sort_kspace(acq_data.receive_data, seq)
# Image reconstruction with FFT
img = np.fft.fftshift(np.fft.fftn(np.fft.fftshift(ksp, axes=(2, 3, 4)), axes=(2, 3, 4)), axes=(2, 3, 4))
# Just grab the 0th coil/avg data
img = img[0, 0, ...]
ksp = ksp[0, 0, ...]
# 3D magnitude plot of image slices
num_slices = img.shape[0]
num_cols = int(np.ceil(np.sqrt(num_slices)))
num_rows = int(np.ceil(num_slices / num_cols))
fig, ax = plt.subplots(num_rows, num_cols, figsize=(10, 10))
ax = ax.ravel()
total_max = np.amax(np.abs(img))
total_min = 0 # np.amin(np.abs(img))
for k, x in enumerate(img[:, ...]):
ax[k].imshow(np.abs(x), vmin=total_min, vmax=total_max, cmap="gray")
ax[k].axis("off")
_ = [a.remove() for a in ax[k + 1:]]
fig.tight_layout(pad=0.01)
fig.set_facecolor("black")
# Complement acquisition data
acq_data.add_info({
"note": "sphere phantom",
"sequence_parameter": params,
})
acq_data.add_data({
"kspace": ksp,
"image": img,
})
acq_data.save()
# Export to ISMRMRD, using the header returned by the sequence constructor
acq_data.save_ismrmrd(header=header)
del acq
# %%