修改影像js引用

This commit is contained in:
lxd 2024-08-29 16:23:28 +08:00
parent 3ecceabf27
commit 8ce6e6f995
10 changed files with 11814 additions and 86 deletions

View File

@ -5,14 +5,14 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>胶片预览</title>
<script src="https://unpkg.com/hammerjs@2.0.8/hammer.js"></script>
<script src="https://unpkg.com/cornerstone-core@2.6.1/dist/cornerstone.js"></script>
<script src="https://unpkg.com/cornerstone-math@0.1.10/dist/cornerstoneMath.min.js"></script>
<script src="https://unpkg.com/cornerstone-wado-image-loader@4.1.3/dist/cornerstoneWADOImageLoader.bundle.min.js"></script>
<script src="https://unpkg.com/cornerstone-web-image-loader@2.1.1/dist/cornerstoneWebImageLoader.min.js"></script>
<script src="./js/hammer.js"></script>
<script src="./js/cornerstone.js"></script>
<script src="./js/cornerstoneMath.min.js"></script>
<script src="./js/cornerstoneWADOImageLoader.bundle.min.js"></script>
<script src="./js/cornerstoneWebImageLoader.min.js"></script>
<script src="./js/cornerstoneTools.js"></script><!-- https://unpkg.com/cornerstone-tools@6.0.7/dist/cornerstoneTools.js -->
<script src="https://unpkg.com/dicom-parser@1.8.13/dist/dicomParser.min.js"></script>
<script src="http://code.jquery.com/jquery-1.12.2.min.js"></script>
<script src="./js/dicomParser.min.js"></script>
<script src="./js/jquery-1.12.2.min.js"></script>
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- 可选的 Bootstrap 主题文件(一般不用引入) -->
@ -383,7 +383,7 @@
<body>
<div id="container">
<div id="top-menu" >
<img title="放大镜" style="width: 40px;height: 40px; margin-left: 5px;" id="Magnify" class="img-checkbox" onclick="switchAction('Magnify',1,this)" src="/static/放大镜.jpg"/>
<img title="放大镜" style="width: 35px;height: 35px; margin-left: 5px;" id="Magnify" class="img-checkbox" onclick="switchAction('Magnify',1,this)" src="/static/放大镜.jpg"/>
<img title="平移" style="width: 50px;height: 50px;" id="Pan" class="img-checkbox" onclick="switchAction('Pan',1,this)" src="/static/平移.jpg"/>
<img title="左键缩放" style="width: 50px;height: 50px;" id="Zoom" class="img-checkbox" onclick="switchAction('Zoom',1,this)" src="/static/缩放.jpg"/>
<img title="滚轮缩放" style="width: 50px;height: 50px;" id="ZoomMouseWheel" class="img-checkbox" onclick="switchAction('ZoomMouseWheel',1,this)" src="/static/滚轮缩放.jpg" />
@ -409,7 +409,7 @@
<img title="重置" id="reset" style="width: 50px;height: 50px;" onclick="resetTool()" class="img-checkbox" src="/static/重置.jpg"/>
<div class="dropdown">
<img style="width: 42px;height: 42px;" class="dropbtn" src="/static/布局2x.jpg"/>
<img style="width: 36px;height: 36px;" class="dropbtn" src="/static/布局2x.jpg"/>
<ul class="dropdown-content">
<li><a data-value="1x1"><img src="/static/1.1.jpg"/>1x1</a></li>
<li><a data-value="1x2"><img src="/static/1.2.jpg"/>1x2</a></li>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,3 @@
/*! cornerstone-web-image-loader - 2.1.1 - 2018-12-05 | (c) 2016 Chris Hafey | https://github.com/cornerstonejs/cornerstoneWebImageLoader */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cornerstoneWebImageLoader",[],t):"object"==typeof exports?exports.cornerstoneWebImageLoader=t():e.cornerstoneWebImageLoader=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=5)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.external=void 0;var r,o=n(4),a=(r=o)&&r.__esModule?r:{default:r};var u=void 0,i={set cornerstone(e){u=e,(0,a.default)(u)},get cornerstone(){return u}};t.external=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadImage=function(e){var t=r.external.cornerstone,n=new XMLHttpRequest;return n.open("GET",e,!0),n.responseType="arraybuffer",i.beforeSend(n),n.onprogress=function(n){if(n.lengthComputable){var r=n.loaded,o=n.total,a=Math.round(r/o*100),u={imageId:e,loaded:r,total:o,percentComplete:a};t.triggerEvent(t.events,"cornerstoneimageloadprogress",u)}},{promise:new Promise(function(t,r){n.onload=function(){(0,o.default)(this.response).then(function(n){var r=(0,a.default)(n,e);t(r)},r)},n.send()}),cancelFn:function(){n.abort()}}},t.configure=function(e){i=e};var r=n(0),o=u(n(3)),a=u(n(2));function u(e){return e&&e.__esModule?e:{default:e}}var i={beforeSend:function(){}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=e.naturalHeight,u=e.naturalWidth;return{imageId:t,minPixelValue:0,maxPixelValue:255,slope:1,intercept:0,windowCenter:128,windowWidth:255,render:r.external.cornerstone.renderWebImage,getPixelData:function(){return(n=void 0,a===t?n=o.getContext("2d"):(o.height=e.naturalHeight,o.width=e.naturalWidth,(n=o.getContext("2d")).drawImage(e,0,0),a=t),n.getImageData(0,0,e.naturalWidth,e.naturalHeight)).data;var n},getCanvas:function(){return a===t?o:(o.height=e.naturalHeight,o.width=e.naturalWidth,o.getContext("2d").drawImage(e,0,0),a=t,o)},getImage:function(){return e},rows:n,columns:u,height:n,width:u,color:!0,rgba:!1,columnPixelSpacing:void 0,rowPixelSpacing:void 0,invert:!1,sizeInBytes:n*u*4}};var r=n(0),o=document.createElement("canvas"),a=void 0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return new Promise(function(t,n){var r=new Image,o=new Uint8Array(e),a=new Blob([o]),u=window.URL||window.webkitURL,i=u.createObjectURL(a);r.src=i,r.onload=function(){t(r),u.revokeObjectURL(i)},r.onerror=function(e){u.revokeObjectURL(i),n(e)}})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){e.registerImageLoader("http",r.loadImage),e.registerImageLoader("https",r.loadImage)};var r=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.external=t.configure=t.loadImage=t.createImage=t.arrayBufferToImage=void 0;var r=i(n(3)),o=i(n(2)),a=n(1),u=n(0);function i(e){return e&&e.__esModule?e:{default:e}}var d={arrayBufferToImage:r.default,createImage:o.default,loadImage:a.loadImage,configure:a.configure,external:u.external};t.arrayBufferToImage=r.default,t.createImage=o.default,t.loadImage=a.loadImage,t.configure=a.configure,t.external=u.external,t.default=d}])});
//# sourceMappingURL=cornerstoneWebImageLoader.min.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,5 @@
const scheme = 'wadouri'
const baseUrl = ''
//功能名称
const functionNames = [
"Magnify", "Pan", "Zoom", "ZoomMouseWheel", "Wwwc",
@ -384,8 +386,7 @@ function initConerstone(element) {
function initConerstoneAndData() {
var series = stateData.dicomInfo.seriesList[stateData.imgIndex].instanceList
const scheme = 'wadouri'
const baseUrl = ''
const imageIds = series.map(seriesImage => `${scheme}:${baseUrl}${seriesImage.imageid}`)
//define the stack
@ -443,8 +444,7 @@ function initImgList(data) {
//$("#dicom-list").append('<img id="img_' + i + '" onclick="changeIndex(' + i + ')" class="' + className + '" src="' + data.seriesList[i].thumbUrl + '"/>');
//$("#dicom-list").append('<div class="icon-img-box" onclick="changeIndex(' + i + ')"><img id="img_' + i + '" class="' + className + '" src="' + data.seriesList[i].thumbUrl + '"/><div class="process-div" id="process-' + i + '"></div></div>');
//$("#dicom-list").append('<div class="icon-img-box" id="icon-img-box-'+i+'" onclick="changeIndex(' + i + ')"><img id="img_' + i + '" class="' + className + '"/><div class="process-div" id="process-' + i + '"></div></div>');
// $("#dicom-list").append('<div style="height: 200px;" class="icon-img-box ' + className + '" id="icon-img-box-' + i + '" onclick="changeIndex(' + i + ')"> <img style=" width: 130px;height: 130px;" src="' + data.seriesList[i].thumbUrl + '"/> <h4 style="color: white; id="h_' + i + '" >"'+data.seriesList[i].SeriesDesc+'"</h4></div>');
$("#dicom-list").append('<div style="height: 220px;" class="icon-img-box ' + className + '" id="icon-img-box-' + i + '" onclick="changeIndex(' + i + ')"><div class="process-div" id="process-' + i + '"></div><span style="color: white;word-wrap: break-word;font-size: 16px; id="h_' + i + '" >'+data.seriesList[i].SeriesDesc+'</span></div>');
$("#dicom-list").append('<div style="height: 220px;" class="icon-img-box ' + className + '" id="icon-img-box-' + i + '" onclick="changeIndex(' + i + ')"><div class="process-div" id="process-' + i + '"></div><span style="color: white;word-wrap: break-word;font-size: 16px; id="h_' + i + '" >' + data.seriesList[i].SeriesDesc +'</span></div>');
}
}
@ -470,14 +470,23 @@ function changeIndex(i) {
//获取数据
function initData() {
var idx = GetQueryString("idx");
// var idx = GetQueryString("idx");
// var maxSize = GetQueryString("maxSize");
var localStorage = window.localStorage;
var localData = JSON.parse(localStorage.data);
var data= JSON.parse(localData.do);
console.log("网页接受到数据"+data)
var maxSize = localData.maxSize
console.log("网页接受到数据maxSize" + maxSize)
if (maxSize) {
cacheProcess.maxSize = maxSize;
}
var data = JSON.parse(localData.do);
console.log("网页接受到数据" + data)
stateData.dicomInfo = data;
//初始化进度
initProcess();
initQueue();
initImgList(stateData.dicomInfo);
//加载icon图片
convertDicom2Img();
@ -486,7 +495,7 @@ function initData() {
cacheImages();
}, 500)
initConerstoneAndData();
}
//初始化滚动条
@ -656,86 +665,65 @@ function doCreate() {
}
function cacheImages() {
//cacheImageIndex(0);
startCache();
}
//var cacheInterval = setInterval(
// function () {
// let size = stateData.dicomInfo.seriesList.length;
// for (var i = 0; i < size; i++) {
// let p = stateData.processMapping.get(i);
// if (p >= stateData.dicomInfo.seriesList[i].instanceList.length) {
// cacheImageIndex(i + 1)
// }
// }
// }, 200
//);
function cacheImageIndex1(a) {
if (a >= stateData.dicomInfo.seriesList.length) {
clearInterval(cacheInterval);
return;
}
var series = stateData.dicomInfo.seriesList[a].instanceList
const scheme = 'wadouri'
const baseUrl = ''
const imageIds = series.map(seriesImage => `${scheme}:${baseUrl}${seriesImage.imageid}`)
for (var j = 0; j < imageIds.length; j++) {
cornerstone.loadAndCacheImage(imageIds[j]).then(() => {
updateProcess(a, "cacheImages");
});
}
var cacheProcess = {
taskSize:0,//当前正在进行的任务数量
maxSize:10 //同时最大缓存个数
}
var cacheProcess = {
index: 0,
sindex: 0,
isOk: null,
end: false
var queue = [];
function initQueue() {
console.log("初始化队列开始");
//序列分组个数
var groupSize = stateData.dicomInfo.seriesList.length;
for (var i = 0; i < groupSize; i++) {
var group = stateData.dicomInfo.seriesList[i];
var imageSize = group.instanceList.length;
for (var j = 0; j < imageSize; j++) {
var message = {
index: i,
sindex: j,
imageId: imageId = `${scheme}:${baseUrl}${group.instanceList[j].imageid}`
};
queue.push(message)
console.log("队列push消息", message);
}
}
console.log("初始化队列完成",queue);
}
var cacheInterval = null;
function startCache() {
cacheInterval = setInterval(function () {
//如果已经结束,清除定时器
if (cacheProcess.end) {
console.log("缓存结束-清除定时器");
if (queue.length == 0) {
console.log("队列任务已清空");
clearInterval(cacheInterval);
return;
}
//如果未缓存完成,直接返回
if (cacheProcess.isOk == false) {
console.log("缓存未完成-直接返回");
if (cacheProcess.maxSize <= cacheProcess.taskSize) {
//任务已满,等待
console.log("队列已满-等待", cacheProcess.taskSize);
return;
}
else if (cacheProcess.isOk == null || cacheProcess.isOk == true) {
console.log("缓存开始");
cacheProcess.isOk = false;
var imageIds = stateData.dicomInfo.seriesList[cacheProcess.index].instanceList;
//上一个序列加载完成
if (imageIds.length <= cacheProcess.sindex) {
cacheProcess.index++;
cacheProcess.sindex = 0;
}
if (stateData.dicomInfo.seriesList.length == cacheProcess.index) {
cacheProcess.end = true;
return;
}
imageIds = stateData.dicomInfo.seriesList[cacheProcess.index].instanceList;
const scheme = 'wadouri'
const baseUrl = ''
const imageId = `${scheme}:${baseUrl}${imageIds[cacheProcess.sindex].imageid}`
cornerstone.loadAndCacheImage(imageId).then(() => {
console.log("缓存回调--",cacheProcess);
updateProcess(cacheProcess.index);
cacheProcess.isOk = true;
cacheProcess.sindex++;
console.log("缓存回调用,更新索引--", cacheProcess);
});
}
}, 10)
//从队列获取数据
var queueMessage = queue.shift();
console.log("获取队列消息", queueMessage);
cacheImg(queueMessage);
}, 1)
}
function cacheImg(queueMessage) {
cacheProcess.taskSize++;
cornerstone.loadAndCacheImage(queueMessage.imageId).then(() => {
console.log("缓存回调--", cacheProcess);
cacheProcess.taskSize--;
updateProcess(queueMessage.index);
console.log("缓存回调用,更新索引--", cacheProcess);
});
}
function cacheImageIndex(a) {
@ -744,8 +732,6 @@ function cacheImageIndex(a) {
return;
}
var series = stateData.dicomInfo.seriesList[a].instanceList
const scheme = 'wadouri'
const baseUrl = ''
const imageIds = series.map(seriesImage => `${scheme}:${baseUrl}${seriesImage.imageid}`)
for (var j = 0; j < imageIds.length; j++) {
cornerstone.loadAndCacheImage(imageIds[j]).then(() => {
@ -800,8 +786,6 @@ function convertDicom2Img() {
//加载dicom文件转换为base64格式
function loadDicomShowIcom(i) {
console.log("加载icon-" + i);
const scheme = 'wadouri'
const baseUrl = ''
const imageId = `${scheme}:${baseUrl}${stateData.dicomInfo.seriesList[i].instanceList[0].imageid}`
console.log("imgId:", imageId);
const imgElement = document.getElementById('icon-img-box-' + i);

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -539,7 +539,7 @@ const open = async (
// 1iframe
setTimeout(() => {
dataLoaded.value= true; // iframe
}, 800);
}, 500);
} finally {
formLoading.value = false
}
@ -553,6 +553,7 @@ const iframeData = async () => {
var localData = {
regid: '', // 'someNumber'
orgId: '', // 'someOrgId' ID
maxSize:10,
do: response
}