From 9277d48c85474a86efc169ca9d1fb56da423da8f Mon Sep 17 00:00:00 2001 From: caiyiling <1321909229@qq.com> Date: Tue, 18 Mar 2025 17:55:22 +0800 Subject: [PATCH] 1 --- .../visit-review/components/FileViewer.vue | 135 +++++++++--------- .../visit-review/components/ReadPage.vue | 13 +- 2 files changed, 72 insertions(+), 76 deletions(-) diff --git a/src/views/trials/trials-panel/reading/visit-review/components/FileViewer.vue b/src/views/trials/trials-panel/reading/visit-review/components/FileViewer.vue index f78f0496..56b4cf5c 100644 --- a/src/views/trials/trials-panel/reading/visit-review/components/FileViewer.vue +++ b/src/views/trials/trials-panel/reading/visit-review/components/FileViewer.vue @@ -70,7 +70,7 @@ > --> - +
-
+
@@ -225,12 +225,12 @@ :close-on-press-escape="false" :show-close="false" width="400px" - > - + > + - + @@ -316,9 +316,9 @@ export default { }, rules: { length: [ - { required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }, - { pattern: /^\d+$/, message: this.$t('trials:noneDicom:message:msg3'), trigger: ['blur', 'change'] } - ], + { required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }, + { pattern: /^\d+$/, message: this.$t('trials:noneDicom:message:msg3'), trigger: ['blur', 'change'] } + ] } } }, @@ -391,7 +391,7 @@ export default { isMove: false, height: 0 })) - let digitPlaces = Number(localStorage.getItem('digitPlaces')) + const digitPlaces = Number(localStorage.getItem('digitPlaces')) this.digitPlaces = digitPlaces === -1 ? this.digitPlaces : digitPlaces this.initLoader() window.addEventListener('message', this.handleIframeMessage) @@ -429,7 +429,6 @@ export default { element.oncontextmenu = (e) => e.preventDefault() resizeObserver.observe(element) element.addEventListener('CORNERSTONE_STACK_NEW_IMAGE', this.stackNewImage) - }) const viewportInputArray = [ { @@ -466,7 +465,6 @@ export default { cornerstoneTools.addTool(SplineROITool) cornerstoneTools.addTool(EraserTool) cornerstoneTools.addTool(LengthTool) - viewportIds.forEach((viewportId, i) => { const toolGroupId = `canvas-${i}` @@ -499,13 +497,13 @@ export default { // 'spline' // ) toolGroup.addTool(SplineROITool.toolName) - + toolGroup.addTool(EraserTool.toolName) toolGroup.addTool(LengthTool.toolName, { getTextLines: this.getLengthToolTextLines, cachedStats: false }) - + toolGroup.setToolActive(StackScrollTool.toolName, { bindings: [{ mouseButton: MouseBindings.Wheel }] }) @@ -548,12 +546,12 @@ export default { this.renderHistoryAnnotationTaskIds.push(obj.VisitTaskId) // let arr = [] obj.Annotations.map(i => { - const annotation = i.MeasureData - annotation.annotationId = i.Id - cornerstoneTools.annotation.state.addAnnotation(annotation) - if (obj.ReadingTaskState === 2) { - cornerstoneTools.annotation.locking.setAnnotationLocked(annotation.annotationUID) - } + const annotation = i.MeasureData + annotation.annotationId = i.Id + cornerstoneTools.annotation.state.addAnnotation(annotation) + if (obj.ReadingTaskState === 2) { + cornerstoneTools.annotation.locking.setAnnotationLocked(annotation.annotationUID) + } }) }, // 渲染图片 @@ -649,7 +647,7 @@ export default { this.rows = parseInt(command.split('*')[0]) this.cols = parseInt(command.split('*')[1]) if (this.rows === 1 && this.cols === 1) { - this.$nextTick(()=>{ + this.$nextTick(() => { this.activeCanvas(0) }) } @@ -790,9 +788,9 @@ export default { if (toolName === 'Length') { const renderingEngine = getRenderingEngine(renderingEngineId) const viewport = renderingEngine.getViewport(`canvas-${this.activeCanvasIndex}`) - let imageId = viewport.csImage.imageId - let annotations = cornerstoneTools.annotation.state.getAllAnnotations() - let idx = annotations.findIndex(i=>i.metadata.referencedImageId === imageId && i.metadata.toolName === 'Length') + const imageId = viewport.csImage.imageId + const annotations = cornerstoneTools.annotation.state.getAllAnnotations() + const idx = annotations.findIndex(i => i.metadata.referencedImageId === imageId && i.metadata.toolName === 'Length') if (idx > -1) { this.activeTool = '' // 当前图像已存在比例尺! @@ -858,7 +856,7 @@ export default { const fileList = this.viewportInfos[i].fileList const fileIndex = fileList.findIndex(f => f.Path === path) if (annotation.metadata.toolName === 'Length') { - this.$emit('setPS', {NoneDicomFileId: fileList[fileIndex].Id,Path: fileList[fileIndex].Path, PS: null}) + this.$emit('setPS', { NoneDicomFileId: fileList[fileIndex].Id, Path: fileList[fileIndex].Path, PS: null }) } }, async annotationModifiedListener(e) { @@ -879,10 +877,10 @@ export default { if (annotation.metadata.toolName === 'Length') { const value = annotation.data.l if (value) { - let cachedStats = Object.keys(annotation.data.cachedStats) - let ps = value / annotation.data.cachedStats[cachedStats[0]].length + const cachedStats = Object.keys(annotation.data.cachedStats) + const ps = value / annotation.data.cachedStats[cachedStats[0]].length annotation.data.ps = ps - this.$emit('setPS', {NoneDicomFileId: fileList[fileIndex].Id,Path: fileList[fileIndex].Path, PS: ps}) + this.$emit('setPS', { NoneDicomFileId: fileList[fileIndex].Id, Path: fileList[fileIndex].Path, PS: ps }) } this.setToolsPassive() } @@ -928,7 +926,7 @@ export default { this.setToolsPassive() return } - + const params = { id: '', visitTaskId: this.viewportInfos[i].taskInfo.VisitTaskId, @@ -939,7 +937,7 @@ export default { } const res = await addNoneDicomMark(params) annotation.annotationId = res.Result - + const renderingEngine = getRenderingEngine(renderingEngineId) const viewport = renderingEngine.getViewport(`canvas-${this.activeCanvasIndex}`) viewport.render() @@ -947,18 +945,18 @@ export default { // this.$message.success(this.$t('common:message:savedSuccessfully')) }, async saveForm() { - let validate = await this.$refs.lengthForm.validate() + const validate = await this.$refs.lengthForm.validate() if (!validate) return - let value = this.form.length - let annotation = this.form.annotationObj.annotation - let fileList = this.form.annotationObj.fileList - let fileIndex = this.form.annotationObj.fileIndex + const value = this.form.length + const annotation = this.form.annotationObj.annotation + const fileList = this.form.annotationObj.fileList + const fileIndex = this.form.annotationObj.fileIndex if (value) { annotation.data.l = parseFloat(value) - let cachedStats = Object.keys(annotation.data.cachedStats) - let ps = parseFloat(value) / annotation.data.cachedStats[cachedStats[0]].length + const cachedStats = Object.keys(annotation.data.cachedStats) + const ps = parseFloat(value) / annotation.data.cachedStats[cachedStats[0]].length annotation.data.ps = ps - this.$emit('setPS', {NoneDicomFileId: fileList[fileIndex].Id,Path: fileList[fileIndex].Path, PS: ps}) + this.$emit('setPS', { NoneDicomFileId: fileList[fileIndex].Id, Path: fileList[fileIndex].Path, PS: ps }) } else { cornerstoneTools.annotation.state.removeAnnotation(annotation.annotationUID) return @@ -973,7 +971,7 @@ export default { } const res = await addNoneDicomMark(params) annotation.annotationId = res.Result - + const renderingEngine = getRenderingEngine(renderingEngineId) const viewport = renderingEngine.getViewport(`canvas-${this.activeCanvasIndex}`) viewport.render() @@ -994,53 +992,53 @@ export default { textLines.push(`L: ${parseFloat(data.l).toFixed(this.digitPlaces)} mm`) textLines.push(`PS: ${parseFloat(data.l / length).toFixed(3)} mm/px`) } - return textLines; + return textLines }, getPlanarFreehandROIToolTextLines(data, targetId) { - const cachedVolumeStats = data.cachedStats[targetId]; + const cachedVolumeStats = data.cachedStats[targetId] const { area, mean, stdDev, - length, + // length, perimeter, max, isEmptyArea, unit, areaUnit, - modalityUnit, - } = cachedVolumeStats || {}; + modalityUnit + } = cachedVolumeStats || {} - const textLines = []; + const textLines = [] let ps = null - let path = targetId.split(`web:${this.OSSclientConfig.basePath}`)[1] - let i = this.psArr.findIndex(i=>i.Path === path) + const path = targetId.split(`web:${this.OSSclientConfig.basePath}`)[1] + const i = this.psArr.findIndex(i => i.Path === path) if (i > -1 && this.psArr[i].PS) { ps = parseFloat(this.psArr[i].PS).toFixed(3) } if (area) { const areaLine = isEmptyArea ? `Area: Oblique not supported` - : `Area: ${ps ? parseFloat(area * ps * ps).toFixed(this.digitPlaces) : parseFloat(area).toFixed(this.digitPlaces)} ${ps ? 'mm' + '\xb2' : areaUnit}`; - textLines.push(areaLine); + : `Area: ${ps ? parseFloat(area * ps * ps).toFixed(this.digitPlaces) : parseFloat(area).toFixed(this.digitPlaces)} ${ps ? 'mm' + '\xb2' : areaUnit}` + textLines.push(areaLine) } if (mean) { - textLines.push(`Mean: ${parseFloat(mean).toFixed(this.digitPlaces)} ${modalityUnit}`); + textLines.push(`Mean: ${parseFloat(mean).toFixed(this.digitPlaces)} ${modalityUnit}`) } if (Number.isFinite(max)) { - textLines.push(`Max: ${csUtils.roundNumber(max)} ${modalityUnit}`); + textLines.push(`Max: ${csUtils.roundNumber(max)} ${modalityUnit}`) } if (stdDev) { - textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${modalityUnit}`); + textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${modalityUnit}`) } if (perimeter) { if (ps) { - textLines.push(`Perimeter: ${ parseFloat(perimeter * ps).toFixed(this.digitPlaces) } mm`); + textLines.push(`Perimeter: ${parseFloat(perimeter * ps).toFixed(this.digitPlaces)} mm`) } else { - textLines.push(`Perimeter: ${ parseFloat(perimeter).toFixed(this.digitPlaces) } ${unit}`); + textLines.push(`Perimeter: ${parseFloat(perimeter).toFixed(this.digitPlaces)} ${unit}`) } } @@ -1049,34 +1047,34 @@ export default { // textLines.push(`${csUtils.roundNumber(length)} ${unit}`); // } - return textLines; + return textLines }, getRectangleROIToolTextLines(data, targetId) { - const cachedVolumeStats = data.cachedStats[targetId]; - const { area, mean, max, stdDev, areaUnit, modalityUnit } = cachedVolumeStats; + const cachedVolumeStats = data.cachedStats[targetId] + const { area, mean, max, stdDev, areaUnit, modalityUnit } = cachedVolumeStats if (mean === undefined) { - return; + return } - const textLines = []; + const textLines = [] let ps = null - let path = targetId.split(`web:${this.OSSclientConfig.basePath}`)[1] - let i = this.psArr.findIndex(i=>i.Path === path) + const path = targetId.split(`web:${this.OSSclientConfig.basePath}`)[1] + const i = this.psArr.findIndex(i => i.Path === path) if (i > -1 && this.psArr[i].PS) { ps = parseFloat(this.psArr[i].PS).toFixed(3) } if (ps) { - textLines.push(`Area: ${parseFloat(area * ps * ps).toFixed(this.digitPlaces)} ${'mm' + '\xb2'}`); + textLines.push(`Area: ${parseFloat(area * ps * ps).toFixed(this.digitPlaces)} ${'mm' + '\xb2'}`) } else { - textLines.push(`Area: ${parseFloat(area).toFixed(this.digitPlaces)} ${areaUnit}`); + textLines.push(`Area: ${parseFloat(area).toFixed(this.digitPlaces)} ${areaUnit}`) } - - textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${modalityUnit}`); - textLines.push(`Max: ${csUtils.roundNumber(max)} ${modalityUnit}`); - textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${modalityUnit}`); - return textLines; + textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${modalityUnit}`) + textLines.push(`Max: ${csUtils.roundNumber(max)} ${modalityUnit}`) + textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${modalityUnit}`) + + return textLines }, debounce(callback, delay) { let timerId @@ -1147,8 +1145,7 @@ export default { viewport.setImageIdIndex(sliceIdx) viewport.render() // } - // this.$emit('toggleImage', { taskId: this.viewportInfos[i].taskInfo.VisitTaskId, studyId: this.viewportInfos[i].studyId, imageIndex: sliceIdx }) - + // this.$emit('toggleImage', { taskId: this.viewportInfos[i].taskInfo.VisitTaskId, studyId: this.viewportInfos[i].studyId, imageIndex: sliceIdx }) }, sliderMouseleave(e, index) { const i = this.viewportInfos.findIndex(i => i.index === index) diff --git a/src/views/trials/trials-panel/reading/visit-review/components/ReadPage.vue b/src/views/trials/trials-panel/reading/visit-review/components/ReadPage.vue index 897d738b..3b37072f 100644 --- a/src/views/trials/trials-panel/reading/visit-review/components/ReadPage.vue +++ b/src/views/trials/trials-panel/reading/visit-review/components/ReadPage.vue @@ -51,7 +51,7 @@ { + const arr = res.Result.NoneDicomMarkList.map(i => { if (typeof i.MeasureData === 'string') { i.MeasureData = JSON.parse(i.MeasureData) } - if (i.MeasureData.metadata.toolName === 'Length' && this.psArr.findIndex(p=>p.NoneDicomFileId === i.NoneDicomFileId) === -1) { - this.psArr.push({NoneDicomFileId: i.NoneDicomFileId, Path: i.Path, PS: i.MeasureData.data.ps}) + if (i.MeasureData.metadata.toolName === 'Length' && this.psArr.findIndex(p => p.NoneDicomFileId === i.NoneDicomFileId) === -1) { + this.psArr.push({ NoneDicomFileId: i.NoneDicomFileId, Path: i.Path, PS: i.MeasureData.data.ps }) } return i }) @@ -272,7 +271,7 @@ export default { }) }, setPS(obj) { - let i = this.psArr.findIndex(p=>p.NoneDicomFileId === obj.NoneDicomFileId) + const i = this.psArr.findIndex(p => p.NoneDicomFileId === obj.NoneDicomFileId) if (i > -1) { this.psArr[i].PS = obj.PS } else { @@ -313,7 +312,7 @@ export default { toggleImage(obj) { this.$refs[obj.taskId][0].activeImage(obj) }, - + previewCD(taskId) { this.isClinicalDataFullscreen = false this.dialogVisible = true