分裂主病灶状态计算逻辑优化

uat_us
caiyiling 2024-03-18 17:26:24 +08:00
parent dc6340f65c
commit af9ad72798
4 changed files with 78 additions and 69 deletions

View File

@ -516,7 +516,7 @@ export default {
loadingText: '', loadingText: '',
initAnnotations: [], initAnnotations: [],
activeCanvasWW: null, activeCanvasWW: null,
activeCanvasWC: null, activeCanvasWC: null
} }
}, },
@ -701,9 +701,9 @@ export default {
const debouncedCallback = this.debounce((e) => { const debouncedCallback = this.debounce((e) => {
const { annotation } = e.detail const { annotation } = e.detail
const { remark } = annotation.data const { remark } = annotation.data
if(this.initAnnotations.length > 0 && this.initAnnotations[0].orderMark === remark && !this.initAnnotations[0].isInit){ if (this.initAnnotations.length > 0 && this.initAnnotations[0].orderMark === remark && !this.initAnnotations[0].isInit) {
this.initAnnotations[0].isInit = true this.initAnnotations[0].isInit = true
}else{ } else {
this.onAnnotationModified(e) this.onAnnotationModified(e)
} }
// const { cachedStats } = annotation.data // const { cachedStats } = annotation.data

View File

@ -18,8 +18,8 @@ const {
} = cornerstoneTools } = cornerstoneTools
// const { getWorldWidthAndHeightFromTwoPoints } = utilities.planar // const { getWorldWidthAndHeightFromTwoPoints } = utilities.planar
// const { roundNumber } = utilities // const { roundNumber } = utilities
const { hideElementCursor,resetElementCursor } = cursors.elementCursor const { hideElementCursor } = cursors.elementCursor
const { getAnnotations,addAnnotation } = annotation.state const { getAnnotations, addAnnotation } = annotation.state
const { isAnnotationVisible } = annotation.visibility const { isAnnotationVisible } = annotation.visibility
const { isAnnotationLocked } = annotation.locking const { isAnnotationLocked } = annotation.locking
const drawHandlesSvg = drawing.drawHandles const drawHandlesSvg = drawing.drawHandles
@ -84,27 +84,27 @@ class CircleROITool extends cornerstoneTools.CircleROITool {
// this._getTextLines = this.getTextLines // this._getTextLines = this.getTextLines
} }
addNewAnnotation = (evt) => { addNewAnnotation = (evt) => {
const eventDetail = evt.detail; const eventDetail = evt.detail
const { currentPoints, element } = eventDetail; const { currentPoints, element } = eventDetail
const worldPos = currentPoints.world; const worldPos = currentPoints.world
// const canvasPos = currentPoints.canvas; // const canvasPos = currentPoints.canvas;
const enabledElement = getEnabledElement(element); const enabledElement = getEnabledElement(element)
const { viewport, renderingEngine } = enabledElement; const { viewport, renderingEngine } = enabledElement
this.isDrawing = true; this.isDrawing = true
const camera = viewport.getCamera(); const camera = viewport.getCamera()
const { viewPlaneNormal, viewUp } = camera; const { viewPlaneNormal, viewUp } = camera
const referencedImageId = this.getReferencedImageId( const referencedImageId = this.getReferencedImageId(
viewport, viewport,
worldPos, worldPos,
viewPlaneNormal, viewPlaneNormal,
viewUp viewUp
); )
const FrameOfReferenceUID = viewport.getFrameOfReferenceUID(); const FrameOfReferenceUID = viewport.getFrameOfReferenceUID()
const annotation = { const annotation = {
highlighted: true, highlighted: true,
@ -114,7 +114,7 @@ class CircleROITool extends cornerstoneTools.CircleROITool {
viewPlaneNormal: [...viewPlaneNormal], viewPlaneNormal: [...viewPlaneNormal],
viewUp: [...viewUp], viewUp: [...viewUp],
FrameOfReferenceUID, FrameOfReferenceUID,
referencedImageId, referencedImageId
}, },
data: { data: {
label: '', label: '',
@ -126,43 +126,43 @@ class CircleROITool extends cornerstoneTools.CircleROITool {
topLeft: [0, 0, 0], topLeft: [0, 0, 0],
topRight: [0, 0, 0], topRight: [0, 0, 0],
bottomLeft: [0, 0, 0], bottomLeft: [0, 0, 0],
bottomRight: [0, 0, 0], bottomRight: [0, 0, 0]
}, }
}, },
points: [[...worldPos], [...worldPos]], points: [[...worldPos], [...worldPos]],
activeHandleIndex: 1, activeHandleIndex: 1
}, },
cachedStats: {}, cachedStats: {}
}, }
}; }
addAnnotation(annotation, element); addAnnotation(annotation, element)
const viewportIdsToRender = getViewportIdsWithToolToRender( const viewportIdsToRender = getViewportIdsWithToolToRender(
element, element,
this.getToolName() this.getToolName()
); )
this.editData = { this.editData = {
annotation, annotation,
viewportIdsToRender, viewportIdsToRender,
newAnnotation: true, newAnnotation: true,
hasMoved: false, hasMoved: false
}; }
this._activateDraw(element); this._activateDraw(element)
hideElementCursor(element); hideElementCursor(element)
evt.preventDefault(); evt.preventDefault()
triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender); triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender)
return annotation; return annotation
}; };
renderAnnotation = (enabledElement, svgDrawingHelper) => { renderAnnotation = (enabledElement, svgDrawingHelper) => {
let renderStatus = false let renderStatus = false
const { viewport } = enabledElement const { viewport } = enabledElement
const { element } = viewport const { element } = viewport
let annotations = getAnnotations(this.getToolName(), element) let annotations = getAnnotations(this.getToolName(), element)
if (!annotations || (annotations && annotations.length === 0)) { if (!annotations || (annotations && annotations.length === 0)) {
@ -195,7 +195,7 @@ class CircleROITool extends cornerstoneTools.CircleROITool {
// const { points, activeHandleIndex } = handles // const { points, activeHandleIndex } = handles
const { points } = handles const { points } = handles
var activeHandleIndex = null var activeHandleIndex = null
if(annotation.highlighted && !annotation.isLocked && annotation.isVisible){ if (annotation.highlighted && !annotation.isLocked && annotation.isVisible) {
activeHandleIndex = 1 activeHandleIndex = 1
} }
@ -249,7 +249,6 @@ class CircleROITool extends cornerstoneTools.CircleROITool {
modalityUnitOptions modalityUnitOptions
) )
} else if (annotation.invalidated) { } else if (annotation.invalidated) {
this._throttledCalculateCachedStats( this._throttledCalculateCachedStats(
annotation, annotation,
viewport, viewport,
@ -430,74 +429,74 @@ class CircleROITool extends cornerstoneTools.CircleROITool {
) => { ) => {
const data = annotation.data const data = annotation.data
const { viewportId, renderingEngineId } = enabledElement const { viewportId, renderingEngineId } = enabledElement
const { points } = data.handles const { points } = data.handles
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p)) const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p))
const { viewPlaneNormal, viewUp } = viewport.getCamera() const { viewPlaneNormal, viewUp } = viewport.getCamera()
const [topLeftCanvas, bottomRightCanvas] = ( const [topLeftCanvas, bottomRightCanvas] = (
getCanvasCircleCorners(canvasCoordinates) getCanvasCircleCorners(canvasCoordinates)
) )
const topLeftWorld = viewport.canvasToWorld(topLeftCanvas) const topLeftWorld = viewport.canvasToWorld(topLeftCanvas)
const bottomRightWorld = viewport.canvasToWorld(bottomRightCanvas) const bottomRightWorld = viewport.canvasToWorld(bottomRightCanvas)
const { cachedStats } = data const { cachedStats } = data
const targetIds = Object.keys(cachedStats) const targetIds = Object.keys(cachedStats)
const worldPos1 = topLeftWorld const worldPos1 = topLeftWorld
const worldPos2 = bottomRightWorld const worldPos2 = bottomRightWorld
for (let i = 0; i < targetIds.length; i++) { for (let i = 0; i < targetIds.length; i++) {
const targetId = targetIds[i] const targetId = targetIds[i]
const image = this.getTargetIdImage(targetId, renderingEngine) const image = this.getTargetIdImage(targetId, renderingEngine)
// If image does not exists for the targetId, skip. This can be due // If image does not exists for the targetId, skip. This can be due
// to various reasons such as if the target was a volumeViewport, and // to various reasons such as if the target was a volumeViewport, and
// the volumeViewport has been decached in the meantime. // the volumeViewport has been decached in the meantime.
if (!image) { if (!image) {
continue continue
} }
const { dimensions, imageData, metadata } = image const { dimensions, imageData, metadata } = image
const worldPos1Index = transformWorldToIndex(imageData, worldPos1) const worldPos1Index = transformWorldToIndex(imageData, worldPos1)
worldPos1Index[0] = Math.floor(worldPos1Index[0]) worldPos1Index[0] = Math.floor(worldPos1Index[0])
worldPos1Index[1] = Math.floor(worldPos1Index[1]) worldPos1Index[1] = Math.floor(worldPos1Index[1])
worldPos1Index[2] = Math.floor(worldPos1Index[2]) worldPos1Index[2] = Math.floor(worldPos1Index[2])
const worldPos2Index = transformWorldToIndex(imageData, worldPos2) const worldPos2Index = transformWorldToIndex(imageData, worldPos2)
worldPos2Index[0] = Math.floor(worldPos2Index[0]) worldPos2Index[0] = Math.floor(worldPos2Index[0])
worldPos2Index[1] = Math.floor(worldPos2Index[1]) worldPos2Index[1] = Math.floor(worldPos2Index[1])
worldPos2Index[2] = Math.floor(worldPos2Index[2]) worldPos2Index[2] = Math.floor(worldPos2Index[2])
// Check if one of the indexes are inside the volume, this then gives us // Check if one of the indexes are inside the volume, this then gives us
// Some area to do stats over. // Some area to do stats over.
if (this._isInsideVolume(worldPos1Index, worldPos2Index, dimensions)) { if (this._isInsideVolume(worldPos1Index, worldPos2Index, dimensions)) {
const iMin = Math.min(worldPos1Index[0], worldPos2Index[0]) const iMin = Math.min(worldPos1Index[0], worldPos2Index[0])
const iMax = Math.max(worldPos1Index[0], worldPos2Index[0]) const iMax = Math.max(worldPos1Index[0], worldPos2Index[0])
const jMin = Math.min(worldPos1Index[1], worldPos2Index[1]) const jMin = Math.min(worldPos1Index[1], worldPos2Index[1])
const jMax = Math.max(worldPos1Index[1], worldPos2Index[1]) const jMax = Math.max(worldPos1Index[1], worldPos2Index[1])
const kMin = Math.min(worldPos1Index[2], worldPos2Index[2]) const kMin = Math.min(worldPos1Index[2], worldPos2Index[2])
const kMax = Math.max(worldPos1Index[2], worldPos2Index[2]) const kMax = Math.max(worldPos1Index[2], worldPos2Index[2])
const boundsIJK = [ const boundsIJK = [
[iMin, iMax], [iMin, iMax],
[jMin, jMax], [jMin, jMax],
[kMin, kMax] [kMin, kMax]
] ]
const center = [ const center = [
(topLeftWorld[0] + bottomRightWorld[0]) / 2, (topLeftWorld[0] + bottomRightWorld[0]) / 2,
(topLeftWorld[1] + bottomRightWorld[1]) / 2, (topLeftWorld[1] + bottomRightWorld[1]) / 2,
(topLeftWorld[2] + bottomRightWorld[2]) / 2 (topLeftWorld[2] + bottomRightWorld[2]) / 2
] ]
const ellipseObj = { const ellipseObj = {
center, center,
xRadius: Math.abs(topLeftWorld[0] - bottomRightWorld[0]) / 2, xRadius: Math.abs(topLeftWorld[0] - bottomRightWorld[0]) / 2,
@ -518,7 +517,7 @@ class CircleROITool extends cornerstoneTools.CircleROITool {
(worldWidth / scale / 2) * (worldWidth / scale / 2) *
(worldHeight / aspect / scale / 2) (worldHeight / aspect / scale / 2)
) )
const modalityUnit = getModalityUnit( const modalityUnit = getModalityUnit(
metadata.Modality, metadata.Modality,
annotation.metadata.referencedImageId, annotation.metadata.referencedImageId,
@ -530,9 +529,9 @@ class CircleROITool extends cornerstoneTools.CircleROITool {
this.configuration.statsCalculator.statsCallback, this.configuration.statsCalculator.statsCallback,
boundsIJK boundsIJK
) )
const stats = this.configuration.statsCalculator.getStatistics() const stats = this.configuration.statsCalculator.getStatistics()
cachedStats[targetId] = { cachedStats[targetId] = {
Modality: metadata.Modality, Modality: metadata.Modality,
area, area,
@ -551,7 +550,7 @@ class CircleROITool extends cornerstoneTools.CircleROITool {
annotation.isHandleOutsideImage = false annotation.isHandleOutsideImage = false
} else { } else {
this.isHandleOutsideImage = true this.isHandleOutsideImage = true
cachedStats[targetId] = { cachedStats[targetId] = {
Modality: metadata.Modality, Modality: metadata.Modality,
areaUnit: getCalibratedAreaUnits(null, image) areaUnit: getCalibratedAreaUnits(null, image)
@ -559,19 +558,19 @@ class CircleROITool extends cornerstoneTools.CircleROITool {
annotation.isHandleOutsideImage = true annotation.isHandleOutsideImage = true
} }
} }
annotation.invalidated = false annotation.invalidated = false
// Dispatching annotation modified // Dispatching annotation modified
const eventType = Enums.Events.ANNOTATION_MODIFIED const eventType = Enums.Events.ANNOTATION_MODIFIED
const eventDetail = { const eventDetail = {
annotation, annotation,
viewportId, viewportId,
renderingEngineId renderingEngineId
} }
triggerEvent(eventTarget, eventType, eventDetail) triggerEvent(eventTarget, eventType, eventDetail)
return cachedStats return cachedStats
} }
} }

View File

@ -450,13 +450,15 @@ export default {
const lesionState = !isNaN(parseInt(this.getQuestionVal(7))) ? parseInt(this.getQuestionVal(7)) : '' const lesionState = !isNaN(parseInt(this.getQuestionVal(7))) ? parseInt(this.getQuestionVal(7)) : ''
this.$emit('resetQuestions', { isLymphLesion, lesionPart, lesionOrgan, lesionShort, lesionState, saveTypeEnum: this.questionForm.saveTypeEnum, lesionLength, rowIndex: this.rowIndex, questionId: this.parentQsId, anwsers: this.questionForm }) this.$emit('resetQuestions', { isLymphLesion, lesionPart, lesionOrgan, lesionShort, lesionState, saveTypeEnum: this.questionForm.saveTypeEnum, lesionLength, rowIndex: this.rowIndex, questionId: this.parentQsId, anwsers: this.questionForm })
} }
if (this.lesionType === 0 && params && params.splitLesionTargetPPD) { if (this.lesionType === 0 && params) {
// ppd // ppd
var ppd = this.getQuestionVal(12) var ppd = this.getQuestionVal(12)
ppd = isNaN(parseFloat(ppd)) ? 0 : parseFloat(ppd) ppd = isNaN(parseFloat(ppd)) ? 0 : parseFloat(ppd)
this.splitLesionTargetPDD = ppd + params.splitLesionTargetPPD this.splitLesionTargetPDD = ppd + params.splitLesionTargetPPD
this.splitLesionTargetLDi = params.splitLesionTargetLDi
this.splitLesionTargetSDi = params.splitLesionTargetSDi
} }
// //
@ -464,9 +466,6 @@ export default {
state = isNaN(parseInt(state)) ? 0 : parseInt(state) state = isNaN(parseInt(state)) ? 0 : parseInt(state)
var ldi = this.getQuestionVal(0)// var ldi = this.getQuestionVal(0)//
ldi = isNaN(parseFloat(ldi)) ? 0 : ldi ldi = isNaN(parseFloat(ldi)) ? 0 : ldi
if (this.lesionType === 0 && params && params.splitLesionTargetLDi) {
this.splitLesionTargetLDi = ldi + params.splitLesionTargetLDi
}
var pddIncrease = this.getQuestionVal(17) // PPD var pddIncrease = this.getQuestionVal(17) // PPD
pddIncrease = isNaN(parseFloat(pddIncrease)) ? 0 : parseFloat(pddIncrease) pddIncrease = isNaN(parseFloat(pddIncrease)) ? 0 : parseFloat(pddIncrease)
var ldiIncrease = this.getQuestionVal(18)// PPDLDi var ldiIncrease = this.getQuestionVal(18)// PPDLDi
@ -490,10 +489,17 @@ export default {
var minPPD = this.getQuestionVal(13) var minPPD = this.getQuestionVal(13)
minPPD = parseFloat(minPPD) minPPD = parseFloat(minPPD)
pddIncrease = ((((this.splitLesionTargetPDD - minPPD) / minPPD)) * 100).toFixed(this.digitPlaces) pddIncrease = ((((this.splitLesionTargetPDD - minPPD) / minPPD)) * 100).toFixed(this.digitPlaces)
ldi = this.splitLesionTargetLDi + ldi
var minLDi = this.getQuestionVal(15)
ldiIncrease = ldi - minLDi
var sdi = this.getQuestionVal(1)//
sdi = isNaN(parseFloat(sdi)) ? 0 : sdi
sdi = this.splitLesionTargetSDi + sdi
var minSDi = this.getQuestionVal(16)
sdiIncrease = sdi - minSDi
} }
if (this.splitLesionTargetPDD) { // if(this.)
ldi = this.splitLesionTargetLDi
}
/** /**
* 15mm<当前靶病灶LDi20mm * 15mm<当前靶病灶LDi20mm
* 相比最低点PPD增加百分比 50 * 相比最低点PPD增加百分比 50
@ -983,6 +989,10 @@ export default {
var pddIncreaseNum = null var pddIncreaseNum = null
if (this.splitLesionTargetPDD) { if (this.splitLesionTargetPDD) {
pddIncreaseNum = ((((this.splitLesionTargetPDD - minPPD) / minPPD)) * 100).toFixed(this.digitPlaces) pddIncreaseNum = ((((this.splitLesionTargetPDD - minPPD) / minPPD)) * 100).toFixed(this.digitPlaces)
ldi = this.splitLesionTargetLDi + ldi
ldiIncrease = ldi - minLDi
sdi = this.splitLesionTargetSDi + sdi
sdiIncrease = sdi - minSDi
} else { } else {
pddIncreaseNum = ((((ppd - minPPD) / minPPD)) * 100).toFixed(this.digitPlaces) pddIncreaseNum = ((((ppd - minPPD) / minPPD)) * 100).toFixed(this.digitPlaces)
} }

View File

@ -81,7 +81,7 @@ export default {
spleenInfo: null, spleenInfo: null,
calculateSpleenStatus: '', calculateSpleenStatus: '',
formChanged: false, formChanged: false,
digitPlaces:null digitPlaces: null
} }
}, },
computed: { computed: {