From 64d8c853b3aacd4e948015a6b99b430abd88b226 Mon Sep 17 00:00:00 2001 From: wangxiaoshuang <825034831@qq.com> Date: Fri, 24 Apr 2026 14:37:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A8=E6=8E=A7=E5=83=8F=E7=B4=A0=E5=8C=BF?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Dicom/DicomCanvas.vue | 4 + src/components/Dicom/DicomViewer.vue | 214 ++++++++++++++++++++++++--- src/icons/svg/IsMasked.svg | 1 + src/views/dicom-show/dicom-study.vue | 22 ++- 4 files changed, 212 insertions(+), 29 deletions(-) create mode 100644 src/icons/svg/IsMasked.svg diff --git a/src/components/Dicom/DicomCanvas.vue b/src/components/Dicom/DicomCanvas.vue index 49f4e1cb..1d9f207a 100644 --- a/src/components/Dicom/DicomCanvas.vue +++ b/src/components/Dicom/DicomCanvas.vue @@ -57,6 +57,7 @@
{{ markers.left }}
+ @@ -138,6 +139,7 @@ export default { zoom: 0, location: '', fps: 5, + IsMasked: false }, toolState: { initialized: false, @@ -378,6 +380,8 @@ export default { e.detail.enabledElement.options = {} var data = e.detail.image.data this.dicomInfo.hospital = data.string('x00080080') + let instanceInfo = this.series.instanceInfoList.find(item => item.ImageId === e.detail.image.imageId) + this.dicomInfo.IsMasked = instanceInfo.IsMasked // this.dicomInfo.pid = data.string('x00100020') this.dicomInfo.pid = data.string('x00120040') this.dicomInfo.name = data.string('x00100010') diff --git a/src/components/Dicom/DicomViewer.vue b/src/components/Dicom/DicomViewer.vue index 58ebfa96..c446a914 100644 --- a/src/components/Dicom/DicomViewer.vue +++ b/src/components/Dicom/DicomViewer.vue @@ -7,16 +7,25 @@
-->
-
矩形
-
清除 +
{{ + $t('DicomViewer:anonymous:Note_RectangleRoi') }}
+
{{ + $t('DicomViewer:anonymous:Eraser') }}
-
应用
-
应用整个序列
+
{{ + $t('DicomViewer:anonymous:Application') }}
+
{{ + $t('DicomViewer:anonymous:ApplicationAll') }}
-
对比
-
退出
-
恢复
+
{{ + $t('DicomViewer:anonymous:Comparison') }}
+
{{ + $t('DicomViewer:anonymous:Exit') }}
+
{{ + $t('DicomViewer:anonymous:Recovery') }}
3x2 -
像素匿名
+
{{ $t('DicomViewer:anonymous:PixelAnonymity') + }} +
@@ -330,7 +341,7 @@ {{ $t('trials:ptData:button:submit') - }} + }}
@@ -374,6 +385,10 @@ export default { type: Boolean, default: false }, + Comparison: { + type: Boolean, + default: false + }, modality: { type: String, default: '' @@ -381,6 +396,7 @@ export default { }, data() { return { + hasAnonymous: false, isAnonymous: false, isComparison: false, activeTool: '', @@ -450,6 +466,8 @@ export default { } }, mounted() { + let type = this.$router.currentRoute.query.type ? this.$router.currentRoute.query.type : '' + this.hasAnonymous = type === 'Study' this.customWwc = { visible: false, title: this.$t('DicomViewer:data:customWwc'), @@ -468,11 +486,116 @@ export default { }, methods: { - anonymousImage() { - console.log(this.series, 'this.series') + comparison(f) { + this.isComparison = f + this.$emit("update:Comparison", f) + const elements = document.querySelectorAll('.dicom-item') + const scope = this + Array.from(elements).forEach((element, index) => { + if (element.style.display !== 'none') { + scope.$refs[`dicomCanvas${index}`].setToolPassive(scope.activeTool) + } + }) + scope.activeTool = null + if (this.isComparison) { + this.$refs[`dicomCanvas0`].getNote_RectangleRoi().then(obj => { + let { image } = obj + let instanceInfo = this.series.instanceInfoList.find(item => item.ImageId === image.imageId) + if (!instanceInfo.IsMasked) return this.$confirm(this.$t("DicomViewer:anonymous:notMasked")) + this.changeLayout('1x2') + let serie = {} + Object.keys(this.series).forEach(key => { + if (key !== 'instanceInfoList' && key !== 'imageIds') { + serie[key] = this.series[key] + } + }) + let imageId = image.imageId + let newImageId = imageId.split("?")[0].split(".MaskDicom_")[0] + "?" + imageId.split("?")[1] + let info0 = {}, info1 = {} + Object.keys(instanceInfo).forEach(key => { + info0[key] = instanceInfo[key] + info1[key] = instanceInfo[key] + }) + info0.ImageId = imageId + info1.ImageId = newImageId + console.log(info0) + console.log(info1) + let dicomCanvas0_info = Object.assign({ + instanceInfoList: [ + info0 + ], + imageIds: [imageId] + }, serie) + let dicomCanvas1_info = Object.assign({ + instanceInfoList: [ + info1 + ], + imageIds: [newImageId] + }, serie) + console.log(dicomCanvas0_info, 'dicomCanvas0_info') + console.log(dicomCanvas1_info, 'dicomCanvas0_info') + this.$refs[`dicomCanvas0`].loadImageStack(dicomCanvas0_info) + this.$refs[`dicomCanvas1`].loadImageStack(dicomCanvas1_info) + }) + } else { + this.changeLayout('1x1') + this.$refs[`dicomCanvas0`].loadImageStack(this.series) + } + + }, + recovery(isAll = false) { + if (this.isComparison) return false + this.$refs[`dicomCanvas0`].getNote_RectangleRoi().then(async obj => { + let { image } = obj + let instanceInfo = this.series.instanceInfoList.find(item => item.ImageId === image.imageId) + if (!instanceInfo.IsMasked) return this.$confirm(this.$t("DicomViewer:anonymous:notMasked")) + let data = { + // SeriesId: this.series.seriesId, + instanceIdList: [instanceInfo.Id] + } + if (isAll) { + data.SeriesId = this.series.seriesId + delete data.instanceIdList + } + let res = await this.studyUndoMaskImage(data) + if (!res) return false + this.$emit("update:loading", true) + if (!isAll) { + let strs = image.imageId.split("?") + let newImageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${res[0].Path}?${strs[1]}` + this.series.instanceInfoList.some(item => { + if (item.Id === instanceInfo.Id) { + item.ImageId = newImageId + item.IsMasked = false + } + return item.Id === instanceInfo.Id + }) + let index = this.series.imageIds.findIndex(item => item === image.imageId) + this.series.imageIds.splice(index, 1, newImageId) + await this.$refs[`dicomCanvas0`].reloadImage(newImageId) + } else { + let arr = [] + this.series.instanceInfoList.forEach(item => { + let strs = item.ImageId.split("?") + let info = res.find(i => item.Id === i.Id) + let newImageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${info.Path}?${strs[1]}` + item.ImageId = newImageId + item.IsMasked = false + arr.push(newImageId) + }) + this.series.imageIds = arr + console.log(this.series, 'this.series') + // this.loadImageStack(this.series) + this.$refs[`dicomCanvas0`].loadImageStack(this.series) + } + this.$emit("update:loading", false) + this.$emit('loadStudy', false) + }) + }, + anonymousImage(isAll = false) { + if (this.isComparison) return false this.$refs[`dicomCanvas0`].getNote_RectangleRoi().then(async obj => { let { toolInfo, image } = obj - console.log(image, 'image') if (!toolInfo || toolInfo.data.length <= 0) return this.$confirm(this.$t("DicomViewer:anonymous:notMark")) let instanceInfo = this.series.instanceInfoList.find(item => item.ImageId === image.imageId) let data = { @@ -480,6 +603,10 @@ export default { instanceIdList: [instanceInfo.Id], MaskRegionList: [] } + if (isAll) { + data.SeriesId = this.series.seriesId + delete data.instanceIdList + } toolInfo.data.forEach(item => { let currentStart = item.handles.start let currentEnd = item.handles.end @@ -502,11 +629,37 @@ export default { }) let res = await this.studyMaskImage(data) if (!res) return false - // this.$emit("update:loading", true) - // let strs = image.imageId.split("?") - // let newImageId = `${strs[0]}-MaskImage?${strs[1]}` - // console.log(newImageId, 'newImageId') - // this.$refs[`dicomCanvas0`].reloadImage(newImageId) + this.$emit("update:loading", true) + if (!isAll) { + let strs = image.imageId.split("?") + let newImageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${res[0].Path}?${strs[1]}` + this.series.instanceInfoList.some(item => { + if (item.Id === instanceInfo.Id) { + item.ImageId = newImageId + item.IsMasked = true + } + return item.Id === instanceInfo.Id + }) + let index = this.series.imageIds.findIndex(item => item === image.imageId) + this.series.imageIds.splice(index, 1, newImageId) + await this.$refs[`dicomCanvas0`].reloadImage(newImageId) + } else { + let arr = [] + this.series.instanceInfoList.forEach(item => { + let strs = item.ImageId.split("?") + let info = res.find(i => item.Id === i.Id) + let newImageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${info.Path}?${strs[1]}` + item.ImageId = newImageId + item.IsMasked = true + arr.push(newImageId) + }) + this.series.imageIds = arr + console.log(this.series, 'this.series') + // this.loadImageStack(this.series) + this.$refs[`dicomCanvas0`].loadImageStack(this.series) + } + this.$emit("update:loading", false) + this.$emit('loadStudy', false) }) }, openAnonymous() { @@ -514,12 +667,12 @@ export default { if (!this.isAnonymous) { const elements = document.querySelectorAll('.dicom-item') const scope = this - scope.activeTool = null Array.from(elements).forEach((element, index) => { if (element.style.display !== 'none') { - scope.$refs[`dicomCanvas${index}`].setToolPassive(toolName) + scope.$refs[`dicomCanvas${index}`].setToolPassive(scope.activeTool) } }) + scope.activeTool = null } else { this.activateDicomCanvas(0) this.changeLayout('1x1') @@ -531,7 +684,22 @@ export default { let res = await studyMaskImage(data) this.$emit("update:loading", false) if (res.IsSuccess) { - return true + return res.Result.OkList + } + return false + } catch (err) { + console.log(err) + this.$emit("update:loading", false) + return false + } + }, + async studyUndoMaskImage(data) { + try { + this.$emit("update:loading", true) + let res = await studyUndoMaskImage(data) + this.$emit("update:loading", false) + if (res.IsSuccess) { + return res.Result.OkList } return false } catch (err) { @@ -930,6 +1098,10 @@ export default { .activeBtn { background-color: rgba(255, 255, 255, .5); } + + .isNoted { + cursor: not-allowed; + } } .btnBox { diff --git a/src/icons/svg/IsMasked.svg b/src/icons/svg/IsMasked.svg new file mode 100644 index 00000000..96b67cca --- /dev/null +++ b/src/icons/svg/IsMasked.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/views/dicom-show/dicom-study.vue b/src/views/dicom-show/dicom-study.vue index 7592d05b..8dbe35f1 100644 --- a/src/views/dicom-show/dicom-study.vue +++ b/src/views/dicom-show/dicom-study.vue @@ -124,7 +124,7 @@
+ :modality="modality" :Comparison.sync="isComparison" @loadStudy="loadStudy" />