0% found this document useful (0 votes)
6 views42 pages

Introduction

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views42 pages

Introduction

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 42

RA 2202: Medical Image Processing II

References

Digital Image Processing Using MATLAB


RC Gonzalez, RE Woods , SL Eddins

1
Syllabus

2
Introduction
Digital Image
Two dimensional function denoted as f(x, y)
x and y are spatial coordinates
Amplitude of f is called intensity or gray level
at the point (x, y)

Digital image is divided into a grid of picture elements


(pixels)

Each pixel has a digital non fractional address and a


gray value
3
Digital Image
Matrix size no of discrete pixels

Pixel depth  maximum number (gray value) that can


be recorded per pixel

8 bit pixel depth  28 = 0 – 255 gray levels


16 bit pixel depth  216 = 0 – 65535 gray levels

Image size = no of pixels × bits per pixel

8 bits = 1 byte of memory


4
Digital Image
Color images are formed by a combination of
individual 2-D images

In RGB color system, a color image consists of three


(red, green, and blue) individual component images

Therefore many of the techniques developed for


monochrome images can be extended to color images
by processing the three component images
individually

5
Digital Image Display
Displayed on CRTs or LCDs

In black & white or gray scale displays, brightness of


each pixel corresponds to number stored in the pixel

Human eye can resolve about 40 gray levels, & 256


gray levels if there are no white or black bands
separating adjacent gray levels

8 bit gray scale is enough for displays

6
Digital Image Processing

There are two principal application areas

1. To Improve pictorial information for human


interpretation

2. To process image data for storage, transmission,


and representation for autonomous machine
perception.

7
MATLAB
MATLAB stands for matrix laboratory.

High-performance language for technical computing

Integrates computation, visualization, and


programming in an easy-to-use environment

Problems and solutions are expressed in familiar


mathematical notation.

Interactive system whose basic data element is an


array 8
MATLAB Desktop
M

9
MATLAB Editor

MATLAB editor is both a text editor specialized for


creating M-files and a graphical MATLAB debugger

10
MATLAB Coordinate Convention

M Instead of (x, y) MATLAB


use (r, c) to indicate rows
and columns

Origin of the coordinate


system is at (r, c) = (1, 1);
thus r ranges from 1 to M
and c from 1 to N

11
Digital Image

Digital Images are represented as matrices

12
Digital Image Formats
DICOM (Digital Imaging and Communications in
Medicine) is the most widely used image format in
medical imaging

DICOM images include metadata that provides


detailed information about the patient, the imaging
study, and the equipment used

Used in Radiology, cardiology, oncology, and other


fields that use imaging techniques like X-ray, CT,
MRI, and ultrasound.
13
DICOM Image Format

Supports 2D and 3D images, patient information,


and secure data transmission.

DICOM Image extension used .dcm

14
Other Digital Image Formats

15
Image Input
Images are read into MATLAB using imread function
For example
>> f = imread (‘chestxray.jpg’);
Reads the JPEG image chestxray.jpg into
image array f
Semicolon ; at the end of a command line is used to
suppress the output. If ; is not included MATLAB
displays the results of the operation specified in that
line
Prompt symbol (>>) designates the beginning of a
command line
16
DICOM Image Input

DICOM Images are read into MATLAB using


dicomread function

For example

>> f = dicomread (‘D:\Images\patient3.dcm’);

Reads the DICOM image patient3.dcm from a folder


called Images on the D: drive into image array f

17
Displaying Images

Images are displayed using imshow function

Syntax: imshow(f, G)

Where f is an image array and G is the number of


intensity levels used to display it. If G is omitted it
defaults to 256 levels

18
Displaying Images

Syntax imshow (f, [low high]) displays as black all


values less than or equal to low and as white all
values grater than or equal to high

Values in between are displayed as intermediate


intensity values using the default number of levels

19
Displaying Images

Syntax imshow (f, [ ]) set variable low to the


minimum value of array f and high to its maximum
value

This form is useful for displaying low dynamic range


images or that have positive and negative values

20
Displaying Images

If another image, g is displayed using imshow,


MATLAB replaces the image in the screen with the
new image

To keep the first image and output a second image,


use function figure as
>> figure, imshow(g)

>> imshow(f), figure, imshow(g)


Displays both images
21
Writing Images

Images are written to disk using imwrite function

Syntax imwrite (f, ‘patient3.tif’)

Writes f to a TIFF file named patient3.tif

22
Data Classes and Image Types

Pixels of images have integer coordinates


But pixel values are not restricted to integers
Table shown in next slide lists the various data
classes supported by MATLAB
First eight entries are referred to as numeric data
classes
Ninth entry is the char data class
Last entry is referred to as logical data class

23
Data Classes and Image Types
M

24
Data Classes and Image Types

All numeric computations in MATLAB are done


using double quantities and it is the most frequent
data class

Data class unit8 is also encountered frequently


especially when reading images from storage
devices

25
Binary Images

Binary image is a logical array of 0s and 1s

Array of 0s and 1s whose data class say unit8 is not


considered as a binary image.

26
Binary Images

A numeric array is converted into binary using


function logical

If A is a numeric array consisting of 0s and 1s we


create a logical array B using
B = logical (A)

27
Binary Images

If A contains elements other than 0s and 1s logical


function converts all nonzero quantities to logical 1s
and all entries with value 0 to logical 0s

Using relational and logical operators also creates


logical arrays

28
Image Types
MATLAB supports four types of images
1. Intensity images
2. Binary images
3. Indexed images
4. RGB images

Most monochrome image processing operations are


carried out using binary or intensity images

Indexed and RGB color images are discussed later

29
Intensity Images

Intensity image is a data matrix whose values have


been scaled to represent intensities

Class Range of values


unit8 [0, 255]
unit16 [0, 65535]
double floating point numbers
scaled double [0, 1]

30
Converting between Image Classes and Types
M

31
Matrix Indexing
Matrices can be represented as a sequence of row
vectors enclosed by square brackets and separated
by semicolons. For example typing

>> A = [1 2 3; 4 5 6; 7 8 9]

32
Some Important Standard Arrays
Can generate simple image arrays using

If only one argument is included in any of the


functions the result is a square array
33
MATLAB Function Programming

So called M-files in MATLAB can be scrips that


simply execute a MATLAB statements or they can
be functions that can accept arguments and can
produce one or more outputs

M-files are created using a text editor and stored


with a name of the form filename.m

34
MATLAB Function Programming
First line of a function M-file is the function definition
line and it has the form

function [outputs] = name (inputs)

Example
function [s, p] = sumprod (f, g)

Where f and g are the input images, s is the sum


image and p is the product image
35
Operators
MATLAB operators are group into three categories

1. Arithmetic operators that perform numeric


computations
2. Relational operators that compare operands
quantitatively
3. Logical operators that perform the functions AND,
OR and NOT

36
Arithmetic Operators

MATLAB has two different types of arithmetic


operations
Matrix arithmetic operations are defined by the rules
of linear algebra
Array arithmetic operations are carried out element
by element and can be used in multidimensional
arrays

Dot (.) character distinguishes array operations from


matrix operations
37
MATLAB Arithmetic Operators
MATLAB

38
MATLAB Arithmetic Operators

39
Relational Operators

Operator Name
< Less than
<= Less than or equal
> Greater than
>= Greater than or equal
== Equal to
~= Not equal to

40
Logical Operators

Operator Description
& Elementwise AND
| Elementwise OR
~ Elementwise and scaler NOT
&& Scalar AND
|| Scalar OR

41
Flow Control Statements
M

42

You might also like