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 3c358aaf..2426b687 100644 --- a/src/views/dicom-show/dicom-study.vue +++ b/src/views/dicom-show/dicom-study.vue @@ -157,36 +157,25 @@ export default { } }, created: function() { - try { - console.log(this.$route.query) - this.type = this.$route.query.type ? this.$route.query.type : '' - this.visitNum = this.$router.currentRoute.query.visitNum ? parseInt(this.$router.currentRoute.query.visitNum) : 0 - console.log(this.type) - console.log(111) - 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) - changeURLStatic('TokenKey', '') - } - console.log(222) - console.log(this.type) - this.studyId = this.$router.currentRoute.query.studyId - if (this.type === 'Series') { - // this.initStudy() - console.log(333) - console.log(this.$router.currentRoute.query.showDelete) - this.showDelete = parseInt(this.$router.currentRoute.query.showDelete) - console.log(333) - this.initSeries() - } else if (this.type === 'Study') { - this.showDelete = parseInt(this.$router.currentRoute.query.showDelete) - this.loadStudy() - } else if (this.type === 'Share') { - this.loadStudy() - } - } catch (e) { - console.log(e) + 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('datasetscachechanged', this.datasetsCacheChanged) + if (this.$router.currentRoute.query.TokenKey) { + store.dispatch('user/setToken', this.$router.currentRoute.query.TokenKey) + changeURLStatic('TokenKey', '') + } + this.studyId = this.$router.currentRoute.query.studyId + if (this.type === 'Series') { + // this.initStudy() + this.showDelete = parseInt(this.$router.currentRoute.query.showDelete) + this.initSeries() + } else if (this.type === 'Study') { + this.showDelete = parseInt(this.$router.currentRoute.query.showDelete) + this.loadStudy() + } else if (this.type === 'Share') { + this.loadStudy() } }, beforeDestroy() { @@ -251,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] } @@ -258,59 +248,55 @@ export default { }) }, initSeries() { - try { - console.log(0) - var scope = this - this.studyCode = this.$router.currentRoute.query.studyCode - this.modality = this.$router.currentRoute.query.modality - this.seriesCount = 1 - this.description = this.$router.currentRoute.query.description - var seriesId = this.$router.currentRoute.query.seriesId - var seriesNumber = this.$router.currentRoute.query.seriesNumber - var subjectVisitId = this.$router.currentRoute.query.subjectVisitId - var studyId = this.$router.currentRoute.query.studyId - var trialId = this.$router.currentRoute.query.trialId - console.log(1) - getInstanceList(seriesId).then(res => { - if (!res.Result || (res.Result && res.Result.length === 0)) return - var seriesInstanceUid = res.Result[0].SeriesInstanceUid - var sliceLocation = res.Result[0].SliceLocation - var isReading = res.Result[0].IsReading - var isDeleted = res.Result[0].IsDeleted - var seriesList = [] - var imageIds = [] - res.Result.forEach(instance => { - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${instance.Path}`) - }) - seriesList.push({ - trialId, - subjectVisitId, - studyId, - imageIds: imageIds, - seriesId: seriesId, - seriesUid: seriesInstanceUid, - seriesNumber: seriesNumber, - sliceThickness: sliceLocation, - modality: this.modality, - description: this.description, - isReading, - isDeleted, - previewImageUrl: res.OtherInfo.ImageResizePath ? scope.OSSclientConfig.basePath + res.OtherInfo.ImageResizePath : res.OtherInfo.ImageResizePath, - instanceCount: res.Result.length, - prefetchInstanceCount: 0, - loadStatus: false, - imageloadedArr: [] - }) - this.seriesList = seriesList - if (this.seriesList.length > 0) { - this.$nextTick(() => { - this.loadAllImages() - this.$refs.dicomViewer.loadImageStack(this.seriesList[0]) - this.firstInstanceId = this.seriesList[0].imageIds[0] - }) - } + var scope = this + this.studyCode = this.$router.currentRoute.query.studyCode + this.modality = this.$router.currentRoute.query.modality + this.seriesCount = 1 + this.description = this.$router.currentRoute.query.description + var seriesId = this.$router.currentRoute.query.seriesId + var seriesNumber = this.$router.currentRoute.query.seriesNumber + var subjectVisitId = this.$router.currentRoute.query.subjectVisitId + var studyId = this.$router.currentRoute.query.studyId + var trialId = this.$router.currentRoute.query.trialId + getInstanceList(seriesId).then(res => { + if (!res.Result || (res.Result && res.Result.length === 0)) return + var seriesInstanceUid = res.Result[0].SeriesInstanceUid + var sliceLocation = res.Result[0].SliceLocation + var isReading = res.Result[0].IsReading + var isDeleted = res.Result[0].IsDeleted + var seriesList = [] + var imageIds = [] + res.Result.forEach(instance => { + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${instance.Path}`) }) - } catch (e) {console.log(e)} + seriesList.push({ + trialId, + subjectVisitId, + studyId, + imageIds: imageIds, + seriesId: seriesId, + seriesUid: seriesInstanceUid, + seriesNumber: seriesNumber, + sliceThickness: sliceLocation, + modality: this.modality, + description: this.description, + isReading, + isDeleted, + previewImageUrl: res.OtherInfo.ImageResizePath ? scope.OSSclientConfig.basePath + res.OtherInfo.ImageResizePath : res.OtherInfo.ImageResizePath, + instanceCount: res.Result.length, + prefetchInstanceCount: 0, + loadStatus: false, + imageloadedArr: [] + }) + this.seriesList = seriesList + if (this.seriesList.length > 0) { + this.$nextTick(() => { + this.loadAllImages() + this.$refs.dicomViewer.loadImageStack(this.seriesList[0]) + this.firstInstanceId = this.seriesList[0].imageIds[0] + }) + } + }) }, showSeriesImage(e, seriesIndex, series) { // if (seriesIndex === this.currentSeriesIndex) return @@ -460,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) { @@ -474,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 = [] } }, @@ -494,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/components/StudyList.vue b/src/views/trials/trials-panel/reading/dicoms/components/StudyList.vue index fcae4c2c..102d20ef 100644 --- a/src/views/trials/trials-panel/reading/dicoms/components/StudyList.vue +++ b/src/views/trials/trials-panel/reading/dicoms/components/StudyList.vue @@ -901,7 +901,7 @@ export default { .image-desc { vertical-align: top; p{ - width: 100px; + width: 95px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; @@ -910,7 +910,10 @@ export default { margin: 0px; line-height: 1.5; div{ - width: 100px; + width: 95px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } } } 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..6f199749 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