diff --git a/src/utils/request-pool.js b/src/utils/request-pool.js index 3c1595f5..9e4ac646 100644 --- a/src/utils/request-pool.js +++ b/src/utils/request-pool.js @@ -17,7 +17,7 @@ async function executeTask() { if (taskPool.length > 0) { // let startSortTime = performance.now() if( sortType ){ - sortTaskPool() + maxRequest = 6 } // let endSortTime = performance.now() var requestNum = Math.min(taskPool.length, maxRequest) diff --git a/src/views/dicom-show/dicom-study.vue b/src/views/dicom-show/dicom-study.vue index 76ffae39..2426b687 100644 --- a/src/views/dicom-show/dicom-study.vue +++ b/src/views/dicom-show/dicom-study.vue @@ -160,7 +160,7 @@ export default { this.type = this.$router.currentRoute.query.type ? this.$router.currentRoute.query.type : '' this.visitNum = this.$router.currentRoute.query.visitNum ? parseInt(this.$router.currentRoute.query.visitNum) : 0 - cornerstone.events.addEventListener('cornerstoneimageloaded', this.cornerstoneImageLoaded) + // cornerstone.events.addEventListener('cornerstoneimageloaded', this.cornerstoneImageLoaded) // cornerstone.events.addEventListener('datasetscachechanged', this.datasetsCacheChanged) if (this.$router.currentRoute.query.TokenKey) { store.dispatch('user/setToken', this.$router.currentRoute.query.TokenKey) @@ -240,6 +240,7 @@ export default { }) scope.seriesList = seriesList if (scope.seriesList.length > 0) { + this.loadAllImages() scope.$refs.dicomViewer.loadImageStack(scope.seriesList[0], scope.labels[scope.tpCode]) scope.firstInstanceId = scope.seriesList[0].imageIds[0] } @@ -445,11 +446,16 @@ export default { }, loadAllImages() { var priority = new Date().getTime() - this.seriesList.forEach(series => { + this.seriesList.forEach((series, index) => { series.imageIds.forEach(imageId => { - priority-- + var p = null + if (this.firstInstanceId === imageId) { + p = priority * 100 + } else { + p = priority - 1 + } // this.load(imageId, series.seriesId, priority) - this.imageList.push({ imageId: imageId, seriesId: series.seriesId, priority }) + this.imageList.push({ imageId: imageId, seriesId: series.seriesId, seriesIndex: index, priority: p }) }) }) if (this.imageList.length > 0) { @@ -459,12 +465,13 @@ export default { 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.sortTaskPool() this.imageList = [] } }, @@ -479,7 +486,24 @@ export default { }) }) }, - imageLoaded(imageId, seriesUid) { + imageLoaded(image, seriesUid) { + var seriesIndex = image.seriesIndex + if (seriesIndex < 0) return + if (this.seriesList[seriesIndex].imageloadedArr.indexOf(image.imageId) < 0) { + ++this.seriesList[seriesIndex].prefetchInstanceCount + this.seriesList[seriesIndex].imageloadedArr.push(image.imageId) + + if (this.seriesList[seriesIndex].prefetchInstanceCount >= this.seriesList[seriesIndex].instanceCount) { + this.seriesList[seriesIndex].prefetchInstanceCount = this.seriesList[seriesIndex].instanceCount + // 设置当前序列状态为已下载完成 + this.seriesList[seriesIndex].loadStatus = true + // if (!this.isLoadedAll) { + // this.loadAllImages() + // } + } + } + }, + imageLoaded2(imageId, seriesUid) { var seriesIndex = -1 for (let i = 0; i < this.seriesList.length; ++i) { if (this.seriesList[i].seriesUid === seriesUid) { diff --git a/src/views/dicom-show/dicom-visit.vue b/src/views/dicom-show/dicom-visit.vue index 8ca4336c..27788f7e 100644 --- a/src/views/dicom-show/dicom-visit.vue +++ b/src/views/dicom-show/dicom-visit.vue @@ -248,7 +248,7 @@ export default { this.visitInfo = this.$router.currentRoute.query.visitInfo this.isReading = this.$router.currentRoute.query.isReading ? this.$router.currentRoute.query.isReading * 1 : 0 this.showDelete = parseInt(this.$router.currentRoute.query.showDelete) - cornerstone.events.addEventListener('cornerstoneimageloaded', this.cornerstoneImageLoaded) + // cornerstone.events.addEventListener('cornerstoneimageloaded', this.cornerstoneImageLoaded) this.getStudiesInfo() }, beforeDestroy() { @@ -311,6 +311,7 @@ export default { instanceId = instanceId.split('.')[0] this.firstInstanceId = instanceId this.activeNames = [this.studyList[0].StudyId] + this.loadAllImages() } }) }, @@ -497,14 +498,23 @@ export default { }, loadAllImages() { var priority = parseInt(new Date().getTime()) - this.studyList.map(study => { - study.SeriesList.map(series => { - if (!series.loadStatus && series.seriesId !== this.firstSeriesId) { - series.imageIds.map(imageId => { - // imageIds.push({ imageId: image, seriesId: series.seriesId, priority }) - this.imageList.push({ imageId: imageId, seriesId: series.seriesId, priority }) - }) - } + this.studyList.map((study, studyIndex) => { + study.SeriesList.map((series, seriesIndex) => { + series.imageIds.map(imageId => { + var p = null + if (this.firstInstanceId === imageId) { + p = priority * 100 + } else { + p = priority - 1 + } + this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex, seriesIndex, priority: p }) + }) + // if (!series.loadStatus && series.seriesId !== this.firstSeriesId) { + // series.imageIds.map(imageId => { + // // imageIds.push({ imageId: image, seriesId: series.seriesId, priority }) + // this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex, seriesIndex, priority }) + // }) + // } }) }) if (this.imageList.length > 0) { @@ -562,26 +572,13 @@ export default { // 清理缓存的影像 } }, - imageLoaded(imageId, seriesUid) { - var studyIndex = -1 - var seriesIndex = -1 - for (let i = 0; i < this.studyList.length; ++i) { - for (let j = 0; j < this.studyList[i].SeriesList.length; ++j) { - if (this.studyList[i].SeriesList[j].seriesUid === seriesUid) { - studyIndex = i - seriesIndex = j - break - } - } - if (studyIndex > 0) break - } - if (seriesIndex < 0) return - - const imageIdIndex = this.studyList[studyIndex].SeriesList[seriesIndex].imageIds.indexOf(imageId) - if (imageIdIndex < 0) return - if (this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.indexOf(imageId) < 0) { + imageLoaded(image, seriesUid) { + var studyIndex = image.studyIndex + var seriesIndex = image.seriesIndex + if (seriesIndex < 0 || studyIndex < 0) return + if (this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.indexOf(image.imageId) < 0) { ++this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount - this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.push(imageId) + this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.push(image.imageId) if (this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount >= this.studyList[studyIndex].SeriesList[seriesIndex].instanceCount) { this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount = this.studyList[studyIndex].SeriesList[seriesIndex].instanceCount diff --git a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeStudyList.vue b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeStudyList.vue index e6b6fa45..1dfebc71 100644 --- a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeStudyList.vue +++ b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeStudyList.vue @@ -49,18 +49,18 @@ />
- T: {{ series.sliceThickness }} +
+ T: {{ parseFloat(series.sliceThickness).toFixed(digitPlaces) }}
{{ series.modality }}: {{ series.instanceCount }} image