# Will the phase of the reconstructed data using a single MRI k-space point show any curvature?

Some courses tell that each point in k-space (spatial-frequency domain) represents a certain stripe pattern in spatial domain.

Consequently, if I reconstructed the image using only a single point in k-space data, the phase of the constructed image will change periodically(Exactly speaking, it changes linearly. The periodicity comes from phase wrapping). This means there will be only straight lines in phase map.

Here is a simple MATLAB code snippet for demonstration:

I = imread('cameraman.tif');
ksp = fftshift(fft2(I));

for i=1:256
k = zeros(size(ksp));
k(128,i) = ksp(128,i); % choose a single point in ksp

Ir = ifft2(ifftshift(k));
phase_map = angle(Ir);
imshow(phase_map,[])
title(num2str(i))
end


But some other courses say: the phase map will show curvature if the encoding gradient has a poor linearity. For example, the content of stanford RAD229 https://www.youtube.com/watch?v=uO--lYGjvFM begin from 14:40.

The k-space data itself won't know whether the gradient is good or not, but the meaning of each point wouldn't change. If each point of k-space only represents a certain stripe pattern. The phase of the reconstructed "image" using a single ksp point will change periodically (which means no curvature in phase map) even if the gradient has a poor linearity.

Conflict: Which one is right? Is there any way to generate the phase map showed in RAD 229?

Update: Here is a small demo in 1D case：

import numpy as np
import matplotlib.pyplot as plt

mx = np.zeros([256,1])
mx[96:128+32] = 1
plt.plot(mx)

ksp = np.fft.fft(mx,axis=0)
plt.plot(np.abs(ksp))

k = np.zeros(ksp.shape);

# voxel #2 and #3 were mis-placed using an imperfect gradient
k[3] = ksp[3]+ksp[2];

rec = np.fft.ifft(k,axis=0);
phase = np.angle(rec)
# it's a straight line after unwrapping
plt.plot(np.angle(rec))


My question is about the variable phase in this code. If the video is right, the plotted phase should be curved. But the result shows that the phase is still a straight line( after phase unwrapping).

I've acquired some images using a poor gradient unit. The images are distorted obviously but I cannot find any curvature when analyzing these data using the above mentioned matlab code.

Some courses tell that each point in k-space (spatial-frequency domain) represents a certain stripe pattern in spatial domain.

It does. A simpler way to think about what sort of "stripe pattern" would be generated by a point $$(m,n)$$ in k-space is to imagine a wave that propagates along the direction of $$(0,0) (m,n)$$. That wave has a frequency that is proportional to the distance of $$(m,n)$$ from the centre $$(0,0)$$. Also, you might find this and this useful too.

Consequently, if I reconstructed the image using only a single point in k-space data, the phase of the constructed image will change periodically. This means there will be only straight lines in phase map.

This is not strictly accurate, or maybe it is described in a vague way here. The "phase of the constructed image will" not "change periodically". It will vary linearly.

If the phase varied periodically, the reconstructed image would look like frequency modulation.

Phase is the first derivative of frequency.

Here is an illustrative example in Python (but easily generalisable in other platforms):

import numpy

Fs=100 # Sampling frequency in Hz
T=1 # Duration of signal in seconds

t = numpy.linspace(0,T, Fs*T) # Time vector (in seconds)

p = 2*numpy.pi*t # Phase vector


Here, p is our phase vector. As you can see, it is just a line that increases at a specific rate. If you feed this phase to a sinusoid, you get a specific frequency. If you want to generate a higher frequency you make the slope that the phase varies steeper. For example y = numpy.sin(10*p). This will give you a 10 Hz sinusoid running for 1 second at a sampling frequency of 100Hz.

By saying that "...the phase [...] will change periodically..." what you imply is that p somehow oscillates. But what will happen if we get an oscillating p? (Frequency Modulation).

Here is a very simple example (it comes as a continuation of the above one):

from matplotlib import pyplot as plt

plt.plot(numpy.sin(20*p+6*numpy.sin(p)));
plt.xlabel("Discrete time")
plt.ylabel("Amplitude")
plt.show()


Which will give you something like:

You can see here that we start at a high frequency, we go to a lower frequency and then back up again to a high frequency. The phase here still "evolves" at a linear rate but on that ramp, we have superimposed a sinusoid to show what happens when "...phase change[s] [...] periodically...".

What you are asking, is actually answered in the Stanford video you cite within the first 5-10 minutes.

To understand the sort of distortion that the gradient brings to the image, you have to understand how does frequency map to space in the MRI.

The key to understanding that is the Larmor frequency. The Larmor frequency is what allows us to map frequency to space (or more accurately space to frequency) by varying the strength of the magnetic field.

In other words, by having a linear magnetic field, we map equal distances in physical space to equal distances in the k-space.

If the magnetic field varies non-linearly (first 5-8 minutes of the Stanford video), then where you excite (or receive from) is not where you think it is.

Therefore, equal distances in physical space do not map anymore to equal distances in the k-space.

This is what distorts the image.

An extreme example in 1 dimension is (again, as a continuation of the above)

plt.plot(numpy.sin(p-numpy.sin(0.25*p)));
plt.xlabel("Discrete time")
plt.ylabel("Amplitude")
plt.show()


This will give you something like:

This was supposed to be a "normal" sinusoid cycle but due to the fact that the phase does not change linearly, what we see here is a distorted version.

Here is the difference between the linear evolution of phase and the profile that causes this distortion:

plt.plot(p);
plt.plot(p-numpy.sin(0.25*p));
plt.legend(["Linear", "Non-Linear"])
plt.xlabel("Discrete phase")
plt.ylabel("Amplitude")
plt.show();


Which gives:

Again, the key to understanding what is going on here is to relate physical space to frequency and field strength through the Larmor frequency. If the gradient is not linear then equal parcels of physical space are not mapped to equal parcels of k-space and that is where distortion is coming from.

Hope this helps.

EDIT:

To the points raised:

...my question is whether the phase is a straight line or curved?

You seem to be referring to the phase spectrum as obtained from the Discrete Fourier Transform (DFT).

This has nothing to do with the reason behind the image distortion and impossible to "probe" from a single image.

The distortion of phase because of gradient non-linearities is something that happens BEFORE the data is captured. By the time the signal is captured it is distorted already.

Therefore, if you do not have a reference image (that is, an image that is distortion free), it is impossible to "see" the phase distortion. You could try infering it too, but that would be valid up to a point and for assumed distortion profiles. The only reason why we are able to tell that an image is distorted is because we know the anatomy.

I just want to reproduce the results in this video.

The results presented in the video come from a simulator. The very first equation presented at the top left is the one that is used to map gradient phase to k-space position. If you don't have $$\vec{G}$$, it is impossible to know how $$k$$ gets deformed for a given image.

You can remap the phase yourself with a function (that is, change the balance between the imaginary and real components of an image's complex DFT) and proceed with the reconstruction, or, you can achieve the end result of the distortion via an image geometric transformation. This transformation is literally a remapping of the pixel positions to new positions which is exactly what happens when the gradient contains non-linearities. For more information you might want to see this.

• Maybe I have not demostrate what I want to ask. Sorry about that.In the following code, my question is whether the phase is a straight line or curved? : import numpy as np import matplotlib.pyplot as plt mx = np.zeros([256,1]) mx[96:128+32] = 1 plt.plot(mx) ksp = np.fft.fft(mx,axis=0) plt.plot(np.abs(ksp)) k = np.zeros(ksp.shape); k[3] = ksp[3]; rec = np.fft.ifft(k,axis=0); phase = np.angle(rec) # it's a straight line after unwrapping plt.plot(np.angle(rec))  – Shannon Jul 10 '20 at 2:49
• I just want to reproduce the results in this video. – Shannon Jul 10 '20 at 3:12
• @ShannonChow Please see updated response. – A_A Jul 10 '20 at 9:46
• I don't think there are any addtional procedures (e.g. phase remapping) before/after ifft(k-space data) in the video. So the content in the video is not repeatable? @A_A – Shannon Jul 13 '20 at 1:14
• @ShannonChow To reproduce the content of the video you need to know the $\vec{G}$ and then you need to somehow apply that $\vec{G}$ on to the image. Whether you do this through phase remapping or modification (due to the -circular- shift property of the transform), the end result is similar: The image gets distorted. – A_A Jul 13 '20 at 12:06