【发布时间】:2018-10-08 08:20:46
【问题描述】:
我想显示我网站上的 Dicom 图像。所以我找到了基石库来做这件事。
代码如下:
<!DOCTYPE HTML>
<html>
<head>
<!-- twitter bootstrap CSS stylesheet - included to make things pretty, not needed or used by cornerstone -->
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<link href="cornerstone.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="page-header">
<br>
</div>
<div class="row">
<form class="form-horizontal">
<div class="form-group">
<input type="file" id="selectFile" >
</div>
</form>
</div>
<div style="width:512px;height:512px;position:relative;color: white;display:inline-block;border-style:solid;border-color:black;"
oncontextmenu="return false"
class='disable-selection noIbar'
unselectable='on'
onselectstart='return false;'
onmousedown='return false;'>
<div id="dicomImage"
style="width:512px;height:512px;top:0px;left:0px; position:absolute">
</div>
</div>
</div>
</body>
<!-- jquery - currently a dependency and thus required for using cornerstoneWADOImageLoader -->
<script src="jquery.min.js"></script>
<!-- include the cornerstone library -->
<script src="cornerstone.min.js"></script>
<!-- include the dicomParser library as the WADO image loader depends on it -->
<script src="dicomParser.min.js"></script>
<!-- include the cornerstoneWADOImageLoader library -->
<script src="cornerstoneWADOImageLoader.min.js"></script>
<script src="../dist/cornerstoneFileImageLoader.js"></script>
<!-- jpeg 2000 codec -->
<script src="jpx.min.js"></script>
<script>
$(document).ready(function() {
var element = $('#dicomImage').get(0);
cornerstone.enable(element);
// Listen for the change event on our input element so we can get the
// file selected by the user
$('#selectFile').on('change', function(e) {
// Add the file to the cornerstoneFileImageLoader and get unique
// number for that file
var file = e.target.files[0];
alert("cambio il file");
var index = cornerstoneFileImageLoader.addFile(file);
// create an imageId for this image
var imageId = "dicomfile://" + index;
// load and display this image into the element
var element = $('#dicomImage').get(0);
cornerstone.loadImage(uriImageDesktop).then(function(image) {
cornerstone.displayImage(element, image);
});
});
});
</script>
</html>
使用此代码,我可以使用文件选择器显示单个 HTML 页面。有了这个组件,我可以导航到我的电脑,然后库加载一个 Dicom 图像。
现在我想从 URL 传递我的 Dicom 图像的路径。
所以我正在尝试这样做
var uriImageDesktop = "C:\Users\michele\Desktop\deflate_tests\image";
// load and display this image into the element
var element = $('#dicomImage').get(0);
cornerstone.loadImage(uriImageDesktop).then(function(image) {
cornerstone.displayImage(element, image);
});
目前我写的是静态 dicom 图像,但没有找到。
所以问题是,我怎样才能从我的 dicom 文件中传递一个路径然后显示它?
【问题讨论】:
标签: javascript html dicom cornerstone