107
INTRACRANIAL HEMATOMA DETECTION

Project Thesis

  • Upload
    garthee

  • View
    1.436

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Project Thesis

INTRACRANIAL HEMATOMA DETECTION

Page 2: Project Thesis

ii

INTRACRANIAL HEMATOMA DETECTION

Undergraduate graduation project Report

submitted in partial fulfillment of

the requirements for the

Degree of Bachelor of Science of Engineering

in

Department of Electronic & Telecommunication Engineering

University of Moratuwa

Supervisor

Dr. A. A. Pasqual

Project Group

G.K.I. Abayarathna 050001A

G. Gartheeban 050131V

E.D.R. Kumara 050234N

W.M.D. Soysa 050440R

May 19, 2009

Page 3: Project Thesis

Approval of the Department of Electronic and Telecommunication Engineering

Head, Department Of Electronic and

Telecommunication Engineering

This is to certify that we have read this project and that in our opinion it is fully

adequate, in scope and quality, as an Undergraduate Graduation Project.

Supervisor:

Name and Signature

Date:

iii

Page 4: Project Thesis

Abstract

THESIS TITLE

Supervisor: Dr. A. A. Pasqual

Keywords : intracranial hematoma detection, near infra-red, near infra-red spec-troscopy, iHD

Intracranial hematoma is a treatable potentially fatal secondary injury, with 80percentage of survival rate if identified and treated timely. Traumatic brain injury,the most prevailing cause of fatality in an accident, is one of the prime causes ofintracranial hematoma, along with post-surgery complications.

The nature of the causes requires portability, ability to mass produce, afford-ability in detection methods. However conventional detection technologies suchas CT scan and MRI, albeit being accurate and comprehensive, do not offer theaforementioned features. A portable, affordable, safety abiding device to detectintracranial hematoma has rich set of applications such as quick diagnosis, es-pecially on patients with no external wounds, wider availability, by making thedevices available in virtually every infirmaries, pre-scanning before enlistment forCT scans, on-site detection, especially on battle fields, nationwide catastrophes,etc.

This report describes the design and development of the intracranial hematomadetector (iHD) that detects the presence of the hematoma with above reasonableaccuracy. The solution consists of the iHD terminal and iHD mobile application(iHDMA). iHD terminal consists of Near Infra-red (NIR) LED and sensor systemto measure the absorption of NIR light. The measured values are encoded andtransmitted, through BluetoothTM , to a mobile computer running iHDMA . IniHDMA, using, optical density (OD) calculations, threshold detection, post detec-tion integration and bidirectional associative memory, the presence of hematomais ascertained.

In addition to reporting OD and probability estimation, iHD system can detectthe hematomas, semiautomatically for a given constant probability of false alarm.The system is currently accurate enough to detect Extracerebral Hematoma (EH)that could cause and absorbtion difference above 0.2 in optical density; it the samecategory that needs immediate attention as well.

iv

Page 5: Project Thesis

“To our parents, teachers and friends.”

v

Page 6: Project Thesis

ACKNOWLEDGEMENTS

Dr. Ajith Pasqual has been a supportive and encouraging project advisor. He

showed a strong commitment and was very enthusiastic in extending a helping

hand. He was very approachable and open, on many occasions we were able to

contact him even in non-office hours, and notably one time, when he was on a

tour. Dr. Pasqual supervised two projects this year, and amidst his involvements

in numerous activities, he has always been there for us. In the middle, even when

we were about to follow through another project with another supervisor, he was

more than helpful. We thank him for being an excellent mentor and a guide.

Prof. J.A.K.S. Jayasinghe has been helpful is obtaining the enclosure within short

span of time. He, albeit his heavy schedule allocated time to check the design and

supervise the operation of the Rapid Prototyping Machine. We thank him for his

assistance.

Mr. Kithsiri Samarasinghe, former Head of the Department, offered valuable ad-

vices as a supervisor, mentor, lecturer, and Head of the Department. His popular

”five minute introduce yourself”, triggered many of us to reflect on ourselves and

encouraged us to be forward and assertive. More importantly his advices on final

year project procedures, engineering aspects and industry oriented preparation

were invaluable. We thank him for being a wonderful teacher.

Dr. Chulantha Kulasekare, Head of the Department, has served in the super-

visory panel during feasibility study presentation and offered valuable advices.

Further, during the project selection period, when we approached him with our

idea, he was very supportive and encouraging. He was clairvoyant in recognizing

the potential pitfalls and readily warned us about the caveats. We thank him for

being a supportive educator.

We are in debt to Dr. Kosala Ranatunga for proposing the idea, arranging meet-

ings with the Director of the Accident ward, General Hospital, Colombo and other

surgeons, and taking all the trouble in obtaining permissions. He was very sup-

portive during the last phase of the project and visited on the 17th of May to

vi

Page 7: Project Thesis

inspect the operation of the device as well. We thank him for his facilitation.

We also thank Dr. Himashi Kularathne, neurosurgeon, Head of Neural Surgi-

cal Ward, General Hospital, Colombo for granting us permission to conduct field

tests on patients undergoing surgery for extracerebral hematoma.

Mr. Udaya Chinthaka Jayatilake, lecturer, Department of mathematics, is a pro-

ficient mathematician who is keen on exploring the impossibles. He introduced

us Artificial Neural Networks and Bidirectional Associative Memory. His lectures

were simple and informative, always looking for ways to integrate with practical

applications. We thank him for being a guide to elusive mathematics.

A number of people have helped us in iHD project. Sashitha Nalin, from De-

partment of Mechanical engineering, was helpful in designing the chassis. Few

other batch mates offered their valuable advice throughout the project. We also

thank the staff from Engineering Design Center for letting us use Rapid Prototype

machine and their help in using it. We also thank other staff members, technical

assistants, and non-academic staff for all their support.

We also thank our parents and friends for being there, during our tenure at Uni-

versity of Moratuwa, supporting us financially and otherwise, and tolerating us

during the hard times, especially during the busy days.

vii

Page 8: Project Thesis

TABLE OF CONTENTS

APPROVAL iii

ABSTRACT iv

DEDICATIONS v

ACKNOWLEDGEMENTS vi

TABLE OF CONTENTS viii

LIST OF FIGURES xii

LIST OF TABLES xiv

ABBREVIATIONS xv

1 INTRODUCTION 1

1.1 Intracranial Hematoma Detector (iHD) . . . . . . . . . . . . . . . . 3

1.2 Organization of the Report . . . . . . . . . . . . . . . . . . . . . . . 5

2 LITERATURE SURVEY 6

2.1 Intracranial Hematoma (IH) . . . . . . . . . . . . . . . . . . . . . . 7

2.1.1 Types of Intracranial Hematoma . . . . . . . . . . . . . . . 7

2.1.2 Traumatic Brain Injury (TBI) . . . . . . . . . . . . . . . . . 9

2.2 Other diagnosis procedures . . . . . . . . . . . . . . . . . . . . . . . 10

2.2.1 Computed Axial Tomography (CAT) . . . . . . . . . . . . . 10

2.2.2 Magnetic Resonance Imaging (MRI) . . . . . . . . . . . . . 10

2.3 Near Infrared Spectroscopy (NIRS) . . . . . . . . . . . . . . . . . . 11

2.3.1 Application of near infrared spectroscopy for intracranialhematoma detection . . . . . . . . . . . . . . . . . . . . . . 12

2.4 Safety Regulations . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

2.5 Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.5.1 Threshold detection . . . . . . . . . . . . . . . . . . . . . . . 15

2.5.2 Post detection integration . . . . . . . . . . . . . . . . . . . 15

2.5.3 Bidirectional Associative Memory (BAM) . . . . . . . . . . 16

2.6 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

viii

Page 9: Project Thesis

3 SYSTEM OPERATION 17

3.1 Using the system . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

3.2 Operation of iHD terminal . . . . . . . . . . . . . . . . . . . . . . . 21

3.3 Operation of iHDMA . . . . . . . . . . . . . . . . . . . . . . . . . . 22

3.4 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

4 SYSTEM ARCHITECTURE 26

4.1 iHD System Architecture . . . . . . . . . . . . . . . . . . . . . . . . 26

4.2 iHD Hardware Architecture . . . . . . . . . . . . . . . . . . . . . . 27

4.2.1 Signal generation and Sensor Subsystem . . . . . . . . . . . 28

4.2.1.1 Pulse generation . . . . . . . . . . . . . . . . . . . 29

4.2.1.2 NIR light emission . . . . . . . . . . . . . . . . . . 29

4.2.1.3 Signal reception, amplification and Analog to Dig-ital Conversion (ADC) . . . . . . . . . . . . . . . . 31

4.2.1.4 Interfacing and Transmitter - Receiver Separation . 33

4.2.2 Processing & Controlling Subsystem . . . . . . . . . . . . . 36

4.2.2.1 PIC Microcontroller . . . . . . . . . . . . . . . . . 36

4.2.2.2 Sensor Interfacing . . . . . . . . . . . . . . . . . . 37

4.2.2.3 Possible methods of computation . . . . . . . . . . 38

4.2.3 Communication Subsystem . . . . . . . . . . . . . . . . . . . 39

4.2.3.1 UART . . . . . . . . . . . . . . . . . . . . . . . . . 40

4.2.4 Power Management Subsystem . . . . . . . . . . . . . . . . 42

4.2.4.1 Low Dropout (LDO) Regulators . . . . . . . . . . 42

4.2.4.2 Power Source . . . . . . . . . . . . . . . . . . . . . 43

4.2.4.3 DC Power and Charging . . . . . . . . . . . . . . . 43

4.2.4.4 Sleep, Power Saving Modes . . . . . . . . . . . . . 44

4.2.5 Input Output Subsystem . . . . . . . . . . . . . . . . . . . . 44

4.2.6 Safety concerns . . . . . . . . . . . . . . . . . . . . . . . . . 45

4.3 iHD Firmware Architecture . . . . . . . . . . . . . . . . . . . . . . 45

4.3.1 Communication state implementation . . . . . . . . . . . . . 46

4.3.2 Data Acquisition state implementation . . . . . . . . . . . . 46

4.3.3 User Indication IO . . . . . . . . . . . . . . . . . . . . . . . 46

4.4 Communication Protocol . . . . . . . . . . . . . . . . . . . . . . . . 47

4.4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

4.4.2 Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

4.4.3 Message Starting Header . . . . . . . . . . . . . . . . . . . . 48

4.4.4 Message Body . . . . . . . . . . . . . . . . . . . . . . . . . . 49

4.4.5 Message-ending Header . . . . . . . . . . . . . . . . . . . . . 49

4.4.6 Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

4.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

5 HEMATOMA LIKELIHOOD ESTIMATION IN iHDMA 50

ix

Page 10: Project Thesis

5.1 Optical Density calculation on Isolated Scans . . . . . . . . . . . . 50

5.1.1 Merits and Demerits . . . . . . . . . . . . . . . . . . . . . . 51

5.2 Characteristics of Intensity values and OD . . . . . . . . . . . . . . 51

5.3 Reference Estimation through normalization . . . . . . . . . . . . . 52

5.3.1 Moving average based normalization . . . . . . . . . . . . . 52

5.4 Threshold detection . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

5.5 Post detection integration . . . . . . . . . . . . . . . . . . . . . . . 57

5.6 Application of Bidirectional Associative Memory (BAM) . . . . . . 58

5.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

6 RESULTS, EVALUATION AND DISCUSSION 60

6.1 Testing procedures and clinical trials . . . . . . . . . . . . . . . . . 60

6.1.1 Trial Objectives and Purpose . . . . . . . . . . . . . . . . . 60

6.1.2 Trial Design . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

6.1.3 Selection and Withdrawal of Subjects . . . . . . . . . . . . . 61

6.1.4 Treatment of Subjects . . . . . . . . . . . . . . . . . . . . . 61

6.1.5 Assessment of Efficacy . . . . . . . . . . . . . . . . . . . . . 62

6.1.6 Assessment of Safety . . . . . . . . . . . . . . . . . . . . . . 62

6.1.7 Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

6.2 Evaluation and Discussion . . . . . . . . . . . . . . . . . . . . . . . 63

6.2.1 Sensor outputs . . . . . . . . . . . . . . . . . . . . . . . . . 63

6.2.2 Performance metrics . . . . . . . . . . . . . . . . . . . . . . 63

6.3 Presentation of results . . . . . . . . . . . . . . . . . . . . . . . . . 64

7 CONCLUSION 69

7.1 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

7.2 Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

7.3 Future directions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

BIBLIOGRAPHY 72

APPENDICES 77

A iHD SCHEMATIC 77

B COMMUNICATION PROTOCOL SPECIFICATION 79

B.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

B.1.1 Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

B.2 Message-starting Header . . . . . . . . . . . . . . . . . . . . . . . . 81

B.3 Message Body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

B.4 Message-ending Header . . . . . . . . . . . . . . . . . . . . . . . . . 82

B.5 Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

B.6 Example Word Patterns . . . . . . . . . . . . . . . . . . . . . . . . 83

x

Page 11: Project Thesis

B.6.1 Word Types . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

B.6.2 Message ID . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

B.6.3 Command or Reply . . . . . . . . . . . . . . . . . . . . . . . 84

B.6.4 Frame ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

B.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

C DATASHEETS 86

D BIDIRECTIONAL ASSOCIATIVE MEMORY (BAM) 91

xi

Page 12: Project Thesis

LIST OF FIGURES

1.1 Intracranial Hematoma detector . . . . . . . . . . . . . . . . . . . . 4

1.2 Banana-shaped light path . . . . . . . . . . . . . . . . . . . . . . . 4

2.1 Traumatic Brain Injury . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.2 NIR Absorption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2.3 Optical Density Histogram . . . . . . . . . . . . . . . . . . . . . . . 13

2.4 Significance of Optical Density variations . . . . . . . . . . . . . . . 14

3.1 Modes of operations of iHD terminal . . . . . . . . . . . . . . . . . 18

3.2 Optical Density Scan Positions . . . . . . . . . . . . . . . . . . . . . 19

3.3 Visualizing Results . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.4 Complete Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.5 iHDMA capture operation . . . . . . . . . . . . . . . . . . . . . . . 22

3.6 iHDMA store and data-process operation . . . . . . . . . . . . . . . 23

3.7 iHDMA advanced analysis operation . . . . . . . . . . . . . . . . . 24

3.8 iHDMA configurations . . . . . . . . . . . . . . . . . . . . . . . . . 24

4.1 iHD System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

4.2 iHD Hardware Architecture . . . . . . . . . . . . . . . . . . . . . . 28

4.3 Burst of Pulses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

4.4 OPT101 Sesor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

4.5 OPT101 High sensitive light to voltage converter . . . . . . . . . . 32

4.6 Dark Current Offset Correction . . . . . . . . . . . . . . . . . . . . 33

4.7 NIR LED and Sensor attachment . . . . . . . . . . . . . . . . . . . 34

4.8 Flexible Elastic Optical Probe . . . . . . . . . . . . . . . . . . . . . 35

4.9 Bluetooth Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

4.10 Bluetooth Integration via UART . . . . . . . . . . . . . . . . . . . 41

4.11 Bluetooth Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

4.12 Firmware Architecture . . . . . . . . . . . . . . . . . . . . . . . . . 45

5.1 Intensity Samples (Before Normalization) . . . . . . . . . . . . . . . 53

5.2 Intensity Samples (After Normalization) . . . . . . . . . . . . . . . 53

5.3 Dynamic threshold . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

5.4 Results after threshold detection . . . . . . . . . . . . . . . . . . . . 56

5.5 Post detection integration . . . . . . . . . . . . . . . . . . . . . . . 57

6.1 Reference samples before normalization . . . . . . . . . . . . . . . . 64

6.2 Reference samples with normalization factor 4 . . . . . . . . . . . . 65

xii

Page 13: Project Thesis

6.3 Reference samples with normalization factor 9 . . . . . . . . . . . . 65

6.4 Reference samples with triangular normalization function . . . . . . 66

6.5 Reference samples with triangular normalization function . . . . . . 66

6.6 OD calculation on scan and reference intensities . . . . . . . . . . . 67

6.7 BAM to filter out unlikely cases . . . . . . . . . . . . . . . . . . . . 67

6.8 Visualization of the results. . . . . . . . . . . . . . . . . . . . . . . 68

6.9 Presentation of Quick scan OD output . . . . . . . . . . . . . . . . 68

A.1 iHD SCHEMATIC 1 . . . . . . . . . . . . . . . . . . . . . . . . . . 77

A.2 iHD SCHEMATIC 2 . . . . . . . . . . . . . . . . . . . . . . . . . . 78

B.1 Typical Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

B.2 Message-starting Header . . . . . . . . . . . . . . . . . . . . . . . . 81

B.3 Types of Message Starting Headers (Commands) . . . . . . . . . . . 81

B.4 Types of Message Starting Headers (Replies) . . . . . . . . . . . . . 81

B.5 Message Body of Ping Reply . . . . . . . . . . . . . . . . . . . . . . 82

B.6 Message Body of Update settings and request settings reply . . . . 82

B.7 Message Body of Request Data . . . . . . . . . . . . . . . . . . . . 82

B.8 Message-ending Header . . . . . . . . . . . . . . . . . . . . . . . . . 82

B.9 Frame-idle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

B.10 Data-Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

B.11 Typical word . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

C.1 Datasheet - PIC 18F452 . . . . . . . . . . . . . . . . . . . . . . . . 86

C.2 Pin Diagram - PIC 18F452 . . . . . . . . . . . . . . . . . . . . . . . 87

C.3 Specifications of OPT101 . . . . . . . . . . . . . . . . . . . . . . . . 88

C.4 OPAMP characteristics of OPT101 . . . . . . . . . . . . . . . . . . 89

C.5 Datasheet - NIR LED . . . . . . . . . . . . . . . . . . . . . . . . . 90

xiii

Page 14: Project Thesis

LIST OF TABLES

4.1 iHD terminal power budget . . . . . . . . . . . . . . . . . . . . . . 42

4.2 Message Starting Header . . . . . . . . . . . . . . . . . . . . . . . . 48

4.3 Types of message commands . . . . . . . . . . . . . . . . . . . . . . 48

xiv

Page 15: Project Thesis

ABBREVIATIONS

ADC Analog - to - Digital Converter

ANN Artificial Neural Network

APD Avalanche Photodiodes

BAM Bidirectional Associative Memory

BT Bluetooth

CAT Computed Axial Tomography

CCD Charge Coupled Devices

CT Computer Tomography

EEPROM Electrically Erasable Programmable Read-Only Memory

EH Extracerebral Hematoma

FDA Food and Drug Administration

IH Intracranial Hematoma

iHD intracranial Hematoma Detector

iHDMA intracranial Hematoma Detector Mobile Application

LCD Liquid Crystal Display

LED Light Emitting Diode

MRI Magnetic Resonance Imaging

NIR Near Infra-Red

NIRS Near Infra-Red Spectroscopy

OT Optical Topography

PDA Personal Digital Assistant

PMT PhotoMultiplier Tubes

PWM Pulse Width Modulation

SiPD Silicon Photodiodes

SPP Serial Port Profile

TBI Traumatic Brain Injury

xv

Page 16: Project Thesis

Chapter 1

INTRODUCTION

Medical diagnosis is the process of determining the presence of a disease in an

individual, followed by the confirmation through analysis and past experience of

similar observations [1]. Technology has enabled us to utilize elaborate equipments

to diagnose with greater accuracy and precision, in addition to conventional physi-

cal examinations, with the assistance of Medical Technologists [2]. Nonetheless our

dynamic lifestyles, exorbitant price of medical equipments, exiguity of advanced

equipments in developing countries and remote areas, and lack of technical exper-

tise have always been in favor of portable simple on-site detection technologies.

Intracranial hematoma detection is a medical diagnosis of determining the pres-

ence of hemorrhage inside the cranium, which could potentially lead to death if

not detected and treated timely.

While advanced high-priced detection methods like Computed Tomography (CT)

[3] is widespread today, we are motivated by the promise of affordable portable

technologies which could benefit people living in developing countries like Sri

Lanka. In addition, a portable device is highly desirable in on-site detection and

thus unveil another set of applications. A potential list of such applications are,

• Quick diagnosis : Patients with no external wounds are likely to be over-

looked and hence might result in inadvertent severity. In addition, patients

with inconspicuous and latent symptoms might also suffer the same fate.

Further, due to overlapping symptoms it is increasingly becoming common

1

Page 17: Project Thesis

to be misdiagnosed when sophisticated tests are not carried out [4]. In devel-

oping countries like Sri Lanka where the medical tests are costly and equip-

ments are scanty, this is not a rare case. Wider availability of an affordable,

less cumbersome device to provide positive confirmation of the disease will

be of great value to a physician in making a well informed decision (Courtesy

- Dr. E. C. Kulasekare)

• Wider availability: By making Intracranial Hematoma Detector (iHD)

available in virtually every infirmary, a quick diagnosis can be performed

and on positive indication they could be referred to teaching hospitals with

adequate facilities for additional tests and further treatment.

• Pre-scanning before enlisting to CT scans : CT equipments are pro-

hibitively expensive and hardly affordable by a standard hospital in devel-

oping countries such as Sri Lanka. This leads to a long waiting list for the

usage that results in unacceptable delays and deaths that could have been

otherwise prevented. Such a device could be used as a preliminary measure

to filter out the patients by confirming the presence of hematoma.

• On-site detection : During a public accident or nationwide catastrophe

not everyone needs the same medical attention. While people with benign ex-

ternal wounds could wait post first-aid treatment, those who are with urgent

medical conditions should be transferred and attended immediately. How-

ever in the absence of an external wound, Traumatic Brain Injuries (TBI), a

major cause of death and disability worldwide [5], are not detected and hence

lead to fatalities. This is common in battle fields, accidents in sports and

adventure and industrial mishaps. An on-site detection technology addresses

the particular issue at hand.

Observing the distinctions between traditional equipments and portable devices,

it becomes clear that they are in fact complementing each other rather than sub-

stituting, thus improves the outcome together. Due to the fundamental difference

2

Page 18: Project Thesis

between the underlying technology, otherwise-would-have-been-trivial factors such

as usability, noise treatment, power consumption, etc become significant. There-

fore, unusual measures have to be undertaken. In determining the successfulness

of solution, the following are deemed to be critical:

• Safety assessment: Since it is a medical instrument that directly deals

with patients it should abide by the safety regulations and not become the

cause for further complications. Primary concerns are heat generation and

exposure to radiation.

• Reliable: The results should reflect the actual condition with high proba-

bility and device must be capable of self learning to adjust its parameter to

improve the accuracy in semi-supervised manner.

• Affordable: To be able to ensure the wider availability, especially to allow

penetration into developing countries, the cost of a single device must be

affordable without compromising the quality and features.

• Portable: One of the main application is on-site detection, to make it

possible the solution need to be a battery powered handheld device. For ad-

vanced processing and computations, a mobile computer will be used which

will essentially bring the cost of the device down.

• Power consumption : As it is battery powered, maximum power dissi-

pation is limited.

1.1 Intracranial Hematoma Detector (iHD)

This report describes the design, implementation, and evaluation of iHD system

(figure: 1.1). It consists of hardware device - intracranial hematoma detector ter-

minal (iHD terminal), firmware running in the terminal and software application -

intracranial hematoma detector mobile application (iHDMA). The device operates

3

Page 19: Project Thesis

Figure 1.1: iHD with its top enclosure removed.

in several modes and the fundamental operation is to transmit a burst of pulsed

energy of Near-Infrared (NIR) light, let it take a banana shaped path [6] along the

cranium (figure: 1.2), and measure the intensity on its reception.

Figure 1.2: The assumed banana-shaped light path through tissue sample.

Analog to digital converted value of intensity corresponds to the absorption of

NIR light along its path. Using conventional Optical Density (OD) calculations

presence of hematoma can be directly calculated [7]. However, to reduce the

4

Page 20: Project Thesis

complexity and improve the feature set, we propose few enhancements that are

based on radar system principles.

Instead of single scan, continuous scans will be carried out to generate several sam-

ples that will be put through various methods and pattern matching algorithms to

semi-automatically detect the presence of hematoma, and provide visual imaging

of the head.

1.2 Organization of the Report

The remainder of this report discusses the background, design and development

of iHD system and evaluation of the system in real world application. Chapter

2 introduces to the general background and related work. Chapter 3 discusses

operation of the terminal and mobile application. We present the implementation

of the hardware and firmware of iHD system in Chapter 4. Chapter 5 describes the

algorithms used for hematoma likelihood estimation in iHDMA. Chapter 6 presents

the evaluation of the solution developed and discusses the results. Finally, Chapter

7 summarizes our work and discusses the possible future directions.

5

Page 21: Project Thesis

Chapter 2

LITERATURE SURVEY

Intracranial hematoma is one of the profoundly studied injuries in medical surg-

eries. Intracranial hematoma is a treatable cause of secondary injury which can

cause significant disability or death if not promptly recognized and treated. They

occur as the primary injury in 40% of patients with severe head injury. Recurrent

hematomas, postoperative epidural hematomas, and delayed traumatic intracere-

bral hematomas develop in up to 23% of patients with severe head injury [7].

Near infrared spectroscopy (NIRS) is a spectroscopic method utilizing the near

infrared region of the electromagnetic spectrum (from 700 nm to 1400 nm). NIRS

can be used for non-invasive assessment of the brain function through an intact

skull in human subjects by detecting changes in blood hemoglobin concentrations.

This application is sometimes called optical topography (OT) in which NIRS is

used for functional mapping of the human cortex.

This chapter presents the background and discusses the related work in the area

of intracranial hematoma detection. Section 2.1 begins with a general overview

of intracranial hematoma and discusses the causes and implications. Section 2.2

lists the current diagnosis procedures, merits and demerits. Section 2.3 gives an

overview of NIRS, examines its applicability for intracranial hematoma detection

and surveys related work in this area. Section 2.4 discusses the safety regulations.

Section 2.5 examines different techniques to estimate the presence of hematoma

from intensity data.

6

Page 22: Project Thesis

2.1 Intracranial Hematoma (IH)

An intracranial hematoma is a hemorrhage that occurs within the skull. Intracra-

nial bleeding occurs when a blood vessel within the skull ruptures or leaks. It can

result from physical trauma or non-traumatic causes [8].

Intracranial hematoma possesses a serious medical emergency because the accumu-

lation of blood within the skull can lead to increase in intracranial pressure, which

can crush delicate brain tissues or limit its blood supply thus cause a secondary

injury. Pressure increase can be lethal under certain circumstance where it could

leave a potentially deadly brain herniation. Early identification prior to neuro-

logical deterioration, is the key to successful surgical treatment. This is currently

accomplished by serial CT scan because it is the only reliable method currently

available.

2.1.1 Types of Intracranial Hematoma

• Intra-axial Hematoma

• Extra-axial Hematoma

– Subgaleal Hematoma: Hematoma that occurs between the galea aponeu-

rosis and skull periosteum.

– Cephalhematoma: Hematoma that occurs between the skull periosteum

and skull.

– Epidural Hematoma: Hematoma that occurs between the skull and

dura mater. The condition is potentially deadly because the buildup

of blood may increase pressure in the intracranial space and compress

delicate brain tissue. More often, a tear in the middle meningeal artery

causes this type of hematoma. When hematoma occurs from laceration

7

Page 23: Project Thesis

of an artery, blood collection can cause rapid neurologic deterioration.

Although it occurs in 1-3 % of head injuries between 15 and 20% of

patients with epidural hematomas die of the injury [9] [10].

– Subdural hematoma: Hematoma that occurs between the dura mater

and arachnoid mater. They often occur as a primary head injury due to

fast changing velocities within skull, that leave tears in small bridging

veins. Much more common injuries happen due to various rotational or

linear forces. Further, it is more common in patients on anticoagulants,

such as aspirin and warfarin, and can have a subdural hematoma with a

minor injury. The associated mortality rate is high, approximately 60-

80%. Traditional methods like CT scan or MRI scan are commonly used

to detect subdural hematomas [11]. While small subdural hematomas

can be managed by careful monitoring until the body heals itself, larger

or symptomatic hematomas require a craniotomy. It is also common

on postoperative complications include increased intracranial pressure.

The injured vessels must be repaired.

– Subarachnoid hematoma: Hematoma that occurs between the arach-

noid mater and pia mater (the subarachnoid space), is a form of seizure

and a fatal medical emergency. It can lead to death or disability even

when diagnosed and treated at an early stage [12]. Subarachnoid hem-

orrhage may occur in cases of TBI in a manner other than secondary

to ruptured aneurysms, being caused instead by lacerations of the su-

perficial micro vessels in the subarachnoid space [4]. If not associated

with another brain pathology, this type of hemorrhage could be be-

nign. It is a frequent occurrence in traumatic brain injury, and carries

a poor prognosis if it is associated with deterioration in the level of

consciousness. [13].

8

Page 24: Project Thesis

2.1.2 Traumatic Brain Injury (TBI)

The prime cause for the intracranial hemorrhage is Traumatic Brain Injury. TBI

(figure: 2.1) is often a result of direct hit to the brain from an external mechanical

force or high acceleration.

Figure 2.1: A detailed description of Traumatic Brain Injury.

The yearly incidence in the US is estimated to be 1.5 per 1000 people (1.3 mild, 0.15

moderate and 0.14 severe injuries) which contributes to 52,000 deaths annually.

About two million people suffer from TBI and about 500,000 are hospitalized for

TBI in the United States alone [11]. In developing countries such as Sri Lanka,

the incidence of TBI has risen due to the alarming increase in automobile use and

9

Page 25: Project Thesis

industrialization with the absence of proportionate development in infrastructure,

and therefore corresponding rise in the number of vehicle accidents.

The mortality rate is estimated to be 21%, 30 days after TBI [11]. It is significant

as large percentage of TBI deaths occur weeks after the event [13], mainly due

to the secondary injury and complications developed. These secondary injuries

exacerbate the damage and contributes to great number of TBI deaths occurring

in hospitals [14].

Outcome for patients with head injury depends heavily on the cause. Patients

with TBI from falls have an 89% of survival rate while only 9% of patients with

firearm-related TBIs survive. Firearms and vehicle accidents are the most common

cause of fatal TBI [11].

2.2 Other diagnosis procedures

2.2.1 Computed Axial Tomography (CAT)

CAT is the definitive tool for accurate diagnosis of an intracranial hemorrhage.

The early detection of the aforementioned blood clots is paramount, and will

be a life saver. Currently only Computer Tomography (CT scan) is capable of

identifying it, nonetheless unfortunately, it is prohibitively expensive and rarely

available. However, a clinical pre-screening technique could improve the utilization

of CT scan.

2.2.2 Magnetic Resonance Imaging (MRI)

A medical imaging technique used to visualize the internals and functions of the

organs and body. MRI offers greater contrast between different soft tissues and

clear picture than CT does, and hence useful in brain imaging. Further, unlike

10

Page 26: Project Thesis

CT, it uses no ionizing radiation, but a powerful magnetic field and therefore less

harmful to body. However MRI cannot be used on patients with metal implants,

and cardiac pacemakers due to effects of the strong magnetic field and powerful

radio frequency pulses [15].

Aforementioned methods share many merits like, high resolution, reliable opera-

tion and excellent accuracy. Nonetheless they also share the following common

drawbacks

• High capital cost and hence unaffordable in developing countries.

• Complex operational procedures and hence require high operational, main-

tenance and repair cost.

• Unportable and hence cannot be deployed with field units to be used for

on-site detections.

In addition, CT scan is highly harmful to the tissues as continuous high power

irradiation could leave the patient with damaged cells thus increasing the likelihood

of cancer and other complications.

2.3 Near Infrared Spectroscopy (NIRS)

Near-infrared spectrum is 0.75 − 1.4 µm in wavelength, defined by the water ab-

sorption. Near infrared spectroscopy is based on molecular overtone and combina-

tion vibrations. Such transitions are forbidden by the selection rules of quantum

mechanics [16]. As a result, the molar absorption in the near IR region is typi-

cally quite small thus it penetrates much farther into a sample than mid infrared

radiation. As a result, near-infrared light can penetrate several centimeters of

biological tissues, enabling noninvasive investigation of the brain from the surface

of the scalp.

11

Page 27: Project Thesis

Near-infrared spectroscopy (NIRS) is an optical noninvasive method of measuring

cerebral hemoglobin distribution. It is a useful technique to investigate biological

tissues, because in the near-infrared regions 750− 900 nm (figure: 2.2), water has

a low absorption, while oxyhemoglobin (HbO2) and deoxyhemoglobin (Hb) still

have detectable absorption differences [12].

Figure 2.2: Absorption of light energy by Water and Hemoglobin in NIRregion [6].

It is a relatively simple technique that is portable, does not require a dedicated

technical staff, and does not require the patient to be injected with any isotopes.

2.3.1 Application of near infrared spectroscopy for intracranial hematoma detec-

tion

The basic principle of hematoma detection with NIRS is that water absorption

in the near infrared range is relatively small and hemoglobin contributes to most

of the tissue absorption; extra vascular blood absorbs NIR light more than nor-

mal brain tissue since there is a greater concentration of hemoglobin in an acute

hematoma. By comparing the re-reflected and diffusing optical signal I2 from the

12

Page 28: Project Thesis

suspicious hematoma side and I1 from the healthy side or from a standard model,

the optical density (OD) is calculated as in (Equation 2.1).

OD = log10(I1/I2) (2.1)

The paper “Use of near infrared spectroscopy to identify traumatic intracranial

hematomas” [7] claims that an OD value greater than 0.05 hints the presence of

hematoma and likelihood increases with the OD value. An OD value greater than

0.5 definitely corresponds to an extra cerebral hematoma.

Figure 2.3: Histogram of Optical Density for different hematomas [17].

Figures 2.3 and 2.4 illustrate the direct correspondence between OD, and the

presence and type of hematoma. Hemorrhages, irrespective of their type, depth

or thickness produce an OD > 0.05 at high probability. Further extra cerebral

hemorrhages, irrespective of the depth or thickness produce an OD > 0.6 [18].

Intracerebral hemorrhages fall in the gray region and may be confused with small,

13

Page 29: Project Thesis

Figure 2.4: Optical density variations under different hematoma conditions[17].

extracerebral hemorrhages as well. However as intra cerebral hemorrhage is hardly

operable and tiny hemorrhages are not life-threatening, it can be referred to future

analysis.

2.4 Safety Regulations

Food and Drug Administration (FDA), USA regulations limit the maximum power

irradiated to the skin to 2−5 mW/mm2 in the spectrum of wavelength of 700−900

nm for the exposure of 10 s or more. An LED source of high light intensity can

be considered for use when faced with this limitation.

Based on the experiments by Ito et al. [19], elevations in the temperature due to

NIR absorption is less than 0.5o C. In the experiments by Alper Bozkurt, et el

[20], the increase in the skin temperature was 0.5± 0.1o C due to the cushioning

14

Page 30: Project Thesis

material used to attach the light source, and that was mainly due to skin-air heat

exchange and sweating. However, the temperature increase due to semiconductor

junction is in the range of 1 to 10o C [20]. The major contributor is therefore the

semiconductor junction, which may cause burn injuries [21][22]. Further cell death

is possible in the event of sustained temperature rise above 41o C [23]. Therefore

care must be taken to control temperature.

It is required to control irradiation due to LED to 50 mW/cm2. This is comparable

to the irradiance of the NIR region of the sunlight, which is about 50 mW/cm2.

The temperature increase and total irradiated power can be controlled by pulsing

the current that is fed to NIR LED source.

2.5 Algorithms

2.5.1 Threshold detection

In radar systems, to detect the hit, dynamic threshold is preferred to constant

threshold, because noise level could vary. This ensures the constant probability of

false alarm, while varying the threshold level accordingly.

When standard deviation (σ) and average noise (Vn) can be calculated from the

sample vector, the dynamic threshold is established as in equation:2.2.

Vm = Vn + k × σ (2.2)

2.5.2 Post detection integration

Similar to the aforementioned algorithm, post detection integration is a popular

method used in radar systems. Here, once positive indication vector is generated,

unusual pattern that highlights an impossible situation could be identified.

15

Page 31: Project Thesis

In mathematical terms the probability estimation can be given by equation: 2.3,

for n samples with npositive number of positive indications. Positive indications

with less probabilities can be thus filtered out.

ppostdetectionintegration =npositive

n(2.3)

Complex pattern matching algorithms can be used, and we demonstrate the ap-

plication of bidirectional associative memory in chapter 5.

2.5.3 Bidirectional Associative Memory (BAM)

BAM is an important tool available in Neural Networks and one of the most widely

used. It achieves heteroassociation with smaller correlation matrix. Once trained,

using a set of pairs of vectors, it could recall a pair (A, B) given initial pair (α, β).

Wang et al [24] illustrated the use of BAM for pattern recognition. Also it was

proved by Kosko [25], that BAM will converge for any correlation matrix W.

However it could not guarantee that energy will be at local minimum. But it was

shown by Yeou-Fang Wang et al [26] that guaranteed recall exists for all training

pairs thus trained relationship could be established. Additional mathematical

derivation is provided in Appendix D.

2.6 Chapter Summary

This chapter described background studies. Also it presented the current ap-

proaches and related work. The chapter then continued to explain the application

of NIR in IH detection. After that, it proposed enhancements in detection algo-

rithms to provide a new feature set and to improve accuracy. The next chapter

discusses the operation of iHD system.

16

Page 32: Project Thesis

Chapter 3

SYSTEM OPERATION

The complete solution consists of a portable remote device - iHD terminal - and a

mobile application - iHDMA - running on a mobile computer such as a Personal

Digital Assistant (PDA), notebook or netbook. In this chapter we will look at the

use of the device and operation of both iHD terminal and iHDMA. This chapter is

provided for the completeness only, and for a beginner level instruction User-Guide

must be referred to. Generic overview is given in section 3.1. Section 3.2 discusses

the use of iHD in-depth and section 3.2 leads through the use of iHDMA.

3.1 Using the system

The iHD terminal is used to perform the scans and the iHDMA is used to compute

the results and visualize them.

• Mode 1 - Active Scan : Continuous scan over the injured side of the

head to obtain the intensity values over scanned area.

• Mode 2 - Reference scan : Continuous scan over the healthy side of the

head to obtain reference values.

• Mode 3 - Quick scan : Quick scan is performed in four stages over four

predefined locations (figure: 3.2) on the head. On each location a pair of

scan is performed on each side starting with left side of the head. Realtime

Bluetooth communication is enabled in this method.

17

Page 33: Project Thesis

Figure 3.1: Terminal is operated in four different modes. User can sequentiallymove from one mode to another mode by pressing the mode button on the

device. User is also allowed to skip through modes and come back later.

18

Page 34: Project Thesis

– Mode 3a - Quick Scan on Frontal area : Over left (followed by right)

side of the forehead above the frontal sinus

– Mode 3b - Quick Scan on Temporal area : On left (followed by right)

side of the temporal fossa

– Mode 3c - Quick Scan on Parietal area : Above left (followed by right)

side of the head midway between the ear and the middle of the skull.

– Mode 3d - Quick Scan on Occipital area : Behind left (followed by right)

side of the head midway between the ear and occipital protuberance.

• Mode 4 - Data Transfer : iHD terminal’s Bluetooth module is put in the

listening mode so that a mobile application can query data from the iHD

terminal. Further this mode allows few low level firmware configurations.

Figure 3.2: Although Optical Density scans can be taken at any two identicalpositions on either side of the head, these predefined positions will make the

process simpler and efficient.

Once the scans are completed, the data is transmitted to a mobile computer run-

ning iHDMA for analysis and semi-automatic diagnosis. iHDMA is run on a .Net

platform powered mobile computer with Windows Operating System (OS) in-

stalled. The computer should be Bluetooth enabled. The estimates are computed

by iHDMA and visualized (figures:3.3-3.4).

19

Page 35: Project Thesis

Figure 3.3: An important objective of iHD is to be simple to operate. Theresults are visualized through a brain imaging, and thus provides greater us-

ability.

Figure 3.4: The summary is provided for a quick glance of all the details.

20

Page 36: Project Thesis

3.2 Operation of iHD terminal

Once the iHD terminal is powered on it will be put in mode 1 - active scan. The

user is indicated that the device is ready and waiting for user input. The device is

then moved gently over the injured side of the head from forehead to the occipital

protuberance while keeping the scan button pressed. The active state is indicated

to user.

An average movement of 160 mm is expected at 16 mms−1.On average this will

yield more than 400 samples. If required, it could be performed over shorter length

at a slower speed resulting in concentrated samples for higher resolution.

It is followed by mode 2 - reference scan where identical procedure is repeated

but over the reference side of the head. Should the scan be made over a shorter

length during active scan, it must however be matched here. Although approxi-

mately same number of samples are expected the exact number could vary and it

is considered in the algorithm.

If a scan is repeated under a particular mode before uploading the results to the

mobile application, data will be replaced allowing repeated scans to correct errors

in the process.

To support conventional OD measurements and facilitate the comparisons, mode 3 (3a

to 3d) - Quick scan is provided. Under this mode, the device is kept over the in-

dicated position on the left side of the head and scan is carried out by pressing

the scan button once. It must be followed by the same procedure over the same

location on the right side of the head. For example under mode 3a, firstly the de-

vice is placed on the left side of the forehead above the frontal sinus and scanned.

Then it is repeated on the right side of the forehead above the frontal sinus. Re-

altime Bluetooth connection is enabled under this mode. Similar to mode 1 and 2

repeated scans under a given mode will replace the previous data.

21

Page 37: Project Thesis

Once the required scans are completed, it moves into mode 4 - data transfer.

Here, the device is put into discovery mode searching for a serial profile enabled

Bluetooth connection. If one is found it is added to the list . No more user

interaction is needed on device side to complete the data transfer or diagnosis.

3.3 Operation of iHDMA

The use of mobile application is intuitive and designed to offer optimal user expe-

rience while enabling the maximum flexibility. The application is written on .Net

3.5 platform1and has no other dependency.

The standard flow is to begin with data capture (figure: 3.5). Under this step, user

could verify the presence of a valid iHD terminal by pressing connect button. The

device would respond with a code that will be used to identify a valid terminal.

User could then proceed to capture data.

Figure 3.5: Under capture mode following the device validation user couldimport the data with a single click. Should any error occur data buffer could

be flushed with reset button.

Capture is followed by save option, where record ID, medical officer ID and other

details can be stored together with the data. Also the integrity of the data is

1.Net 3.5 runtime can be downloaded from Microsoft website :http://www.microsoft.com/downloads

22

Page 38: Project Thesis

checked and it is processed (figure: 3.6). The data is stored in XML format so

that it could be subjected to further analysis with external applications.

Figure 3.6: Captured data can be completed with additional parameters andsaved as an XML file. User can then proceed to process data to generate anal-ysis. Also user could load already saved or processed data for a re-analysis.Further availability of active scan, reference scan and OD scan data are indi-

cated to the user; so is the data analysis results.

In the next step a quick snapshot of the results is produced for instant diagnosis.

Both intensity threshold (based on active and reference scans) and conventional

OD results are used to create visual imaging. The color variation is used to indicate

the severity and when the threshold is exceeded alert is generated, thus enabling

the quick identification of a hemorrhage. It is followed by advanced analysis (figure:

3.7).

The last step offers advanced configuration (figure: 3.8) for experienced users. If

Bluetooth connection port is configured with non-default parameters, correspond-

ing settings can be made here. Further signal intensity, pulse frequency and other

related parameters of iHD system can be configured here and synchronized with

the device.

23

Page 39: Project Thesis

Figure 3.7: In addition to quick results, advanced analysis can be opted for.Parameters like normalization count, threshold limit, etc can be set with theaid of visual indication under this section. Hence the parameters can be set to

attain the optimal performance.

Figure 3.8: Mobile computers may offer Bluetooth through a different portor with different settings. Further user might prefer to change iHD terminal’sfirmware parameters for better performance. This section permit such config-urations over Bluetooth, without modifying the actual firmware code. Also it

allows global level iHDMA parameter configurations.

24

Page 40: Project Thesis

3.4 Chapter Summary

This chapter described the use of iHD system. This chapter also described the

detailed use of software (iHDMA) and hardware (iHD) components of iHD system.

The next chapter discusses the architecture design and implementation of iHD

system.

25

Page 41: Project Thesis

Chapter 4

SYSTEM ARCHITECTURE

The critical component of the solution is the iHD terminal. In this chapter we will

look at the design architecture of the iHD terminal. We begin the chapter with

detailed description of the architecture of the iHD terminal in Section 4.1. We look

at the system from bird’s eye view and analyze the inter-operation between the

components. Section 4.2 is dedicated to the hardware design and implementation.

In Section 4.3 we describe the firmware component running the iHD terminal.

Section 4.4 examines the communication protocol specifications.

4.1 iHD System Architecture

iHD terminal is a small hardware platform consisting of a microcontroller, NIR

transmitter and receivers, and other associated hardware units. Detailed explana-

tion is given in section 4.2. The unit operates in four different modes. Detailed

instruction on operating the device is given in chapter 3.

iHD terminal is used to perform different types of scans over both injured side

and reference side of the head, store them and transmit to the remote application.

The fundamental operation of a scan is to transmit a pulse modulated signal and

measure the intensity of the received signal. The transmitted signal is confined to

NIR spectrum with the aid of NIR LEDS, and differential analysis is performed

to cancel ambient noise. This atomic step is repeated at configured frequency on

26

Page 42: Project Thesis

a predetermined pattern to achieve several modes of operation. Further param-

eters pertinent to the signal generated and reception component are maintained

configurable to enable maximum flexibility.

4.2 iHD Hardware Architecture

Figure 4.1: iHD Unit.

The hardware implementation of the system (figure: 4.2) can be grouped into five

basic modules each with unique functionality considering the overall architecture.

The basic modules are,

• Signal generation and Sensor Subsystem

• Processing & Controlling Subsystem

• Communication Subsystem

27

Page 43: Project Thesis

• Power Management Subsystem

• Input Output Subsystem

Figure 4.2: Architecture diagram depicts the interaction between individualsubsystems.

4.2.1 Signal generation and Sensor Subsystem

Concentration of hemoglobin determines the extent of absorption of NIR signal

and thus affects intensity of reception. Hemoglobin concentration in a particular

point of the brain is found relatively by transmitting series of pulses of Near

Infra Red light and measure the reflecting amount of NIR energy, through the

NIR intensity to voltage convertor reading. The amount of reflected energy is a

measure of amount of absorbed energy by brain tissues.

The process can be further divided into the following

• Pulse generation and Current Control

• NIR light emission

28

Page 44: Project Thesis

• Signal reception, noise cancelation and analog to digital conversion

• Interfacing, and Transmitter - Receiver Separation

4.2.1.1 Pulse generation

Burst of pulses are generated through Pulse Width Modulation (PWM) program-

matically. This facilitates the power and time control in software. Microcontroller

is used to generate the PWM signal (figure: 4.3). Although it was initially con-

sidered to use an isolated signal generation circuit for better performance, due

to above reasonable power line noise, microcontroller based signal generation was

chosen. Further it allows greater control over the frequency, duty cycle and burst

time, while maintaining them configurable through firmware settings.

Further external transistor based amplifier is employed to permit larger current

and it acts as a current source. To prevent over current condition, PIC is coupled

through inverters that act as buffers.

Figure 4.3: Burst of pulses that are fed to NIR LED.

4.2.1.2 NIR light emission

The wavelengths selection is based on the absorption spectra of the hemoglobin.

As explained earlier peak difference in absorption between water and blood is at

760nm for Hb and 850− 860nm for HbO2.

29

Page 45: Project Thesis

Wavelength consideration

• 805nm - 810nm : A wavelength of 805nm - 810nm is suitable for hematoma

detection since it is very close to the isosbestic wavelength of oxyhemoglobin

and deoxyhemoglobin absorption, and the signal detected will not be af-

fected by differences in oxygen saturation in blood. Narrow bandwidth high

power NIR LEDs within this frequency range, that were purchased from

ROITHNER LASER TECHNIK are used in iHD.

• 760nm - 850nm : Wavelengths of 760 nm and 850 nm are selected to monitor

temporal changes of cerebral concentrations of HbO2 and Hb. For each

wavelength it is assumed that the linear changes in attenuation for each

chromophore can be linearly summed. The result of these computations is

the value of the absolute change in concentration of each chromophore in

the non-arbitrary units of micro molar of chromophore per liter of tissue.

Two wavelengths can be multiplexed to have separate information on each

wavelength. They can be alternatively turned on and off in pulsed manner

to achieve this.

As the latter approach clearly possess an advantage it was attempted initially.

However due to the fact that the sensor has equal response in both the bandwidths,

mutual noise became critical. It was however later handled by introducing an

optical narrow bandwidth filter at 760nm and 850nm. This produced significantly

better results. Nonetheless, due to the lens attenuation the intensity reception did

not yield results better than single wavelength operation, and thus considering the

simplicity of the design, peak difference in absorption levels between water and

hemoglobin, and ambient noise, 850 nm single wavelength emission is used in iHD

terminal.

One of the most important reasons for choosing a LED is that its radiation is within

the FDA limitations for the radiation power, and if needed multiple LEDs can be

30

Page 46: Project Thesis

operated together to attain required radiation intensity. Further glass top conver-

gence provided by LED was adequate to achieve the radiation intensity required

to penetrate the tissues and skull. Compared with quantitative measurement of

oxygen saturation or other applications, the incident light for hematoma detection

does not require as sharp a spectrum distribution as does the laser; hence LED is

used.

4.2.1.3 Signal reception, amplification and Analog to Digital Conversion (ADC)

Following types of detectors, that can be used to measure the transmitted signals,

were considered.

• Silicon photodiodes (eg OPT101)

• Avalanche photodiodes (APD)

• Photomultiplier tubes (PMT)

• Charge coupled devices (CCD)

The latter two options are not feasible on the basis of price and size.

Silicon Photodiodes (SiPD) : Although silicon photodiodes have a lower sen-

sitivity in comparison to APDs, their reasonable response time, high dynamic

range, and the requirement that several needed to be placed within the flexible

probe area, made them the perfect choice. The integrated combination of photo-

diode and transimpedance amplifier on a single chip (figure: 4.4) eliminates the

problems commonly encountered in discrete designs such as leakage current errors,

noise pick-up, and gain peaking due to stray capacitance.

OPT101 is a monolithic photodiode with on-chip transimpedance amplifier (figure:

4.5) from Texas Instrument (TI) which is specially made for medical applications.

31

Page 47: Project Thesis

Figure 4.4: OPT101. An integrated solution for high sensitive light to voltageconversion over NIR region.

It is inexpensive compared to others such Si sensors and costs only 8USDs [27].

TI’s free sample offer was used for the research and development process.

Figure 4.5: The 0.09×0.09cm2 photodiode is operated in the photoconductivemode for excellent linearity and low dark current. The OPT101 has high sensi-tivity of 0.45A/W and quiescent current is only 120A. Further peak response

is at around 850 nm [27].

Dark Current Offset Correction: The dark current is the result of absence

of light falling on the photodiode and it makes small voltage at the output and it

should be avoided to have better performance.

The photodiode dark current of OPT101 is approximately 2.5 pA and contributes

virtually no offset error at room temperature. The bias current of the op amp’s

32

Page 48: Project Thesis

summing junction (- input) is approximately 165 pA. Further it can is deducted

with the following circuit for improved performance (figure: 4.6).

Figure 4.6: The dark current will be subtracted from the amplifier’s biascurrent, and this residual current will flow through the feedback resistor creatingan offset. The dark output voltage can be trimmed to zero with this optional

circuit. [27].

4.2.1.4 Interfacing and Transmitter - Receiver Separation

The primary concern was to achieve maximum coupling between transmitter and

receiver along the path through cerebrum while ensuring safety, minimum interface

noise addition, and least interference from ambient noise.

Separation : It was noted during the tests, due to the high sensitivity of the

sensor and narrow bandwidth of the transmitter, the direct noise from transmitter

to sensor could prevail at a meter separation even when they are not facing each

other. Further it was noted that the received power increases with the separation

up to 5 cm and then decreases according to inverse square law. The objective of

the design is to ensure maximum coupling through cerebrum and thus the perfect

separation was deemed to be 3− 3.5 cm.

33

Page 49: Project Thesis

Interface : The photon current will be significant and unstable at the contact

boundary between the optical probe and the tissue surface. Poor optical contact

results in noise, false signals, and inconsistent readings. The surface of the head is

usually not flat. Further it was adequate to maintain perfect contact with sensor

while ensuring the emitted power of the LED is tunneled through the skull. It is

achieved by raising the sensor slightly above the surface of the device while placing

a pair of LEDs in a pit with aluminum and black rubber. This guarantees that full

LED power is channeled through head at minimum direct leakage to the sensor

(figure:4.8).

Figure 4.7: The design is planned such that, if necessary this could be furtherimproved to accommodate flexible elastic optical probes as shown.

The flexible probe improves optical contact, but we cannot say that it totally

solves the contact problem; for example, movement of the skin also results in

signal instability [28]. Thus the movement needs to be gentle and we advice a

speed of 16mms−1.

34

Page 50: Project Thesis

Figure 4.8: The LED and photodiode are mounted on the baseboard, whichcan be curved a little to fit the shape of a human head. A black sponge is used

to prevent leakage of light from the source to the detector [28].

Encapsulation : LED cannot be placed in direct contact with skin as the heat

transferred through conduction will be significant and will result in high temper-

ature rise of the skin (up to 9 degrees). This is taken care of by placing the LED

in an abyss while ensuring total enclosure. It requires encapsulation in a suitable

material:

• Flexible enough to conform to the head

• Have suitable optical properties

• Do not give off any by-products

A two-part clear silicon rubber satisfied all of the above requirements. Further,

to prevent direct leakage, it was first wrapped by aluminum foil followed by the

rubber material coated in black color. Encapsulation was carried out in three

stages

• Encapsulation of the back of the sensor board

• Encapsulating the front of the PCB of LED board, except for the regions

directly above the LEDs and photo sensors

35

Page 51: Project Thesis

• Filling the regions directly above the LEDs and photo sensors

4.2.2 Processing & Controlling Subsystem

This is the brain of the blood clot detector and responsible for controlling all

the subsystems. The microcontroller is in charge of the whole operation, which

includes acquiring the signal, adjusting the incident light intensity, and commu-

nicating with the operator. The main functionalities required for this subsystem

will be Analog to Digital Convertor (ADC) to interface Sensor, controlling NIR

LED currents, adjusting intensity via use of pulse circuit, and UART operation

for serial communication between Bluetooth and Microcontroller. Due to the fact

that whole system is operated by low capacity small battery, it should operate

with low power consumption.

4.2.2.1 PIC Microcontroller

The major reason for selection of the PIC microcontroller is that it has emerging

development tools. Other reason for this selection was, this project was selected

to the second phase of the Microchip PIC32 Design Challenge. We were offered

the starter kits and other required resources free. Hence we selected PIC family

of Microcontroller as our main processing and controlling unit.

Features of PIC18F452

• 2 level priority interrupts

• 10 MHz Maximum Frequency

• 32K Program Memory

• Multiple Power Management Modes

36

Page 52: Project Thesis

• UART Module

• 8-Channel 10-bit Analog-to-Digital Converter

4.2.2.2 Sensor Interfacing

The OPT101 sensor produces an analog output which varies among two voltage

levels. But microcontroller processes only digital data. So we need to use analog

to digital conversion when interfacing the sensor to the Microcontroller. The

microcontroller has a 10 bit Analog-to-Digital converter (ADC) with externally

configurable voltage references. The 10-bit ADC includes the following features:

• Successive Approximation Register (SAR) conversion

• Up to 500 kilo samples per second (ksps) conversion speed

• External voltage reference input pins

• One unipolar, differential Sample-and-Hold Amplifier.

The data available from the sensor input can be read as digital after converting

them from analog by using ADC of the microcontroller. The absorption of NIR

light is the difference of the transmitted energy to the received energy. But these

two parameters cannot be calculated in practice.

The basic operation of hematoma detection is by exploiting the fact that water

absorption in the near infrared range is relatively small and hemoglobin contributes

to most of the tissue absorption which is calculated by comparing the reflected

and diffusing optical signal intensity Ileftfrom left side and Iright from right side,

the optical density OD can be derived to:

OD = log10(I0/Ileft)− log10(I0/Iright) = log10(Ileft/Iright) (4.1)

37

Page 53: Project Thesis

Then intracranial hematoma can be detected by comparing the OD with the de-

tection threshold and historical data. According to position, different intracranial

hematomas can be divided into epidural, subdural, and intra-cerebral types. Back-

ground study given in section 2.3 provides the insight into this.

4.2.2.3 Possible methods of computation

• Time resolved : In Time-resolved method, short pulses of light is trans-

mitted and the distribution of time of flight of the transmitted photons is

measured. This measurement provides the greatest amount of information

about the tissue being investigated, but the device will be complex.

• Frequency modulated : Frequency modulated instruments involve mod-

ulating the light source at radio frequencies and detecting the intensity and

phase of the transmitted signal. This requires less complex instrument.

• Continuous Intensity : The continuous intensity instrument is the sim-

plest of all, where light is injected into the tissue and the attenuated trans-

mitted intensity is measured at some distance from the source.

The exact depth of the hematoma from the surface that can be examined by NIRS

is still controversial. Further direct depth calculation is rendered impossible due

to short distances involved.

The typical time of flight for a depth of 3cm will be

Tflight = (2× 0.03)/(3× 108) = 2× 10−10s (4.2)

We will neither be able to generate nor detect at this high frequency (Equation

: 4.2) in a microcontroller based implementation. However through transmitting

38

Page 54: Project Thesis

burst of pulses of continuous intensity (type 3) and detecting patterns the charac-

teristics of the hematoma can be found.

4.2.3 Communication Subsystem

Figure 4.9: GS-BT2416C2 Bluetooth Module

The use of a remote connection to a wireless device such as PDA can help us

integrate great variety of flexibility into the system. The mobility of the device

is extremely high in such a design. Also it increases user friendliness by use of

graphical user interface on the remote device. Reasons for use of a Bluetooth (BT)

module (figure: 4.9):

• Cost effective comparing to high-end microcontrollers and graphical display

on the device itself

• Easy integration with microcontroller via Universal Asynchronous Receiver

Transmitter (UART)

39

Page 55: Project Thesis

• Relatively flexible, feature-rich software development and better graphic

quality are achieved. With use of BT we can maintain our functionality

in better quality and in very economic manner than other options.

A suitable BT module called GS-BT2416C2 is used as it possess the following

characteristics.

1. SPP (Serial Port Profile) Support : All Mobile phones/PDAs support SPP

only

2. Direct interfacing to a UART and control by AT commands

3. After initialization with AT commands it direct data transfer via UART

4. Bluetooth specification V.1.2 compliant

5. Transmission rate up to 721 Kbps

6. Working distance up to 10 meters without an external antenna

7. Hardware based UART flow control

The BT module is compatible with UART interface controlling (figure: 4.10). The

module with AT command is dedicated to implement serial cable replacement. An

automatic point to point connection takes place when modules are switched on.

Modules are configured via macro instruction to play the role of master or slave.

4.2.3.1 UART

UART is used to control the module with AT commands (COMMAND MODE),

or send/receive serial data to be transmitted over the SPP Bluetooth link (DATA

MODE). The first time that the module is powered up, the default UART settings

are as following (saved in flash memory)

40

Page 56: Project Thesis

Figure 4.10: The interfacing of the BT module using the UART and 2 GeneralPurpose Input Output(GPIO) ports.

1. Baud rate: (bps) 9600

2. Data bits: 8

3. Stop bits: 1

4. Parity: None

5. Flow control: None

When these settings are changed by the AT+UARTSETUP command, they are

stored in the flash memory to be reloaded when the module is powered up the

next time.

GPIO1 : This will be configured as output. GPIO1 is high when an SPP Blue-

tooth link to a remote device is present. GPIO1 is low when no Bluetooth link is

present.

GPIO3 : The GPIO3 should be configured as input. If GPIO3 is set to high,

the module switches its mode of operation to DATA MODE. If GPIO3 is set to

low, the module switches its mode of operation to COMMAND MODE. After

aforementioned initialization is performed, any feature of the BT module can be

41

Page 57: Project Thesis

accessed via the its protocol stack (figure: 4.11). The dataflow and command sets

are explained under section 4.3.

Figure 4.11: Bluetooth Stack

4.2.4 Power Management Subsystem

This subsystem manages power to the rest of the subsystems. To maximize the

power capacity and portability a rechargeable dual cell (7.4V - 8.4V ) will be used

to power the terminal. Provision of power at the appropriate voltages to the

other subsystems will be handled by this subsystem. The voltage and current

requirements for the device is tabulated below (Table 4.1).

Device / Subsystem Vmin (V)Vtypical(V)Vmax (V)Imax (mA)

PIC18F452 2.3 3.3 3.6 200Bluetooth Module 3.13 3.3 3.47 90Sensor Subsystem 2.7 5 6 250

I/O 3 5 6 50

Table 4.1: voltage and current requirements of iHD terminal subsystems.

4.2.4.1 Low Dropout (LDO) Regulators

The REG1117 is a family of easy-to-use three-terminal voltage regulators from

Texas Instrument. The family includes a variety of fixed and adjustable-voltage

42

Page 58: Project Thesis

versions, two currents 800mA and 1A. REG1117 characteristics

• Output tolerance: 1%

• Output Current: 800mA, 1A

• Dropout Voltage: 1.2V @ 800mA

• Internal Current Limit

• Thermal Overload Protection

• 0.06V voltage ripple at 3.3V Output

• 0.10V voltage ripple at 5.0V Output

4.2.4.2 Power Source

The requirement to have portability of the terminal requires small size battery op-

eration when considering the weight and the size of the device. Therefore we have

selected rechargeable dual cell with capacity of 2100mAh for major power source

for our device. The 2100mAh of capacity can operate the device continuously for

3 hours at full functionality.

4.2.4.3 DC Power and Charging

The device can be simultaneously powered by both battery and external DC sup-

ply. A generic purpose DC adapter with 9V , 1A rating could be used to charge the

batteries while powering up the terminal. When the device is discharged the user

can connect to the charger and keep until the batteries get fully charged. However

to minimize the complexity and size of the device, no special power management

unit is provided.

43

Page 59: Project Thesis

4.2.4.4 Sleep, Power Saving Modes

The iHD terminal is an on-demand-use device and hence not expected to be pow-

ered on when it is not in use. Therefore special power saving and sleeping modes

other than the micro controller’s built in power saving modes of operation are not

considered.

4.2.5 Input Output Subsystem

This is the subsystem that interacts with user. The Sensor Subsystem could also

be categorized under this subsystem, but as it is the most critical component it

was considered separately. In this section we focus on controlling inputs to the

systems.

Considering the portability, power and simplicity requirements, we moved the

responsibility of processing and displaying results to the mobile computer and

therefore iHD terminal is only providing minimal user interaction.

The main inputs used here to interact with user, are the mode selection button

and scan button. Visual imaging, statistical analysis and learning system will be

implemented in remote mobile computer such as a PDA which will act on the data

received via the Bluetooth connection.

As explained in section 3.1, once the device is powered on it will be put in mode

1. Through a push button, user could navigate through modes. The button is

connected to an interrupt enabled input of the microcontroller to give the highest

priority. User can then trigger the scan by pressing and holding the scan button

(under mode 1 - active scan and mode -2 reference scan) or pressing and releasing

the scan button. The button is provided with de-bouncing algorithm to improve

user interaction and allow accidental releases.

44

Page 60: Project Thesis

4.2.6 Safety concerns

As explained in section:2.5, care must be taken to ensure that the irradiated power

is within the safety limits. It was also earlier established that radiation up to 50

mW/cm2 is harmless as it is comparable to the irradiance of the NIR region of

the sunlight.

The average radiated power of an NIR LED is 20 mW, thus resulting in total

radiation of 40 mW assuming that 1 cm2 area is illuminated.

4.3 iHD Firmware Architecture

Figure 4.12: iHD firmware block diagram

iHD Firmware Architecture is shown in (figure: 4.12). Due to the realtime nature

of the application both external input and internal clock triggered interrupts based

scheduler is implemented to switch between different states. A user input will take

priority and hence result in the state change wherever the program was. However

necessary care is taken to windup the current state properly and variables are

properly stored.

45

Page 61: Project Thesis

State maintainer chooses the appropriate state function and runs. There are two

such state implementations. In addition, it handles the user indication output

that reflects the current state and status of the operation.

4.3.1 Communication state implementation

This module handles the Bluetooth communication. When the state is entered,

the component resets the BT module through hardware reset, thus escaping from

whatever status the BT module is currently in. It is followed by initialization of

AT commands, and initial settings. Then BT is put in discovery mode, and when

it is contacted by a mobile computer running iHDMA it answers. This module

is also responsible for the responses to the commands sent from iHDMA. In this

context, it handles the formatting of replies and queueing them.

4.3.2 Data Acquisition state implementation

This module handles the different modes of scans. When one of the scan mode is

entered, settings of an atomic scan operation is loaded from EEPROM and stored

in global variables. Then the module chooses the properties depending on the scan

mode and calls the atomic scan function that is common for all. The operation is

then delegated to PWM generation, ADC sampling, encoding (10 bits output to

a word) and store functions.

4.3.3 User Indication IO

The current state is displayed to user at all time, and changes in states are reflected

instantly, irrespective of the unloading and loading latency involved. Further, the

46

Page 62: Project Thesis

operation status such as scanning, busy, ready to scan and errors are displayed

appropriately.

4.4 Communication Protocol

This section describes the protocol that is adopted to be used for the commu-

nication between the remote intracranial hematoma detector (iHD) and Medical

Application (iHDMA) that is running in a Personal Computer, Notebook or Mo-

bile Computer. Detailed description of the protocol and examples are given in

Appendix B.

4.4.1 Introduction

The iHDMA will always be a host and iHD always be slaves. Therefore, only

iHDMA can initiate communication by querying the iHD and the iHD is obliged

to respond. The atomic unit of the data is a word (16 bits) which is in big-endian

format, i.e. the higher order byte is sent first. All the messages are encapsulated

between a message-starting header and message-ending header. Further frame

headers wrap all data frames.

One cycle of communication includes the command initiated by iHDMA and the

reply from iHD.

Commands can be one of the following :

• Request Settings

• Update Settings

• Request Data

• Ping

47

Page 63: Project Thesis

4.4.2 Structure

As aforementioned, a command or reply message is wrapped by headers. The

body length can be of variable number of words.

The header identifies the type of the word (i.e. a Message Header) and type of

the command (Ping, Request Data, Request Settings or Update settings), and the

body is supplemented with any parameters if available. Hence, the body may be

absent when it is neither required by the command nor available. The command

or reply is ended with message-ending header which is 0xFFFF for all messages.

4.4.3 Message Starting Header

A 16 bits long word of the following format (Table : 4.2) will serve as a message-

starting header.

1 1 1 1 0 0 0 0 0 0 0 0 X X X XWord Type Reserved Command / Message ID

(Message Header) (0 always) Reply

Table 4.2: Message Starting Header

There are four types of commands (Table : 4.3) and they are replied with the

reply bit turned on:

Ping 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1Request Data 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0Request Settings 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0Update Settings 1 1 1 1 0 0 0 0 0 0 0 0 1 0 0 0

Table 4.3: Types of message commands

48

Page 64: Project Thesis

4.4.4 Message Body

For a command, message body is used to pass relevant parameters. For a reply,

message body consists of information that is queried through the command and

can vary depending on the type of the command.

4.4.5 Message-ending Header

All 16 bits are set to 1s and thus can be easily identified. Hence, data packets of

any type, settings-replies, frame headers and ping-replies cannot have all 16 bits

set.

4.4.6 Frame

A frame can be either a frame-idle or data-frame, again consists of frame-starting

header, data packet and frame-ending header. Scan data is sent inside a frame

when requested.

4.5 Summary

This chapter described hardware architecture of iHD terminal explaining the in-

dividual subsystems and their operations. It discussed the firmware architecture

of iHD terminal. Also it presented the communication protocol specification. The

next chapter discusses the algorithms used to estimate the likelihood of hematoma

in iHDMA.

49

Page 65: Project Thesis

Chapter 5

HEMATOMA LIKELIHOOD ESTIMATION IN IHDMA

Traditionally, for optical density calculations, scans are performed at selected pair

of locations, and they are used to estimate the likelihood of hematoma. We explore

alternative algorithms, mainly derived from a completely different area - radar

systems, for this purpose. In addition, we try to develop Artificial Neural Network

(ANN) based model for semi-automatic detection.

An introduction into optical density calculations is given in section 5.1 with a

short discussion on its merits and demerits. Section 5.2 examines the characteris-

tics of the intensity sample values. In section 5.3 we generate one-to-one reference

estimates for each scan. Section 5.4 walks through threshold detection based esti-

mation followed by post detection integration in section 5.5. Section 5.6 discusses

the possibilities of using complex pattern matching algorithms and explains appli-

cation of Bi-directional Associative Memory (BAM) based ANN model.

5.1 Optical Density calculation on Isolated Scans

As explained in section:3, mode-3 corresponds to quick scans on isolated pre-

defined locations on either side of the head. The scans are performed in pairs

starting from the point on the left side of the head followed by the measurement

at the corresponding point on right side. It leaves us with four pairs of intensity

measurements. Using equation:4.1, we could estimate OD for the given point.

50

Page 66: Project Thesis

Absolute value of OD tells us the likelihood of a hematoma. The background

study given in section:2.5, provides us with a method of ascertaining it.

The sign of OD gives us the hematoma side. A positive OD means right side’s

intensity value is lower, and it translates to higher absorption of NIR on that side.

Hence it could be inferred that hematoma is on the right side.

Scans are performed on four predefined locations namely, frontal area, temporal

area, parietal area and occipital area. When a positive indication is generated more

scans can be carried out in the proximity and a clear picture can be generated.

5.1.1 Merits and Demerits

The merits lie in the simplicity of the method and quick analysis. It gives the

results instantly, and an expert could offer the opinion instantly. Using his past

experience, he could be able to make the estimations without further analysis.

The demerits are possible false alarms due to noise and glitches that are not

accounted for. Further the absence of visual indication, advanced analysis and

intelligence makes this method unsuitable for less experienced personnel such as

first-aid crew.

5.2 Characteristics of Intensity values and OD

Hematomas are generally of considerable size and hence identifiable from several

scans close by. Sensor, transmitter separation of 3 cm browses through an area of

1cm2 and hence by taking several measurements around that point false alarms

and misses can be avoided.

With regard to the absolute value of OD, an OD > 0.5 corresponds to 3 times

higher absorption and thus confirms the presence of hematoma. However an OD =

51

Page 67: Project Thesis

0.1 corresponds 1.26 times higher absorption which could have been caused by a

glitch or noise. An expert opinion is hence required under this method. Through

ANN we propose and automatic detection in the absence of an expert.

Further, the ability to make continuous scans give a promise for visualizing the

results easily. This requires us to acquire a number of samples over the injured

side of the head and find the corresponding reference value.

5.3 Reference Estimation through normalization

The caveat in carrying out continuous scans is the difficulty in controlling the

number of samples and uniformity. We could advice the personnel to move at a

constant slow pace over the head thus achieving reasonable level of uniformity in

the measurements. Further, knowing the total number of samples and end points

on the head we could estimate the average length covered by each sample.

However the problem of unequal number of samples from active scan and reference

scans still exists. We handle this by normalizing the reference sample count to that

of active scan.

5.3.1 Moving average based normalization

For N number of active scan samples and M number of reference scan samples,

our objective is to achieve N number of reference scan samples (figure: 5.1 and

5.2) thus obtaining one-to-one correspondence between active scan samples and

reference scan samples. This is done by the normalization function (equation:

5.1).

52

Page 68: Project Thesis

Figure 5.1: The image depicts a possible scenario where unequal number ofsamples might be acquired in Active and Reference scans.

Figure 5.2: The image illustrates the normalization operation. While unequalsample counts have been normalized, spikes in reference samples also have beenbeen removed. This smoothing effect is controlled by the Normalization Factor

and in realtime controlled by the slider shown in the diagram.

53

Page 69: Project Thesis

let, X be the active scan sample vector, Y be the reference scan sample vector,

and Z be the normalize reference scan sample vector.

for1 ≤ i ≤ N,

j = bi×N/Mc

Ns =

j − L if j − L > 1

1 if else

Ne =

j + L if j + L < M

M if else

Z[i] =

∑Nek=Ns Y [k]

Ne−Ns(5.1)

However, with the distance from the current sample, the influence of other sample

values must decrease. That is if there are 20 active scan samples and 40 reference

scan samples the normalized reference scan sample corresponding to the 12th active

scan sample must heavily depend on 24th reference scan sample than on 26th or

22nd samples.

This is achieved by a windowing function, for example, a linear windowing function

would be as in (Equation: 5.2).

W1 =

k−Nsj−Ns

if Ns ≤ k ≤ j

Ne−kNe−j

if j ≤ k ≤ Ne

0 if else

(5.2)

Z[i] =

∑Nek=Ns Y [k]×W1

Ne−Ns(5.3)

However, for a larger normalization count along with a higher number of samples,

we go for an inverted-square windowing function (Equation: 5.4), that takes the

54

Page 70: Project Thesis

shape of 11+x2 .

W2 =

11+(k−j)2

if Ns ≤ k ≤ Ne

0 if else(5.4)

5.4 Threshold detection

Once we generate two vectors of equal size, they can be directly compared and

anomalies can be identified. However to standardize the process and automate we

have to create a mathematical model.

The caveat is the intensity variation due to absorption, range from 1.2 times to

as high as 30 times. Adopting log model solves the problem by linearizing the

variation according to the order of the magnitude. Nonetheless, both linear and

logarithmical values are reported by iHDMA for completeness.

Further, the hematomas can be identified by setting a fixed threshold, for example,

OD = 0.2. However, this could cripple the flexibility and extensions. Therefore we

propose a probability based detection algorithm which will report the probability

of hematoma on individual locations based on normalized reference scans and

historical data.

Considering the reference vector as the sample set, standard deviation is found.

For a given probability of false alarm (pFA) dynamic threshold (figure: 5.3) is

set. The outliers from set of reference scans (the samples exceeding this dynamic

threshold) are reported in terms of both OD and excess in times of standard

deviation (zstd).

55

Page 71: Project Thesis

Figure 5.3: In threshold detection, dynamic threshold is generated by main-taining constant probability of false alarm. A similar approach is taken and theThreshold Factor is in realtime controlled by the slider shown in the diagram.

Figure 5.4: Results after threshold detection.

56

Page 72: Project Thesis

Figure 5.5: Post detection integration is used to improve the accuracy, andautomating detection. The key issue is to remove improbable scenarios similarto one shown in figure: 5.4). As it can be seen from the above image, thediscrepancy is removed through post detection integration using algorithms such

as BAM.

5.5 Post detection integration

The certitude of the presence of hematoma can be further enhanced by considering

the neighboring samples. Because hematoma cannot exist as an isolated tiny dot,

principle of locality could be applied to identify anomalies.

The simplest of all is to select a set of n samples (typically n = 5) around the

sample of interest (n− 2 to n + 2) and count the positive indications. If number

of positive indications are greater than 50% or a given constant, the indication

ppostdetectionintegration could be ascertained (Equation:2.2).

This is coupled with the parameters derived earlier (either OD or standard devi-

ation) to give a better estimate (Equation:5.5).

57

Page 73: Project Thesis

Ihematoma = ppostdetectionintegration × zstd (5.5)

5.6 Application of Bidirectional Associative Memory (BAM)

While aforementioned probability based approach could yield satisfactory results it

could be easily misled. For example, a vector of [1, 0, 1, 0, 1] could make the system

ascertain a positive indication, while it is clearly recognizable that an alternate

zeros and ones can mean some errors and not the presence of a hematoma.

As introduced in section:2.5.3, BAM is an ANN model that can be used to detect

patterns with machine learning. This could enable us to estimate the existence of

hematoma with higher accuracy. It can be used to infer the presence of hematoma

on a selected set of samples by learning from experience.

Let, p1×n be the vector of selected samples and typically P1×n.

We generate BAM vector Wn×n by,

W =R∑

r=1

rqrtrpT (5.6)

Where,

q is a constant found to minimize the energy of W and,

t is the expected results generated from the past experience.

Following the method, explained in section:2.5.3 presence of hematoma can be

identified when a complete recall is available. However it must be noted BAM,

being a semi-automatic algorithm using ANN, destroys the probability information

prevailed thus far, and hence it would not be possible to generate the probability

of existence further down.

58

Page 74: Project Thesis

5.7 Summary

We began the introduction by revisiting OD calculations. We also looked at the

merits and demerits. Then we analyzed the characteristics of intensity values and

established that continuous scan improves the outcome. We looked at few algo-

rithms to normalize the reference count so that one-to-one mapping can be made

between reference scan samples and active scan samples. We then introduced the

application of threshold detection followed by post detection integration. Lastly,

we discussed the use of an ANN model such as BAM for pattern matching. The

next chapter presents the evaluation of the iHD system and discusses the results.

59

Page 75: Project Thesis

Chapter 6

RESULTS, EVALUATION AND DISCUSSION

In this chapter we discuss the clinical trial procedures, output of the individual

components, performance metrics, and presentation of results.

6.1 Testing procedures and clinical trials

6.1.1 Trial Objectives and Purpose

The purpose of the trial is to assess the efficacy of the iHD and to obtain the

statistical data of the area and concentration of haemoglobin in intracranial haem-

orrhages.

6.1.2 Trial Design

The patients undergoing surgery, due to an intracranial hematoma are intended

to be used in the trial procedure. The trial procedure will happen between the

events of taking the CT scan of the patient, and the starting of the surgery.

To avoid bias, all the patients undergoing surgery due to intracranial hematoma

within a specified time period (from 5pm 21st May to 8am 22nd May), will be

taken for the trial.

60

Page 76: Project Thesis

The expected duration of subject participation is 5 minutes before undergoing

the surgery and a follow up trial after the surgery is conducted with a duration

of another 5 minutes, when possible. All patients undergoing the trial will be

scanned with the iHD. There will be 2 areal scans done in each side of the head

of the patient, and another 8 single scans on 8 specific areas of the head.

The discontinuation criteria for this trial is, if the patient shows signs of external

bleeding, or is the injured side of the patient cannot be touched without causing

pain to the subject.

The iHD project team will be accountable for conducting and managing the trial

procedure.

6.1.3 Selection and Withdrawal of Subjects

• Subject inclusion criteria: The patient should be suspected of having an

intracranial hematoma. The patient should be undergoing surgery.

• Subject exclusion criteria: The patient having an external bleeding. The

patient being touched on the injured side will result in affliction.

• Subject withdrawal criteria: The patient having an external bleeding. The

patient being touched on the injured side will result in affliction.

6.1.4 Treatment of Subjects

• The patient will be scanned in the injured side.

• The patient will be scanned in the opposite side.

• Singular scan values are obtained in 8 different locations in the head shown

in figure:.

61

garthee
Typewritten Text
garthee
Typewritten Text
3.2
Page 77: Project Thesis

6.1.5 Assessment of Efficacy

• Specification of the efficacy parameters: The following will be the main

parameters that would be used to measure the efficacy of the device.

– The difference in the optical density on the injured side and the refer-

ence side.

– The correlation of the area of the hematoma from the CT scan and the

detected region by the iHD.

• Methods and timing for assessing, recording, and analyzing efficacy param-

eters: The efficacy parameters will be stored in electronic format, as an xml

file, and will be analyzed later by the iHD project team.

6.1.6 Assessment of Safety

The safety regulations defined by FDA and discussed in section 2.4 have been

followed in the design as illustrated in section 4.2.6, and will be abided by in

conducting the tests as well.

6.1.7 Statistics

All the patients that satisfy the trial inclusion criteria at the Accident ward, Na-

tional Hospital, Colombo during the time period mentioned will be used for the

trial, and no sampling method will be used.

The number of subjects planned to be enrolled is 20. This number is used consid-

ering the average rate of reported cases of intracranial hematomas in the National

hospital and the statistical significance.

62

Page 78: Project Thesis

Data Handling and Recordkeeping : All the data of the trial will be kept and

handled by the iHD project team, until they are published.

Publication Policy : The data and records of the trial will be published by the

iHD project team, at the completion of the trials.

6.2 Evaluation and Discussion

6.2.1 Sensor outputs

Light to voltage converter generates on average 700 mV when NIR light is sent

through the healthy side of the skull at frontal area. This is comparable with the

ambient noise of 50 mV . Therefore, the device is capable of detecting maximum

of 1.15 in OD.

On an unshaved head, the results have not been satisfactory and average results

ranged between 100 mV and 150 mV . As the hair absorption is significant, it will

be necessary to increase the power radiated. Therefore the device that is tuned

for the use on a shaved head will be ineffective when there is hair absorption, in

which case greater power is needed.

ADC has a resolution of 10 bits with reference voltage of 5V. Hence average sen-

sor output corresponds to a maximum of 143 of 1024 steps available, and there-

fore 8 least significant bits of 10 bit ADC output will be sufficient to detect the

hematoma. Therefore on continuous scan only last 8 bits are stored for analysis.

6.2.2 Performance metrics

The complete process takes less than 15 minutes. Single scan takes on average

5 seconds and programmatically it is ended in 10 seconds. Further delays are

63

Page 79: Project Thesis

enforced to avoid accidental changes. Transfer of data from iHD to iHDMA over

Bluetooth is almost instantaneous. Full set of calculations in iHDMA on a note-

book with pentium AMD Turion 2.0 GHz processor and 2GB memory running

Vista OS takes less than 2 seconds.

The terminal consumes on average 700 mA during operation. A pair of lithium-

ion dual-cell can feed the device for more than 3 hours continuously. However

the device will be put in standby mode and consumes lesser power normally. In

practical situation, this translates to more than 30 scans per recharge.

6.3 Presentation of results

Firstly, acute differences in neighborhood and unequal sample count of reference

scan samples are accounted for through normalization function.

Figure 6.1: Reference samples before normalization

Threshold detection is performed on the log ratio between scan and reference scan

values.

64

Page 80: Project Thesis

Figure 6.2: Reference samples with normalization factor 4

Figure 6.3: The image illustrates the effect of normalization factor in smooth-ing reference scan values.

Final results are also visualized to provide a better interpretation.

65

Page 81: Project Thesis

Figure 6.4: The image depicts the effect on using different functions for nor-malization.

Figure 6.5: The image depicts the effect on using different functions for nor-malization.

66

Page 82: Project Thesis

Figure 6.6: Threshold detection is performed on the log ratio between scanand reference scan intensity values. The image shows the OD calculation.

Figure 6.7: The image demonstrates the use of BAM to filter out unlikelydetections semiautomatically by matching patterns.

67

Page 83: Project Thesis

Figure 6.8: The image shows the visualization of the results on a subject withinjury on left side of the head. Intensity variation on the injured side is shownby the red color component. Further positive indications that are confirmedby post detection integration - i.e. using BAM - are marked by white colored

circles.

Figure 6.9: Quick scan is used to calculate the OD values on predefinedlocations for quick analysis by an expert. Under this mode, detection is made

manually from OD values.

68

Page 84: Project Thesis

Chapter 7

CONCLUSION

The report discussed the concepts behind the design of intracranial hematoma

detector, implementation, development of algorithm for semiautomatic detection,

and evaluation.

Intracranial hematoma detector is a non-invasive system to detect the presence

of hemorrhages in brain with above reasonable accuracy semiautomatically. We

summarize design challenges, contributions of the project and future directions for

enhancement.

7.1 Challenges

We faced numerous challenges in designing the system, developing detection algo-

rithms and evaluating the results.

• Power and safety: NIRS is a non-invasive detection technology used for

brain imaging. However, the potential temperature rise due to heat transfer

limits the maximum power that can be used. Although the primary transfer

mode is conduction that can be prevented by proper isolation, radiated heat

also plays a considerable role - 0.5oC at 50 mW/cm2, that limits the power

rating of the LEDs used. It must also be noted that solar radiation at NIR

wavelength is of the same order, and hence contributes to significant noise.

The dilemma is to increase received signal power, while keeping the source

69

Page 85: Project Thesis

power rating within the limits regulated by FDA. It is mainly achieved by

pulsing the source current, and producing NIR light in burst of pulses which

results in greater peak power while keeping the average power below the

limit.

• Compactness of the device: The size and design of the iHD should be

portable as it is expected to be a handheld. The circuits are arranged in

layers to stack them in smaller space. Also mobile phone batteries are used

to provide enough power while saving space.

• Detection and false alarm: The ability to detect a hematoma is inversely

proportional to the probability of false alarm. Hence, the correct balance

must be attained between both, and it is achieved by maintaining a variable

factor, that is adjusted semiautomatically.

• Field testings: The efficacy of the device can be only tested when it is

deployed in real world scenario. The difficulty is in obtaining the consensus

from the patients and relevant medical officers, and infrequency of arrival of

patients with extracerebral hematomas over a short time span. The testings

will be done.

7.2 Contributions

The report discussed the design and implementation of intracranial hematoma

detector - iHD, and accompanying mobile application - iHDMA. Also it listed out

the challenges faced in developing the solution. We itemize the contributions of

the report below.

70

Page 86: Project Thesis

• Hardware device: iHD terminal is a simple microcontroller based system

that uses bursts of NIR light energy as per the specifications that are par-

tially configurable to measure the absorption differences. The system inter-

connects several subsystems including NIR transmitter and sensor, measures

the intensity of NIR light at reception, stores the data and transfers to the

mobile application.

• Continuous scan: In contrary to conventional methods of taking mea-

surements at particular points on the head and calculating OD, we adopted

a novel way of using continuous scan from radar systems. It enables us to

provide a visual imaging and a more descriptive picture of the details.

• Semiautomatic detection: To assist less experienced personnel, espe-

cially when it is used in field operations in the absence of experts, semiauto-

matic detection is developed. Here,threshold detection - another derivation

from radar systems, is used with variable threshold factor.

• BAM based filtering: The detection might include improbable targets.

With machine learning, however, we can filter out them. BAM is an artificial

neural network based tool that is used to detect patterns. BAM is adopted

here for the aforementioned post detection identification.

7.3 Future directions

Although the system if fully functional, it could be enhanced in usability, accuracy

and feature set.

In our discussions with neurologists, we understood they desire better imaging fea-

tures from this solution to substitute CT scans in peripheral hospitals. Currently

the system scans along a line, i.e. linear in dimension. By implementing an array

of LEDs and sensors it could be developed into a two-dimensional solution, which

could generate a complete visual imaging of the brain.

71

Page 87: Project Thesis

The device can be made more compact, resembling a mobile phone device by

using smaller surface mount components and advanced materials for chassis such

as recyclable glass and aluminum.

In order to keep the design simple and elegant it was decided to off-load all re-

porting functions to a mobile application. However, calculations such as OD value

can be moved to iHD.

Also to guarantee greater accuracy the signal can be modulated by a predefined

frequency and at the reception a matched filter can be used to extract the signal

from ambient noise. It might result in more accurate detection in the presence of

significant ambient noise such as direct solar radiation.

72

Page 88: Project Thesis

BIBLIOGRAPHY

[1] L.A. Al-Gwaiz and H.H. Babay. The diagnostic value of absolute neutrophil

count, band count and morphologic changes of neutrophils in predicting bac-

terial infections. Medical Principles and Practice, 16(5):344–347, 2007. ISSN

1011-7571. URL http://www.karger.com/DOI/10.1159/000104806.

[2] Yoshinori Iwatani. The medical technologist as a key professional in medical

care in the 21st century. Rinsho Byori, 56(10):915–923, Oct 2008.

[3] Esther L Yuh, Alisa D Gean, Geoffrey T Manley, Andrew L Callen, and

Max Wintermark. Computer-aided assessment of head computed tomogra-

phy (ct) studies in patients with suspected traumatic brain injury. J Neu-

rotrauma, 25(10):1163–1172, Oct 2008. doi: 10.1089/neu.2008.0590. URL

http://dx.doi.org/10.1089/neu.2008.0590.

[4] L. L. Teunissen, G. J. Rinkel, A. Algra, and J. van Gijn. Risk factors for

subarachnoid hemorrhage: a systematic review. Stroke, 27(3):544–549, Mar

1996.

[5] Deaths by cause, sex and mortality stratum in who re-

gions, estimates for 2002. The world health report 2004 -

changing history., World Health Organization, 2004. URL

http://www.who.int/entity/whr/2004/annex/topic/en/annex_2_en.pdf.

[6] Birsen Yazc Il-Young Son. Near infrared imaging and spectroscopy for brain

activity monitoring.

73

Page 89: Project Thesis

[7] S. P. Gopinath C. S. Robertson and B. Chance. Use of near infrared spec-

troscopy to identify traumatic intracranial hematomas. J. Biomed. Opt, 2:

3141, 1997.

[8] D. Kushner. Mild traumatic brain injury: toward understanding manifesta-

tions and treatment. Arch Intern Med, 158(15):1617–1624, 1998.

[9] A. Mishra and S. Mohanty. Contre-coup extradural haematoma : a short

report. Neurol India, 49(1):94–95, Mar 2001.

[10] Sanders MJ and McKenna K. Head and Facial Trauma. Mosby, 2nd revised

edition, 2001. Chapter 22.

[11] Traumatic brain injury (TBI) - definition, epidemiology, patho-

physiology: eMedicine physical medicine and rehabilitation.

http://emedicine.medscape.com/article/326510-overview. URL

http://emedicine.medscape.com/article/326510-overview.

[12] A. Villringer and B. Chance. Non-invasive optical spectroscopy and imaging

of human brain function. Trends Neurosci, 20(10):435–442, Oct 1997.

[13] A. Sauaia, F. A. Moore, E. E. Moore, K. S. Moser, R. Brennan, R. A. Read,

and P. T. Pons. Epidemiology of trauma deaths: a reassessment. J Trauma,

38(2):185–193, Feb 1995.

[14] Eugene Park, Joshua D Bell, and Andrew J Baker. Traumatic brain injury:

can the consequences be stopped? CMAJ, 178(9):1163–1170, Apr 2008. doi:

10.1503/cmaj.080282. URL http://dx.doi.org/10.1503/cmaj.080282.

[15] P. L. Hope and J. Moorcraft. Magnetic resonance spectroscopy. Clin Perina-

tol, 18(3):535–548, Sep 1991.

[16] Patrick J. Treado, Ira W. Levin, and E. Neil Lewis. Near-infrared acousto-

optic filtered spectroscopic microscopy: A solid-state approach to chemical

74

Page 90: Project Thesis

imaging. Applied Spectroscopy, 46:553–559(7), 1 April 1992. doi: doi:10.

1366/0003702924125032. URL http://www.ingentaconnect.com.

[17] S. P. Gopinath, C. S. Robertson, R. G. Grossman, and B. Chance. Near-

infrared spectroscopic localization of intracranial hematomas. J Neurosurg,

79(1):43–47, Jul 1993.

[18] CLAUDIA S. ROBERTSON, SHANKAR P. GOPINATH, and

BRITTON CHANCE. A new application for near-infrared spec-

troscopy: Detection of delayed intracranial hematomas after head

injury. Journal of Neurotrauma, 12(4):591–600, 1995. URL

http://www.liebertonline.com/doi/abs/10.1089/neu.1995.12.591.

[19] Y. Ito, R. P. Kennan, E. Watanabe, and H. Koizumi. Assessment of

heating effects in skin during continuous wave near infrared spectroscopy.

J Biomed Opt, 5(4):383–390, Oct 2000. doi: 10.1117/1.1287730. URL

http://dx.doi.org/10.1117/1.1287730.

[20] Alper Bozkurt and Banu Onaral. Safety assessment of near in-

frared light emitting diodes for diffuse optical measurements. Biomed

Eng Online, 3(1):9, Mar 2004. doi: 10.1186/1475-925X-3-9. URL

http://dx.doi.org/10.1186/1475-925X-3-9.

[21] K. G. Murphy, J. A. Secunda, and M. A. Rockoff. Severe burns from a pulse

oximeter. Anesthesiology, 73(2):350–352, Aug 1990.

[22] D. B. Sobel. Burning of a neonate due to a pulse oximeter: arterial saturation

monitoring. Pediatrics, 89(1):154–155, Jan 1992.

[23] Guyton AC. Textbook of Medical Physiology. Saunders, 2000.

[24] Y. F. Wang, Jr. Cruz, J. B., and Jr. Mulligan, J. H. Two coding strategies

for bidirectional associative memory. 1(1):81–92, March 1990. doi: 10.1109/

72.80207.

75

Page 91: Project Thesis

[25] B. Kosko. Bidirectional associative memories. 18(1):49–60, Jan.–Feb. 1988.

doi: 10.1109/21.87054.

[26] Y. F. Wang, Jr. Cruz, J. B., and Jr. Mulligan, J. H. Guaranteed recall of all

training pairs for bidirectional associative memory. 2(6):559–567, Nov. 1991.

doi: 10.1109/72.97933.

[27] ”Texas Instruments”. Optoelectronic products -

light to voltage - opt101. Datasheet. URL

http://focus.ti.com/docs/prod/folders/print/opt101.html.

[28] Q. Zhang, H. Ma, S. Nioka, and B. Chance. Study of near infrared technology

for intracranial hematoma detection. J Biomed Opt, 5(2):206–213, Apr 2000.

doi: 10.1117/1.429988. URL http://dx.doi.org/10.1117/1.429988.

76

Page 92: Project Thesis

Appendix A

IHD SCHEMATIC

Figure A.1: Schematic diagram of iHD terminal. Signal generation and sensorsubsystem and Communication subsystem are shown in the diagram.

77

Page 93: Project Thesis

Figure A.2: Schematic diagram of iHD. Microcontroller and power manage-ment subsystem are show in the diagram

78

Page 94: Project Thesis

Appendix B

COMMUNICATION PROTOCOL SPECIFICATION

Version : 0.1

The document describes the protocol that is adopted to be used for the commu-

nication between the remote intracranial hematoma detector (iHD) and Medical

Application (iHDMA) running from a Personal Computer, Notebook or Mobile

Computer. Please note “iHD” and “iHD terminals” are used interchangeably to

denote the device.

The following media are currently supported without modifications

• Bluetooth

• Serialport

In addition, other media may be supported, but have neither been tested nor docu-

mented.

B.1 Introduction

The system is planned to accommodate multiple devices non-concurrently, and

hence uses Host-Slave architecture. The iHDMA will always be a host and iHD

will always be a slave. Therefore, only iHDMA can initiate communication by

querying the iHD, and the iHD is obliged to respond.

79

Page 95: Project Thesis

The atomic unit of the data is a word (16 bits) which is in big-endian format, i.e.

the higher order byte is sent first.

All the messages are encapsulated between a message-starting header and message-

ending header. Further frame headers wrap all data frames.

One cycle of communication includes the command initiated by iHDMA and the

reply from iHD.

Commands can be one of the following

• Request Settings

• Update Settings

• Request Data

• Ping

B.1.1 Structure

As aforementioned, a command or reply message is wrapped by headers. The

body can be of any number words long.

Typical command or reply message

Figure B.1: The header identifies the type of the word (i.e. a Message Header)and type of the command (Ping, Request Data, Request Settings or Update set-tings), and the body is supplemented with any parameters if available. Hence,the body may be absent when it is neither required by the command nor avail-able. The command or reply is ended with message-ending header which is

0xFFFF for all messages.

80

Page 96: Project Thesis

B.2 Message-starting Header

A 16 bits long word of the following format will serve as a message-starting header

:

Figure B.2: A 16 bit word serving as a message-starting header.

There can be four types of commands :

Figure B.3: Four types of words used for message starting header of com-mands.

And the corresponding replies are as follows :

Figure B.4: Four types of words used for message starting header of replies.

B.3 Message Body

For a command, message body is used to pass the relevant parameters.

For a reply, message body consists of information that is queried through the

command and can vary depending on the type of the command. All possible

message body combinations are explained below.

81

Page 97: Project Thesis

Figure B.5: Message body of ping reply. Ping reply can be anything, norestriction is imposed on its format, but still it has to be divisible by 3.

Figure B.6: Message Body of update settings and request settings reply.Replies are the same and both return all setting parameters, one per word(Settings reply can be anything, no constraints on its format, but it cannot be

0xFFFF at any time to distinguish from Message-ending Header).

Figure B.7: Message body of request data reply. Data is packetized one levelfurther into frames. A typical request data - reply will be of this format, hence

making the frame a packet.

B.4 Message-ending Header

Figure B.8: Message-ending Header. All 16 bits are set to 1s and thus easilyidentified. Hence, data packets of any type, settings-replies, frame headers and

ping-replies cannot have all 16 bits set.

B.5 Frame

A frame can be either a frame-idle or data-frame

Figure B.9: Frame-idle.

82

Page 98: Project Thesis

Figure B.10: Data-Frame consists of a Frame-starting header, data packets,and a frame-ending header.

B.6 Example Word Patterns

Figure B.11: Typical word. The first 4 bits of a word are used to identifythe type of the word. This is possible because core information is of maximum10 bits long (in the case of ADC output) and thus avoids unnecessary escaping

and processing that will be otherwise needed.

B.6.1 Word Types

Determined by the first 4 bits of any word.

1. Message header (1111)

2. Frame Header (1011)

3. Frame idle (1101)

4. Data Packet (0000)

In addition, special word - Message-ending header (0xFFFF) will be determined

by the whole word (all 16 bits)

83

Page 99: Project Thesis

B.6.2 Message ID

Determined by the last 4 bits of the message-starting headers.

1. Ping (0001)

2. Request Data (0010)

3. Request Settings (0100)

4. Update Settings (1000)

B.6.3 Command or Reply

Determined by the 3rd bit of the second word in a message-starting header.

1. Command (0)

2. Reply (1)

B.6.4 Frame ID

Determined by the last 4 bits of the frame-starting header.

1. Real time scan (0001)

2. Real time calibration (0010)

3. Stored OD Values

(a) ODa (0100)

(b) ODb (1000)

(c) ODc (1100)

(d) ODd (1110)

84

Page 100: Project Thesis

B.7 Summary

This protocol is designed with the scenario of multiple iHDs communicating with

iHDMA non-concurrently but simultaneously. Further, a typical communication

pattern of Pinging device, Request settings, Update settings, and Data acquisition

is assumed. The packets are formed from the atomic unit of word (of 16 bits with

first 4 bits identifying the type of the word).

85

Page 101: Project Thesis

Appendix C

DATASHEETS

Figure C.1: Datasheet of PIC 18F452 - the microcontroller used in iHD ter-minal.

86

Page 102: Project Thesis

Figure C.2: Pin diagrams of PIC 18F452 - the microcontroller used in iHDterminal.

87

Page 103: Project Thesis

Figure C.3: Specifications of OPT101 - the light to voltage converter used iniHD terminal.

88

Page 104: Project Thesis

Figure C.4: OPAMP characteristics of OPT101 - the light to voltage converterused in iHD terminal.

89

Page 105: Project Thesis

Figure C.5: Datasheet of 760/850 nm narrow bandwidth high power NIRLEDS used in iHD terminal..

90

Page 106: Project Thesis

Appendix D

BIDIRECTIONAL ASSOCIATIVE MEMORY (BAM)

We will first look at the derivation and the algorithm of BAM. Then we will present

the conditions for complete recall.

Given input data vector rPn,

target data vector rtn,

where r denotes the rth sample, and

n denotes the nth element,

first step is to generate BAM vector Wn×n

W =R∑

r=1

rqrtrpT (D.1)

It is followed by the following recurrent steps for a new input p,

rc(0) = rp

ra(k) = f (Wrc(k))

rc(k+1) = f (WT ra(k)) (D.2)

and finally when equilibrium is achieved,

rc(N) = rp

ra(N) = rt (D.3)

91

Page 107: Project Thesis

that happens when energy E is minimal.

E(rP, rt) = −raTWrc (D.4)

The equilibrium is ascertained when vectors c and a remain unchanged over iter-

ations.

Although Kosko’s BAM (rq = 1) would result in equilibrium often, Yeou-Fang

Wang et al [26] showed that complete recall is only possible when E is in its local

minimum.

For p and p1 are different by one Hamming Distance, a pair (lp, lt) can be recalled

iff

nl = ltT rtrpT lp− lt1T rtrpT lp1 (D.5)

∀lR∑

r=1

rqnl ≥ 0 (D.6)

92