原創(chuàng)|使用教程|編輯:郝浩|2013-10-21 09:26:40.000|閱讀 974 次
概述:利用HTML5和JavaScript構(gòu)建一個(gè)完整的DICOM Viewer涉及到許多的重要功能。LEADTOOLS醫(yī)療圖像開發(fā)包提供了創(chuàng)建零足跡DICOM Viewer所需的所有功能:圖像顯示、圖像處理、客戶端醫(yī)學(xué)影像“調(diào)窗”、Series Stack和注釋等。接下來,我們將深入介紹HTML5 DICOM Viewer、PACS查詢/檢索以及醫(yī)學(xué)影像“調(diào)窗”等功能。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
利用HTML5和JavaScript構(gòu)建一個(gè)完整的DICOM Viewer涉及到許多的重要功能。LEADTOOLS醫(yī)療圖像開發(fā)包提供了創(chuàng)建零足跡DICOM Viewer所需的所有功能:圖像顯示、圖像處理、客戶端醫(yī)學(xué)影像“調(diào)窗”、Series Stack和注釋等。接下來,我們將深入介紹HTML5 DICOM Viewer、PACS查詢/檢索以及醫(yī)學(xué)影像“調(diào)窗”等功能。
LEADTOOLS HTML5 DICOM Viewer功能介紹:
DICOM圖像HTML5注釋
一旦選中DICOM系列,圖像開始鏈接到查看器,并且注解實(shí)現(xiàn)初始化。完成AnnAutomationManager對象的創(chuàng)建并連接到查看器。
function initializeAnnotations() { _automationManager = new Leadtools.Annotations.Automation.AnnAutomationManager(); _automationManager.createDefaultObjects(); _automationManager.findObjectById(Leadtools.Annotations.Core.AnnObject.rulerObjectId).get_objectTemplate().set_measurementUnit(6); _automationManager.findObjectById(Leadtools.Annotations.Core.AnnObject.polyRulerObjectId).get_objectTemplate().set_measurementUnit(6); _automationManager.findObjectById(Leadtools.Annotations.Core.AnnObject.protractorObjectId).get_objectTemplate().set_measurementUnit(6); var divElemnt = document.getElementById("ViewerParent"); _overlayCanvas = document.createElement("canvas"); _overlayCanvas.id = "overlayCanvas"; _overlayCanvas.width = $(divElemnt).width(); _overlayCanvas.height = $(divElemnt).height(); var parent = document.getElementById(_leadViewer.get_canvasId()).parentNode; parent.appendChild(_overlayCanvas); _automationInteractiveMode = new Leadtools.Annotations.Automation.ImageViewerAutomationControl(_leadViewer); }
使用注釋前,你需要選擇所需要繪制的對象,或者使用Select工具修改現(xiàn)有注釋。
function OnAnnotationSelect() { if (null != _leadViewer && null != _currentAutomation && _annotationSelect.enabled) { AutomationService(); _currentAutomation.get_manager().set_currentObjectId(Leadtools.Annotations.Core.AnnObject.selectObjectId); } } function OnAnnotationArrow() { if (null != _leadViewer && null != _currentAutomation && _annotationArrow.enabled) { AutomationService(); _currentAutomation.get_manager().set_currentObjectId(Leadtools.Annotations.Core.AnnObject.pointerObjectId); } } function OnAnnotationText() { if (null != _leadViewer && null != _currentAutomation && _annotationText.enabled) { AutomationService(); _currentAutomation.get_manager().set_currentObjectId(Leadtools.Annotations.Core.AnnObject.textObjectId); } }
利用Web服務(wù)加載和保存注釋
加載和保存注釋功能對醫(yī)療應(yīng)用程序的工作流程是非常重要的。首先,它們用于說明和指出圖像中注意的事項(xiàng)。當(dāng)然,最重要的仍然是圖像本身,所以最好能夠隱藏和顯示注釋。
function DoSaveAnn(annotationsData) { var firstFrame = _dicomLoader.GetFrame(0); var description = $('#annSaveDescText').val(); if (!description) { alert("You must enter a description"); return; } var series = firstFrame.Instance.SeriesInstanceUID; var userData = { Description: description, ReferencedSOPInstance: firstFrame.Instance.SOPInstanceUID }; annotationsProxy.SaveAnnotations(series, annotationsData, JSON.stringify(userData), SaveAnnotationsError, SaveAnnotationsSuccess); }
當(dāng)圖像幀被加載完后,應(yīng)用程序會進(jìn)行快速的權(quán)限檢查,然后檢索與圖像關(guān)聯(lián)的先前保存的注釋文件數(shù)組。
function OnSeriesLoaded(args, frames) { _overlayManager.SetOverlayTags(frames); if (_userPermissions.CanViewAnnotations) { annotationsProxy.FindSeriesAnnotations(frames[0].Instance.SeriesInstanceUID, FindAnnotationsError, FindAnnotationsSuccess); } } function FindAnnotationsSuccess(annotations) { if (annotations && annotations.length > 0) { _loadedAnnotationsIds = annotations; EnableAnnotationLoad(); } else { _loadedAnnotationsIds = null; DisableAnnotationLoad(); } }
如果圖像有注釋,則加載按鈕被啟用。單擊“加載”按鈕會彈出一個(gè)與圖像關(guān)聯(lián)的注釋對話框。用戶選擇一個(gè)注釋文件后,下列代碼可以從服務(wù)器獲取注釋數(shù)據(jù),然后將注釋添加至canvas。
下圖為iPhone設(shè)備上的圖像和注釋效果:
function LoadSelectedServerAnn() { var annID = _loadedAnnotationsIds[parseInt($($(".annItemSelected")[0]).attr("annIndex"))]; annotationsProxy.GetAnnotations(annID.AnnotationID, GetAnnotationsError, GetAnnotationsSuccess); } function GetAnnotationsSuccess(annotationsData) { if (annotationsData) { try { var length = _automationArray.length; var codecs = new Leadtools.Annotations.Core.AnnCodecs(); while (length--) { var frame = _dicomLoader.GetFrame(length); var automation = _automationArray[length]; var container = automation.get_container(); var destChildren = container.get_children(); var instanceNumber = frame.Instance.InstanceNumber; var loadContainer = codecs.loadFromXmlDocument(annotationsData, parseInt (instanceNumber)); if (loadContainer) { var srcChildren = loadContainer.get_children(); var childrenCount = srcChildren.get_count(); for (var i = 0; i < childrenCount; i++) { var child = srcChildren.get_item(i); destChildren.add(child); } automation.get_automationControl().automationInvalidate(); } } alert("Annotations Loaded"); } catch (er) { alert('Invalid annotations data.\n\r' + er ); } } else { alert("No annotations found"); } }
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自:慧都控件網(wǎng)