COSCUP 2014 - 自動化骨密度報告系統

Post on 30-Jun-2015

249 views 4 download

description

骨密度 (Bone Mineral Density) 是由雙能 X 光吸光測定法 (DEXA) 檢測,依據年齡大小或是否已停經等條件,與健康成年人或是同年齡族群的骨密度進行比較,計算與參照族群標準差之差距,分別可計算出 T-Score 及 Z-Score,再依世界衛生組織的分級方式,可分為正常、骨量減少、骨質疏鬆症等程度。 目前 DEXA 測量完的骨密度數據及分析會以圖檔報告的方式存放於醫療影像儲傳系統 (PACS) 中,再由放射線科醫師將需要參照的數字選填,並將其骨密度分級。這類的「工人」智慧不僅費時費力,更可能因為誤判數字而產生錯誤的報告。 因此,我利用 Ruby on Rails 這套 Framework,建立一個自動化報告系統,在匯入 DEXA 資料後,可計算 T-Score 及 Z-Score,並依標準診斷流程產生報告內文,再搭配 AutoHotKey 巨集來與原始報告系統整合。 導入此系統後,完成報告的時間可縮短 82% (p < 0.001)。回溯性的分析可以發現自動報告與人工報告的正確率分別為 98.8% 及 93.7% (p < 0.001),其中自動報告的錯誤原因來自於技術員輸入錯誤 (0.64%, 33/5120) 及需人為判讀之複雜情況 (0.57%, 29/5120)。 目前此專案公開於 GitHub 上,名為 LiberaBMD。

Transcript of COSCUP 2014 - 自動化骨密度報告系統

放射科医师如何借由开源软体增进效率

以自动化骨密度报告系统为例

蔡依达 (I-Ta Tsai)

(I-Ta Tsai)

PCMan tsaiid

进入正题

以开源软体 架構

自动化骨密度报告系统 來 偷懶 增进效率

I have no relevant financial or non-financial relationship(s) within the products or services described, reviewed, evaluated or compared in this presentation.

骨質疏鬆 Osteoporosis

Anatomy & Physiology, Connexions Web site. http://cnx.org/content/col11496/1.6/, Jun 19, 2013.

James Heilman, MD CC BY-SA 3.0

?骨密度报告 Bone Density

脊椎

髖部

前臂

性別

男女

≥ 50 y/o< 50 y/o

停經前停經後

Z Score

-2.0Below

WithinT Score

-1.0

-2.5

NormalLow Bone MassOsteoporosis

Average bone mineral density (BMD) of L1 to L4 is 0.939 gm/cm2, about 93% of the mean of young reference value (T-score = -0.6).

The BMD of right proximal femur is 0.711 gm/cm2, and is about 84% of the mean of young reference value (T-score = -1.4).

The BMD of right 1/3 forearm is 0.666 gm/cm2, about 97% of the mean of young reference value (T-score = -0.3).

Conclusion:

The BMD meets the criteria of low bone mass, according to the WHO (World Health Organization) classification.

Average bone mineral density (BMD) of L1 to L4 is 0.939 gm/cm2, about 93% of the mean of young reference value (T-score = -0.6).

The BMD of right proximal femur is 0.711 gm/cm2, and is about 84% of the mean of young reference value (T-score = -1.4).

The BMD of right 1/3 forearm is 0.666 gm/cm2, about 97% of the mean of young reference value (T-score = -0.3).

Conclusion:

The BMD meets the criteria of low bone mass, according to the WHO (World Health Organization) classification.

!

錄音 打字+

科技始终来自於人类的惰性

?How

LiberaBMD

A ruby-on-rails based web application for analysis of Hologic bone densitometry. It provides a web interface to show the patient and examination lists, and with a pre-defined reporting template, it generates the final report according to the interpretation algorithm of bone mineral density. It also has web APIs for the final report generation, which can be integrated into other radiology information system.

https://github.com/tsaiid/libera-bmd!

DB Schema

{ "l1_included":1, "l2_included":1, "l3_included":1, "l4_included":1, "l1_area":16.285641436031202, "l1_bmc":16.99838341485105, "l1_bmd":1.043765054119572, "l2_area":18.333654385665113, "l2_bmc":20.458727470207037, "l2_bmd":1.1159110475107186, "l3_area":17.929959525400736, "l3_bmc":19.19764387749801, "l3_bmd":1.070702019728566, "l4_area":18.29426952124908, "l4_bmc":18.99286785102212, "l4_bmd":1.0381867299463152, "tot_area":70.84352486834612, "tot_bmc":75.64762261357822, "tot_bmd":1.06781279946417, }

SPINE

{ "troch_area":12.187268473622307, "troch_bmc":6.42159083076162, "troch_bmd":0.5269097701966838, "inter_area":20.527471477257816, "inter_bmc":17.39763568286712, "inter_bmd":0.8475294047852795, "neck_area":5.237099303926052, "neck_bmc":3.387444524551131, "neck_bmd":0.6468169358583088, "wards_area":1.1355205967391069, "wards_bmc":0.4129044211119751, "wards_bmd":0.3636256553141525, "htot_area":37.951839254806174, "htot_bmc":27.20667103817987, "htot_bmd":0.7168735843213304, }

HIP

{ "ru13tot_area":6.06894105963075, "ru13tot_bmc":3.3610065904212476, "ru13tot_bmd":0.5538044540880316, "rumidtot_area":12.08358326600947, "rumidtot_bmc":5.287974125787681, "rumidtot_bmd":0.4376163931987372, "ruudtot_area":7.000375234646343, "ruudtot_bmc":1.9609613883207748, "ruudtot_bmd":0.2801223252455898, "rutot_area":25.15289956028656, "rutot_bmc":10.609942104529702, "rutot_bmd":0.4218178536076827, }

FOREARM

?T & Z Scores

自己斯構自己算SCORE

{ "if_current":1, "ethnic":"O", "sex":"M", "reftype":"S", "bonerange":"1234", "if_default":1, "y_min":0.1, "y_max":1.5, "x_min":20.0, "x_max":90.0, "age_young":25.0, }

REFERENCE CURVEx_value y_value std l_value

20.0 1.017 0.111 1.0

25.0 1.017 0.111 1.0

35.0 1.009 0.121 1.0

45.0 0.964 0.119 1.0

55.0 0.941 0.138 1.0

65.0 0.913 0.138 1.0

75.0 0.895 0.159 1.0

85.0 0.892 0.115 1.0

REFERENCE CURVE

0.500

0.675

0.850

1.025

1.200

20 25 30 35 40 45 50 55 60 65 70 75 80 85 90

BMD + STDBMDBMD - STD

T- & Z-SCORE

z =x� µ

Standard score

?!但计算出来的score

有时会有点小误差

Proper calculation of Z-­scores requires the use of an accurate age value, i.e. you must calculate the actual age (DXA Exam Date – Patient birth Date). This will yield an age such as 56.77547634, not 56.0.

Next you must linearly interpolate between the Reference BMD just above and just below the subject’s actual age to get the actual age-­matched BMD value.

Thomas Kelly Principal Scientist at Hologic

Export DB

EMRRequest

Web API

AutoHotkey (AHK) is a free, open-source macro-creation and automation software for Windows that allows users to automate repetitive tasks. It is driven by a scripting language that was initially aimed at providing keyboard shortcuts, otherwise known as hotkeys, that over time evolved into a full-fledged scripting language.

• Expand abbreviations

• Mouse or keyboard macro

• Component Object Model (COM)

::btw::by the way

^k:: MouseMove, 111, 222 Click Send ^v Return

; Access an IE object by WinTitle and Internet Explorer_Server Number ; By jethrow ; http://www.autohotkey.com/board/topic/47052-basic-webpage-controls-with-javascript-com-tutorial/ !WBGet(WinTitle="ahk_class IEFrame", Svr#=1) { ;// based on ComObjQuery docs static msg := DllCall("RegisterWindowMessage", "str", "WM_HTML_GETOBJECT") , IID := "{0002DF05-0000-0000-C000-000000000046}" ;// IID_IWebBrowserApp ;// , IID := "{332C4427-26CB-11D0-B483-00C04FD90119}" ;// IID_IHTMLWindow2 SendMessage msg, 0, 0, Internet Explorer_Server%Svr#%, %WinTitle% if (ErrorLevel != "FAIL") { lResult:=ErrorLevel, VarSetCapacity(GUID,16,0) if DllCall("ole32\CLSIDFromString", "wstr","{332C4425-26CB-11D0-B483-00C04FD90119}", "ptr",&GUID) >= 0 { DllCall("oleacc\ObjectFromLresult", "ptr",lResult, "ptr",&GUID, "ptr",0, "ptr*",pdoc) return ComObj(9,ComObjQuery(pdoc,IID,IID),1), ObjRelease(pdoc) } } }

^l:: wb := WBGet() ! myL = ( acc_no = $('iframe[name=frameWork]').contents().find('input[name=OldAccNo]').val(); report_area = $('iframe[name=frameWork]').contents().find('textarea[name=ReportContent]'); ! $.support.cors = true; ! // jquery plugin for IE8, IE9 cross domain ajax $.getScript( "http://cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.1/jquery.xdomainrequest.min.js"); ! $.ajax({ dataType: "json", url: "http://vghks.tsai.it/bone-density/studies/report/" + acc_no + "/text", crossDomain: true }).done(function(data){ if (data.report) report_area.val(data.report); else alert("No data available. Please check the database."); }); ) ! window := wb.document.parentWindow window.execScript(myL) Return

實際運作情況

發報告的速度真的比較快?

App 正確性足不足夠?

人工輸入正式報告正確性如何?

錯誤原因又是哪些?

0 s

400 s

800 s

1200 s

1600 s

264

1,452

p < 0.001

• 5,120 Exams(2013-01-01 ~ 2013-12-31)

117 (98.3%)

2 (1.7%) 119

307 (95.4%)

14 (4.6%) 321

424 16 440

(p = 0.146)

DISCUSSIONS

前人的经验

Note: This copy is for your personal non-commercial use only. To order presentation-ready copies for distribution to your colleagues or clients, contact us at www.rsna.org/rsnarights.

1181INFORMATICS

The process of verbally reporting or manually retyping numeric data generated at dual-energy x-ray absorptiometry (DXA) involves numer-ous pitfalls. With use of a macro scripting editor, a customized macro was created to automate the transfer of data generated by a DXA scanner into a structured voice recognition dictation system without requiring radiologists to type in a medical record number or accession number to identify the study. A preliminary report is generated with use of software for a DXA unit and a customized template that includes numeric and qualitative assessments of osteoporosis as well as data from prior studies if available. A customized macro is then invoked by the macro scripting editor, which selectively transfers the report from the draft document into the voice recognition dictation system, thereby pro-ducing a final structured diagnostic report. All of the radiologists sur-veyed to evaluate this automated method reported ease of software use and greater efficiency in report production. In addition, a random audit of the 800 DXA scans that have been reported with this technique dem-onstrated no reports generated under an incorrect accession number and no incorrect transfer of data. Automated DXA reporting is now the preferred method of dictation at the authors’ institution and represents an inexpensive, accurate, and customizable means of DXA reporting.©RSNA, 2011

Informatics in RadiologyUse of a Macro Scripting Editor to Facilitate Transfer of Dual-Energy X-ray Absorptiometry Reports into an Existing Departmental Voice Recognition Dictation System1

Abbreviations: DICOM = Digital Imaging and Communications in Medicine, DXA = dual-energy x-ray absorptiometry, GUI = graphical user interface, PACS = picture archiving and communication system

RadioGraphics 2011; Published online Content Codes: 1From the Department of Radiology, Santa Clara Valley Medical Center, 751 S Bascom Ave, San Jose, CA 95128. Presented as an informatics exhibit at the 2009 RSNA Annual Meeting. Received August 27, 2010; revision requested December 1; final revision received February 22, 2011; accepted February 23. All authors have no financial relationships to disclose. Address correspondence to M.R.P. (e-mail: ).

©RSNA, 2011

for the accession number of the study, and the re-mainder of the template contains the preliminary report to be transferred into the dictation system. For purposes of comparison, the template was also

Figure 2. Screen capture of the graphical user interface (GUI) for DXA Physician’s Viewer software. Once image files from a DXA examination are sent to the DXA software, a preliminary report containing pertinent DXA information can be gener-ated by pressing the Dx Report button (far left). For illustration purposes, the displayed protected health information is anonymous. (Courtesy of Hologic.)

Screen captures of extractable information from the Microsoft Access database file (a) and of a portion of the Microsoft Word template containing mail merge entry fields before data transfer (b). Microsoft Word mail merge is used to create data entry fields within the Word template that specify information to be extracted from the stored Microsoft Access database file, including patient name, demographic information, and assessment of bone mineral density. For illustration purposes, information from the Access file is displayed in Microsoft Excel format and the displayed protected health information is anonymous.

customized to input data from prior studies (maxi-mum of five studies, including the baseline study) performed on the same unit. External studies from a different scanner or institution can also be manually entered into the DXA scanner. All of this information is used to create a preliminary Word document using the DXA console. This process is activated by pressing the Dx Report button on the DXA console GUI (Fig 2). Radiologists can then

radiographics.rsna.org

Screen capture of the GUI for Macro Express (Insight Software Solutions). The GUI consists of drop-down menus with many prebuilt scripting commands that can be selected to perform specific tasks. A portion of our DXA macro script is also shown.

Figure 5. Screen captures of our customized DXA macro script created using Macro Express (Insight Software Solutions). The DXA macro is divided into six sections, the first two of which are shown in a and the latter four in b. Each section contains scripts designed to perform specific tasks. Once the macro is invoked by activating the key-board hot key, the tasks in the macro script are performed sequentially. The result is the automatic generation of a DXA report and subsequent transfer of this report into the dictation system.

BUT! 人生最厲害就是這個BUT!

for the accession number of the study, and the re-mainder of the template contains the preliminary report to be transferred into the dictation system. For purposes of comparison, the template was also

Figure 2. Screen capture of the graphical user interface (GUI) for DXA Physician’s Viewer software. Once image files from a DXA examination are sent to the DXA software, a preliminary report containing pertinent DXA information can be gener-ated by pressing the Dx Report button (far left). For illustration purposes, the displayed protected health information is anonymous. (Courtesy of Hologic.)

Screen captures of extractable information from the Microsoft Access database file (a) and of a portion of the Microsoft Word template containing mail merge entry fields before data transfer (b). Microsoft Word mail merge is used to create data entry fields within the Word template that specify information to be extracted from the stored Microsoft Access database file, including patient name, demographic information, and assessment of bone mineral density. For illustration purposes, information from the Access file is displayed in Microsoft Excel format and the displayed protected health information is anonymous.

customized to input data from prior studies (maxi-mum of five studies, including the baseline study) performed on the same unit. External studies from a different scanner or institution can also be manually entered into the DXA scanner. All of this information is used to create a preliminary Word document using the DXA console. This process is activated by pressing the Dx Report button on the DXA console GUI (Fig 2). Radiologists can then

1181INFORMATICS

The process of verbally reporting or manually retyping numeric data

Informatics in RadiologyUse of a Macro Scripting Editor to Facilitate Transfer of Dual-Energy X-ray Absorptiometry Reports into an Existing Departmental Voice Recognition Dictation System1Not Open Source

Quantitative Computed Tomography (QCT) as a RadiologyReporting Tool by Using Optical Character Recognition(OCR) and Macro Program

Young Han Lee & Ho-Taek Song & Jin-Suck Suh

Published online: 8 March 2012# Society for Imaging Informatics in Medicine 2012

Abstract The objectives are (1) to introduce a new conceptof making a quantitative computed tomography (QCT)reporting system by using optical character recognition(OCR) and macro program and (2) to illustrate the practicalusages of the QCT reporting system in radiology readingenvironment. This reporting system was created as a devel-opment tool by using an open-source OCR software and anopen-source macro program. The main module wasdesigned for OCR to report QCT images in radiology read-ing process. The principal processes are as follows: (1) tosave a QCT report as a graphic file, (2) to recognize thecharacters from an image as a text, (3) to extract the T scoresfrom the text, (4) to perform error correction, (5) to reformatthe values into QCT radiology reporting template, and (6) topaste the reports into the electronic medical record (EMR)or picture archiving and communicating system (PACS).The accuracy test of OCR was performed on randomlyselected QCTs. QCT as a radiology reporting tool success-fully acted as OCR of QCT. The diagnosis of normal,osteopenia, or osteoporosis is also determined. Error correc-tion of OCR is done with AutoHotkey-coded module. Theresults of T scores of femoral neck and lumbar vertebrae hadan accuracy of 100 and 95.4 %, respectively. A convenientQCT reporting system could be established by utilizingopen-source OCR software and open-source macro pro-gram. This method can be easily adapted for other QCTapplications and PACS/EMR.

Keywords Computer in medicine . PACS . OCR . QCT.

Reading room

Introduction

Quantitative computed tomography (QCT) has become adiagnostic tool to evaluate the bone density. QCT has someimportant advantages over dual-energy X-ray absorptiome-try (DXA) and is being increasingly utilized in diagnosisand screening of osteoporosis [1]. Currently, QCT usuallyoutputs the QCT report as a graphic image of the T scorevalues, which is not recognizable as a text (Fig. 1). Physi-cians or radiologists had to read the values on the picturearchiving and communicating system (PACS) and typewritethe values on the electronic medical record (EMR) or radio-logic report. This situation might be a tiresome task and hassome probability of typographical error.

Optical character recognition, usually abbreviated as OCR,is a mechanical or electronic translation of scanned imagesfrom typewritten or printed text into machine-encoded text[2]. The OCR can be used for converting imaged values to textdata. The OCR-powered radiology reporting system would beuseful. In this article, we introduce the development of anautomated QCT radiology reporting system by using OCRand macro program and illustrate the practical usages ofautomating QCT reports in radiology reading environment.

Materials and Methods

Hardware and Software

The software we used was Centricity® PACS RA1000(GE Healthcare, Barrington, IL). The PACS workstation

Y. H. Lee :H.-T. Song : J.-S. Suh (*)Department of Radiology, Research Institute of RadiologicalScience, Medical Convergence Research Institute,and Severance Biomedical Science Institute,Yonsei University College of Medicine,50 Yonsei-ro, Seodaemun-gu,Seoul 120-752, Republic of Koreae-mail: jss@yumc.yonsei.ac.kr

J Digit Imaging (2012) 25:815–818DOI 10.1007/s10278-012-9464-8

4. Correction of the OCR errors. The error correction isautomatically performed with the software written bymacro using the if–then routine and string operations.Based on the common misrecognition of the OCR en-gine, the error correction of the common patterns arebelow:

For corrections of segmentation errors (e.g., “1 .0 2”instead of “1.02”), the macro program deleted the spacebetween the numbers. The extra spaces were replacedwith single space. Because the T values are the number,when the numbers are recognized by character, themacro program corrects the misrecognition, e.g., “0” /zero/instead of “O” or “o” /ou/, “8” instead of “B,” and “7”instead of “Z.”

5. Making the QCT report with the formal format. Thereporting format is generated from the QCT valuesand the patient information. The diagnosis of osteope-nia, osteoporosis, or normal bone mineral density basedon the T score can be inserted into the QCT radiologyreporting template.

Predefined templates of radiologic QCT report arebelow:

T score of the femur is [T score1], compatible with[diagnosis1].T score of the spine is [T score2], compatible with[diagnosis2].

The [diagnosis1] and [diagnosis2] can be determinedby the T score according to World Health Organizationguideline: T score −1.0 or greater is “normal,” T scorebetween −1.0 and −2.5 is “low bone mass” (or “osteope-nia”), and T score −2.5 or below is osteoporosis [5, 6]. Themacro program can fill up the [T score1] and [T score2]with the templates, and copy to clipboard of Windows.

6. Export of the QCT report. The QCT report is exported andpasted into the EMR or PACS (Fig. 4). This step isachieved by using the macro program:Window switching

to EMR or PACS window, focusing the cursor on theinput textbox, and sending the key [control V] for paste.

Accuracy Evaluation

The accuracy of OCR was evaluated from 500 randomlyselected QCT images between May 2011 and June 2011.The OCR-recognized T scores from the reporting systemwere compared for accuracy with T scores which is eyerecognized by two musculoskeletal radiologists. The confi-dence intervals of accuracies were calculated.

Results

The QCT by using open-source OCR and macro programacted successfully as a radiology reporting tool that usedOCR to process QCT which evaluates the bone mineraldensity of the femoral neck and lumbar vertebrae. Themacro inputs the QCT report into the EMR or PACS byautomating the QCT reporting steps of reading the T scoresfrom the QCT report (Fig. 4). The diagnosis of normal,osteopenia, or osteoporosis is also determined according toT scores. In accuracy evaluation of T scores of the OCR andeye recognition, the results of the femoral neck and lumbarvertebrae T scores had an accuracy of 100 % (confidenceinterval 1.0—1.0, confidence interval; p<0.01) and 95.4 %(confidence interval 0.9356—0.9724; p<0.01), respectively.

Discussion

For the development of this QCT reporting tool, we used theOCR software GOCR and a macro program AutoHotkey.

Fig. 3 The QCT images and OCR-generated texts QCT report images(a) and OCR-generated texts (b). The text from the primary OCRrecognition has some errors such as splitting, segmentation, and alpha-bet vs. numbers

Fig. 4 Screenshot of the QCT reports. This report can be automaticallygenerated with QCT-OCR reporting tools

J Digit Imaging (2012) 25:815–818 817

Quantitative Computed Tomography (QCT) as a RadiologyReporting Tool by Using Optical Character Recognition(OCR) and Macro Program

Young Han Lee & Ho-Taek Song & Jin-Suck Suh

Published online: 8 March 2012# Society for Imaging Informatics in Medicine 2012

J Digit Imaging (2012) 25:815–818DOI 10.1007/s10278-012-9464-8

Not Open Source

LIMITATIONS

Bone Densitometry Manufacturers

Bone Densitometry Manufacturers

CONCLUSIONS

https://github.com/tsaiid/libera-bmd https://github.com/tsaiid/ahk-smartwonder

?自己報告自己救

Q&A

woodleywonderworks @ Flickr