+
@@ -215,7 +217,8 @@ export default {
srDialogVisible: false,
srInfo: {},
digitPlaces: 2,
- visitTaskIdx: -1
+ visitTaskIdx: -1,
+ currentLoadIns: []
}
},
@@ -259,12 +262,17 @@ export default {
// this.studyList = this.visitTaskList[idx].StudyList
// }
// })
+ cornerstone.events.addEventListener('cornerstoneimageloadprogress', this.cornerstoneimageloadprogress)
cornerstone.events.addEventListener('cornerstoneimageloaded', this.cornerstoneImageLoaded)
// cornerstone.events.addEventListener('cornerstoneimagecachefull', this.cornerstoneimagecachefull)
// cornerstone.events.addEventListener('cornerstoneimagecachechanged', this.cornerstoneimagecachechanged)
+ window.addEventListener('beforeunload', e => {
+ cornerstone.imageCache.purgeCache()
+ })
},
beforeDestroy() {
cornerstone.imageCache.purgeCache()
+ window.removeEventListener('beforeunload', e => { cornerstone.imageCache.purgeCache() })
},
methods: {
initStudyInfo() {
@@ -273,7 +281,9 @@ export default {
this.getInitSeries().then((res) => {
requestPoolManager.startTaskTimer()
res.map((item) => {
- this.loadInitialImage(item)
+ let imageId = item.imageIds[item.imageIdIndex]
+ const p = parseInt(new Date().getTime())
+ requestPoolManager.loadAndCacheImagePlus(imageId, item.seriesId, p * 100)
})
var i = res.findIndex(s => s.isCurrentTask)
if (i > -1) {
@@ -282,71 +292,17 @@ export default {
this.measureData = this.visitTaskList[idx].MeasureData
this.studyList = this.visitTaskList[idx].StudyList
var priority = parseInt(new Date().getTime())
- res[i].imageIds.map(image => {
- priority--
- this.imageList.push({ imageId: image, seriesId: res[i].seriesId, studyIndex: res[i].studyIndex, seriesIndex: res[i].seriesIndex, visitTaskId: res[i].visitTaskId, priority })
- })
-
- // this.studyList.map((study, studyIndex) => {
- // study.SeriesList.map((series, seriesIndex) => {
- // if (series.modality !== 'SR') {
- // series.imageIds.map(image => {
- // var p = priority - seriesIndex
- // if (series.seriesId === res[i].seriesId) {
- // p = priority
- // } else {
- // --p
- // }
- // this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority: p })
- // })
- // }
- // })
- // })
- this.loopLoad()
- }
- }
- DicomEvent.$emit('loadImageStacks', res)
- loading.close()
- this.isRender = true
- }).catch(() => {
- loading.close()
- })
- },
- initStudyInfo2() {
- console.log('initStudyInfo')
- const loading = this.$loading({ fullscreen: true })
- // 初始化待渲染序列
- this.getInitSeries().then((res) => {
- requestPoolManager.startTaskTimer()
- res.map((item) => {
- this.loadInitialImage(item)
- })
- var i = res.findIndex(s => s.isCurrentTask)
- if (i > -1) {
- var p = parseInt(new Date().getTime())
- // var p = this.visitTaskId === this.currentTaskId ? parseInt(new Date().getTime()) : 999 // 非当前任务,符合自动下载的权重次之
- var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId)
- if (idx > -1) {
- this.measureData = this.visitTaskList[idx].MeasureData
- this.studyList = this.visitTaskList[idx].StudyList
-
- this.studyList.map((study, studyIndex) => {
- study.SeriesList.map((series, seriesIndex) => {
- if (series.modality !== 'SR') {
- // var sliceThickness = isNaN(parseInt(series.sliceThickness)) ? null : parseInt(series.sliceThickness)
- // if (sliceThickness === 5 || series.instanceCount <= 100) {
- series.imageIds.map(image => {
- let priority = 0
- if (series.seriesId === res[i].seriesId) {
- priority = parseInt(new Date().getTime()) * 10
- } else {
- priority = --p
- }
- this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
- })
- }
+ if (res[i].isExistMutiFrames) {
+ res[i].instanceInfoList.map(image => {
+ priority--
+ this.imageList.push({ imageId: image.ImageId, seriesId: res[i].seriesId, studyIndex: res[i].studyIndex, seriesIndex: res[i].seriesIndex, visitTaskId: res[i].visitTaskId, priority })
})
- })
+ } else {
+ res[i].imageIds.map(image => {
+ priority--
+ this.imageList.push({ imageId: image, seriesId: res[i].seriesId, studyIndex: res[i].studyIndex, seriesIndex: res[i].seriesIndex, visitTaskId: res[i].visitTaskId, priority })
+ })
+ }
this.loopLoad()
}
}
@@ -361,11 +317,7 @@ export default {
loadInitialImage(seriesInfo) {
var p = parseInt(new Date().getTime())
var imageId = seriesInfo.imageIds[seriesInfo.imageIdIndex]
- requestPoolManager.loadAndCacheImagePlus(imageId, seriesInfo.seriesId, p * 100).then(res => {
- if (seriesInfo.isCurrentTask) {
- this.imageLoaded({ studyIndex: seriesInfo.studyIndex, seriesIndex: seriesInfo.seriesIndex, imageId: res.imageId }, res.data.string('x0020000e'))
- }
- })
+ requestPoolManager.loadAndCacheImagePlus(imageId, seriesInfo.seriesId, p * 100)
},
getStudyList() {
console.log('getStudyList')
@@ -647,9 +599,15 @@ export default {
}
if (!isAddToTakPool) {
var priority = parseInt(new Date().getTime())
- series.imageIds.map((imageId) => {
- this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
- })
+ if (series.isExistMutiFrames) {
+ series.instanceInfoList.map(image => {
+ this.imageList.push({ imageId: image.ImageId, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
+ })
+ } else {
+ series.imageIds.map(imageId => {
+ this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
+ })
+ }
if (this.imageList.length > 0) {
this.loopLoadStatus = 0
this.loopLoad()
@@ -673,11 +631,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}&visitTaskId=${this.visitTaskId}&idx=${studyIndex}|${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}&visitTaskId=${this.visitTaskId}&idx=${studyIndex}|${seriesIndex}`)
}
this.studyIndex = studyIndex
this.seriesIndex = seriesIndex
@@ -685,7 +642,6 @@ export default {
var dicomStatck = this.studyList[studyIndex].SeriesList[seriesIndex]
dicomStatck.imageIds = imageIds
dicomStatck.imageIdIndex = 0
- console.log(dicomStatck)
this.$emit('loadImageStack', dicomStatck)
this.loopLoadStatus = -1
series.isLoading = true
@@ -697,9 +653,16 @@ export default {
}
if (!isAddToTakPool) {
var priority = parseInt(new Date().getTime())
- series.imageIds.map((imageId) => {
- this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
- })
+ if (series.isExistMutiFrames) {
+ series.instanceInfoList.map(image => {
+ this.imageList.push({ imageId: image.ImageId, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
+ })
+ } else {
+ series.imageIds.map((imageId) => {
+ this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
+ })
+ }
+
if (this.imageList.length > 0) {
this.loopLoadStatus = 0
this.loopLoad()
@@ -768,10 +731,17 @@ export default {
// }
// 均只下载关键序列
if (!isCurrentTask && study.IsCriticalSequence) {
- series.imageIds.map(image => {
- priority = priority - 1
- this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
- })
+ if (series.isExistMutiFrames) {
+ series.instanceInfoList.map(image => {
+ priority = priority - 1
+ this.imageList.push({ imageId: image.ImageId, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
+ })
+ } else {
+ series.imageIds.map(imageId => {
+ priority = priority - 1
+ this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
+ })
+ }
}
}
})
@@ -783,9 +753,7 @@ export default {
if (this.imageList.length > 0) {
// requestPoolManager.startTaskTimer()
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()
@@ -805,12 +773,21 @@ export default {
}
if (!isAddToTakPool) {
const priority = parseInt(new Date().getTime())
- series.imageIds.map(image => {
- const index = this.cachedImages.findIndex(item => item.uri === image)
- if (index === -1) {
- this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
- }
- })
+ if (series.isExistMutiFrames) {
+ series.instanceInfoList.map(image => {
+ const index = this.cachedImages.findIndex(item => item.uri === image)
+ if (index === -1) {
+ this.imageList.push({ imageId: image.ImageId, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
+ }
+ })
+ } else {
+ series.imageIds.map(image => {
+ const index = this.cachedImages.findIndex(item => item.uri === image)
+ if (index === -1) {
+ this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
+ }
+ })
+ }
if (this.imageList.length > 0) {
this.loopLoadStatus = 0
this.loopLoad()
@@ -895,6 +872,45 @@ export default {
// }
// }
},
+ 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 studyIndex = params.idx.split('|')[0]
+ const seriesIndex = params.idx.split('|')[1]
+ var prefetchInstanceCount = this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount
+ var instanceCount = this.studyList[studyIndex].SeriesList[seriesIndex].instanceCount
+ if (this.studyList[studyIndex].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.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount = prefetchInstanceCount
+ if (percentComplete >= 100) {
+ this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.push(imageId)
+ }
+ }
+ if (prefetchInstanceCount >= instanceCount * 100) {
+ this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount = instanceCount * 100
+ // 设置当前序列状态为已下载完成
+ this.studyList[studyIndex].SeriesList[seriesIndex].loadStatus = true
+ }
+ }
+ },
cornerstoneimagecachechanged(e) {
const cacheInfo = cornerstone.imageCache.getCacheInfo()
console.log(cacheInfo)