# MRI reconstruction using windowing based apodization

I am trying to apply windowing to do MRI reconstruction. I have a 256 point one dimensional k-space samples which look as follows:

Here, the real part(green) is flat around 0 and the blue curve is the imaginary part. Now, what I would like to do is perform some apodization. For this, I construct a hanning window as follows:

from scipy import signal

win = signal.hann(256)
# sig is the
sig = signal.convolve(sig, win, mode='same') / sum(win)


The hanning window is the same size as the k-space vector (256). Next, I convolved the k-space signal with the hanning window, which looks like:

Next, I performed the inverse fft to reconstruct the image (which should have near uniform intensity everywhere) using:

from scipy import fftpack

rec = np.abs(fftpack.ifftshift(fftpack.ifftn(sig)))


This results in the recon image as:

I feel I have done something wrong as I was expecting to have a fairly uniform image rather than a spike. Do I need to do something post reconstruction to account for the fact that I have performed some windowing before the reconstruction?

• You say real part(green) is flat around 0 and the blue curve is the imaginary part. but the legend on the graph says the opposite: the blue is the real part and the green is the imaginary part. Which is it? – Peter K. Jun 20 '16 at 19:34
• Ah damn. Sorry, I messed up the legends! – Luca Jun 20 '16 at 19:53

You say:

• I have a 128 point one dimensional k-space samples...
• The hanning window is the same size as the k-space vector (256)...

Make sure that you have the appropriate sizes in your algorithm.

• Next, I convolved the k-space signal with the hanning window...

Windowing is applied in $k$-space by multiplication - you simply have to multiply your window and the original $k$-space line. In image space, this is a convolution, hence you could take the Fourier Transform of the window function and convolve the image with it.

Another view: Apodization is applied to suppresses certain frequencies. For example, the highest frequencies are simply skipped by setting them to 0 due to the multiplication of the window function and the $k$-space data. If you were to convolve the two, you would "spill" the information of the higher frequencies all over $k$-space - which certainly is not what you want to achieve by apodization.

• Agreed! Instead of doing sig = signal.convolve(sig, win, mode='same') / sum(win) the OP should be doing sig = numpy.multiply(sig, win) -- with or without normalization by the sum. – Peter K. Jun 20 '16 at 19:38
• Thanks for the reply and the catch on the 256-128 confusion. I had changed it at some point and forgot to amend the post everywhere. My question is should the fourier transform of the window function not be used for the multiplication then with the k-space signal? Considering that the convolution in image space should be multiplication in k-space and vice versa? – Luca Jun 20 '16 at 19:55
• Ok, my last comment makes no sense on retrospection. However, after I do this apodization, do I not need to divide the reconstructed time domain image with the FT of the window? – Luca Jun 20 '16 at 20:27
• No, you do not need this division. You do the multiplication in $k$-space, inverse-FT the modified $k$-space back to the image domain and you are done. – M529 Jun 20 '16 at 21:05
• @Luca The effect of the windowing is something that you want - why would you "correct" for it in image space afterwards? You want to smooth out some higher frequencies. You can do this in $k$-space by multiplying the window function or convolving the Fourier Transform of the window function and the image in image space. For further insight, look up an example on blurring an image with a Gaussian Kernel by convolution and the relationship to the FFT. The theory behind that and your application is the same. – M529 Jun 21 '16 at 8:40