From ef5e5527fd06a7de3e3167dad3cc2237e3a94f05 Mon Sep 17 00:00:00 2001 From: caiyiling <1321909229@qq.com> Date: Fri, 21 Mar 2025 16:29:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E6=B3=A8=E6=9B=B4=E6=94=B9=E5=8F=8A?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E5=90=8D=E7=A7=B0=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/reading.js | 1 + .../reading/dicoms/components/StudyList.vue | 6 +- .../dicoms/customize/CustomizeStudyList.vue | 28 +++--- .../reading/dicoms/tools/Probe/ProbeTool.js | 98 +++++++++++++++---- 4 files changed, 97 insertions(+), 36 deletions(-) diff --git a/src/store/modules/reading.js b/src/store/modules/reading.js index e3a7eb1b..73074d7f 100644 --- a/src/store/modules/reading.js +++ b/src/store/modules/reading.js @@ -862,6 +862,7 @@ const actions = { const data = {} data.StudyId = study.StudyId data.StudyCode = study.StudyCode + data.StudyName = study.StudyName data.Modalities = study.Modalities data.SeriesCount = study.SeriesCount data.InstanceCount = study.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 2debef19..9301e356 100644 --- a/src/views/trials/trials-panel/reading/dicoms/components/StudyList.vue +++ b/src/views/trials/trials-panel/reading/dicoms/components/StudyList.vue @@ -19,15 +19,14 @@ class="dicom-desc" style="width: 150px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" > -
{{ study.StudyCode }} - {{ study.Modalities }} ({{ study.SeriesCount }}) + {{ study.Modalities }} ({{ study.SeriesCount }})
{{ study.StudyCode }} - + {{study.StudyName}}
{{ study.Modalities }} ({{ study.SeriesCount }})
@@ -35,7 +34,6 @@
{{ study.Description }}
-
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 6a52c3b9..ef99e37e 100644 --- a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeStudyList.vue +++ b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeStudyList.vue @@ -19,22 +19,20 @@ class="dicom-desc" style="width: 150px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" > - -
-
- {{ study.StudyCode }} - {{ study.Modalities }} ({{ study.SeriesCount }}) -
-
- {{ study.StudyCode }} - - {{study.StudyName}} - -
{{ study.Modalities }} ({{ study.SeriesCount }})
-
-
{{ study.Description }}
+
+
+ {{ study.StudyCode }} + {{ study.Modalities }} ({{ study.SeriesCount }})
- +
+ {{ study.StudyCode }} + + {{study.StudyName}} + +
{{ study.Modalities }} ({{ study.SeriesCount }})
+
+
{{ study.Description }}
+
diff --git a/src/views/trials/trials-panel/reading/dicoms/tools/Probe/ProbeTool.js b/src/views/trials/trials-panel/reading/dicoms/tools/Probe/ProbeTool.js index 1c5bc0f1..a8224bbc 100644 --- a/src/views/trials/trials-panel/reading/dicoms/tools/Probe/ProbeTool.js +++ b/src/views/trials/trials-panel/reading/dicoms/tools/Probe/ProbeTool.js @@ -10,6 +10,7 @@ const getNewContext = cornerstoneTools.import('drawing/getNewContext') const draw = cornerstoneTools.import('drawing/draw') const drawHandles = cornerstoneTools.import('drawing/drawHandles') const drawTextBox = cornerstoneTools.import('drawing/drawTextBox') +const drawLink = cornerstoneTools.import('drawing/drawLink') const drawLinkedTextBox = cornerstoneTools.import('drawing/drawLinkedTextBox') // Utilities @@ -23,6 +24,8 @@ const getModule = cornerstoneTools.getModule const getPixelSpacing = cornerstoneTools.import('util/getPixelSpacing') // import numbersWithCommas from './../../util/numbersWithCommas.js'; const numbersWithCommas = cornerstoneTools.import('util/numbersWithCommas') +const clipBoxToDisplayedArea = cornerstoneTools.import('util/clip') + // const logger = getLogger('tools:annotation:ProbeTool'); import calculateEllipseStatistics from './calculateEllipseStatistics' import getCircleCoords from './getCircleCoords' @@ -327,17 +330,16 @@ export default class ProbeTool extends cornerstoneTools.ProbeTool { ); return } - console.log(data.handles.textBox) - const handles = { - start: { - x: data.handles.end.x, - y: data.handles.end.y - }, - end: { - x: data.handles.end.x + r, - y: data.handles.end.y - } - } + // const handles = { + // start: { + // x: data.handles.end.x, + // y: data.handles.end.y + // }, + // end: { + // x: data.handles.end.x + r, + // y: data.handles.end.y + // } + // } let xOffset = 0 if (data.remark && !isNaN(parseInt(data.remark.slice(-1)))) { let i = parseInt(data.remark.slice(-1)) @@ -346,33 +348,95 @@ export default class ProbeTool extends cornerstoneTools.ProbeTool { } else if (i === 2) { xOffset = 0 } else if (i=== 3) { - xOffset = 40 + xOffset = 0 } } // const xOffset = -30 const textBoxAnchorPoints = handles => [ - handles.start, handles.end ] - drawLinkedTextBox( + _drawLinkedTextBox( context, element, data.handles.textBox, textLines, - handles, - textBoxAnchorPoints, + data.handles, color, lineWidth, xOffset, - true + false ) } }); } } } +function _drawLinkedTextBox( + context, + element, + textBox, + text, + handles, + color, + lineWidth, + xOffset, + yCenter) { + const { pixelToCanvas } = external.cornerstone; + + // Convert the textbox Image coordinates into Canvas coordinates + const textCoords = pixelToCanvas(element, textBox); + + if (xOffset) { + textCoords.x += xOffset; + } + + const options = { + centering: { + x: false, + y: yCenter, + }, + }; + + options.displacer = box => clipBoxToDisplayedArea(element, box); + + // Draw the text box + textBox.boundingBox = drawTextBox( + context, + text, + textCoords.x, + textCoords.y, + color, + options + ); + if (textBox.hasMoved) { + // Identify the possible anchor points for the tool -> text line + let arr = [ + { + x: handles.end.x, + y: handles.end.y + }, + { + x: handles.end.x, + y: handles.end.y + } + ] + const linkAnchorPoints = arr.map(h => + pixelToCanvas(element, h) + ); + + // Draw dashed link line between tool and text + drawLink( + linkAnchorPoints, + textCoords, + textBox.boundingBox, + context, + color, + lineWidth + ); + } +} function _getUnit(modality, showHounsfieldUnits) { return modality === 'CT' && showHounsfieldUnits !== false ? 'HU' : ''; }