Repository navigation
Trajectory discrepancies between the sequence when is created and the same sequence when is being readed #420
Replies: 1 comment
|
I could reproduce this with pypulseq 1.5.0.post1 (and current main, f2c582b) using Where it comes from It is the precision of the .seq text format. Trapezoid amplitudes are written with pypulseq/src/pypulseq/Sequence/write_seq.py Line 151 in f2c582b and pypulseq/src/pypulseq/Sequence/sequence.py Line 1211 in f2c582b MATLAB Pulseq writes In this example the numbers are:
The part of gz after the RF center lasts an effective 2035 us, and the rephaser 1760 us. That gives -0.333 * 2035e-6 + (-0.333 * 1760e-6) = -6.78e-4 - 5.87e-4 = -1.265e-3 1/m, which matches the measured offset. Two more checks:
Physically it doesn't matter. For a 3 mm slice, one full kz cycle across the slice is 333 1/m, so 1.3e-3 1/m is about 4e-6 of a cycle. Also, the read-back trajectory describes the amplitudes that are actually stored in the .seq file you run. Why BART gives 2 pixels in z BART estimates the image size from the trajectory. A dimension only gets size 1 if its max |k| is exactly 0; otherwise it gets So any non-zero kz gives 2 pixels in z, including the tiny value from before writing. I ran BART v1.0.00 with trajectories scaled as k * FOV (FOV = [0.26, 0.26, 0.003] m, as in the example's FOV definition):
What to do For a 2D acquisition, set kz to exactly zero when you build the BART trajectory, and pass the matrix size so BART doesn't have to guess it: k_adc = seq.calculate_kspace()[0] # (3, n_x * n_spokes), 1/m
traj = k_adc * np.array([fov, fov, 0.0])[:, None] # BART units (1/FOV), kz forced to 0 for 2D
traj = traj.reshape(3, n_spokes, n_x).transpose(0, 2, 1) # (3, samples, spokes)With this, BART runs on both the original and the read-back trajectory and gives a 64x64 image. On the same k-space data, the two images differ by 1.1e-5 in relative norm, so the leftover kx/ky rounding doesn't matter either. Tested with pypulseq 1.5.0.post1 (numpy 2.5.3, Python 3.12) and pypulseq main at f2c582b. BART v1.0.00 was built from mrirecon/bart at 731bfd3. |
Uh oh!
There was an error while loading. Please reload this page.
Hello,
I have started using PyPulseq for the design of sequences and BART for the reconstruction of the signal coming from a Pulseq sequence. I've noticed that when trying to reconstruct a 2D image from a 2D radial sequence generated by the test case
write_radial_gre.pyBART would detect two pixels on the z-axis coming from the fact that the k_z frequencies were not zero.When looking at the trajectories directly generated by the sequence with
seq.calculate_kspace()[0]I've observed that while the k_z trajectories are originally close to 0 (~10^-12), once I look at the same sequence after doingseq.write('seq_name')andseq.read('seq_name'). Now the k_z trajectories have become way bigger (~10^-3).I know there are some rounding errors when writing the .seq file, as well as some parameters that could cause some additional errors trying to mimic a true MRI scanner. I'm not sure if all of these could be the cause of this difference.
All reactions