You are on page 1of 13

Medical Image Analysis

Lecture 1: Intro to MATLAB programming

Why Medical Image Analysis?

Introduction
This course will cover the common image processing & analysis techniques applied in medical imaging applications. Examples will be taken from magnetic resonance imaging, X-ray, computed tomography, and nuclear medicine/ tomographic techniques.

Introduction
In essence, it should be remembered that image processing is really signal processing applied in two, or three dimensions. Thus, many of the concepts studied in signal processing are directly applicable, e.g. low and high-pass filtering, filter impulse response, frequency response, etc.

Introduction
Image processing techniques serve three purposes in medical diagnostics: 1. Reconstruction of images acquired using tomographic techniques 2. Improvement in the appearance of images for viewing 3. Preparation of images for quantitative analysis

Introduction
The goal of medical image analysis techniques is to perform automatic or semi-automatic (interactive) medical diagnostics.

Course Goals
Over this period, students enrolled in this course will have: 1. Developed a theoretical understanding of postprocessing methods used for medical images 2. Learnt quantitative techniques used to enhance multimodal medical images 3. Understood the sources of confounding artifacts in medical imaging 4. Simulated, solved, and analyzed representative medical image processing & analysis problems using MATLAB and accompanying toolboxes

Introduction
It is important to note that abuse of image processing techniques can introduce features (artifacts) that are not part of the inherent image information. Such artifacts can obscure, or be mistaken for, diagnostic features. This can result in misdiagnosis. misdiagnosis For this reason, processing software on clinical scanners must be rigorously tested prior to FDA approval for inclusion within scanner software systems.

Introduction to MATLAB
Basic Commands (please review usage):
a=zeros(X,Y); a=ones(X,Y); clear all; close all; who/whos figure

MATLAB: Loops
FOR Repeat statements a specific number of times. The general form of a FOR statement is: FOR variable = expr, statement, ..., statement END
e.g.: FOR I = 1:N, FOR J = 1:N, A(I,J) = 1/(I+J-1); END END

MATLAB: Loops
WHILE Repeat statements an indefinite number of times.The general form of a WHILE statement is: WHILE expression statements END The statements are executed while the real part of the expression has all non-zero elements. The expression is usually the result of expr rop expr where rop is ==, <, >, <=, >=, or ~=. See also IF, SWITCH, BREAK, CONTINUE, END.

MATLAB: Workspace variables


load filename loads filename into workspace, filename should be a .MAT file, with MATLAB variables Save filename saves variables in the workspace into a file named filename.mat load/save filename X : operates on only one variable X

Introduction to MATLAB
The Image Processing Toolbox is a set of functions (Written in MATLAB) MATLAB which support image processing operations such as: Spatial and morphological operations, linear filtering and filter operations, transforms, image analysis, registration, ROI operations, deblurring etc.

Introduction to MATLAB
To see the code associated with a particular MATLAB function: >> type function_name To study synopses of a function use help and lookfor functions

Graphing in MATLAB
figure and associated attributes axis and associated attributes plot subplot gcf, gca, gco and handle information

Introduction to MATLAB
Some image processing demos:
dctdemo edgedemo firdemo imadjdemo ipexmri roidemo

MATLAB: Image manipulation


I=imread(filename.tif);
imshow(I): shows a gray scale image imagesc(I): scaled to use full colormap imshow(I, []): functions as imagesc image(I) Pixval: shows cursor position & intensity value

Imwrite, imfinfo Colorbar, Colormap


Image formats: BMP, TIFF, JPEG, PNG, HDF, RAS and more.

Also see fread, fwrite etc for file access

MATLAB Image types


Binary images (uint8 or double logical matrix): 0s and 1s Indexed images (uint8, uint16, double): pixel values are direct indices into an RGB colormap, colormap is m-by-3 Intensity images (uint8, uint16, double): pixels are intensity (grayscale) values RGB image (uint8, uint16, double): each pixel is specified by 3 values for R, G, and B

MATLAB image conversion


gray2ind, ind2gray Dither (grayscale binary) im2bw (intensity binary) ind2rgb, rgb2ind mat2gray, rgb2gray

MATLAB image arithmetic


imabsdiff: absolute difference of 2 images imadd: addition imcomplement: complement imdivide imlincomb: linear combination immultiply imsubtract

MATLAB: MATLAB structures


S=struct('field1', VALUES1, ... 'field2', VALUES2,...)
creates a structure array with the specified fields and values. The value arrays VALUES1, VALUES2, etc. must be cell arrays of the same size, scalar cells or single values. Corresponding elements of the value arrays are placed into corresponding structure array elements.

MATLAB: DICOM compatibility


Versions 6.X of MATLAB, MATLAB release 13 onwards are DICOM capable Basic DICOM functions:
I=dicomread(filename) dicomwrite(filename) Info=dicominfo(filename)

DICOM structure
>> info = dicominfo('CT-MONO2-16-ankle.dcm'); >> Filename: [1x57 char]
FileModDate: '24-Dec-2000 21:54:48' FileSize: 525436 Format: 'DICOM' FormatVersion: 3 Width: 512 Height: 512 BitDepth: 16 ColorType: 'grayscale' SelectedFrames: [] FileStruct: [1x1 struct] StartOfPixelData: 1140 MetaElementGroupLength: 192

. And more

MATLAB resources on the web


http://www.mathworks.com/access/helpdesk/help/t echdoc/matlab.shtml http://www.mathworks.com/products/demos/matla b/intro/intro1.html http://www.mit.edu/people/abbe/matlab/lec1.html http://dnl.ucsf.edu/matlab/ http://www.mines.utah.edu/gg_computer_seminar/ matlab/matlab.html http://www.mathtools.net/MATLAB/Image_Process ing/index.html (free webinars and tutorials, registration needed)

DICOM resources on the web


http://medical.nema.org/ (Official DICOM web-page) http://www.dclunie.com/ http://www.psychology.nottingham.ac.uk/staf f/cr1/dicom.html

You might also like