From 09e5bcb3b7fdc6e444d44b92ce34798c813a236c Mon Sep 17 00:00:00 2001 From: wangxiaoshuang <825034831@qq.com> Date: Thu, 4 Dec 2025 13:40:23 +0800 Subject: [PATCH] =?UTF-8?q?mpr=E6=9F=A5=E7=9C=8B=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E5=92=8C=E6=A0=87=E8=AE=B0=E6=88=AA=E5=9B=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reading/dicoms3D/components/ReadPage.vue | 82 +++++++++++++------ .../dicoms3D/components/VolumeViewport.vue | 12 ++- 2 files changed, 67 insertions(+), 27 deletions(-) diff --git a/src/views/trials/trials-panel/reading/dicoms3D/components/ReadPage.vue b/src/views/trials/trials-panel/reading/dicoms3D/components/ReadPage.vue index d5c07bdd..a26fcc8d 100644 --- a/src/views/trials/trials-panel/reading/dicoms3D/components/ReadPage.vue +++ b/src/views/trials/trials-panel/reading/dicoms3D/components/ReadPage.vue @@ -703,7 +703,7 @@ export default { }, immediate: true }, - currentReadingTaskState() { console.log(this.currentReadingTaskState, 'currentReadingTaskState') }, + // currentReadingTaskState() { console.log(this.currentReadingTaskState, 'currentReadingTaskState') }, activeTaskId: { immediate: true, handler(id) { @@ -722,7 +722,7 @@ export default { this.clipPlaying = false this.fps = 15 } - if (index === this.cells.length - 1 && series) { + if (index === this.cells.length - 1 && series && series.TaskInfo) { this.lastViewportTaskId = series.TaskInfo.VisitTaskId this.currentVisitInfo = series.TaskInfo } @@ -1047,7 +1047,6 @@ export default { const element2 = this.$refs['viewport-1'][0].$el const element3 = this.$refs['viewport-2'][0].$el const element4 = this.$refs['viewport-3'][0].$el - console.log(Enums.OrientationAxis) let viewportInputArray = [ { viewportId: 'viewport-0', @@ -1089,7 +1088,7 @@ export default { type: ViewportType.ORTHOGRAPHIC, element: volumeElement2, defaultOptions: { - orientation: Enums.OrientationAxis.CORONAL + orientation: Enums.OrientationAxis.SAGITTAL } }, { @@ -1097,7 +1096,7 @@ export default { type: ViewportType.ORTHOGRAPHIC, element: volumeElement3, defaultOptions: { - orientation: Enums.OrientationAxis.SAGITTAL + orientation: Enums.OrientationAxis.CORONAL } }, ] @@ -1506,7 +1505,6 @@ export default { const referencedImageId = annotation.metadata.referencedImageId console.log(annotation, 'annotation') const params = this.getInstanceInfo(referencedImageId) - console.log(params, 'params') annotation.visitTaskId = series.TaskInfo.VisitTaskId annotation.studyId = series.StudyId annotation.seriesId = series.Id @@ -2725,20 +2723,31 @@ export default { const i = this.visitTaskList.findIndex(i => i.VisitTaskId === obj.visitTaskId) if (i === -1) return const studyList = this.visitTaskList[i].StudyList - const series = this.getMarkedSeries(studyList, obj.annotation, true) + let series = this.getMarkedSeries(studyList, obj.annotation, true) if (series) { this.activeViewportIndex = this.cells.length - 1 if (obj.annotation.from === 'MPR') { - let res = await this.openMPRViewport(series) let viewPlaneNormal = obj.annotation?.metadata?.viewPlaneNormal.map(i => i == 0 ? 0 : i).join(',') if (viewPlaneNormal === '0,0,-1') { this.activeViewportIndex = 0 + series = Object.assign({ orientation: 'AXIAL' }, series) } else if (viewPlaneNormal === '0,-1,0') { - this.activeViewportIndex = 1 - } else if (viewPlaneNormal === '1,0,0') { this.activeViewportIndex = 2 + series = Object.assign({ orientation: 'CORONAL' }, series) + } else if (viewPlaneNormal === '1,0,0') { + this.activeViewportIndex = 1 + series = Object.assign({ orientation: 'SAGITTAL' }, series) } + let res = await this.openMPRViewport(series) if (!res) return false + } else { + if (this.isMPR) { + this.isMPR = false + this.rows = 1 + this.cols = 1 + this.activeViewportIndex = 0 + // return this.activeSeries(series) + } } this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].setSeriesInfo(series, true) this.$refs[series.TaskInfo.VisitTaskId][0].setSeriesActive(series.StudyIndex, series.SeriesIndex) @@ -2748,17 +2757,41 @@ export default { const i = this.visitTaskList.findIndex(i => i.VisitTaskId === obj.visitTaskId) if (i === -1) return const studyList = this.visitTaskList[i].StudyList - const series = this.getMarkedSeries(studyList, obj.annotation, true) + let series = this.getMarkedSeries(studyList, obj.annotation, true) if (series) { this.activeViewportIndex = this.cells.length - 1 if (obj.annotation.from === 'MPR') { let viewPlaneNormal = obj.annotation?.metadata?.viewPlaneNormal.map(i => i == 0 ? 0 : i).join(',') if (viewPlaneNormal === '0,0,-1') { this.activeViewportIndex = 0 + series = Object.assign({ orientation: 'AXIAL' }, series) } else if (viewPlaneNormal === '0,-1,0') { - this.activeViewportIndex = 1 - } else if (viewPlaneNormal === '1,0,0') { this.activeViewportIndex = 2 + series = Object.assign({ orientation: 'CORONAL' }, series) + } else if (viewPlaneNormal === '1,0,0') { + this.activeViewportIndex = 1 + series = Object.assign({ orientation: 'SAGITTAL' }, series) + } + let res = await this.openMPRViewport(series) + if (!res) { + this.$refs[series.TaskInfo.VisitTaskId][0].setSeriesActive(series.StudyIndex, series.SeriesIndex) + setTimeout(async () => { + const divForDownloadViewport = document.querySelector( + `div[data-viewport-uid="${this.viewportKey}-${this.activeViewportIndex}"]` + ) + const canvas = await html2canvas(divForDownloadViewport) + const base64Str = canvas.toDataURL('image/png', 1) + callback(base64Str) + }, 200) + return false + } + } else { + if (this.isMPR) { + this.isMPR = false + this.rows = 1 + this.cols = 1 + this.activeViewportIndex = 0 + // return this.activeSeries(series) } } this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].setSeriesInfo(series, true) @@ -2770,7 +2803,7 @@ export default { const canvas = await html2canvas(divForDownloadViewport) const base64Str = canvas.toDataURL('image/png', 1) callback(base64Str) - }, 500) + }, 200) } }, async getScreenshots(measureData, callback) { @@ -3124,24 +3157,27 @@ export default { }, async openMPRViewport(data = null) { return new Promise(async (resolve, reject) => { - if (this.isMPR) return resolve(true) + if (this.isMPR) { + if (!data) return resolve(false) + let viewportSeries = this.$refs[`viewport-volume-0`][0].series + if (data && viewportSeries.SeriesInstanceUid === data.SeriesInstanceUid) return resolve(true) + } + this.isMPR = true this.rows = 3 this.cols = 1 this.loading = true this.loadingText = this.$t('trials:lugano:message:loadVolumes') const series = data ? data : this.$refs[`viewport-${this.activeViewportIndex}`][0].series - this.activeViewportIndex = 0 - // this.$refs[`viewport-0`][0].setSeriesInfo(series) - // this.$refs[`viewport-1`][0].setSeriesInfo(series) - // this.$refs[`viewport-2`][0].setSeriesInfo(series) - // this.$refs[`viewport-3`][0].setSeriesInfo(series) + if (!data) this.activeViewportIndex = 0 + const visitTaskId = this.visitTaskList[this.activeTaskIndex].VisitTaskId + this.$refs[visitTaskId][0].setSeriesActive(series.StudyIndex, series.SeriesIndex) await this.getVolume(series) this.loading = false this.loadingText = null - this.$refs[`viewport-volume-0`][0].setSeriesInfo(Object.assign({ orientation: 'AXIAL' }, series)) - this.$refs[`viewport-volume-1`][0].setSeriesInfo(Object.assign({ orientation: 'CORONAL' }, series)) - this.$refs[`viewport-volume-2`][0].setSeriesInfo(Object.assign({ orientation: 'SAGITTAL' }, series)) + this.$refs[`viewport-volume-0`][0].setSeriesInfo(Object.assign({ orientation: 'AXIAL', isLocation: data && this.activeViewportIndex === 0 }, series)) + this.$refs[`viewport-volume-1`][0].setSeriesInfo(Object.assign({ orientation: 'SAGITTAL', isLocation: data && this.activeViewportIndex === 1 }, series)) + this.$refs[`viewport-volume-2`][0].setSeriesInfo(Object.assign({ orientation: 'CORONAL', isLocation: data && this.activeViewportIndex === 2 }, series)) resolve(false) }) diff --git a/src/views/trials/trials-panel/reading/dicoms3D/components/VolumeViewport.vue b/src/views/trials/trials-panel/reading/dicoms3D/components/VolumeViewport.vue index dfc02285..c41845e1 100644 --- a/src/views/trials/trials-panel/reading/dicoms3D/components/VolumeViewport.vue +++ b/src/views/trials/trials-panel/reading/dicoms3D/components/VolumeViewport.vue @@ -40,10 +40,10 @@