From ccdedbee2fc92dc2f2b6437c29ec4c9793ac9b48 Mon Sep 17 00:00:00 2001 From: caiyiling <1321909229@qq.com> Date: Wed, 16 Oct 2024 16:20:34 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=BD=B1=E5=83=8F=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E9=A1=B5=E5=B7=A5=E5=85=B7=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Dicom/DicomCanvas.vue | 12 ++++++++-- .../tools/RectangleRoi/RectangleRoiTool.js | 22 ++++++++++++++----- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/components/Dicom/DicomCanvas.vue b/src/components/Dicom/DicomCanvas.vue index 24cce9e1..8733c5db 100644 --- a/src/components/Dicom/DicomCanvas.vue +++ b/src/components/Dicom/DicomCanvas.vue @@ -108,6 +108,8 @@ import invertOrientationString from '@/views/trials/trials-panel/reading/dicoms/ import calculateSUV from '@/views/trials/trials-panel/reading/dicoms/tools/calculateSUV' // import requestPoolManager from '@/utils/request-pool' import ScaleOverlayTool from '@/views/trials/trials-panel/reading/dicoms/tools/ScaleOverlay/ScaleOverlayTool' +import RectangleRoiTool from '@/views/trials/trials-panel/reading/dicoms/tools/RectangleRoi/RectangleRoiTool' +import EllipticalRoiTool from '@/views/trials/trials-panel/reading/dicoms/tools/EllipticalRoi/EllipticalRoiTool' cornerstoneTools.external.cornerstone = cornerstone cornerstoneTools.external.Hammer = Hammer cornerstoneTools.external.cornerstoneMath = cornerstoneMath @@ -262,7 +264,13 @@ export default { apiTool ) if (!toolAlreadyAddedToElement) { - cornerstoneTools.addToolForElement(element, apiTool) + if (toolName === 'RectangleRoi') { + cornerstoneTools.addToolForElement(element, apiTool, { configuration: { showMinMax: true, showStatsText: true}}) + } else if (toolName === 'EllipticalRoi') { + cornerstoneTools.addToolForElement(element, apiTool, { configuration: { showMinMax: true}}) + } else { + cornerstoneTools.addToolForElement(element, apiTool) + } } } // Setup button listener @@ -322,7 +330,7 @@ export default { // cornerstoneTools.addStackStateManager(this.canvas, ['stack', 'stackPrefetch', 'playClip']) cornerstoneTools.addToolState(this.canvas, 'stack', this.stack) // cornerstoneTools.stackPrefetch.enable(this.canvas) - cornerstone.updateImage(element, true) + cornerstone.updateImage(element, true) // cornerstoneTools.stackPrefetch.setConfiguration({ maxImagesToPrefetch: Infinity, // preserveExistingPool: true }) // cornerstoneTools.stackPrefetch.enable(this.canvas) diff --git a/src/views/trials/trials-panel/reading/dicoms/tools/RectangleRoi/RectangleRoiTool.js b/src/views/trials/trials-panel/reading/dicoms/tools/RectangleRoi/RectangleRoiTool.js index 6a201329..99b942c5 100644 --- a/src/views/trials/trials-panel/reading/dicoms/tools/RectangleRoi/RectangleRoiTool.js +++ b/src/views/trials/trials-panel/reading/dicoms/tools/RectangleRoi/RectangleRoiTool.js @@ -40,7 +40,8 @@ export default class RectangleRoiTool extends cornerstoneTools.RectangleRoiTool drawHandles: true, drawHandlesOnHover: false, hideHandlesIfMoving: false, - renderDashed: false + renderDashed: false, + showStatsText: false // showMinMax: false, // showHounsfieldUnits: true }, @@ -531,12 +532,15 @@ function _createTextBoxContent( minString += ' ' } - otherLines.push(`${minString}${maxString}`) + otherLines.push(`${minString}`) + otherLines.push(`${maxString}`) } } - - // textLines.push(_formatArea(area, hasPixelSpacing)) - // otherLines.forEach(x => textLines.push(x)) + if (options.showStatsText) { + textLines.push(_formatArea(area, hasPixelSpacing)) + otherLines.forEach(x => textLines.push(x)) + } + if (data.hasOwnProperty('remark')) { if (data.hasOwnProperty('status') && data.status) { textLines.push(`${data.remark}(${data.status})`) @@ -546,3 +550,11 @@ function _createTextBoxContent( } return textLines } +function _formatArea(area, hasPixelSpacing) { + // This uses Char code 178 for a superscript 2 + const suffix = hasPixelSpacing + ? ` mm${String.fromCharCode(178)}` + : ` px${String.fromCharCode(178)}`; + + return `Area: ${numbersWithCommas(area.toFixed(2))}${suffix}`; +} From a6b68ea599fd86fbe9336103244c75f41ddf4b40 Mon Sep 17 00:00:00 2001 From: caiyiling <1321909229@qq.com> Date: Wed, 16 Oct 2024 16:22:02 +0800 Subject: [PATCH 2/2] 1 --- src/components/Dicom/DicomCanvas.vue | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/Dicom/DicomCanvas.vue b/src/components/Dicom/DicomCanvas.vue index 8733c5db..9332f54a 100644 --- a/src/components/Dicom/DicomCanvas.vue +++ b/src/components/Dicom/DicomCanvas.vue @@ -108,8 +108,6 @@ import invertOrientationString from '@/views/trials/trials-panel/reading/dicoms/ import calculateSUV from '@/views/trials/trials-panel/reading/dicoms/tools/calculateSUV' // import requestPoolManager from '@/utils/request-pool' import ScaleOverlayTool from '@/views/trials/trials-panel/reading/dicoms/tools/ScaleOverlay/ScaleOverlayTool' -import RectangleRoiTool from '@/views/trials/trials-panel/reading/dicoms/tools/RectangleRoi/RectangleRoiTool' -import EllipticalRoiTool from '@/views/trials/trials-panel/reading/dicoms/tools/EllipticalRoi/EllipticalRoiTool' cornerstoneTools.external.cornerstone = cornerstone cornerstoneTools.external.Hammer = Hammer cornerstoneTools.external.cornerstoneMath = cornerstoneMath