diff --git a/src/store/modules/reading.js b/src/store/modules/reading.js index 75beef40..5a13663e 100644 --- a/src/store/modules/reading.js +++ b/src/store/modules/reading.js @@ -190,6 +190,7 @@ const actions = { }, getMasterSeries({ state }, obj) { return new Promise(resolve => { + console.log('getMasterSeries') var seriesInfo = {} var i = state.visitTaskList.findIndex(i => i.VisitTaskId === obj.visitTaskId) getReadingVisitStudyList(obj.trialId, obj.visitId, obj.visitTaskId).then(res => { @@ -216,17 +217,20 @@ const actions = { series.InstanceInfoList.forEach(instance => { if (instance.NumberOfFrames && instance.NumberOfFrames > 1) { for (let i = 0; i < instance.NumberOfFrames; i++) { - const path = `${instance.Path}?frame=${i}&instanceId=${instance.Id}` - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${path}`) + const imageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?frame=${i}&instanceId=${instance.Id}&visitTaskId=${obj.visitTaskId}&idx=0|0` + imageIds.push(imageId) } } else { - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?instanceId=${instance.Id}`) + const imageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?instanceId=${instance.Id}&visitTaskId=${obj.visitTaskId}&idx=0|0` + imageIds.push(imageId) } + instance.ImageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?instanceId=${instance.Id}&visitTaskId=${obj.visitTaskId}&idx=0|0` instanceList.push(instance.Id) }) seriesList.push({ isDicom: study.IsDicom, imageIds: imageIds, + instanceInfoList: series.InstanceInfoList, instanceList: instanceList, seriesId: series.Id, imageIdIndex: 0, @@ -731,6 +735,7 @@ const actions = { }) }, getStudyInfo({ state }, obj) { + console.log('getStudyInfo') return new Promise(resolve => { var index = state.visitTaskList.findIndex(i => i.VisitTaskId === obj.visitTaskId) if (state.visitTaskList[index].studyListInit) { @@ -763,12 +768,16 @@ const actions = { series.InstanceInfoList.forEach(instance => { if (instance.NumberOfFrames && instance.NumberOfFrames > 1) { for (let i = 0; i < instance.NumberOfFrames; i++) { - const path = `${instance.Path}?frame=${i}&instanceId=${instance.Id}` - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${path}`) + const imageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?frame=${i}&instanceId=${instance.Id}&visitTaskId=${obj.visitTaskId}&idx=${studyIndex}|${seriesIndex}` + imageIds.push(imageId) } + instance.ImageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?frame=${0}?instanceId=${instance.Id}&visitTaskId=${obj.visitTaskId}&idx=0|0` } else { - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?instanceId=${instance.Id}`) + const imageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?instanceId=${instance.Id}&visitTaskId=${obj.visitTaskId}&idx=${studyIndex}|${seriesIndex}` + imageIds.push(imageId) + instance.ImageId = imageId } + instanceList.push(instance.Id) }) seriesList.push({ diff --git a/src/views/dicom-show/dicom-study.vue b/src/views/dicom-show/dicom-study.vue index c9dd14a4..909b86e8 100644 --- a/src/views/dicom-show/dicom-study.vue +++ b/src/views/dicom-show/dicom-study.vue @@ -84,23 +84,17 @@ -
- Key Images -
-
- #{{ item.seriesNumber }} -
{{ item.modality }}: {{ item.instanceCount }} image
- T: {{ item.sliceThickness }} + T: {{ parseFloat(item.sliceThickness).toFixed(2) }}
{{ item.description }}
- {{ item.prefetchInstanceCount }}/{{ item.instanceCount }} + {{ item.imageloadedArr.length }}/{{ item.instanceCount }}
@@ -124,8 +118,8 @@ /> -
- +
+
@@ -197,7 +191,8 @@ export default { showDelete: false, loading: false, imageList: [], - showSeriesList: [] + showSeriesList: [], + currentLoadIns: [] } }, created: function() { @@ -221,6 +216,7 @@ export default { } else if (this.type === 'Share') { this.loadStudy() } + cornerstone.events.addEventListener('cornerstoneimageloadprogress', this.cornerstoneimageloadprogress) }, beforeDestroy() { requestPoolManager.stopTaskTimer() @@ -245,16 +241,15 @@ export default { if (data.IsSuccess) { const { Result } = data var seriesList = [] - Result.forEach(function(item) { + Result.forEach((item, index) => { const imageIds = [] item.InstanceInfoList.forEach(i => { if (i.NumberOfFrames && i.NumberOfFrames > 1) { for (let j = 0; j < i.NumberOfFrames; j++) { - const path = `${i.Path}?frame=${j}&instanceId=${i.Id}` - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? scope.OSSclientConfig.basePath : scope.OSSclientConfig.basePath}${path}`) + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? scope.OSSclientConfig.basePath : scope.OSSclientConfig.basePath}${i.Path}?frame=${j}&instanceId=${i.Id}&seriesIndex=${index}`) } } else { - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? scope.OSSclientConfig.basePath : scope.OSSclientConfig.basePath}${i.Path}?instanceId=${i.Id}`) + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? scope.OSSclientConfig.basePath : scope.OSSclientConfig.basePath}${i.Path}?instanceId=${i.Id}&seriesIndex=${index}`) } }) var subjectVisitId = scope.$router.currentRoute.query.subjectVisitId @@ -318,11 +313,11 @@ export default { res.Result.forEach(instance => { if (instance.NumberOfFrames > 1) { for (let i = 0; i < instance.NumberOfFrames; i++) { - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${instance.Path}?frame=${i}`) + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${instance.Path}?frame=${i}&instanceId=${instance.Id}&seriesIndex=0`) } isExistMutiFrames = true } else { - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${instance.Path}`) + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${instance.Path}?instanceId=${instance.Id}&seriesIndex=0`) } instanceInfoList.push({ Id: instance.Id, InstanceNumber: instance.InstanceNumber, NumberOfFrames: instance.NumberOfFrames, Path: instance.Path }) }) @@ -376,11 +371,10 @@ export default { const imageIds = [] if (instanceInfo.NumberOfFrames && instanceInfo.NumberOfFrames > 1) { for (let j = 0; j < instanceInfo.NumberOfFrames; j++) { - const path = `${instanceInfo.Path}?frame=${j}&instanceId=${instanceInfo.Id}` - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${path}`) + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${instanceInfo.Path}?frame=${j}&instanceId=${instanceInfo.Id}&seriesIndex=${seriesIndex}`) } } else { - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${instanceInfo.Path}?instanceId=${instanceInfo.Id}`) + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${instanceInfo.Path}?instanceId=${instanceInfo.Id}&seriesIndex=${seriesIndex}`) } const seriesInfo = { trialId: series.trialId, @@ -523,31 +517,44 @@ export default { }).catch(() => {}) }, loadAllImages() { + const seriesIndex = this.seriesList.findIndex(i => i.loadStatus === false) + if (seriesIndex === -1) return + const series = this.seriesList[seriesIndex] var priority = new Date().getTime() - this.seriesList.forEach((series, index) => { - series.imageIds.forEach(imageId => { - var p = null - if (this.firstInstanceId === imageId) { - p = priority * 100 - } else { - p = priority - 1 + for (let i = 0; i < series.imageIds.length; i++) { + const imageId = series.imageIds[i] + if (series.isExistMutiFrames) { + const params = this.getInstanceInfo(imageId) + if (params.frame && params.frame > 0) { + continue } - // this.load(imageId, series.seriesId, priority) - this.imageList.push({ imageId: imageId, seriesId: series.seriesId, seriesIndex: index, priority: p }) - }) - }) + } + var p = null + if (this.firstInstanceId === imageId) { + p = priority * 100 + } else { + p = priority - 1 + } + this.imageList.push({ imageId: imageId, seriesId: series.seriesId, seriesIndex: seriesIndex, priority: p }) + } if (this.imageList.length > 0) { this.loopLoad() } }, + getInstanceInfo(imageId) { + const params = {} + const searchParams = new URLSearchParams(imageId.split('?')[1]) + for (const [key, value] of searchParams.entries()) { + params[key] = value + } + return params + }, loopLoad() { if (this.imageList.length > 0) { requestPoolManager.startTaskTimer() console.log('loopLoad') this.imageList.map(image => { - requestPoolManager.loadAndCacheImagePlus(image.imageId, image.seriesId, image.priority).then(res => { - this.imageLoaded(image, res.data.string('x0020000e')) - }) + requestPoolManager.loadAndCacheImagePlus(image.imageId, image.seriesId, image.priority) }) requestPoolManager.sortTaskPool() this.imageList = [] @@ -630,6 +637,45 @@ export default { return 0 }, + cornerstoneimageloadprogress(e) { + const imageId = e.detail.imageId + const percentComplete = e.detail.percentComplete + const params = {} + const searchParams = new URLSearchParams(imageId.split('?')[1]) + for (const [key, value] of searchParams.entries()) { + params[key] = value + } + if (this.visitTaskId === params.visitTaskId) { + const seriesIndex = params.seriesIndex + var prefetchInstanceCount = this.seriesList[seriesIndex].prefetchInstanceCount + var instanceCount = this.seriesList[seriesIndex].instanceCount + if (this.seriesList[seriesIndex].imageloadedArr.indexOf(imageId) < 0) { + const i = this.currentLoadIns.findIndex(i => i.imageId === imageId) + if (i > -1) { + prefetchInstanceCount = prefetchInstanceCount - this.currentLoadIns[i].percentComplete + percentComplete + this.currentLoadIns[i].percentComplete = percentComplete + if (percentComplete === 100) { + this.currentLoadIns.splice(i, 1) + } + } else { + if (percentComplete !== 100) { + this.currentLoadIns.push({ imageId, percentComplete }) + } + prefetchInstanceCount = prefetchInstanceCount + percentComplete + } + this.seriesList[seriesIndex].prefetchInstanceCount = prefetchInstanceCount + if (percentComplete >= 100) { + this.seriesList[seriesIndex].imageloadedArr.push(imageId) + } + } + if (prefetchInstanceCount >= instanceCount * 100) { + this.seriesList[seriesIndex].prefetchInstanceCount = instanceCount * 100 + // 设置当前序列状态为已下载完成 + this.seriesList[seriesIndex].loadStatus = true + this.loadAllImages() + } + } + }, cornerstoneImageLoaded(e) { if (this.firstInstanceId === e.detail.image.imageId && !this.isStartLoad) { // 初始化图像加载完成时,自动下载 diff --git a/src/views/dicom-show/dicom-visit.vue b/src/views/dicom-show/dicom-visit.vue index fc8c534c..837079eb 100644 --- a/src/views/dicom-show/dicom-visit.vue +++ b/src/views/dicom-show/dicom-visit.vue @@ -68,7 +68,7 @@ :key="instance.Id" class="frame_content" :style="{'margin-bottom':idx -
- +
+
@@ -146,7 +146,7 @@
- +