Top Banner
GÖTEBORG UNIVERSITY M.Sc. Thesis Matlab tool for segmentation and re-creation of 1 H-MRS volumes of interest in MRI image stacks Mikael Montelius Supervisors: Maria Ljungberg, Ph.D. Åsa Carlsson, Ph.Lic. DEPARTMENT OF RADIATION PHYSICS GÖTEBORG UNIVERSITY GÖTEBORG, 2008
62

1044931 Mikael Montelius Rapporten Utan Kod

Oct 22, 2014

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1044931 Mikael Montelius Rapporten Utan Kod

GÖTEBORG UNIVERSITY

M.Sc. Thesis

Matlab tool for segmentation and re-creation of 1H-MRS volumes of interest in MRI image stacks

Mikael Montelius

Supervisors: Maria Ljungberg, Ph.D. Åsa Carlsson, Ph.Lic.

DEPARTMENT OF RADIATION PHYSICS GÖTEBORG UNIVERSITY

GÖTEBORG, 2008

Page 2: 1044931 Mikael Montelius Rapporten Utan Kod

Abstract In in vivo Magnetic Resonance Spectroscopy (MRS) of the brain it is important to know the relative tissue volume of the volume of interest (VOI) specified in the measurement. In this project a tool for evaluating these relative tissue volumes was implemented in Matlab code. The program will be used in an MRS study of Obsessive Compulsive Disorder (OCD). The tool was programmed to allow interactive segmentation of the Magnetic Resonance (MR) images used when planning the VOI from where the MRS signal was extracted. The tool was also programmed to recreate and superimpose the VOI in the image stack and the accuracy of the positioning was tested in a phantom study. A PMMA (PolyMethyl MethAcrylate) cube was used as a phantom and was scanned in several MR scanners at Sahlgrenska University Hospital. The VOI was planned to coincide with the signal lacking cube, and an MRS spectrum was created to export the VOI settings from the scanner. The images and VOI settings were run through the tool and this produced a very good match between recreated VOI and the signal lacking PMMA cube. This was repeated for several phantom angulations and all results were equally good. Orthogonal image stacks which were recreated from the scanned images were also run through the tool with the same good result. Six series of volunteer measurements were performed following the OCD study routine to test the repeatability of the tool and the ability to create the same VOI position each time in in vivo MRS. The same volunteer was used all six times, and the resulting tissue ratios showed constancy over the series.

2

Page 3: 1044931 Mikael Montelius Rapporten Utan Kod

Acknowledgements I would like to express my gratitude to all those who gave me the possibility to complete this thesis. I am deeply indebted to my supervisors Maria Ljungberg and Åsa Carlsson for their patience and professional support and to Göran Starck for his technical advising. I would also like to thank the other co-workers and roommates at the department of MR and my classmates for an enjoyable time while producing this thesis. Especially, I would like to give my special thanks to my girlfriend Mia and all my family whose patient love enabled me to complete not only this project, but also my entire education.

3

Page 4: 1044931 Mikael Montelius Rapporten Utan Kod

Nomenclature 3D Three dimensional B0-field Static magnetic field of the MR scanner. CHESS Chemical Shift Selective (MR technique) Cho Choline Cr Creatine–phosphocreatinine CSF Cerebrospinal Fluid DICOM Digital Imaging and Communications in Medicine FID Free Induction Decay FT Fourier Transform Gln Glutamine Glu Glutamate GM gray matter in vitro Experiment outside a living organism, here phantom

experiments in vivo Experiment on a living organism Metabolite Molecule involved in metabolic process MR Magnetic Resonance MRI Magnetic Resonance Imaging MRS Magnetic Resonance Spectroscopy NAA N-acetyl aspartate OCD Obsessive Compulsive Disorder Precessional Rotating motion of spinning axis PMMA PolyMethyl MethAcrylate PRESS Point Resolved Spectroscopy (MRS pulse sequence) RF-pulse Radio frequent pulse T1 Longitudinal, or spin-lattice, relaxation time constant T2 Transversal, or spin-spin, relaxation time constant T2* T2, including external factors, decreasing the relaxation

time TE Echo Time TFE Turbo Field Echo TI Inversion Time TMS Tetramethylsilane TR Repetition Time VOI Volume of interest Voxel Volume pixel WM white matter

4

Page 5: 1044931 Mikael Montelius Rapporten Utan Kod

Contents Introduction ....................................................................................................................................6 1. Aim...........................................................................................................................................7 2. MR Basics................................................................................................................................7

2.1.1. Nuclear spin and energy states..............................................................................7 2.1.2. The Larmor equation.............................................................................................7 2.1.3. The Radio Frequency pulse and the Free Induction Decay ...............................8 2.1.4. Relaxation-, Repetition- and Echo Times ............................................................9

2.2. MRI................................................................................................................................10 2.2.1. Image construction ...............................................................................................11 2.2.2. The turbo field echo sequence .............................................................................11

2.3. MRS ...............................................................................................................................13 2.3.1. Spectroscopy .........................................................................................................13 2.3.2. The Chemical Shift...............................................................................................14 2.3.3. J-coupling ..............................................................................................................15

2.4. Digital image matrices .................................................................................................16 2.4.1. Image histogram thresholding and segmentation .............................................16 2.4.2. The Binary Mask ..................................................................................................18

2.5. Data Format..................................................................................................................19 2.6. Anatomy of the brain ...................................................................................................20

3. Material and methods ..........................................................................................................21 3.1. The Image Processing toolbox in Matlab ...................................................................21 3.2. Determining the image and VOI coordinate systems ...............................................21 3.3. Partitioning the tool .....................................................................................................22 3.4. Segmentation.................................................................................................................22 3.5. VOI re-creation ............................................................................................................27 3.6. Verification of VOI re-creation...................................................................................33 3.7. In vivo verification of repeatability.............................................................................34

4. Results ...................................................................................................................................37 4.1. The image and VOI coordinate systems.....................................................................37 4.2. Segmented images ........................................................................................................38 4.3. VOI re-creation ............................................................................................................40 4.4. Verification of VOI re-creation...................................................................................42 4.5. In vivo verification of repeatability.............................................................................44

5. Discussion ..............................................................................................................................49 6. Conclusions ...........................................................................................................................54 7. References .............................................................................................................................54 8. Appendix ...............................................................................................................................56

8.1. Maths .............................................................................................................................56 8.2. To make changes in the code .......................................................................................59 8.3. Experience based tool instructions. ............................................................................60 8.4. Matlab code reference..................................................................................................62

5

Page 6: 1044931 Mikael Montelius Rapporten Utan Kod

Introduction Obsessive Compulsive Disorder (OCD) is an anxiety disorder characterized by the occurrence of repeated and distressing intrusive thoughts and compulsive actions performed to lessen distress [1]. The disorder is typically treated with behavioral therapy, cognitive therapy, medications, or any combination of the three. To better understand the disorder, researchers at Sahlgrenska University hospital use in vivo magnetic resonance spectroscopy (MRS) in clinical studies of the metabolite concentrations in parts of the brain believed to be affected [2]. The patient stays in the MR scanner during the whole examination and a survey MRI (MR Imaging) scan is performed to get an overview of the position of the patient. With the aid of this survey, the operator plans a 3D image stack or a multiple series of 2D images with better resolution to resolve the structure of the brain. From this image stack several reconstructions are made. These are rotated freely in three dimensions to better meet the criteria of the exam. All these images are used to position a volume of interest (VOI), which has the shape of a rectangular parallelepiped, around some particular region of the brain depending on what is examined. Using the PRESS volume selection method [3], the VOI is defined by the intersection of three orthogonally excited planes. The signal emitted from this particular region is collected by the receiver coil and mathematically transformed into a spectrum showing the different metabolites present. Because of the limited rectangular shape of the VOI, and the complex structure of the brain (gyri and sulci), the VOI will often overlap both white matter (WM), gray matter (GM) and cerebrospinal fluid (CSF) and hence, the signal will include contributions from all three compartments. Different states of ill-health involve an increase or decrease of some of the metabolites in specific parts of the brain. Also of interest is the origin of the particular metabolite, i.e. if they occur in WM, GM or CSF. For example; increased levels of some metabolite in a region of the brain (included in the VOI) may be wrongly interpreted if the region contains a large volume of CSF. Consequently there is a need of finding out the ratio of GM, WM and CSF in the VOI. Another problem, specific to the MR post scanning equipment available at Sahlgrenska University hospital, is that the planed VOI is not superimposed on any of the images. This means that after the exam is completed, the straightforward visual information of from where the signal originated is lost. This makes it difficult to re-establish the ratio of WM, GM and CSF contributing to the signal. Moreover, as mentioned earlier, the 3D image stack is rotated freely in all three dimensions, but the VOI information (size, displacement and angulations) is stored as defined by the system of coordinates defined by the MR scanner. Hence, it is not a straightforward task to recreate the position of the VOI in the stack of images.

6

Page 7: 1044931 Mikael Montelius Rapporten Utan Kod

1. Aim The aim was to create a Matlab tool for superimposing the VOI in the 3D image stacks, and also to determine the relative volume of the three tissue types (CSF, WM and GM) within the VOI. The project also included a validation of the spatial VOI re-creation part of the tool by phantom measurements, and to ensure a satisfying segmentation, to perform measurements on a volunteer.

2. MR Basics

All parts of the human body contain hydrogen atoms, or protons, to some extent and the concentration is specific to the tissue. Fortunately, they also posses certain characteristics which makes it possible for us to manipulate them so as to give us a hint of where they reside without any surgical intervention whatsoever. The concentration differences amongst tissues and the structure of the molecular lattice in which they are inherent also enables us to spatially encode the different signal intensities, i.e. to produce images of the interior of the body. It is possible to use nuclei other than the hydrogen nucleus but there are some restrictions of choice. For example, they have to be numerous enough for signal detection and incorporated in the tissues or molecules of clinical interest. For the theoretical sections 2.0–2.3 (MR Basics), the textbooks in references [3]-[6] were used.

2.1.1. Nuclear spin and energy states Another absolutely necessary physical property is the nuclear spin, and the hydrogen nucleus has a so called nonzero spin. Spin is an intrinsic property of the particle but it can be understood classically as a spinning electrical charge (the proton spinning around its own axis) inducing a magnetic moment, a dipole. The spin is, in turn, characterized by a quantized number, depending on the type of nucleus, and this number decides in how many energy states the nucleus can exist. The proton can occupy two different energy states and the energy difference between these states is given by equation 1: 0BE hγ=Δ (1) where EΔ [eV] is the energy difference, γ [Hz T-1] is a constant specific to every species of nuclei, called the gyro magnetic constant, h [eV s] is Planck`s constant dby

ivided π2 and [T] is the magnitude of the externally applied static magnetic field.

0B

2.1.2. The Larmor equation

The dipole property of nonzero spins causes them to act as sub microscopic bar magnets,

which enables them to interact with the B0-field. This interaction causes the axes of the spins to rotate or precess round the direction of the B0-field. De Broglie’s wave equationgives us the relation between frequency and energy:

7

Page 8: 1044931 Mikael Montelius Rapporten Utan Kod

ωh=ΔE (2)

where

ω [rad s ] is the angular frequency of precession. n uency, called the Larmor

-1

Combi ing equation 1 and 2 gives us the precessional freqfrequency, and the Larmor equation:

00 Bγω = (3)

where

0ω [rad s-1] is the angular frequency of precession round the B0-field.

requency pulse and the Free Induction Decay

thermal equilibrium there is a slight excess of spins in the lower energy state, i.e. their

e

g a

2.1.3. The Radio F Inprecession axis is aligned with the B0-field, see figure 1. This results in a net magnetic moment in this direction. Exposing a spin to a Radio Frequent pulse (RF-pulse), with a frequency given by equation 3, the spin will be stimulated to change its energy state. Thprobability of change is equal in both states, but since the spins in the lower state outnumber the spins in the higher state, more of the former will change state duringiven time interval. Hence, by carefully adjusting the timing of the RF-pulse, one can decrease the net magnetic moment to zero, and even further.

Direction of B0-field

++

Spin axis

Precession motion

Nucleus

+

Axis of precession

+

Figure 1. Left: Spin in lower energy state. Right: Spin in higher energy state.

en more important to MR, the RF-pulse also induces a phasing, or synchronizing of the

his

Evprecessional motion, causing the spins to add up to a net magnetic moment in the plane perpendicular to the B0-field. Since this net magnetic moment also precesses with the Larmor frequency, it induces a current in a receiver coil according to Faraday’s law. Tsignal is called the Free Induction Decay (FID).

8

Page 9: 1044931 Mikael Montelius Rapporten Utan Kod

To better understand the following discussion, it is easier to imagine following the s

e s

The

hen the

precessional motion of the net magnetic moments from a rotating coordinate systempoint of view. Figure 2 shows the net magnetic moment precessing around its axis at thLarmor frequency (left) and the same magnetic moment in the rotating coordinate system(right). The tilted vector can be seen as a sum of the perpendicular vector couple, representing the longitudinal (vertical) and transversal (horizontal) magnetization. flip angle, α, with which the magnetic moment is tilted, can posses any number, depending on the time and strength of the RF-pulse, when applied to the spins. WRF-pulse is switched off, the spins start returning to their equilibrium.

α

Figure 2. The in phase spins, or magnetization vector, precess around the external field at t e Larmor

.1.4. Relaxation-, Repetition- and Echo Times

hen the excited spins return to their ground state, the equilibrium, they emit their excess

s

lue

F-

spin-spin

hfrequency (left) but viewed from a rotating coordinate system, they do not seem to rotate, only varying in flip angle (right), equal to the varying cone angle. The perpendicular vector couple is the longitudinal and horizontal magnetization vector components.

2 Wenergy. If the nucleus was not part of a lattice of other nuclei, which creates an emission stimulating environment, a spontaneous emission could take a long time. The time it takefor a sample, excited by an RF-pulse to a 90˚ flip angle, to recover to 63 percent of its equilibrium value, is called the spin-lattice relaxation time, or T1. This is a constant, specific to each tissue and highly dependent on applied magnetic field strength. Its vais typically some hundred ms. A much faster relaxation occurs at the same time, but without energy loss. This is due to the fact that spins, in phase immediately after the Rpulse, start to dephase, i.e. their precession around the external field lose their synchronization and the net signal fades away. This time constant is called the

9

Page 10: 1044931 Mikael Montelius Rapporten Utan Kod

relaxation time, or T2, and it is also highly dependent on the type of tissue. Fluids with low viscosity have a slower relaxation and thereby longer T2, but solids and high viscosity fluids have a very short T2. T2 relaxation is to a great extent the reason tlow signal from for example bone. There is also a dephasing due to the static and time varying magnetic fields induced by neighboring magnetic moments, imperfections in thexternal field or any other magnetic field inhomogeneities. The corresponding time constant is called T2* (T2 star) and it is shorter than T2.

o the

e

he specific time constants of different tissues allow us to manipulate the magnetic (the

ed in

2.2.

SF, fat, white and gray matter all have different T1 and T2, and by for example is

nd

ion

r

wing how to create different contrasts for different tissue types, the origin

n one

create a magnetic field gradient in any direction required.

Tmoment in advantageous ways using different pulse sequences. Applying a 90˚ pulseRF pulse is applied long enough to flip the magnetization vector 90˚) several times, with a repetition time (TR) equal to five times T1, approximately full relaxation will occur between each repetition and hence, the magnetization vector will be as large as possible when “knocked” down in the transversal plane again. Since signal perpendicular to the main magnetic field, i.e. in the transversal plane, is the signal possible to monitor, the recorded signal will now be as large as possible. However, if TR is made smaller, a smaller signal will be measured since the longitudinal relaxation will not be complettime, and less signal can be flipped in the next pulse. If several substances are present in a sample, each with different T1 values, it is possible to suppress the signal from some of them by applying a TR long enough for some of the tissues to fully relax, whilst others, with a longer T1, will not be able to fully recover between the pulses. The difference in signal from the substances leads to differences in contrast (relative brightness between different tissues) in an MR-image. MRI Cmanipulating the TR and TE of a sequence, different weightings of the images canproduce contrasts for various purposes. If a short TR and TE are chosen, the image called T1-weighted. This is because the longitudinal relaxation is yet not completed, athe differences in T1 between tissues are pronounced in the image. The tissue with the shortest T1 will have recovered more than the others and hence produce a greater signalwhen flipped down a second time, and so on. If on the other hand one allows a long TR, but still a short TE, the greatest contrast difference will be due to the different proton densities in the tissues since this is the signaling substance. A long TR allows full T1 relaxation for all tissues (avoid T1 weighting) and a short TE will not allow T2 relaxat(avoid T2 weighting) and the only difference left is the proton density. Similarly, a long TR and TE produce a T2-weighted image. There is also a possibility to use smaller flip angles, i.e. the longitudinal magnetization vector is only slightly tilted and thus allows foa shorter TR. Apart from knoof the signal giving tissue has to be established in order to get an image. This is done utilizing spatially varying magnetic field gradients, or often just called gradients. A gradient coil is used to create an additional magnetic field that varies over the room idirection and it is of much smaller field strength than the B0-field. In the MR system there are several gradients integrated, three of them are used for the spatial encoding, i.e. to

10

Page 11: 1044931 Mikael Montelius Rapporten Utan Kod

2.2.1. Image construction To select a slice of the body, from where to produce the image, a slice selective gradient is added to the B0-field. This enhances the field in one direction and reduces it in the other. If this is done properly, the result will be a linear increase of the magnetic field, e.g. in the head feet or z-direction. Hence, protons in different z-positions in the body will experience different magnetic field strength, causing them to precess with different Larmor frequencies (equation 3), depending on the position. Since the strength of the gradient is known [mT m-1], the precessional frequency of every z-position is also known. Carefully selecting an appropriate frequency range of the RF-pulse, only a slice with protons precessing with Larmor frequencies corresponding to this RF-range will be excited. Once the slice is properly excited, it remains to spatially encode the signal within the slice. Two in plane orthogonal gradients are applied. The first one is the so called Phase encoding gradient; this creates a magnetic field gradient in one direction; for example the x-direction, in the image plane. It will cause the so far in-phase, synchronized protons to experience a varying magnetic field strength depending on their position on the x-axis, causing them to change Larmor frequency. This causes a dephasing along this axis, and once the gradient is turned off, every proton returns to the original Larmor frequency, but keeping their new phase. The net signal stemming from all protons recently in phase is now reduced. The only parts of the slice still signaling enough for detection are the parts having the exact spatial frequency (spatial variations of signal giving matter) to be in phase again (but shifted an integer number of 360˚) when the gradient was turned off. The stronger the gradient and the longer the time it is turned on, the higher the spatial frequencies being in phase when the gradient is turned off. Large homogenous objects have a low spatial frequency and edges and small objects have a high spatial frequency so to collect the entire image, this has to be repeated with different gradient strengths. But before this, the y-direction of the slice is spatially encoded by the Frequency encoding gradient. This induces a spatially varying static magnetic field in the y-direction, and protons in this direction will start precessing with the corresponding Larmor frequency, but still keeping their phase difference in the x-direction. The phase, frequency and intensity of the signal are detected by the receiving coil, but before the information can be transformed to reveal an image, this process needs to be repeated several times. The strength of the phase encoding gradient is changed each time to include another spatial frequency. When all information is collected, the spectral information can be transformed into the real image by applying the inverse Fourier transform. 2.2.2. The turbo field echo sequence The repeating order in which the gradients and RF-pulses are applied when the image is acquired is called the pulse sequence and there are numerous of sequences to choose between in MR. A routinely used sequence is called the turbo field echo (TFE) sequence and it utilizes extremely short TR and flip angles to acquire images in a very short time. This inevitably leads to poor T1 contrast, and to get around this problem, an inversion pre-pulse is used, i.e. an 180˚ pulse flipping the magnetization vector in the opposite direction of the B0-field before the fast repetition of several TRs. The delay between the

11

Page 12: 1044931 Mikael Montelius Rapporten Utan Kod

180˚ pulse and the TRs will cause enhanced T1 weighting since there will be more time r T1 relaxation. Before reaching full relaxation, the magnetization is flipped again, but

e

on of is

foonly partially using a small flip angle this time. The slice is selected and the frequency and phase encoding occurs with sub sequent signal acquisition. The latter part, from thsmaller flip to the acquisition, is repeated with different phase encodings. Either RF- or gradient spoiling is used to ensure that the remaining magnetization in the transversal plane is removed before the next repetition of TR. This is done to avoid contaminatiT1 weighted images by T2 effects. Figure 3 illustrates the timings of the sequence andcalled a pulse sequence diagram.

RF

Gss

GPE

GFE

Signal

spoiler

α180˚ TR loop

TI

TE

Figure 3. Pulse sequence diagram for a turbo field echo sequence with gradient spoiling. Repetittime (TR) is the time between α-pulses in the loop.

In this diagram the parallelepipeds illustrate the direction and m

ion

agnitude of the gradients, here GSS are the slice selection gradients, GPE the phase encoding gradients, and GFE the

hey are turned on is illustrated by their relative idth on the time line. Also illustrated are the RF-pulses and time parameters. TI is the so

r,

wfrequency encoding gradients. The time twcalled Inversion Time, i.e. the time allowed for T1 relaxation before the TR loop. If the slice is made much thicker, it is possible to create a 3D image from this slice. The refocusing gradient can now act as a phase encoding gradient, with altering strength. Hence, the signal is now emanating from the entire volume, frequency encoded in one direction and phase encoded in the other two orthogonal directions. There are, howevestill “slices” in the 3D volume, but they are contiguous. The 3D image volumes also have

12

Page 13: 1044931 Mikael Montelius Rapporten Utan Kod

the advantage of not missing anything in the gaps between slices, and they can later be reconstructed to produce cross section images with any angulation. MRS In MR Spectroscopy (MRS) one can choose to excite different nuclei, depending on thspecific area of interest. There is also a possibility, explained later in the text, to find out which molecule the nucleus is part of. A molecule involved in a metabolic process is called a metabolite, and the detaile

2.3.

e

d knowledge of the occurrence and concentration of ese in specific parts of the brain is of great importance to the physician. The metabolites

investigated in the OCD study at Sahlgrenska university hospital are mainly the Choline (Cho), Creatine–phosphocreatinine (Cr), Glutamine (Gln), Glutamate (Glu) and N-acetyl aspartate (NAA) [2]. In vivo MRS, meaning MRS on a living organism such as a human being, utilizes both MRI and MRS to investigate the occurrence of metabolites in specific parts of the organism. The former is necessary to plan the exact position of interest in the body (positioning the VOI) and the latter to extract the metabolic composition in the selected volume. 2.3.1. Spectroscopy Spectroscopy is usually defined as the study of interactions between radiation and matter, based on the physical phenomenon of resonance (from a classical physicist’s point of view). The MR equipment emits a radio frequent electromagnetic pulse (the RF-pulse introduced earlier) with a bandwidth spanning the frequency range of the nucleus investigated. As mentioned earlier, the gyro magnetic constant is specific to the type of nucleus. In addition to this, the molecule in which it is part of slightly alters the magnetic surrounding of the nucleus, as explained in the next section. This result in a spectrum of frequencies convolved in the returning signal, the FID, where each constituent frequency is specific to the metabolite containing the nucleus. Analogously to a prism separating the different frequencies (colors) of visible light, a mathematical operation called the Fourier Transform (FT) is applied to separate the frequencies of the FID. After applying this

the amount of the different metabolites). igure 4 is a schematic sketch of a Fourier Transform.

th

transform one can analyze the signal for its frequency components and determine the intensity of each component (proportional to F

13

Page 14: 1044931 Mikael Montelius Rapporten Utan Kod

Figure 4. The Fourier Transform of a signal reveals its frequency components.

2.3.2. The Chemical Shift The detailed knowledgb u t

e of the plot of radiofrequencies shown in figure 4 tells something o t he chemical environment of the nuclei emitting the signal. To understand this, a a

slight modification of equation 3 is necessary. The parameter σ is introduced. effBBB γσγω =−= )( 00 (4) While γ [s-1 T-1] is characteristic of each atomic species, σ is the screening factor stemming from the fact that a nucleus of some particular kind experiences a slightly modified B0-field depending on where it is located. Electrons orbiting the nucleus, for example, induce a magnetic field which may increase or decrease the effective magnetic field experienced by the nucleus, hence the index in effB . Also, the chemical structure of the molecule to which it is bound contributes to the screening effect and alters the effective magnetic field. The 1H spectrum of ethanol, CH3CH2OH, presents three resonance lines, due to the fact that the hydrogen in the OH group is less shielded than two magnetically equivalent atoms in the CH2 group, w

the hich in turn are separated from the

ree equivalent atoms in the CH3 group. In simple terms, depending on the magnitude of the off-set from the expected, unscreened nucleus, and the number of lines in a group of lines, the spectroscopist can tell what molecules are present in the sample. Since

th

γ undergoes large variations from nucleus to nucleus, and the screening factor σ is les itive, the resonance frequencies for the various nuclear species are widely separa several MHz) while for each nuclear species, there will only be small differences (a few hundred Hz) depending on the chemical environment. Furthermore,

ergy difference

s sensted (

since the en EΔ , and hence the resonance frequency, is proportional to the strength of the B0-field (equation 1 and 4), it is necessary to introduce another parameter,

14

Page 15: 1044931 Mikael Montelius Rapporten Utan Kod

for comparison of spectra between different MR-equipment, where differences in field strengths are inevitable. This parameter, called the chemical shift and denoted byδ , is a relative parameter given in parts per million.

ppmrefx 6

010*

ννν

δ−

= (5)

Where xν , refν and 0ν [s-1] are the frequencies of the specific nucleus, a reference

y. This allows comparison of spectra from ent and a specific spectral line is assigned a typical

nucleus and the operating frequency respectiveldifferent MR-equipm δ -value, independent of the B0-field. Figure 5 shows a typical spectrum of ethanol, where four groups are clearly visible. The rightmost is TMS (Tetramethylsilane), the most common reference molecule in H-MRS, positioned at 0 ppm.

J

re t st

1

Figure 5. Spectrum of the three groups of ethanol and the reference molecule TMS (at 0 ppm)

2.3.3. -coupling As can be seen in figure 5; in addition to three groups and TMS there is a finer structuwithin the groups, clearly visible in the two rightmost groups. This is due to the fact thathere is also an interaction between spins, called J-coupling. From this, the spectroscopican make even more conclusions about the chemistry of the sample.

Offset (ppm)

a.u.

15

Page 16: 1044931 Mikael Montelius Rapporten Utan Kod

2.4.

nal functio

Digital image matrices An image can be described as a two-dimensio n ),( yxf , where x and are patial coordinates and the value of

y f is the intensity or of the im

sition. oordinates and gray levels are discrete and finite quantities, the ed digi element of the image, i.e. a specific set of coordinates and its

ray level, is called a picture element or a pixel. The difference in gray level between two is c lled the truc e in a

n nt intensities.

gray level age at that sparticular po If the cimage is call tal. Angpixels a con ast, and variations in contrast are what the human mind interprets as a str tur the im ge. Reference [7] was used for section 2.4. In figure 6, part of a digital image of the human brain is enlarged to demo strate theconstituent pixels with differe

Figure 6. a) A digital image (MRI of human brain) consists of a matrix of pixels visible in an enlargement. b) Three pixels with different gray levels. The contrast difference is clearly visible.

The images from an MRI examination are stored digitally and the pixels in the image plane form a 2D matrix. The coordinates of each p s in the matrix and to each coordinate couple is assigned a value of

ixel are the entrief , i.e. to every i:th row and j:th column is

presenting white on an image monitor. Together they form the image.

gram thresholding and segmentation

assigned a gray level or a pixel value, the smallest representing black and the largest re .4.1. I2 mage histo

An image histogram is defined as a plot of the occurrence of each gray level represented in the image. A point on the x-axis is represented by a gray level and the y-axis gives the number of pixels with that specific intensity. A typical histogram is shown in figure 7.

16

Page 17: 1044931 Mikael Montelius Rapporten Utan Kod

Figure 7. The bar under the histogram represents pixel intensity and the height of the vertical lines shows the relative amount of pixels with that specific intensity. Note the two peaks indicated with arrows, corresponding to WM and fat (bright stripe closest to the skin). Note also the two broken lines, dividing the histogram in three compartments, i.e. two possible threshold values.

The histogram is commonly used in image processing and one application is the so called thresholding technique. Based on the shape of the histogram, i.e. the valleys and peaks, a certain gray scale value can be found and set as a threshold. With the aid of some numerical computing program allowing matrix manipulation, all pixels with values lower than the threshold value could be mapped to a new, specific value, for example black, whilst all other pixels could be set to, say white, resulting in a binary image. For illustration; returning to the histogram in figure 7, the two values marked with a dotted line could be set as threshold values and the segmented image would look something like the one to the right in figure 8.

17

Page 18: 1044931 Mikael Montelius Rapporten Utan Kod

Figure 8. Left: original image. Right: Image segmented with two thresholds, separating CSF, gray and white matter with black, gray and white pixels respectively.

The Binary Mask

ies ur

binary mask, only the part of the image corresponding to the region of ones would be unaffected, everything else would be black. This is illustrated in figure 9.

2.4.2. Since an image is stored as a mathematical matrix, it can also be treated as one. For example, it can be multiplied, added or subtracted to another matrix of the same size, a so called filter, or mask. If each entry of the image matrix was to be multiplied by the corresponding entry of a mask, where all entries were zeros, we would end up with a zero matrix, and hence a black image. On the other hand, if the entries of the mask were all ones, the mask would be transparent and our image would be unaffected. Now imagine that most of the entrof the mask were zeros, but some selected region consisted of ones. Multiplying oimage with this mask of zeros and ones, called a

18

Page 19: 1044931 Mikael Montelius Rapporten Utan Kod

Figure 9. Only the parts of the image multiplied by the “ones” (1) in the mask are unaffected, the rest is mapped into black.

The transparent region of the mask does not necessarily have to be a square, but can take any polygonal shape. In this way, a mask can be created allowing for statistic computatioof specific regions of interest.

Data Format

n

2.5.

Digital Imaging and Communications in Medicine - DICOM is the standard image file format generated by a wide variety of radiological hardware. It was created to facilitate storage and data exchange between hardware, irrespective of manufacturer [8]. In addition to image data (the image matrix mentioned in section 3.4), a header is also part of the dicom file. The header contains additional information, such as acquisition parameters, operator and patient identifiers, image dimensions and positioning of each image plane relative to the radiological hardware (here expressed in the physical room coordinates of the MR-scanner), the latter of absolute necessity to successfully solve one of the main problems of this thesis, namely finding the spatial correlation between the VOI and the images. Because of the often necessary high resolution in medical imaging and the fact that medical examinations often comprise multiple slices and multiple contrasts, dicom files tend to be large. In addition, when generating an MRS spectrum, another file

19

Page 20: 1044931 Mikael Montelius Rapporten Utan Kod

containing spectrum parameters (spectrum parameter file – SPAR file) is created, including information about the position and angulations of the VOI.

2.6. Anatomy of the brain Figure 10 is included to illustrate the approximate positions of the volumes of interest, as defined by the OCD study [2]. The leftmost image is a saggital slice positioned slightly offset from the central slice. The VOI is positioned around the Caudate nucleus. The next image shows the mid plane and, from the left; the Gyru Singuli, the Thalamus and the Occipital regions. The last image is a transversal slice showing a part of the Caudate nucleus and the Gyru Singuli.

Figure 10. Position of the different VOIs in the human brain, as defined in the OCD study at Sahlgrenska University hospital. Left Saggital: Caudatus in a plane parallel to mid plane. Middle Saggital: Gyru Singuli, Thalamus and Occipitalis from left to right respectively. Right Transversal: Caudatus barely visible in the same plane as Gyru Singuli.

20

Page 21: 1044931 Mikael Montelius Rapporten Utan Kod

3. Ma

this project, Matlab (MathWorks, Natick, USA) Version 7.4.0.287 (R2007a), equipped g Toolbox Version V5.4 (R2007a), was used. This was run on an

tel(R) Pentium PC with a 2.40 GHz Processor. Software: Microsoft Windows 2000,

ity.

metabolites in the spectrum from the MRS-

3.1. The Image Processing toolbox in Matlab

Matrix Laboratory, or Matlab, was the numerical computing environment and programming language used in this thesis. As the name states, it is particularly useful when working with matrices and it allows easy matrix manipulation. There are also a number of optional toolboxes that acts as interfaces to special applications. One example, which was the only toolbox necessary for the program, introduced later in the text, is the Image Processing toolbox which allows viewing and reading dicom images and information respectively.

3.2. Determining the image and VOI coordinate systems Phantom MRI scans were performed to reveal the directions of the image coordinate

ggital tle

r, as depicted in figure 11.

terial and methods

Inwith the Image ProcessinInService Pack 4. The MR scanners used were a Philips Gyroscan Intera 1.5 T release 2.1.3 and two Achieva 1.5 T releases 2.5.1. A Transmit/Receive head coil of bird cage type from the same vendor (Philips Medical Systems, Eindhoven, the Netherlands) was also used. The parts of the project involving the OCD study [2] was performed according tothe Helsinki Declaration and approved by the Ethics Committee of Göteborg UniversTo extract the concentrations of themeasurements, LCModel (Version 6.1-0) [9] was used.

system for in the Intera scanner. Three orthogonal phantom MRI scans, coronal, saand transversal, were performed. The phantom was made of a 50 cl plastic drinking botfilled with EEC fluid [10] and placed adjacent to a glass sphere, also filled with EEC fluid. Both were placed in the head coil in the scanne

21

Page 22: 1044931 Mikael Montelius Rapporten Utan Kod

Head-FeetAnterior-Posterior

?

?

??

Left-Right? ?

y marks air

, ted). In a

m the same stack (e.g. the coronal image stack) the coordinates ere noted and analysed. This was repeated for every image in all three stacks (saggital,

e phantom was known, the the pixel coordinates changed

s

tion of all

xes could be determined.

3.3. Partitioning the tool The program was subdivided into two major parts. The first part called segment, which was also set as the calling sequence to start the program, was programmed for making the segmentation of the different tissue types. The second part, with calling sequence position, was the part where the operator enters the spatial information of the VOI.

3.4. Segmentation

The flowchart below describes the function of the segmentation part of the tool. The calling sequence is segment and that is also the name of the main file. This is where the program continuously returns variables defined in the different function files, also described in the flowchart.

Figure 11. The bottle placed to the left of the sphere inside the head coil (dotted line). Grabubbles which acted as markers for anterior - posterior.

The images were imported to Matlab using the dicomread function and another function, dicominfo, was used to show the header information of the images. One of the tags in the header, called ImagePositionPatient, included the x-, y- and z-coordinates, in millimetresof the upper left hand corner of the image (centre of the first image pixel transmitsuccessive image series frowcoronal and transversal) and since the true geometry of thmages unveiled the directions in space. By studying howi

between successive images, the image coordinate system could be revealed. Using thiinformation, images from an earlier OCD examination were used to unveil the VOI coordinate system. Since, for example, the Gyru Singuli VOI is positioned more cranial than the Caudatus VOI, i.e. in a translation in the head-feet (hf) direction, the VOI position information stored for each VOI revealed the direction of the VOI coordinatexes. Using the information from all four VOIs in the OCD project [2], the direca

a

22

Page 23: 1044931 Mikael Montelius Rapporten Utan Kod

Generally, when segment was run, all dicom images in the current directory were imported into Matlab and stored as a 3D matrix called V, with every entry representing the gray scale value of the corresponding image pixel. The function get_max was called for and this rescaled the matrix to a satisfactory gray scale. The images were then presented one by one in the function file keypress, where the operator was allowed to choose which image to work with. The function crop displayed this operator selected image and presented another selection, whether to apply thresholds manually or interactively. Once set, the threshold values were forwarded to segment_one, where the image was segmented before it was returned to crop. The image was displayed next to the original one and a possibility of manual adjustment of the segmentation in real time was presented. The adjusted threshold values were returned to segment and a possibility to start all over or to move on segmenting all images with these thresholds was offered. If the latter was chosen, the matrix and threshold values were imported to the function file segment-all, where all images were segmented and stored in a new 3D matrix called A, before returned to segment. The segmented images were presented, one by one, next to the corresponding original images and both matrices were now defined and available to the next part of the program.

23

Page 24: 1044931 Mikael Montelius Rapporten Utan Kod

--segment-- Variables defined: Description:

24

C Array with names, dates and sizes of the dicom files present incurrent Matlab directory.

the

a Vector with file names, extracted from C , e.g. [1.dcm ... 10.dcm]

b Length of vectorC , i.e. number of dicom files in directory. ),,( kjiV Matrix created from all b images in stack, each consisting o

pixels. Every entry was assigned the corresponding image pixgray scale value.

f i x j els

--get_max-- Function included to find the greatest pixel value in the entire image stack and to returnsegment. Variables defined: D

Ca ,

it to

escription: Integer between 0 and 65535 (maximum value possible). valmax_

valmax_

--segment-- To allow viewing the images in Matlab, a scaling of every, inV existing gray scale value, was performed. Variables defined: Description:

65535 divided by , rounded down to the closest integer. valmax_int V int⋅=VV re-defined

bV ,

--keypress-- Included to present the images inV to the operator, one by one, to decide which image

):,(:, dV , bd ..1= , to work with. A menu was included in this function, with a next, previous and OK button. Variables defined: Description:

Image number chosen. d

Vd ,

Page 25: 1044931 Mikael Montelius Rapporten Utan Kod

--crop-- To choose threshold v this function walues, as programmed to present the operator with the image chosen in the previous functselected by the operator. The pixels in this selection were presented in a histogram. A menu in which the operator was aske ra ely was also displayed. If manually, values were req indow. If interactively, the operator was presented with a cursor for m the interface between tissue typ Variables defined:

ion. A cursor was included with which a section of the image was

d to set threshold values manually or inte ctivuested in the command warking transitional regions in the cropped image, i.e. regions in

es, and the averages of these regions were stored as threshold values. Description: Threshold values. whitegraygraycsf _,_

whitegraygraycsfdV _,_),:,(:,

--segmeFunction included to appl

for all

nt_one-- s to the image y threshold value chosen.

ji, : 0),,(_),, =⇒ djiYgraycsfdji (black) (V ≤

_ <graycsf 32500),,(_),,( =⇒≤ djiYwhitegraydjiV (gray) 65535),,(),,(_ =⇒< djiYdjiVwhitegray (white)

Variables defined: Description: Y

25

Matrix equal in dimensions asV but with three possible entry values, i.e. V segmented.

whitegraygraycsfdV _,_),:,(:, Y

--crop-- A montage of ):,(:, dY ):,(:, dV next to , i.e. the segmented image next to original one, was presented. Next to the montage, four buttons were displayed for increasing or decreasing either of the thresholds, and the segment_one function was recalled for each button press. There was also an OK button to proceed if satisfied.

--segment-- segmentation, the last threshold values were returned to be applied to

all images in stack. The po nother image to work with, was included, and if selected the program returned to keypress-function.

When satisfied with ssibility to start all over, with a

whitegraygraycsf _,_

whitegraygraycsfV _,_,

Page 26: 1044931 Mikael Montelius Rapporten Utan Kod

26

whitegraygraycsfV _,_,

--segment_all-- All images inV were segmented in a loop, and the new matrix was called A . The value representing CSF was set to two to separate it from the background pixels later in the program. Finally, A was returned to segment.

For al : l ),,( kji

2),,(_),,( ≤ graycsfkjiV =⇒ kjiA 32500),,(_),,(_ =⇒≤< kjiAwhitegraykjiVgraycsf

65535),,(),,(_ =⇒< kjiAkjiVwhitegray Variables defined: Description: A Matrix equal in dimensions toV but with three possible entry values,

i.e.V segmented.

Page 27: 1044931 Mikael Montelius Rapporten Utan Kod

3.5. VOI re-creation The next flowchart describes the second part of the tool, the VOI re-creation. The calling sequence is position and that is also the n file. Generally, when idcreate_VOI the VOI w s defined, either manually or from the information in the SPAR file (a function f ed get_SPAR_info extracted the information from the SPAR file if the latt chosen i.e. every corner of the VOI was assigned a coordinate. These were then positioned correctly by a transform in three rotational matrices and one translational matrix before they were called by the intersection-function. This function defined the image planes by the points P1, P2 and P3, s re imp in the image dicom headers. It also defined the lines connecting the corners d calculated the intersection between these lines and every plane in the coordinates and a transition from sition to the closest possible discrete i, j, k coordinate was performed. This is depicted in figure 13. The matrix element representing i, j, k was assigned the value 65000 (white), and all other entries were set to one (black). This matrix was stored as a new matrix called G, which was called by the create_filter function, which in turn created a binary filter. It did this by, in each plane containing white pixels, creating a polygon from these pixels. All values inside the polygon were set to one, and all outside were set to zero. This matrix was called mask and was returned to position. Now the image matrix V was multiplied by G, i.e. the VOI was superimposed on the images, and A, the segmented image matrix, was multiplied by mask, so that only the parts corresponding to the interior of VOI passed the filter. The pixels of the latter product were black, gray or white, and they were calculated accordingly and presented as a ratio.

ame of the main position was run, the SPAR file containing the VOI information was

mported by the operator from a “select file” menu. Several different geometric variables, efined in figure 12, were ex from the image dicom headers and the function tracted

was called for. In this file aile caller was ),

ee figure 12, which a licitly definedof the VOI, anstack. The transition function called these intersectional

their exact po

27

Page 28: 1044931 Mikael Montelius Rapporten Utan Kod

P1= (x1, y1, z1) = p1

P2

k = 1..b

Center of upperleftmost pixel, Pk

i = 1..n1

j = 1..n

r

c

psr

psc

pk

P3

Figure 12. The variables needed to find the orientation of the MRS volume in the image series. The Euler angles of the r and c vectors defined the directions of the image stack, and the spacing between slices and pixels could be used to find the coordinates of a pixel, since the points P were known from the dicom header.

28

Page 29: 1044931 Mikael Montelius Rapporten Utan Kod

P1

P2

ss

Arbitrarypoint of Intersection,”koord”

k

k+1

j

i

rcd ×=

rps

cps

Figure 13. The figure shows how the i, j and k coordinates were found for each intersection point called koord.

29

Page 30: 1044931 Mikael Montelius Rapporten Utan Kod

--position-- Position was set as calling sequence to start the second main file. When executed, the variables AVa ,, andb , defined in segmentation, were imported. A menu was displayed where the operator was asked to import the associated SPAR file. Sub sequentially the following variables were imported from the dicom headers. Variables defined: Description:

Filename of SPAR file Directory search string to SPAR file

File Pathp The ImagePositionPatient tag, revealing the image coordinates of

the centre of the upper leftmost pixel in an image, was imported from each image in the stack and stored in the k:th entry of the column vector corresponding to image number k.

p 2n A vector, equal in dimensions as , but with the dicom filename stored in each entry. Number of columns (pixels in j-direction) in the images, imported from the Width tag. Number of rows (pixels in the i-direction) in the images, imported from the Height tag.

n

1n

r The unit vector (Euler angles) defined by any row of pixels in an image, imported from the ImageOrientationPatient tag.

c The unit vector (Euler angles) defined by any column of pixels in an image, imported from the ImageOrientationPatient tag. Spacing between pixels in a row, imported from the PixelSpacing tag. Spacing between pixels in a column, imported from the PixelSpacing tag.

rps

cps

PathFile,

--get_SPAR_info-- Function defined to import the SPAR values from the previously defined SPAR file.

PathFile,

--create_VOI-- A choice was presented either to input SPAR values manually or to import them from the previously selected SPAR file. If the latter was chosen, the get_SPAR_info function was called. If not, the values were asked for in the Matlab command window. In either case, the following variables were created. Variables defined: Description:

Size of VOI in aVOI information ap nterior-

posterior direction (mm). Size of VOI in llr eft-right direction (mm).

..cont

30

Page 31: 1044931 Mikael Montelius Rapporten Utan Kod

-- create_VOI--cc Size of VOI in head-feet (c

audal-cranial) direction (mm). aoc Centre of VOI ap-off-centre position (mm) loc Centre of VOI lr-off-centre position (mm) coc Centre of VOI cc-off-centre position (mm) aa ap-angulations, i.e. rotation round the ap direction (degrees) la lr-angulations, i.e. rotation round the lr direction (degrees) ca cc-angulations, i.e. rotation round the hf direction (degrees) To compensate for the chancompared to the image coo

Th corners of the VOI wer

i.e. ne in each octant, and

ge of signs in the ap and lr directions of the VOI coordinates rdinates, a change of signs were made:

aocaoc −= locc −= lo

e e initially placed around the origin of the image coordinate system,

thus spanned fromo2

tolr−

2 in the lr direction, from lr

2toap

−2

in ap

the ap direction and from 2

tocc−

2 in the hf direction. The corner in the first octant, i.e. the cc

⎜⎝⎛

2lr

one with the coordinates ,2

ap , ⎟⎠⎞

2, was called

cc1oct and so on, up to 8oct .

This is illustrated in figure 14. All corner coordinates were stored in an 8x4 matrix called oct , as incwhere the fourth column w luded to allow matrix multiplication.

This matrix was transposed slation matrix before it was transposed back to a 4x4 matrix

and multiplied by three 4x4 rotational matrices and a trane :

TT

AzAxAyAte ⎟⎠⎞⎜

⎝⎛ ⋅⋅⋅=

where index z, x, y ranslation round the cc, ap and lr directions and translation

oct⋅

and t indicates t1oct to 8oct were redefined with the newrespectively. VOI coordinates from matrix e ;

1,11 [eoct = 2,1e ]3,1e ... 1,88 [eoct = 2,8e ]3,8e .

81...octoct

--intersectin coordinates of each image plane and VOI side, the variab

on-- To calculate the intersectio les

cr pspsnnbcr, re imported from positiop ,,1,,,, we . The three points needed to define the first image plane were

ncpsnPP c ⋅⋅−+= )1(131P = 1p , nPP rpsr ⋅⋅−+= )11 and (12 . They

are shown in figure 12.

..cont

31

Page 32: 1044931 Mikael Montelius Rapporten Utan Kod

--intersection-- Furthermore, the line defin in parametric form, where the int and 1 at the other. Eve y k planes were tested ose producing a value of

were attended to. e stored in a matrix n all 12

OI and

ed by the coordinates of two VOI corners was expressed parameter t took the value 0 at the one po

r for intersections with this line but only th10 ≤≤

callin

e

t The coordinates of these intersections werled co . The next line was investigated and the coordinates were stored inco . Whe1 2es were tested, the 12 matrices included all intersection coordinates between the V

]...[ cococo = . The calculationsth image matrices. These were saved in the matrix 121 are included in the appendix.

co

--transition-- In this function, a matrix of ones calledG , equal in dimensions toV , was defined, and the variables crdirection of the image stack, i.e. the k direction defined in figure 12, the cross product between

pspsbcrp ,,,,, were imported from position. To give the unit vector in the

the two unit vectors cr and was calculated: rcd ×=

The distance between two image planes in the stack was defined as:

12 ppss −= To find out which entries in the image matrices that corresponded to the intersection points stored in co , a vector was defined, originating in the point 1p , where 1=== kji and

co ), called koord. reaching to the intersection point (one of the coordinates in koordcpsirpsjdsskp cr =⋅−+⋅⋅−+⋅⋅−+ )1()1()1(1

coThis equation was solved for i, j and k and they were rounded to the closest integer. The

rresponding entry in co G was set to koord. was set to 65000 and the next coordinate fromco . Figure 13 illustrates this. This was repeated for every intersection coordinate in

bG ,

--create_filter-- A filter, or mask, was created by searching for entries with the value 65000 in the k:th plane in G . If none were found, all entries were set to 0 and a loop changed plane to k+1. If, on the other hand, some were found, the (i, j, k) coordinates for every such entry were saved. A build

ne oor inates, and l pi

to s name mask and was returned to the main file.

in function called convhull calculated the largest possible polygon, defined by these in-plac d a l xels inside this polygon were set to 1. All pixels outside were set to 0.This was repeated inside the loop until a 3D filter matrix was created, with dimensions equal the image matrix. It wa d

Gmask,

32

Page 33: 1044931 Mikael Montelius Rapporten Utan Kod

--position-- To display the image matrix

lr

cc

ap

oct4

oct1

oct8

igure 14. The positioning of he corners of the VOI, named from oct1 to oct8 corresp nding to the ight octants in which they are present.

F t oe

3.6. Verification of VOI re-creation Tof aoogpias signal lacking cube (apart fromPMMA stand with an integral protractor.

o test the positioning of VOI in the image stack, a phantom was constructed. It consisted PMMA (PolyMethyl MethAcrylate) sphere with a diameter of 15 cm. A circular

pening at the top of the sphere was used to fill it with EEC fluid [10]. In the same pening a PMMA arm was mounted, reaching down into the sphere. In this arm some ashes were made to allow different positions and angles of a PMMA rectangular arallelepiped. The latter was created from a hollow, larger rectangular parallelepiped, cut n two halves as illustrated in figure 15. One of these halves, with size 2x2x1.5 cm3, acted

the half cylinder missing). The sphere was placed on a

V with the intersection points superimposed, it was, entryentry, multiplied by

by G . Hence all values in V corresponding to an intersection were

multiplied by 65000 and thus displayed as white. All other values were unaltered. To e the ratio of the different tissue volumes, matrix calculat A was multiplied, entry by entr

byy,

mas Hence all entries outside the VOI were set to zero, and all entries in e the VOI were unaltered. To calculate the ratio of tissues within VOI, the amothe last product matrix were cacommand window.

k . sid

unts of black, gray and white pixels in lculated and compared. The ratios were displayed in the

33

Page 34: 1044931 Mikael Montelius Rapporten Utan Kod

Figure 15. Lower left: To the outer rim rectangular PMMA parallelepiped secured in a gash. Right: The aforementioned lowered into the sphere with EEC fluid. Also shown is the protractor stand. The figure also shows the modification of an earlier phantom, to create a smaller one, by cutting it in two halves.

To verify the VOI re-creation the phantom was placed in the head coil in the Intera system. The rectangular block in the sphere was positioned to be somewhat off-set from the centre of the sphere, and also not to coincide with the centre of the image coordinate system, and a transversal 3D scan was made. Three orthogonal image stacks, aligned with the sides of the PMMA cube, were constructed from the transversal original. In these three reconstructions, a VOI was planned to precisely coincide with the block and an

ere turned 45, 90 and 225 degrees from the original position, around a vertical axis. The images were run through the program with the

f the VOI was correctly superimposed on the images, e. coincident with the signal lacking cube.

3.7.

er firmly supported with a vacuum cushion side the head coil. Single voxel MRS was performed at the right caudate nucleus

including the superior part of the head and the anterior part of the body of the nucleus. The VOI was positioned and angulated to avoid CSF and to minimize partial volume

MRS scan was run to generate a SPAR file containing the VOI information. This procedure was repeated with the sph

respective VOI information to test ii. The same procedure, apart from the angulations, was repeated for the two Achieva systems. In vivo verification of repeatability Measurements on a volunteer were performed using the Intera MR-system. Mainly following the protocol of the OCD study [2], the volunteer was positioned in supine position, with the head first into the scannin

34

Page 35: 1044931 Mikael Montelius Rapporten Utan Kod

effects of white matter. MRS acquisition parameters were: PRESS sequence, TE = 30 ms, TR = 2000 ms, water suppression excitation (i.e. CHESS) and 256 measurements were acquired in each scan. MR imaging was performed for careful localization of the MRS volume: Following a survey scan, a saggital 3D scan (T1 weighted turbo field echo) was performed, followed by reconstructions of a transversal and a coronal image stack from the same scan. To facilitate precise angulations and positioning of the MRS volume of the caudate nucleus (the VOI) two double oblique reconstructions were made. The first provided a long axis view of the right caudate nucleus, the imaging plane being approximately perpendicular to the nucleus interface to the ventricle, and the second reconstruction provided a short axis view approximately perpendicular to the long axis view. Figure 16, used in the guiding protocol in the OCD study, illustrate the positioning of the so called long axis and short axis image stacks. This procedure was repeated six times on the same volunteer, and to include variations due to the patient positioning procedure, the volunteer was repositioned in the scanner between every measurement.

Figure 16. The lines defining the positioning of the long axis (white) and the short axis (black) image

acks are shown. Also visible is the VOI positioned around the caudate nucleus in a transversal

igure 17 shows the positioning of the caudate VOI in the long axis, the short axis and the

streconstruction.

Ftransversal reconstruction.

35

Page 36: 1044931 Mikael Montelius Rapporten Utan Kod

Figure 17. Screen capture from planning the caudate VOI position. Left: caudatus VOI position in long axis. Right top: The same VOI in short axis. Right bottom: The same VOI in the transversal reconstruction.

LCModel [9] was used to evaluate the MR spectral data, giving values of the metabolite concentrations in each measurement series. These values were plotted against the corresponding series number to test for consistency in the measurements. The metabolites compared were NAA, Cho, Cr and Glu+Gln.

36

Page 37: 1044931 Mikael Montelius Rapporten Utan Kod

4. Results

4.1. The image and VOI coordinate systems In the three perpendicular image scans, two of the image coordinates were always more or less constant but the third coordinate varied greatly. Combining this information with the visual information from the images of the bottle and the sphere, the direction of the coordinate axis could be determined. The directions are shown in figure 18. The VOI coordinate system had opposite sign compared to two of the image coordinate axes, namely the ap- (y) and the lr (x) axis. Both coordinate systems are shown in figure 19.

Head-FeetAnterior-

Left-Right

Posterior

+

- +

-

+-

Figure 18. Same as figure 9, but with the image coordinate directions included.

37

Page 38: 1044931 Mikael Montelius Rapporten Utan Kod

Figure 19. Shown in black is the image coordinate system and in blue the VOI coordinate system. Both share the same origin but notice that the z-axis are unaltered in the feet head direction and that the x- and y- axis both change sign in the transversal plane.

4.2. Segmented images

The final segmentation of the images was successful and one example is presented in figure 21. When running the program the successive order in which the operator was presented with images to work with is shown in figure 20. First, the image in which the operator chose to select a crop was presented and this is shown in figure 20a, where the crop also is visible. The corresponding histogram was presented immediately following the cropping, as is presented in figure 20b where the three denser regions representing the three compartments CSF, gray and white matter are visible. Sub sequentially, the cropped region was shown enlarged, and the two smaller crops, in which the average pixel

20c, including e two crops. The leftmost crop was the one selected to produce a threshold value

etween CSF and gray matter and the rightmost the one selected to produce a threshold value between gray and white matter.

intensities were to be calculated were requested. This is shown in figurethb

38

Page 39: 1044931 Mikael Montelius Rapporten Utan Kod

Figure 20. Images presented and used during the segmentation work flow. a) An original volunteer image before segmentation, the crop is visible as dotted lines. b) The histogram from the cropped region in figure a. c) The crop shown enlarged and the two smaller crops that were to be used for setting the threshold values are here shown as dotted lines. The leftmost was the one selected to produce a threshold value between CSF and gray matter and the rightmost to set the threshold value between gray and white matter.

With the thresholds applied to the original image, and fine tuned manually by the operator, the final result was displayed as shown in figure 21. Comparing the two imagesthe outcome of the segmentation of CSF, GM and WM is apparent in the central regions of the brain where the VOIs are to be p

,

lanned.

39

Page 40: 1044931 Mikael Montelius Rapporten Utan Kod

Figure 21. The result of the segmentation as displayed by the segmentation program. Left: the original image. Right: the corresponding segmented image, separating CSF, white and gray matter.

4.3. VOI re-creation

Using the geometrical data of the SPAR file, the VOI could be superimposed successfully on the images, and the segmented VOI contents could be extracted and counted. The operator was presented with the original image, with the VOI superimposed. Next to this, only the segmented part from inside the VOI, included in the resulting tissue ratios, was shown. The operator was also presented with the menu for browsing through the entire stack. Figure 22 shows one of the final images in the first of the six series of the repeatability tests, where all the above mentioned is included.

40

Page 41: 1044931 Mikael Montelius Rapporten Utan Kod

Figure 22. Left: Original image with the VOI superimposed. Yellow lines connecting the corners were

visualisation. Right: Only the section of the corresponding segmented image passes the filter function.

here added for betterinside the yellow lines

Browsing through the resulting segmented and filtered image series, next to the corresponding original images, the appearing and disappearing of the VOI around the caudate nucleus was clearly visible. Figure 23 is a montage where only the VOI containing parts of the image series have been extracted for better visualization.

Figure 23. Parts of the images in the resulting image series are shown as a sequence starting at the top left, where the appearing of the VOI is visible. The right part of each sub image shows the corresponding segmented and filtered image in which the pixel ratios were determined.

41

Page 42: 1044931 Mikael Montelius Rapporten Utan Kod

Figure 24 shows the numeric results displayed after a complete run through the program. First the threshold values are shown, as adjusted to satisfactory segmentation, and secondly, the tissue volume ratios, rounded to the closest integer.

Figure 24. Screen capture from Matlab displaying the final threshold values producing a relative volume of 1, 66 and 33 % for CSF, gray and white matter respectively.

4.4. Verification of VOI re-creation

The white dots representing the intersection of the image plane and the VOI sides were superimposed on the phantom scan images and coincided well with the corners of the signal lacking cube. This was true for all angles and reconstructions tested and the images displayed are shown in figures 25 and 26, where the former shows the images of the 45 degrees angulated series of original, saggital phantom scan, and the latter shows one image from the three orthogonal reconstructions.

42

Page 43: 1044931 Mikael Montelius Rapporten Utan Kod

Figure 25. Images from the saggital, original series in the 45 degree angulations test. The white pixels show the intersection between the VOI and the image planes. The yellow marked region in one of the images was added to show the arm holding the VOI, visible in some of the images, but not included in VOI.

d the results from the two Achieva ystems were very similar, and are therefore not included in the figures.

Figure 26. The white pixels show the intersections between the VOI and the image planes. Left: Saggital, original image from first, non angulated image series. Middle: Reconstructed transversal image. Right: Reconstructed coronal image.

he results from the other three angulation tests anT

s

43

Page 44: 1044931 Mikael Montelius Rapporten Utan Kod

4.5. In vivo verification of repeatability The displayed, visual results from the saggital, original images from the first series of repeatability tests are shown in figures 22 and 23 in section 5.3. The visual differences between this and the other five series were small, and the images from these series are therefore not shown. Although the threshold values needed to create a satisfying segmentation varied greatly from series to series, as is shown in figure 27, and also from original to reconstructed images within the same series, shown in figure 30, the final tissue ratios produced by the tool remained comparatively constant (figures 28, 29 and 31). Viewing figures 27 and 30 (and the other plots of threshold values not included here) there was a correlation between the two thresholds, following each other like in the zigzag pattern in figure 30.

0

5000

10000

Thre

shol

15000

20000

25000

30000

0 1 2 3 4 5 6 7

Series number

d va

lue

(0-6

5535

)

Csf_gray

Gray_White

Figure 27. Threshold values adjusted to produce a satisfying segmentation in the six saggital, original scans from the series of volunteer measurements.

44

Page 45: 1044931 Mikael Montelius Rapporten Utan Kod

0102030405060708090

Tiss

ue r

atio

(%)

0 1 2 3 4 5 6 7

Series number

Csf

Gray

White

Average ± std = 71 ± 6

Average ± std = 28 ± 5

Average ± std = 1 ± 1

Figure 28. Tissue volume ratios after a complete run of the six saggital, original scans through the tool. Also shown are the averages and standard deviations for each tissue.

Figure 29. The tissue volume ratios (y-axis) for the six repeated measurements (x-axis) of the reconstructed series. Purple indicate gray matter, yellow white matter and blue CSF.

45

Page 46: 1044931 Mikael Montelius Rapporten Utan Kod

0

5000

10000

15000

20000

25000

30000

35000

Originalsag

Reconstrtrans

Reconstrcor

ReconstrLandg

ReconstrLimpa

Thre

shol

d va

lue

(0-6

5535

)

csf_gray

gray_white

Figure 30. The five couples of threshold values producing a satisfying segmentation within the different reconstructions of the third series.

0

10

20

30

40

50

60

70

80

Original sag Reconstrtrans

Reconstr cor ReconstrLandg

ReconstrLimpa

Tiss

ue ra

tio (%

)

Csf

Gray

White

Average ± std = 71 ± 2

Average ± std = 28 ± 2

Average ± std = 1 ± 1

Figure 31. Tissue volume ratios from different reconstructions of the third series. The threshovalues used are shown in figure 30.

ld

The result from one of the MRS measurements as evaluated with LCModel is shown in figure 32. The resulting metabolite concentrations, extracted from the lower spectrum where a curve fitting is applied to the true spectrum, showed a constancy equivalent to the previously shown tissue ratios. The upper graph shows the deviation between fitted and measured curves, i.e. the residual, which was within a reasonable range. In the upper right cell the concentrations and corresponding standard deviations are presented.

46

Page 47: 1044931 Mikael Montelius Rapporten Utan Kod

Figure 32. LC model presentation of the metabolite concentrations from the measured VOI in one of the series. The measured spectrum is shown as a thin black line in the lower graph. The red line is the fitted sum of metabolites in LCModel that best resembles the measured spectra. The upper graph is the residual, i.e. the difference between the fitted and measured spectra, and the upper right cell shows the resulting concentrations of metabolites with corresponding standard deviations.

47

Page 48: 1044931 Mikael Montelius Rapporten Utan Kod

Figure 33 shows how the metabolite concentrations of the VOI varied from series to series, according to LCModel. Also shown are the average values of the six series. Metabolites NAA, Cho and Cr are rather constant over the series but the Glu+Gln metabolite deviates greatly in the sixth series.

0

2

4

6

8

10

12

14

16

18

1 2 3 4 5 6

Series number

Con

cent

ratio

n [i.

u.]

CrNAAChoGlu+Gln

Average ± std = 13.0 ± 4.3

Average ± std = 7.4 ± 1.0

Average ± std = 7.0 ± 1.2Average ± std = 1.4 ± 0.5

Figure 33. Concentrations of five of the measured metabolites in the six series.

48

Page 49: 1044931 Mikael Montelius Rapporten Utan Kod

5. Dis

dinate c about the mid plane, and hence, it would

e hard to tell what direction was right or left, i.e. the lr-direction. In this test, as mentioned earlier, two of the coordinates were practically constant, but nevertheless not totally constant. This was probably because of the small angulations of the image stack, made in the survey images, to better fit the images to the phantom before running the MRI scan. However, the coordinate varying varied tenfold as fast as the other two coordinates. The directions of the coordinate axes were only determined for the Intera MR-system and assumed to be the same for the Achieva systems. However, if they had been different in these two systems, it would be apparent in the numerous phantom scans made. There were some geometry problems in some of the earliest tests of the tool when using images from the Achieva systems. The superimposed sides of the VOI did not coincide with the signal lacking cube in the images. This appeared to be caused by the possibility to extract the SPAR file in two different ways on the Achieva systems, giving different VOI information. A speculation of the cause of the difference is that the order in which the VOI is angulated around the three different axes differs in the two extraction possibilities. If the directions of the axes would differ in the systems, not only would the VOI be erroneously angulated, but it would also be off set in position by two times the amount of the off centre coordinate. This was not the case. The problem remains to be solved since only one of the extraction possibilities will

ng the faulty results. It is, however, not a complicated task to change the order in which the VOI is rotated in the tool, and this is explained in the appendix, section 9.2. To create an intelligent segmentation tool in Matlab appeared to be a rather challenging task, perhaps not possible in the short period of time allotted to this thesis. The greatest challenge seemed to be taking into account the partial volume effect arising when more than one tissue type occurs in a voxel, as mentioned earlier. Since the gray scale value is based on the proportions of each tissue type present in the voxel, the gray scale becomes misleading [11]. Prior to creating this part of the tool, a comparison and investigation of other segmentation tools was made. It seemed evident that to create a more sophisticated segmentation tool, complicated mathematical operations such as morphing the image to a template brain image was inevitable. Based on these premises, the tool was divided into two parts, one being the segmentation part and the other being the positioning of the VOI part, allowing the operator to choose to download some freeware segmentation tool. There are several freeware segmentation tools available on the internet, for example the SPM5 program offered by SPM (Statistical Parametric Mapping) [12]. However, their ability to function appeared to be highly dependent on the version of Matlab currently installed on the computer. Therefore the interactive segmentation tool included was created to be independent of the version of Matlab installed, but it does not take into account the partial volume effect. However, this effect is more pronounced in the superficial slices of MRI volumes, where the cortex is dominant [13], and in the interface between CSF and white matter (misinterpreted as gray matter), and these effects should

cussion The reason for using the phantom images when revealing the directions of the cooraxes is that the human brain is rather symmetrib

remain after the next upgrade of the systems and this is the one produci

49

Page 50: 1044931 Mikael Montelius Rapporten Utan Kod

be relatively small in the regions investigated in the OCD study [2]. Another reflection is at in the transition between tissues, where partial volume effects blur the borders, the

el ge,

hing

value (65535) with this value and

at

ented in the rogram, also showed a superior resemblance between the histograms after the

s

orrelation between the two threshold values, jumping up and down in a zigzag pattern

e

ack tion of

ththreshold (if positioned correctly) probably causes the same amount of error in both directions, i.e. the tissue ratios are unaffected. The segmentation part of the tool is probably the part where future effort has to be made for improvement, but a discrete VOI profile would probably also enhance the accuracy, and the latter, which is discussed later, is probably rather easily implemented. The segmentation was only verified by visual inspection and it should probably be tested more rigorously. However, this seems to require some advanced digitally simulated brains for proper validation, as is used for testing other commercially available segmentation tools. An early concern was the fact that image gray levels had to be properly stretched before viewing them in Matlab. The built-in Matlab functions uses techniques, such as histogramstretching, based on every, in the stack included image histogram for properly presenting the images to the human eye. Since different images include different maximum pixvalues, this cause a gray level stretching, i.e. a windowing, specific to every single imathus producing images differing in intensity level. This would affect the final results since the images from the same stack would be segmented differently. Therefore, the stretcwas totally controlled in the program, by searching for the greatest pixel value in the entire stack, dividing the maximum allowed pixelmultiplying the quotient to every single pixel value in all images of the stack. This seemed to be a successful approach, because all images appeared equal in gray level,least to the naked eye, when browsing through the stack. A comparison between the histograms of each image in a stack, before and after this was implempmodification. As mentioned earlier, the amount of images selected from a stack markedly influence onthe processing time, but it also affects the appearance of the images. This is because whensearching the stack for the maximum pixel value (used in the stretching of the pixel values), different values might be found depending on which images are included. Consequently, the overall gray scale level of an entire stack is highly dependent on whichimages are included. One might think that this would affect the constancy of the tool when for example changing from the original image stack to one of the reconstructed onein the same series, but keeping the same VOI settings. However, as can be seen in figures 28 and 29 in section 5.5, this is not the case. In fact, despite of the clearly visible c(figures 27 and 30); the resulting tissue ratios stay fairly unaffected. In fact, a small test was made out of curiosity, comparing the zigzag pattern of the threshold values with thmaximum pixel value found in the corresponding stacks. This showed an absolute correlation; the maximum pixel value followed the zigzag pattern unconditionally. The conclusion drawn from this was; despite the difference in gray scale level from stto stack (conveyed by the selection of images included in each stack), the combinainteraction and visual inspection when setting the threshold values effectively cancel this variation and produces a fairly constant tissue ratio result.

50

Page 51: 1044931 Mikael Montelius Rapporten Utan Kod

Apart from the variation due to maximum pixel values, there are also intrinsic variations in the acquisition and processing of the images in the scanner systems, which are not absolute measuring systems. But since these effects also cause a change in the windoof the images, they are cancelled by the tool.

wing

the

e crop and positioning it so as to include roughly the same amount of the different tissue

s

s nt

rarely

al times entire program, the processing time is kept short. This is because every

ossible operation is implemented as a matrix operation. This was also a modification

l to e

ing e

e modified phantom did not pinge on the planning of the MRS volume, nor did it affect the positioning results,

Including the histogram was initially an attempt to automatically find optimal threshold values by some mathematical curve adaptation and iterative method, but is now more a remnant to aid the operator in setting the thresholds. The histograms produced withstandard Matlab functions appeared rather coarse and straggling as can be seen in figure 20b, and hence, to find local minima (threshold points) mathematically appeared complicated. Nevertheless, if cropping the images properly, including enough pixels in thtypes, the histograms produced appears sufficient for visually finding local minima. In addition, the possibility to select an image from the stack fulfilling the criteria just mentioned enhances the histogram appearances significantly. Experience of running this part of the tool indicates a satisfying and rapid segmentation when setting the thresholdinteractively and sub sequentially adjusting them in real time, as offered in the interface. This was also the approach when evaluating the volunteer measurements, presented in section 5.5. When adjusting the thresholds in real time by using the menu buttons included, one button press equals an increase/decrease of 500 (gray scale values). Thiresults in a corresponding increase/decrease of the final tissue ratios by about 1 perce(given the same VOI and image stack). The final adjustment, before satisfaction, is more than one or two button presses, and hence, the results are not extremely dependent on the more exact thresholding. Although entire image stacks with a large amount of data are manipulated severthroughout the pmade in a later phase of the work, when it was obvious that the processing time was too long, even with only a few images in a stack. After the modification, the total processing time does not exceed a couple of minutes; even if as many as say 100 images, normathe OCD study, are included in the stack. Nevertheless, experience from running thprogram numerous of times, shows that selecting only those images necessary to include the VOI investigated at the moment, will facilitate the whole process. The reason for implementing the part where the VOI information could be imported by a simple mouse click on the corresponding SPAR file was to avoid the time consumprocess of entering all information manually every time the tool was run. The possibilityto enter the information manually was however left as an option to allow manipulating thVOI positioning, perhaps in further development of the tool. The hollowed out part of the cube is a remnant from an earlier, disregarded phantomconstruction, but the cubical rim can be imagined by following the white superimposed intersectional points, e.g. in figure 25, section 5.4. The reason for initially trying to use this earlier phantom construction was that the cylindrical hole was meant to be a signal giving part of the signal lacking cube. The missing part of thim

51

Page 52: 1044931 Mikael Montelius Rapporten Utan Kod

because the outer rim still makes out a cubic shape, as can be seen in figure 15, section 4.6. If this would have been an MRS study, neither would the arm holding the cube interfere with the results because it is “cut of” by the imagined line connecting the two adjacent points defining one side of the polygon filter. Furthermore, the exact dimensions f the cube were not very important for the purpose of verifying the positioning of the

st

ed if,

id

from the black pixels in the background. However, this

oes not affect the resulting ratios, because the two types of pixels are separated

e

are

pixel by pixel, until e pixel closest to a given coordinate was found. However, since only the coordinates of

d with an error depending on e accuracy with which these directional vectors are given. Hence, all this could affect

d n

oVOI. The only thing important was that it was possible to plan the VOI to coincide with the cube sides, i.e. as long as it was rectangular, any deviation would be apparent. In the part of the program where the polygon was defined for the filter matrices, a Matlabbuilt-in function was used. This function searched for the pixels defining the largepolygon possible but it omitted these pixels in the polygon, i.e. a larger polygon could have been constructed if these pixels were included. This means that the outer shell of the VOI could have been larger and more pixels could have been included to enhance the statistics and accuracy of the final results. This can on the other hand be partly solvwhen defining the VOI size, one defines it a little bit larger. If one wishes, one could also include this in the function where the VOI is defined. This could also be used to superimpose another filter onto the first, but somewhat larger and with some weighting factor. In this way, some kind of discrete, gradual signal profile could be created to avothe abrupt edges on the filter as it is now. The final images presented when running the tool, where the segmented and filtered images are displayed next to the original ones as in figures 22 and 23, are somewhat misleading regarding the size of the VOI. This is because the human eye can not separatethe black pixels representing CSFdnumerically. The background pixels have the value zero, whereas the black pixels representing CSF have the value two and only the latter is counted. If it is desirable to bable to see this difference it is an easy task to change the CSF pixels to a higher value visible to the human eye. How this is done is explained in the appendix, section 9.2. The largest source of error due to the mathematical steps involved in positioning the VOIin the image coordinate system is probably the part where the continuous coordinatestransformed into the discrete matrix coordinates in their closest proximity. As explained in section 4.5 this was done by stepping through the 3D image matrix, ththe pixel from which the stepping originated is known from the dicom header, every step involves an error. This error stems from how precise the stepping length is in every direction, which in turn is decided by the pixel and plane spacing information. Furthermore, the through plane direction, determined by the cross product of the Euler angles defined by the row and column vectors, is also afflicteththe final position, but since it all comes down to the precision of the dicom headers, anthe round off errors induced in Matlab, these errors are probably negligible. The precisiogiven in the dicom header is at least to four decimals, and Matlab is even more precise. The positive side effect of the fact that all variables in the above mentioned are extractedfrom the dicom headers, i.e. the program is independent of if the size of the images or matrices are altered.

52

Page 53: 1044931 Mikael Montelius Rapporten Utan Kod

Experience from running all the tests with the phantom resulted in a couple of thingsworth noting. For example, it was not possible to reproduce the exact match between image and VOI on one Achieva system by copying the parameters and scanner settings producing a good result on the other system. Although the phantom was moved extremcarefully and positioned seemingly identical, using the laser guiding lights, the VOI appeared offset from the position of the signal lacking cube. This however, is proba

ely

bly e rather course calibration of the laser guides, and the difficulty of moving

ared

stem,

umerous of scans performed both in vitro ere = phantom scans) and in vivo.

if it

cel the rly

g ctional error when comparing the reconstructions are 3 and 8 percent, which is even

s

because of ththe phantom without inducing any positioning errors. The procedure where the reconstructed stacks are planned to be aligned with the sides of the PMMA cube appeto be important, and a careless planning resulted in a poorer positioning of the VOI, andthus a poorer verification result. There was some concern regarding the combining of the two different coordinate systems, but the program seems to handle this without any problems. This was also the reason for using the angles 0, 45, 90 and 225 degrees in the angulations test on the Intera syensuring positioning the VOI in at least three of the eight possible octants defined by thecommon origin of the VOI and image coordinate systems. However, any miscalculations regarding this would have appeared in the n(h The repeatability test does not solely test if the program is reliable, but mainly showsis possible to rely on the reproducibility of the OCD study. Actually it is the combination of both that is tested. However, the positioning of the VOI has to be considered reliable from the in vitro tests. The main part tested in the program is the possibility to canvariations in gray scale, as previously discussed. And it seems to be working propesince the fractional error in gray matter is less than 9 percent, and less than 19 percent for white matter (figure 28), when comparing different series. And considering the small volume of the VOIs, and thus the poor statistics, this is rather good. The correspondinfrabetter (figure 31). The poor statistics makes the CSF fractional error seem large, but looking at the figures, it seems rather constant, despite the varying threshold values. Comparing this with the LCModel results shown in figure 33, where all but the Glu+Gln (this was because of a technically bad quality in the sixth spectrum) seems fairly constant, the whole chain, from the fixating of the volunteer to the resulting tissue ratios, seems to be functioning fine. Should the LCModel results vary too much, then the MRS-results of the OCD study would be unreliable. All images in this project are T1-weighted, but it would work for other contrasts as wellsince the only thing different in the images would be the gray scale values. A prerequisite, of course, is that there must be a contrast difference between the three tissues. A small adjustment of the program would have to be made with another weighting, and that is thename of the tissues presented in the final results. Since the gray scale values of each tissue would shift in numeric order, the names associated with them would turn out wrong. Thihowever, is an easy thing to modify and is described in the appendix, section 9.2.

53

Page 54: 1044931 Mikael Montelius Rapporten Utan Kod

6. Conclusions

of

ation.

7. Re

ichael Kyrios, Maja Nedeljkovic,

on Press, Great Britain, ISBN 0 08 0410170

, 2005, 60:1133–1140

The tool is fulfilling what was requested, i.e. to correctly superimpose the VOI in the images and to calculate the ratio of CSF, gray and white matter within the VOI. Below isa summary of the requested features of the tool successfully implemented:

• The tool allows browsing forwards and backwards before deciding which imagethe stack to work with.

• It displays a histogram of an interactively selected region to aid in the segmentation part.

• The threshold values of the segmented image can be adjusted in real time to allowfine tuning of the segment

• In most of the steps, the operator can choose to go back to a previous step. • The processing time is short, even in stacks with numerous dicom images. • There is a possibility to input the VOI information manually, or to let the tool

extract it from the SPAR file. ferences

] Guy Doron, Richard Moulding, M[1“Sensitivity of self-beliefs in obsessive compulsive disorder”, Depression and anxiety, 2005, 0:1–11

[2] Starck G, Ljungberg M, Nilsson M, Jönsson L, Lundberg S, Ivarsson T, Ribbelin S,Ekholm S, Carlsson A, Forssell-Aronsson E, Carlsson ML, “ A 1H magnetic resonance spectroscopy study in adults with obsessive compulsive disorder: correlations between metabolite concentrations and symptom severity.”, Journal of neural transmission. Accepted 2007

[3] Donald W. McRobbie, Elizabeth A. Moore, Martin J. Graves, Martin R. Prince,

“MRI from Picture to Proton”, Cambridge University Press, 2003 [4] Ray H. Hashemi, William G. Bradley, Jr., Christopher J. Lisanti, “MRI The Basics”

2nd edition, Lippincott Williams & Wilkins, USA, Philadelphia, 2004

[5] J.D. De Certaines, W.M.M.J. Bovée, F. Podo, “Magnetic Resonance Spectroscopy in Biology and Medicine”, Pergam

[6] Donald G. Mitchell, Mark S. Cohen, “MRI Principles” 2nd edition, Elsevier 2004 [7] Rafael C. Gonzalez, Richard E. Woods, “Digital Image Processing” 2nd edition,

Prentice Hall, Inc. USR, New Jersey 07458, 2002 [8] R.N.J. Graham, R.W. Perriss, A.F. Scarsbrook, “DICOM demystified: A review of

digital file formats and their use in radiological practice”, Clinical Radiology

54

Page 55: 1044931 Mikael Montelius Rapporten Utan Kod

[9] Stephen W. Provencher, “Automatic quantitation of localized in vivo 1H spectra

enriksen, W. M. M. J. Bovée, F. Podo, “Quality assessment in in vivo NMR Spectroscopy: III

1995

with LCModel”, NMR in Biomedicine, 2001:14:260–264 [10] M. O. Leach, D. J. Collins, S. Keevil, I. Rowland, M. A. Smith, O. H

Clinical test objects: design, construction and solutions.”, Magnetic Resonance Imaging 13(1), 131-137,

[11] Miguel Angel Gonzalez Ballester, Andrew P. Zisserman, Michael Brady,

“Estimation of the partial volume effect in MRI”, Medical Image Analysis, 2002, 6(4):389-405

[12] SPM – Statistical Parametric Mapping homepage. Available at

http://www.fil.ion.ucl.ac.uk/spm/, accessed 15 November, 2007

3] Simon Fraser University homep[1 age. Available at /www.cs.sfu.ca/~stella/papers/blairthesis/main/node13.htmlhttp:/ , accessed 27 mber 2007

tml, 08

Dece [14] Weisstein, Eric W. "Line-Plane Intersection." MathWorld - A Wolfram Web

Resource. Available at http://mathworld.wolfram.com/Line-PlaneIntersection.haccessed 10 January, 20

55

Page 56: 1044931 Mikael Montelius Rapporten Utan Kod

8. Appendix

8.1. Math

The cheade

s

Position file: oordinates of the centre of the upper leftmost pixel in each image, extracted from the r ImagePositionPatient, are stored in the bx3-matrix

⎥⎥⎥⎥

⎢⎢⎢

=zyx

p:::222

⎢⎣ bbb zyx

zy 11

I defines the

⎡ x1

where the index corresponds to the image number. The size of the VOcoordinates of each VOI corner in the image coordinate system.

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢⎢

=−

−−

1

12223 ccaplr

ccaplr

octoct

oct

⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢

⎢⎢

=

⎥⎥⎥⎥⎥⎥⎥

⎦⎢⎢⎢⎢⎢⎢

⎣−−

−−−

−−

1222

1222

1222

1222

222

1222

8

7

6

5

4

2

1

ccaplr

ccaplr

ccaplr

ccaplr

octoctoctoct

oct

where the first row consists of the coordinates of the first corner of the VOI as shown in figure 14, and so on. The last column is only to allow matrix multiplication. The VOI can be rotated and translated to position its corners correctly in the image system, by applying the following transformational matrices:

⎥⎥

⎢⎢⎡

⎤⎡

1222ccaplr

ccaplr

oct

56

Page 57: 1044931 Mikael Montelius Rapporten Utan Kod

The first rotational matrix round the cc axis

⎥⎥

⎢⎢⎣ 1000

0100 ⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎡

⎟⎠⎞

⎜⎝⎛ ⋅⎟

⎠⎞

⎜⎝⎛ ⋅

⎟⎠⎞

⎜⎝⎛ ⋅−⎟

⎠⎞

⎜⎝⎛ ⋅

= 00180

cos180

sin

00180

sin180

cos

ππ

ππ

caca

caca

Az

The 2:nd rotational matrix round the lr axis

⎥⎥⎥⎥⎥⎥

⎢⎣ 000⎢⎢⎢⎢⎢⎡

⎟⎠⎞

⎜⎝⎛ ⋅⎟

⎠⎞

⎜⎝⎛ ⋅−

⎟⎠⎞

⎜⎝⎛ ⋅⎟

⎠⎞

⎜⎝⎛ ⋅

1

0180

cos180

sin0

0180

sin180

cos0

0001

ππ

ππ

lala

lalaAx

The last rotational matrix round the ap axis

=

⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢

⎡ ⎞⎛ π

⎟⎠⎞

⎜⎝⎛ ⋅⎟

⎠⎞

⎜⎝⎛ ⋅

⎟⎠⎞

⎜⎝⎛ ⋅−⎟

⎠⎜⎝

=

1000

0180

cos0180

sin

0010

0180

sin0180

cos

ππ

π

aaaa

aaaa

Ay

The translational matrix . To extract the transformed coordinates,

the product is transposed b

⎥⎥⎥⎥

⎢⎢⎢⎢

=

1000100010001

cocaocloc

At

ack to the original form; TToctAzAxAyAtoct ⎟⎠⎞⎜

⎝⎛ ⋅⋅⋅⋅= .

4 Five points are defined as follows, and their definitions are shown in figures 12, 13 and 1in section 4.5:

kPzyx =),,( 111 rpsnzyxzyx r ⋅⋅−+= )1(),,(),,( 111222 cpsnzyxzyx c ⋅⋅−+= )1(),,(),,( 1111333

1444 ),,( octzyx =

2555 ),,( octzyx = The plane determined by the points , and and the line passing through the points sect in a point which can be determined by solving the four simultaneous equations:

),,( 111 zyx ,)4z and )( 5x

),,( 222 zyx,, 55 zy inter

),,( 333 zyx,,( 44 yx

57

Page 58: 1044931 Mikael Montelius Rapporten Utan Kod

11222 zyx

for zy

11

0

333

111

zyx

zyxzyx

= (1)

(2) (3)

(4)

txxxx ⋅−+= )( 454tyyyy ⋅−+= )( 454

tzzzz ⋅−+= )( 454

x ,, and t , giving

45321

45321

45321

4321 zzzzt −=

4321

4321

0111

1111

zzzzzyyyyyxxxxx

yyyyxxxx

−−−

(5)

ugged back in to (2), (intersection . [14]

an intersection can be found by2, section 4.5 for definitions.

This value can then be pl 3), and (4) to give the point of

The entries in the image matrices that correspond to solving equations (6)-(11) for i, j and k. See figure 1

),,( zyx

koordcpsirpsjdsskP ⋅⋅−+ )1(1 cr =⋅−+⋅⋅−+ )1()1( ⇔

1Pcpsrpsdsskoordcpsirpsjdssk crcr ⋅ −⋅+⋅+⋅+=⋅⋅+⋅+⋅⋅ (6)

where koord is an intersection coordinate ound in equations (2)-(4) and where

f

=×= rcd 2332[ rcrc − 3113 rcrc − ]1221 rcrc − 1[d= 2d ]3d (7) (8) 1[koord= koord 2koord ]3koord

=⋅ rpsr 1[ rpsr ⋅ 2rpsr ⋅ ]3rpsr ⋅ ( 9) =⋅ cpsc 1[ cpsc ⋅ 2cpsc ⋅ ]3cpsc ⋅ (10)

=1P 11 (11)

(7)-(11) exchanged into (6)

[P 21P ]31P

58

Page 59: 1044931 Mikael Montelius Rapporten Utan Kod

⎥⎥⎥

⎢⎢

++=

⎥⎥

⎢⎢⋅

⎥⎥

⋅⋅ 22

((csskoordcsskoord

ij

ccsc

−⋅+⋅+−−⋅+⋅+−−⋅+⋅+−+

⎤⎢

⎡⎥

⎢⎢⎢

⋅⋅⋅⋅

⋅⋅⋅

313312213

21223113

111123321

333

22

111

)))(

PcpsrpsrcrPcpsrpsrcrPcpsrpsrcrcsskoordk

psrpsdssprpsdss

cpsrpsdss

cr

cr

cr

cr

r

cr

⎥⎥⎥

⎢⎢⎢⎡ +

⎥⎤⋅ 111 sskoordcpsr c

⎣ −⋅+⋅+−+−⋅+⋅+−+−⋅+⋅+−

⋅⎥⎥⎦⎢

⎢⎢

⋅⋅⋅⋅

⋅⋅=⎥

⎥⎤⎡

313312213

212231132

11112332

3

222

1

)()()(

PcpsrpsrcrcsskoordPcpsrpsrcrcsskoordPcpsrpsrcrc

cpssscpsrpsdss

psdssjk

cr

cr

cr

c

cr

r

8.2. To make changes in the code • To change the order in which the rotational matrices are applied to the VOI, do the

following in the cell called rotations in the m-file create_VOI: Change the letters z, x and y in the three rows: b = Az*oct'; c = Ax*b; d = Ay*c;

the required new order and save the changes.

• distin e difference between background and CSF pixels in the ilter ages, a change can be made in the m-files position and

csf = length(find(B(:,:,1,:) = = 2));

Change the number 2 to a higher value, say 10000, and save changes

he following

,o) = 2; found in the fifth row of the for-loop and save the changes.

• If other th n T con e tios own in figure 24, will be named incorrectly. The tissues producing the lowest, iddle and highest contrast will be named “csf”, “gray” and “white” respectively, in that

⋅⋅⎥⎦⎢⎣ 33 rpsdi r

⎢⎢

−1

to To be able to guish thegmented and f ed ims

segment_all: n position, nine rows from the end, you will find: I

.

In segment_all, change the number 2 to the same new number (10000) in tow: r

A(m,n,1

a 1 trast images are used, the final numerical presentation of the tissura , as shm

59

Page 60: 1044931 Mikael Montelius Rapporten Utan Kod

successive order. If this is confusing, a small change in the m-file position is sufficient to correct this. In the following three rows found in the end of position, change the words “csf”, “grayand “white” (all lower-case letters) to the names of the tissue types producing lowest, middle and highest intensity in the new contrast images respectively. Do not change the ame words beginning with upper-case letters!

Relative volume of csf is ', num2str(Csf,'%.0f'),'%'] ['Relative volume of gray matter is ', num2str(Grey,'%.0f'),'%'] ['Relative volume of white matter is ', num2str(White,'%.0f'),'%'] Do not forget to save the changes.

gram, the first threshold value set must always be the one west intensity tissues.

The menu for fine tuning threshold values was made for T1-weighted images. This is not

8.3. .

ing the program on a computer for the first time, do the following:

-files of the tool. The same u address in Matlab.

2. Open the m-file segment and change the string C = dir (‘root:\directory\*.dcm’); g, e.g.

hanges and close segment.

n Matlab to the directory containing the m-files. 2. Put a copy of the dicom files you wish to work with in the same directory as the

Tip! Browse the image stack with e.g. irfanview available at www.infanview.com

s ['

Note also: When running the probetween the lowest and second lo

a problem when running other contrast images, but the names of the buttons will be wrong. Experience based tool instructions Before runn

1. Create a new directory where you put a copy of all mdirectory is also the Current Directory yo

found in the third line of code, to your current root and directory search strinC:\directory_name\*.dcm. Save c

Every time a new image stack is run:

1. Change Current Directory i

m-files.

e VOI. This will enhance the speed of the program.

3. Type segment in the command window in Matlab. You should now be presented irst image in the stack and a menu for browsing through the stack before

you choose which image to work with. Press OK when satisfied. issue (CSF, GM and WM)

4. The image you selected is presented and you must press OK again before you are allowed to interactively mark a region in the image. Based on this region, a

(accessed September 2007) and use only the files necessary to completely includ

with the f

Tip! Choose an image showing a large area of brain t

histogram is presented.

60

Page 61: 1044931 Mikael Montelius Rapporten Utan Kod

Tip! Mark a region containing as much CSF, GM and WM as possible, without including anything else. This is the reason to the tip in step three and it will

figure is always available and the interactively set threshold values are shown in the command window in real

e threshold values to the histogram on.

ested in the command window.

” the region selected for the histogram will be presented and you are asked to mark two smaller regions. The first one should

hite matter, also in equal

re comparison and you are presented with a

menu for adjusting the thresholds in real time. If you wish, you can always values to the histogram.

Tip! Enlarge the figure to fit the screen for better visualization. u are

asked to start all over, or to apply the threshold values to all images in the stack. If

wed by DONE, if

9. of the tool. Note! You must have run the previous part first to have the necessary variables

10. Choose the SPAR-file containing the VOI information. se to

manually” or “from SPAR file”. If the latter is chosen, the original

w. If the former is chosen,

e

produce a better looking histogram. 5. The histogram is presented and you are asked to choose to set the thresholds

manually or interactively. Tip! Set the thresholds interactively. The histogram

time. Hence, you can continuously compare thwhile you adjust them in real time for proper segmentati

6. If you choose “manually” the threshold values will be requ

7. If you choose “interactively

include the transition between CSF and gray matter in equal amounts. The latter should include the transition between gray and wamounts. The average pixel value in each region is set as threshold value and the image is segmented using these values. The original and segmented images apresented next to each other for visual

compare your present threshold

8. When you are satisfied, press OK and a new menu is presented where yo

you want to proceed, press “Apply thresholds to all images” and browse through the resulting segmented image stack. If satisfied press OK follonot, press OK followed by “Back to thresholding” Tip! The image stack figure can also be browsed enlarged to fit the screen for better visualization. Type position to start the next part

defined for this part.

Note! You have to follow through this step, but in the next step you can choomanually type the information and the SPAR-file chosen will thus be neglected.

11. Choose “images with VOI superimposed will be presented next to the segmented and filtered images. Browse through the result and press OK when you are satisfied. The tissue ratio is presented in the command windoenter the parameter values you wish and press enter each time. The results are presented in the same manner. Tip! Enlarge the figures when browsing through the results. Note! You do not have to run segment again if you want to use another VOI in thsame stack. Just run position again but select another SPAR file.

61

Page 62: 1044931 Mikael Montelius Rapporten Utan Kod

62

8.4. Matla

For com ria Ljungberg at

asa.car

b code reference plete Matlab code please contact Ma

[email protected] or Åsa Carlsson at

[email protected]