2009 Blair Bohannan: Difference between revisions

From Psych 221 Image Systems Engineering
Jump to navigation Jump to search
imported>Psych 204
No edit summary
imported>Psych 204
No edit summary
Line 37: Line 37:


== Cell III. Artifact 1: DC offset ==
== Cell III. Artifact 1: DC offset ==
The DC offset is a constant, positive shift in amplitude. It results in a large peak at frequency zero. This can be derived from the equation for the DFT. Given that the DFT is defined as  
The DC offset is a constant, positive shift in amplitude. It results in a large peak at frequency zero. This can be derived from the equation for the DFT. Recall that the DFT is defined as  
:<math>X_k=\sum_{n=0}^{N-1} x_n e^{-\frac{j 2 \pi}{N} k n}\quad \quad k = 0, \dots, N-1 </math>
:<math>X_k=\sum_{n=0}^{N-1} x_n e^{-\frac{j 2 \pi}{N} k n}\quad \quad k = 0, \dots, N-1 </math>
where <math> x </math> is the time signal at times <math> n </math> and <math> X </math> is the Fourier transform at frequency indices <math> k </math>. The DFT of a signal <math>x</math> plus a constant DC offset <math> \Delta </math> would be
where <math> x </math> is the time signal at times <math> n </math> and <math> X </math> is the Fourier transform at frequency indices <math> k </math>. The DFT of a signal <math>x</math> plus a constant DC offset <math> \Delta </math> would then be
:<math>X_k=\sum_{n=0}^{N-1} (x_n+\Delta) e^{-\frac{j 2 \pi}{N} k n} \quad \quad k=0, \dots, N-1 </math>
:<math>X\Delta_k=\sum_{n=0}^{N-1} (x_n+\Delta) e^{-\frac{j 2 \pi}{N} k n} \quad \quad k=0, \dots, N-1 </math>
Since this is a linear system, we can separate the DC component from the original signal.

Revision as of 08:31, 9 December 2009

Back to Psych 204 Projects 2009

Project Title - MATLAB image processing tutorial

This page accompanies a MATLAB tutorial which simulates some artifacts that might be found in MR images. Their causes, and in some cases corrections, are demonstrated in the code. One- and two-dimensional examples are provided.
Image artifacts in this tutorial include DC Offset, Quadrature Ghosting, RF Noise, Gradient, and Frequency-Sampling Jitter. Information on the first four topics can be found in Hornak, Joseph P. The Basics of MRI, Chapter 11. More information on the mathematical derivations can be found in Smith, Julius O. Mathematics of the Discrete Fourier Transform (DFT). A full reference list can be found at the end of this page.

About the tutorial

This tutorial consists of a MATLAB (.m) script and some image files. Unzip the files to a folder and either add to path or set the MATLAB workspace to this folder before starting the tutorial.
The tutorial uses cells, and each section below corresponds to a cell in the tutorial. To evaluate a cell in the tutorial, first navigate into it. Ctrl+Enter evaluates the current cell, and Ctrl+Shift+Enter evaluates and moves to the next cell. Variables are re-used throughout the tutorial, so start at the first cell and work through the tutorial in order.
The tutorial package contains a selection of image files. Those titled "stimulus##.tif" (including the one used on this page) are from an image set prepared by Roozbeh Kiani. The associated publication can be found here. Used with permission.

Tutorial

Cell I. Loading images for analysis

The first cell simply loads an image, converts it to grayscale, and sets the size of the image. nPix, the variable setting the number of pixels in the x and y dimensions, should be a power of 2 for faster FFT calculation.
This figure contains the image in grayscale. It has nPix x nPix pixels (in this case, 256 x 256).
Figure 1

Cell II. Using fftshift

The fftshift function is helpful for visualing Fourier transforms in a familiar format. In the 1-dimensional N-point Fourier transform (like the transform of an audio signal), it takes points N/2+1 to N (containing the Nyquist and negative frequency components) and moves them to the beginning of the array. See Oppenheim and Schafer, Chapter 4, if you want to know why this can happen. Thus, the fftshifted function causes the poisitive and negative frequencies to be symmetric about the zero-frequency point. This being the case, it's helpful to keep in mind that the zero-frequency sample is at sample N/2+1.
Here is a 1-dimensional example. The red dot is the zero-frequency component of the transform of the sinusoid in the top subplot.
Figure 2
In the 2-dimensional case, fftshift swaps quadrants 1 and 3, and also 2 and 4 of the Fourier transform. Thus, the low-frequency information is moved to the center of the image, with the [0,0] frequency point moving from matrix index [1,1] to [nPix/2+1,nPix/2+1]. The fftshifted Fourier transform of an image is what we are used to looking at when we talk about k-space.
Here is a 2-d Fourier transform without fftshift. Note the bright spots (high amplitudes) in the outer corners of the image; these are the low frequencies. Figure 3
Here is the same transform, with fftshift applied to it. Now the low-frequency, high-amplitude information is in the center of the image. Figure 4

Cell III. Artifact 1: DC offset

The DC offset is a constant, positive shift in amplitude. It results in a large peak at frequency zero. This can be derived from the equation for the DFT. Recall that the DFT is defined as

Xk=n=0N1xnej2πNknk=0,,N1

where x is the time signal at times n and X is the Fourier transform at frequency indices k. The DFT of a signal x plus a constant DC offset Δ would then be

XΔk=n=0N1(xn+Δ)ej2πNknk=0,,N1

Since this is a linear system, we can separate the DC component from the original signal.