g16.4428 practical magnetic resonance imaging ii part 2:...
TRANSCRIPT
1
G16.4428 Practical Magnetic Resonance Imaging II
Part 2: Medical Image Analysis
B. Image representation
Medical image can be defined as a map from finite discrete 3D grid to signal (gray
level) space
S = I(x,y,z)
The grid in x direction is usually spaced as in y
direction. However, the spacing in z direction is
often different.
If the grid is equally spaced in 3D, the image is
called isotropic, otherwise it is nonisotropic.
For CT, MRI, PET SPECT, image space is
specified by the coordinates of its origin, and
the orientation of the coordinate axes.
S is the signal space. It is often also discrete.
2
Basic Directions and Terminology
right-left RL or left-right LR direction
anterior-posterior AP or postero-anterior PA direction
inferior-superior IS or superior-inferior SI (sometimes named
cranio-caudal & foot-head, but don‟t say up/down)
There are 48 possible axis schemes (directions and orders)!
Right-handed and left-handed coordinate systems
Orientation x y z
================================================
Transverse/axial R->L P->A I->S
coronal-unflipped R->L I->S P->A
sagittal-unflipped P->A I->S R->L
transverse-flipped R->L A->P I->S
coronal-flipped R->L S->I P->A
sagittal-flipped P->A I->S L->R
3
Most common in radiology: L A S (or R P I)
most common in neurology: RAS
which is left-handed? right-handed?
4
File formats & ordering of voxels
We store voxel intensities S in a file as a stream of values in some agreed-upon manner.
Formats require recording a number of characteristics of the image file, including voxel
order, type of number used for intensity, and other attributes relating to conditions of
image acquisition, processing steps that have been performed and so on. This info is
stored in “image header”. Also very important is signal respresentation.
Simple raw headers (Analyze, Midas).
Ordering: voxels are stored in sequence traveling along rows, one row after row
another, one slice after slice another. But which directions are the rows and slices?
Most common for transverse/axial orientation: R-L within P-A within I-S
This means:
voxels ordered from right to left to store a row
rows ordered from posterior to anterior to store a slice
slices stored from inferior to superior to store a volume
5
File vs memory: 3D array variables in C/C++
If we were to read a file into memory in one big blob and treat it as a 3D array, it would
be wrong to access it as: A[x,y,z]
That is because in popular computer languages like C/C++, the first index is the
slowest-incrementing index into memory.
Instead we need to access the image memory as A[z,y,x] or A[z][y][x]
Other complications:
Oblique orientation: often a volume is not aligned to exact orthogonal direction. In this
case it is useful to know which set of axes correspond to most closely. Ex: “oblique
coronal”
There are often multiple volumes in a file, ex: multiple time points.
Where is the origin? Is the origin in the middle of a central voxel or on the corner?
6
Signal representation
depth -- human eye discrimination
nonlinearity of human vision
8 bit format versus 16 bit integer format (1 or 2 bytes per pixel)
signed versus unsigned format
decimal (floating point) formats
7
Saving signal to files
In computing, the terms little endian or big endian refer to
the ordering of data item as stored in memory.
These items are typically 16-bit or 32-bit integers.
Endianness is a difference in data representation at the
hardware level.
Processor architectures that use the little endian: x86, 6502,
Z80, DEC VAX & PDP-11, ARM version 1 & 2.
Big-endian format is used on: Motorola 6800, IBM
System/360, system/370, SPARC until version 9. There is
a need for conversion or byte swapping
8
Look up tables (LUTs) and gray level “windows”
the same data may look different
9
Color LUTs
Demonstration viewing of the image: CTbrain.im
a) default scale
b) background: center = 100, width = 200
c) bone: center = 2000, width = 2000
d) soft tissue: center = 1050, width = 50
e) color LUTs: hot body, rainbow, polar, blue-
yellow, shades of red (g,b) , inverted and
combined scales
10
Image file formats
Simple 2D non-medical formats:
PGM, BMP, JPG, TIFF, PNG
lossless and lossy compression
11
Medical image format DICOM
Digital Imaging and Communications in Medicine, defined by ACR and NEMA
dicom web site http://medical.nema.org/
DICOM is a specification for the creation, transmission, and storage of digital
medical image and report data
very complex, DICOM document has >1,000 pages
many individual files, redundant informaton,
appears initially unorganized
DICOMDIR file restores order, but it is optional
hierarchical structure: patient, study, series, image
file: header, image data
header: variable length. some unrelated to image storage
12
DICOM
To comply with DICOM standard, a manufacturer of imaging equipment must provide a
DICOM Conformance Statement.
DICOM capabilities are expressed as Service-Object Pair (SOP) Classes.
SOP is DICOM jargon for saying that a given capability, such as storage of CT images,
relates to both an object (CT image) and the service (storage).
All DICOM SOP Classes are identified by a name and a unique identifier, for example:
CT Image Storage 1.2.840.10008.5.1.4.1.1.2
For image transmission, DICOM follows client/server model.
client = Service Class User SCU
server = Service Class Provider (SCP).
SCU (or client) requests some service from the SCP (or server). For example: a viewing
console software SCU wants to know if a CT scanner software SCP is active and can be
reached on the network. The SCU requests this verification and the SCP, if active,
provides a response. No data is exchanged.
13
A closer look at DICOM file header
A DICOM file contain a file header portion, File Meta Information portion, and a single
SOP instance. The header is made up of a 128 byte preamble, followed by the
characters „DICM‟.
Following the header is the File Meta Information. This portion contains information
about the file, the series and study it belongs to, and the patient that it belongs to. This
information is frequently parsed into elements called DICOM tags.
There are three types of DICOM tags.: manadatory, conditional, user-defined
14
Key problem: organizing slices into 3D volumes
An easy way: use the image number tag?
However, the image number ("instance number") is not reliable.
Some scanners increase the numbering from the top of the head to the bottom.
The image number meaning depends on the MRI sequence, it may be the acquisition
order, which could be ascending, descending, or interleaved.
The DICOM tag "Slice Spacing" is supposed to be the center-to-center
distance between adjacent slices, but on some scanner it means
slice thickness. the gap between slices, or the gap between "slabs"
15
Solution: use "IOP" and "IPP" tag information
The "Image Orientation Patient" tag gives the direction (unit vector) for the rows and
for the columns. IOP and tags use the R A S coordinate system, where "x" is left
to right, "y" is posterior to anterior, and "z" is inferior to
superior. The center is usually scanner‟s isocenter.
Typical transverse (axial) image will have
IOP = {1.0, 0.0, 0.0, 0.0, 1.0, 0.0}
Another example:
IOP = {0.99, 0.0, -0.02, -0.02, -0.13, -0.99}
The "Image Position Patient" IPP tag gives the coordinates of the first voxel in the
image in the R A S coordinate system
16
To construct a volume
First, calculate the slice normal from IOP vector:
normal[0] = IOP[1]*IOP[5] - IOP[2]*IOP[4];
normal[1] = IOP[2]*IOP[3] - IOP[0]*IOP[5];
normal[2] = IOP[0]*IOP[4] - IOP[1]*IOP[3];
You only have to do this once for all slices in the volume.
Second, calculate the distance along the slice normal using the IPP vector:
z=0.0;
for (int i = 0; i < 3; ++i)
z += normal[i]*ipp[i];
Third, order the slices according to the value of z. Calculate the slice spacing as the
difference between adjacent z values. Verify that differences are equal between slices.
17
Format of Analyze header (binary file)
int sizeof_header // the byte size of the header file.
char 'r' // ‘regular’ = all volumes are the same size.
short int dim[]; // fixel length array of the image
dimensions
// dim[0] = # dimensions in the file; usually 4
// dim[1] = X = number of pixels in an image row
// dim[2] = Y = number of rows in slice
// dim[3] = Z = number of slices in a volume
// dim[4] = T = number of volumes in the file, often =1
short int datatype;
// 0 Unknown data type
// 1 Binary (1 bit per voxel)
// 2 Unsigned character (8 bits per voxel)
// 4 Signed short (16 bits per voxel)
// 8 Signed integer (32 bits per voxel)
// 16 Floating point (32 bits per voxel)
// 32 Complex (64 bits per voxel; 2 floating point numbers)
// 64 Double precision (64 bits per voxel)
short int bitpix; // # bits per pixel; 1, 8, 16, 32, or 64.
float pixdim[]; // Parallels dim[], voxel measurements in mm
// pixdim[1] voxel width
// pixdim[2] voxel height
// pixdim[3] slice thickness
18
NYU Midas header
Similar to Analyze but simplified:
The file is in text format (Analyze header is a binary file).
No fixed order of tags.
There is minimal required information (in bold font below)
Bytes per pixel:=2
Number of dimensions:=3
Size of dimension[0]:=140
Size of dimension[1]:=192
Size of dimension[2]:=256
Pixel size (mm):=1.093750
Slice width (mm):=5.0
Window center:=112
Window width:=225
colormap:=0
Date created:=2010.12.2
Manufacturer:=SIEMENS
Modality:=MRI
Patient name:=
Users often add new tags.
19
Image quality
System signal-to-noise ratio (SNR) is an important feature of medical images. Without
sufficient SNR we would be unable to detect small, low contrast lesions. Before
accepting a new scanner, the customer (clinic, radiology practice, or hospital) should
measure SNR.
A large uniform phantom should be used: ~10 cm diam. for head scans, ~20 cm for
body scans. The phantom should have characteristics of human body. Procedure:
acquire two scans, image1, image2 sequentially
calculate the voxel-by-voxel difference image: image3 =
image1 - image2
construct a large (~75% phantom volume) central region-of-
interest (ROI)
S = ROI average for image1
D = ROI standard deviation for image 3
compute N = D/2 and S/N
Many factors influence the SNR in MR
images: receiving coil resistance, inductive losses in the sample, the
image voxel size, the receiver bandwidth, the number of averages in the image
acquisition.
20
Regions of Interest
A Region of Interest or volume of interest, often
abbreviated ROI/VOI, is a subset of grid points that
define the image. ROIs are often created to specify
image regions, tissue structures or lesions.
The voxels within a tumor may be defined to measure
its size. The cardiac border may be defined on an
image, perhaps during different phases of the cardiac
cycle, to measure cardiac function.
a region of interest can be taken literally from a 2D map.
ROIs can be encoded:
as an integral part of the image, with a special abnormal value which tags
individual voxel signal
as a separate image, having binary (yes/no) value instead of signal
as a separate purely vector graphic entity , such as as a circle, box, or a polygon.
21
Probability distribution
We are often interested in probability distribution of noise in MR and other medical
imaging modalities, or of measured signal that is contaminated by random noise.
A probability distribution can be specified by its density function f(x). The measures
(random variable) are on the x-axis. The area under f(x) between two points signifies the
probability of an observation falling between those two points. The total area under a
probability density function is 1. Important and common probability distributions
include: the uniform distribution, the normal distribution, the Poisson distribution --
important in nuclear medicine images
𝑃 𝑎 < 𝑋 < 𝑏 = 𝑓 𝑥 𝑑𝑥𝑏
𝑎
𝐸 𝑋 = 𝜇 = 𝑥𝑓 𝑥 𝑑𝑥∞
−∞
𝑉𝑎𝑟 𝑋 = (𝑥 − 𝜇)2𝑓 𝑥 𝑑𝑥∞
−∞
22
Noise propagation from k-space to image space
The real and the imaginary images are reconstructed from the acquired data by the
complex Fourier transform. Fourier transform is a linear and orthogonal transform, it
will preserve the Gaussian characteristics of the noise.
The noise in the corresponding real and imaginary voxels can be assumed normally
distributed and uncorrelated.
Most common form for MR images is the magnitude M of the measured signal, because
it avoids the problem of phase artifacts. M is computed as the square root of the sum of
squares of real and imaginary images, a nonlinear mapping. The probability distribution
for M is not normal, it is known as Rician distribution (Rice density):
𝑃 𝑀 =𝑀
𝜎2 𝑒−(𝑀2+𝐴2) 2𝜎2 𝐼0
𝐴 𝑀
𝜎2
I0() is the zeroth-order Bessel function of the first kind, A is the signal in the absence of
noise, and is the standard deviation of the noise in the real and imaginary images
(which are assumed to be equal).
23
Rician distribution
Plot of Rice density for SNR = A/ = 6,5,4,3,2,1,0. The mean values
for each case are shown as vertical bars.
24
Rician distribution
Rician distribution is asymmetric for small SNR
For A/ > 3 it approximates the normal distribution.
The mean of the Rician distributions is larger than A/. This bias is due to the nonlinear
transform of the noisy data.
A special case of the Rician distribution is in image regions where only noise is present,
A = 0. This is known as the Rayleigh distribution.
Thus Rayleigh distribution gives the probability distribution for the noise in modulus
image in regions with no signal. The mean 𝜇0 and the variance 𝜎02 for this distribution
can be computed analytically:
𝜇0 = 𝜎 𝜋2 ~ 1.253 𝜎
𝜎02 = 2 −
𝜋
2 𝜎2 = 0.429 𝜎2
25
Program for Friday lab
Understanding image formats
Apply simple operations in signal intensity space
Viewing DICOM files in MATLAB
Computing slice position Z from IPP and IOP
Loading 3D arrays from DICOM format.
Convert 3D image to Analyze7.5 format
Convert magnitude and phase images to Real and Imaginary images
Constructing ROIs and estimating image noise
Thank you!