新增MRI-PDFF阅片标准
parent
7e52005dab
commit
47d60769be
|
@ -251,3 +251,11 @@ export function uploadOCTLipidAngleTemplate(param) {
|
||||||
data: param
|
data: param
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function saveTableQuestionMark(param) {
|
||||||
|
return request({
|
||||||
|
url: `/ReadingImageTask/saveTableQuestionMark`,
|
||||||
|
method: 'post',
|
||||||
|
data: param
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -70,6 +70,12 @@ function getQuestions(questions) {
|
||||||
answerObj.angle = angle
|
answerObj.angle = angle
|
||||||
answerObj.saveTypeEnum = isNaN(parseFloat(angle)) ? 1 : 2
|
answerObj.saveTypeEnum = isNaN(parseFloat(angle)) ? 1 : 2
|
||||||
}
|
}
|
||||||
|
} else if (criterionType === 21) {
|
||||||
|
// MRI-PDFF
|
||||||
|
let isMeasurable = getQuestionAnswer(item.TableQuestions.Questions, 1105, answerObj)
|
||||||
|
answerObj.isMeasurable = isMeasurable
|
||||||
|
answerObj.mean = getQuestionAnswer(item.TableQuestions.Questions, 1104, answerObj)
|
||||||
|
answerObj.saveTypeEnum = isNaN(parseFloat(isMeasurable)) ? 1 : 2
|
||||||
} else {
|
} else {
|
||||||
answerObj.lesionPart = getQuestionAnswer(item.TableQuestions.Questions, 8, answerObj)
|
answerObj.lesionPart = getQuestionAnswer(item.TableQuestions.Questions, 8, answerObj)
|
||||||
answerObj.loctation = getQuestionAnswer(item.TableQuestions.Questions, 6, answerObj)
|
answerObj.loctation = getQuestionAnswer(item.TableQuestions.Questions, 6, answerObj)
|
||||||
|
@ -507,6 +513,7 @@ const actions = {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getMeasuredData({ state }, visitTaskId) {
|
getMeasuredData({ state }, visitTaskId) {
|
||||||
|
console.log('getMeasuredData')
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
var index = state.visitTaskList.findIndex(i => i.VisitTaskId === visitTaskId)
|
var index = state.visitTaskList.findIndex(i => i.VisitTaskId === visitTaskId)
|
||||||
if (state.visitTaskList[index].measureDataInit) {
|
if (state.visitTaskList[index].measureDataInit) {
|
||||||
|
@ -523,6 +530,13 @@ const actions = {
|
||||||
el.OtherMeasureData = JSON.parse(el.OtherMeasureData)
|
el.OtherMeasureData = JSON.parse(el.OtherMeasureData)
|
||||||
el.OtherMeasureData.data.remark = el.OrderMarkName
|
el.OtherMeasureData.data.remark = el.OrderMarkName
|
||||||
}
|
}
|
||||||
|
// if (el.TableQuestionMarkList.length > 0) {
|
||||||
|
// let list = el.TableQuestionMarkList.map(i=>{
|
||||||
|
// i.MeasureData = i.MeasureData ? JSON.parse(i.MeasureData) : ''
|
||||||
|
// return i
|
||||||
|
// })
|
||||||
|
// el.TableQuestionMarkList = list
|
||||||
|
// }
|
||||||
arr.push(el)
|
arr.push(el)
|
||||||
})
|
})
|
||||||
state.visitTaskList[index].MeasureData = arr
|
state.visitTaskList[index].MeasureData = arr
|
||||||
|
@ -606,6 +620,13 @@ const actions = {
|
||||||
el.MeasureData = JSON.parse(el.MeasureData)
|
el.MeasureData = JSON.parse(el.MeasureData)
|
||||||
el.MeasureData.data.remark = el.OrderMarkName
|
el.MeasureData.data.remark = el.OrderMarkName
|
||||||
}
|
}
|
||||||
|
// if (el.TableQuestionMarkList.length > 0) {
|
||||||
|
// let list = el.TableQuestionMarkList.map(i=>{
|
||||||
|
// i.MeasureData = i.MeasureData ? JSON.parse(i.MeasureData) : ''
|
||||||
|
// return i
|
||||||
|
// })
|
||||||
|
// el.TableQuestionMarkList = list
|
||||||
|
// }
|
||||||
arr.push(el)
|
arr.push(el)
|
||||||
})
|
})
|
||||||
state.visitTaskList[index].MeasureData = arr
|
state.visitTaskList[index].MeasureData = arr
|
||||||
|
@ -623,27 +644,40 @@ const actions = {
|
||||||
resolve(noneDicomMeasureData)
|
resolve(noneDicomMeasureData)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
addMeasuredData({ state }, obj) {
|
addMeasuredData({ state }, obj) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
|
const criterionType = parseInt(localStorage.getItem('CriterionType'))
|
||||||
var index = state.visitTaskList.findIndex(i => i.VisitTaskId === obj.visitTaskId)
|
var index = state.visitTaskList.findIndex(i => i.VisitTaskId === obj.visitTaskId)
|
||||||
var measureData = state.visitTaskList[index].MeasureData
|
var measureData = state.visitTaskList[index].MeasureData
|
||||||
// var idx = measureData.findIndex(item => item.MeasureData.uuid === obj.data.MeasureData.data.uuid)
|
// var idx = measureData.findIndex(item => item.MeasureData.uuid === obj.data.MeasureData.data.uuid)
|
||||||
var idx = measureData.findIndex(item => item.QuestionId === obj.data.QuestionId && item.RowIndex === obj.data.RowIndex)
|
|
||||||
if (idx > -1) {
|
if (criterionType === 21) {
|
||||||
for (const k in state.visitTaskList[index].MeasureData[idx]) {
|
let i = measureData.findIndex(i=>i.TableQuestionId === obj.data.TableQuestionId)
|
||||||
if (k !== 'Id' && obj.data[k]) {
|
if (i > -1) {
|
||||||
state.visitTaskList[index].MeasureData[idx][k] = obj.data[k]
|
for (const k in state.visitTaskList[index].MeasureData[i]) {
|
||||||
|
if (k !== 'Id' && obj.data[k]) {
|
||||||
|
state.visitTaskList[index].MeasureData[i][k] = obj.data[k]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
state.visitTaskList[index].MeasureData.push(obj.data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// state.visitTaskList[index].MeasureData[idx].MeasureData = obj.data.MeasureData
|
|
||||||
console.log('更新标记成功', idx)
|
|
||||||
} else {
|
} else {
|
||||||
state.visitTaskList[index].MeasureData.push(obj.data)
|
var idx = measureData.findIndex(item => item.QuestionId === obj.data.QuestionId && item.RowIndex === obj.data.RowIndex)
|
||||||
console.log('新增标记成功')
|
if (idx > -1) {
|
||||||
|
for (const k in state.visitTaskList[index].MeasureData[idx]) {
|
||||||
|
if (k !== 'Id' && obj.data[k]) {
|
||||||
|
state.visitTaskList[index].MeasureData[idx][k] = obj.data[k]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('更新标记成功', idx)
|
||||||
|
} else {
|
||||||
|
state.visitTaskList[index].MeasureData.push(obj.data)
|
||||||
|
console.log('新增标记成功')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '')
|
// sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '')
|
||||||
console.log(state.visitTaskList)
|
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -738,32 +772,45 @@ const actions = {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
var index = state.visitTaskList.findIndex(i => i.VisitTaskId === obj.visitTaskId)
|
var index = state.visitTaskList.findIndex(i => i.VisitTaskId === obj.visitTaskId)
|
||||||
var measureData = state.visitTaskList[index].MeasureData
|
var measureData = state.visitTaskList[index].MeasureData
|
||||||
|
const criterionType = parseInt(localStorage.getItem('CriterionType'))
|
||||||
// var uuid = obj.measureData.data.uuid
|
if (criterionType === 21) {
|
||||||
// var idx = measureData.findIndex(item => item.MeasureData && item.MeasureData.data && item.MeasureData.data.uuid === uuid)
|
|
||||||
var idx = measureData.findIndex(item => item.QuestionId === obj.questionId && item.RowIndex === obj.rowIndex)
|
|
||||||
if (idx > -1) {
|
|
||||||
if (measureData[idx].FristAddTaskId) {
|
|
||||||
measureData[idx].MeasureData = ''
|
|
||||||
console.log('清除标记成功', idx)
|
|
||||||
} else {
|
|
||||||
measureData.splice(idx, 1)
|
|
||||||
console.log('移除标记成功', idx)
|
|
||||||
}
|
|
||||||
state.visitTaskList[index].MeasureData = measureData
|
|
||||||
} else if (obj.orderMarkName) {
|
|
||||||
const i = measureData.findIndex(item => item.QuestionId === obj.questionId && item.OrderMarkName === obj.orderMarkName)
|
const i = measureData.findIndex(item => item.QuestionId === obj.questionId && item.OrderMarkName === obj.orderMarkName)
|
||||||
if (i > -1) {
|
if (i > -1) {
|
||||||
if (measureData[i].FristAddTaskId) {
|
if (measureData[i].FristAddTaskId) {
|
||||||
measureData[i].MeasureData = ''
|
measureData[i].MeasureData = ''
|
||||||
console.log('清除标记成功', i)
|
console.log('清除标记成功', i)
|
||||||
} else {
|
} else {
|
||||||
measureData.splice(i, 1)
|
measureData.splice(i, 1)
|
||||||
console.log('移除标记成功', i)
|
console.log('移除标记成功', i)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
state.visitTaskList[index].MeasureData = measureData
|
state.visitTaskList[index].MeasureData = measureData
|
||||||
|
} else {
|
||||||
|
var idx = measureData.findIndex(item => item.QuestionId === obj.questionId && item.RowIndex === obj.rowIndex)
|
||||||
|
if (idx > -1) {
|
||||||
|
if (measureData[idx].FristAddTaskId) {
|
||||||
|
measureData[idx].MeasureData = ''
|
||||||
|
console.log('清除标记成功', idx)
|
||||||
|
} else {
|
||||||
|
measureData.splice(idx, 1)
|
||||||
|
console.log('移除标记成功', idx)
|
||||||
|
}
|
||||||
|
state.visitTaskList[index].MeasureData = measureData
|
||||||
|
} else if (obj.orderMarkName) {
|
||||||
|
const i = measureData.findIndex(item => item.QuestionId === obj.questionId && item.OrderMarkName === obj.orderMarkName)
|
||||||
|
if (i > -1) {
|
||||||
|
if (measureData[i].FristAddTaskId) {
|
||||||
|
measureData[i].MeasureData = ''
|
||||||
|
console.log('清除标记成功', i)
|
||||||
|
} else {
|
||||||
|
measureData.splice(i, 1)
|
||||||
|
console.log('移除标记成功', i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
state.visitTaskList[index].MeasureData = measureData
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (idx > -1) {
|
// if (idx > -1) {
|
||||||
// measureData.splice(idx, 1)
|
// measureData.splice(idx, 1)
|
||||||
|
|
||||||
|
@ -1034,7 +1081,7 @@ const actions = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setImageloadedInfo({ state }, obj) {
|
setImageloadedInfo({ state }, obj) {
|
||||||
console.log('setImageloadedInfo', obj)
|
// console.log('setImageloadedInfo', obj)
|
||||||
// if(obj.instance === '20dd8fc9-51b0-ec63-942b-cb3006c72650')
|
// if(obj.instance === '20dd8fc9-51b0-ec63-942b-cb3006c72650')
|
||||||
// var index = state.visitTaskList.findIndex(i => i.VisitTaskId === obj.visitTaskId)
|
// var index = state.visitTaskList.findIndex(i => i.VisitTaskId === obj.visitTaskId)
|
||||||
// // const prefetchInstanceCount = state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].prefetchInstanceCount
|
// // const prefetchInstanceCount = state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].prefetchInstanceCount
|
||||||
|
|
|
@ -148,12 +148,14 @@ import LengthTool from '@/views/trials/trials-panel/reading/dicoms/tools/Length/
|
||||||
import BidirectionalTool from '@/views/trials/trials-panel/reading/dicoms/tools/Bidirectional/BidirectionalTool'
|
import BidirectionalTool from '@/views/trials/trials-panel/reading/dicoms/tools/Bidirectional/BidirectionalTool'
|
||||||
import ArrowAnnotateTool from '@/views/trials/trials-panel/reading/dicoms/tools/ArrowAnnotate/ArrowAnnotateTool'
|
import ArrowAnnotateTool from '@/views/trials/trials-panel/reading/dicoms/tools/ArrowAnnotate/ArrowAnnotateTool'
|
||||||
import RectangleRoiTool from '@/views/trials/trials-panel/reading/dicoms/tools/RectangleRoi/RectangleRoiTool'
|
import RectangleRoiTool from '@/views/trials/trials-panel/reading/dicoms/tools/RectangleRoi/RectangleRoiTool'
|
||||||
|
import ProbeTool from '@/views/trials/trials-panel/reading/dicoms/tools/Probe/ProbeTool'
|
||||||
// import OrientationMarkersTool from '@/views/trials/trials-panel/reading/dicoms/tools/OrientationMarkers/OrientationMarkersTool'
|
// import OrientationMarkersTool from '@/views/trials/trials-panel/reading/dicoms/tools/OrientationMarkers/OrientationMarkersTool'
|
||||||
import ScaleOverlayTool from '@/views/trials/trials-panel/reading/dicoms/tools/ScaleOverlay/ScaleOverlayTool'
|
import ScaleOverlayTool from '@/views/trials/trials-panel/reading/dicoms/tools/ScaleOverlay/ScaleOverlayTool'
|
||||||
import getOrientationString from '@/views/trials/trials-panel/reading/dicoms/tools/OrientationMarkers/getOrientationString'
|
import getOrientationString from '@/views/trials/trials-panel/reading/dicoms/tools/OrientationMarkers/getOrientationString'
|
||||||
import invertOrientationString from '@/views/trials/trials-panel/reading/dicoms/tools/OrientationMarkers/invertOrientationString'
|
import invertOrientationString from '@/views/trials/trials-panel/reading/dicoms/tools/OrientationMarkers/invertOrientationString'
|
||||||
// import calculateLongestAndShortestDiameters from '@/views/trials/trials-panel/reading/dicoms/tools/Bidirectional/calculateLongestAndShortestDiameters'
|
// import calculateLongestAndShortestDiameters from '@/views/trials/trials-panel/reading/dicoms/tools/Bidirectional/calculateLongestAndShortestDiameters'
|
||||||
import calculateSUV from '@/views/trials/trials-panel/reading/dicoms/tools/calculateSUV'
|
import calculateSUV from '@/views/trials/trials-panel/reading/dicoms/tools/calculateSUV'
|
||||||
|
// import { ProbeTool } from '@cornerstonejs/tools'
|
||||||
cornerstoneTools.external.cornerstone = cornerstone
|
cornerstoneTools.external.cornerstone = cornerstone
|
||||||
cornerstoneTools.external.Hammer = Hammer
|
cornerstoneTools.external.Hammer = Hammer
|
||||||
cornerstoneTools.external.cornerstoneMath = cornerstoneMath
|
cornerstoneTools.external.cornerstoneMath = cornerstoneMath
|
||||||
|
@ -799,8 +801,8 @@ export default {
|
||||||
measureData.ww = Math.round(viewport.voi.windowWidth)
|
measureData.ww = Math.round(viewport.voi.windowWidth)
|
||||||
measureData.wc = Math.round(viewport.voi.windowCenter)
|
measureData.wc = Math.round(viewport.voi.windowCenter)
|
||||||
var questionInfo = this.measureData[idx]
|
var questionInfo = this.measureData[idx]
|
||||||
const canvas = this.canvas.querySelector('canvas')
|
// const canvas = this.canvas.querySelector('canvas')
|
||||||
measureData.pictureBaseStr = canvas.toDataURL('image/png', 1)
|
// measureData.pictureBaseStr = canvas.toDataURL('image/png', 1)
|
||||||
measureData.data.active = false
|
measureData.data.active = false
|
||||||
this.$emit('modifyMeasureData', { measureData, questionInfo })
|
this.$emit('modifyMeasureData', { measureData, questionInfo })
|
||||||
// e.stopImmediatePropagation()
|
// e.stopImmediatePropagation()
|
||||||
|
@ -1000,26 +1002,14 @@ export default {
|
||||||
if (i > -1) {
|
if (i > -1) {
|
||||||
var idx = this.measureData.findIndex(item => item.MeasureData && item.MeasureData.data && item.MeasureData.data.uuid === toolState.data[i].uuid)
|
var idx = this.measureData.findIndex(item => item.MeasureData && item.MeasureData.data && item.MeasureData.data.uuid === toolState.data[i].uuid)
|
||||||
if (idx > -1) {
|
if (idx > -1) {
|
||||||
// console.log('mouseClick')
|
|
||||||
DicomEvent.$emit('setCollapseActive', this.measureData[idx])
|
DicomEvent.$emit('setCollapseActive', this.measureData[idx])
|
||||||
if (this.readingTaskState < 2) {
|
if (this.readingTaskState < 2) {
|
||||||
const measureData = {}
|
const measureData = {}
|
||||||
var markName = this.measureData[idx].OrderMarkName
|
var markName = this.measureData[idx].OrderMarkName
|
||||||
if (this.disabledMarks.indexOf(markName) === -1 || !this.disabledMarks) {
|
if (this.disabledMarks.indexOf(markName) === -1 || !this.disabledMarks) {
|
||||||
// if (toolType === 'Bidirectional') {
|
|
||||||
// const {
|
|
||||||
// longestDiameter,
|
|
||||||
// shortestDiameter
|
|
||||||
// } = calculateLongestAndShortestDiameters(toolState.data[i], image, this.digitPlaces)
|
|
||||||
// toolState.data[i].longestDiameter = longestDiameter
|
|
||||||
// toolState.data[i].shortestDiameter = shortestDiameter
|
|
||||||
// }
|
|
||||||
// if (toolType === 'Length') {
|
|
||||||
// toolState.data[i].length = this.calculateLenth(toolState.data[i])
|
|
||||||
// }
|
|
||||||
var questionInfo = this.measureData[idx]
|
var questionInfo = this.measureData[idx]
|
||||||
const canvas = this.canvas.querySelector('canvas')
|
// const canvas = this.canvas.querySelector('canvas')
|
||||||
measureData.pictureBaseStr = canvas.toDataURL('image/png', 1)
|
// measureData.pictureBaseStr = canvas.toDataURL('image/png', 1)
|
||||||
measureData.studyId = this.stack.studyId
|
measureData.studyId = this.stack.studyId
|
||||||
measureData.seriesId = this.stack.seriesId
|
measureData.seriesId = this.stack.seriesId
|
||||||
measureData.instanceId = instanceId
|
measureData.instanceId = instanceId
|
||||||
|
@ -1031,6 +1021,10 @@ export default {
|
||||||
measureData.ww = Math.round(viewport.voi.windowWidth)
|
measureData.ww = Math.round(viewport.voi.windowWidth)
|
||||||
measureData.wc = Math.round(viewport.voi.windowCenter)
|
measureData.wc = Math.round(viewport.voi.windowCenter)
|
||||||
measureData.data.active = false
|
measureData.data.active = false
|
||||||
|
var criterionType = parseInt(localStorage.getItem('CriterionType'))
|
||||||
|
if (criterionType === 21) {
|
||||||
|
measureData.tableQuestionId = this.measureData[idx].TableQuestionId
|
||||||
|
}
|
||||||
this.$emit('modifyMeasureData', { measureData, questionInfo })
|
this.$emit('modifyMeasureData', { measureData, questionInfo })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1161,6 +1155,8 @@ export default {
|
||||||
cornerstoneTools.addToolForElement(element, ArrowAnnotateTool, { configuration: { allowEmptyLabel: true, handleRadius: false, drawHandlesOnHover: true, hideHandlesIfMoving: true }})
|
cornerstoneTools.addToolForElement(element, ArrowAnnotateTool, { configuration: { allowEmptyLabel: true, handleRadius: false, drawHandlesOnHover: true, hideHandlesIfMoving: true }})
|
||||||
} else if (toolName === 'RectangleRoi') {
|
} else if (toolName === 'RectangleRoi') {
|
||||||
cornerstoneTools.addToolForElement(element, RectangleRoiTool, { configuration: { allowEmptyLabel: true, handleRadius: false, drawHandlesOnHover: true, hideHandlesIfMoving: true }})
|
cornerstoneTools.addToolForElement(element, RectangleRoiTool, { configuration: { allowEmptyLabel: true, handleRadius: false, drawHandlesOnHover: true, hideHandlesIfMoving: true }})
|
||||||
|
} else if (toolName === 'Probe' && parseInt(localStorage.getItem('CriterionType')) === 21) {
|
||||||
|
cornerstoneTools.addToolForElement(element, ProbeTool, { configuration: { fixedRadius: 5, handleRadius: true, drawHandlesOnHover: true, hideHandlesIfMoving: true, digits: this.digitPlaces }})
|
||||||
} else {
|
} else {
|
||||||
cornerstoneTools.addToolForElement(element, apiTool)
|
cornerstoneTools.addToolForElement(element, apiTool)
|
||||||
}
|
}
|
||||||
|
@ -1351,8 +1347,8 @@ export default {
|
||||||
measureData.ww = Math.round(viewport.voi.windowWidth)
|
measureData.ww = Math.round(viewport.voi.windowWidth)
|
||||||
measureData.wc = Math.round(viewport.voi.windowCenter)
|
measureData.wc = Math.round(viewport.voi.windowCenter)
|
||||||
|
|
||||||
const canvas = this.canvas.querySelector('canvas')
|
// const canvas = this.canvas.querySelector('canvas')
|
||||||
measureData.pictureBaseStr = canvas.toDataURL('image/png', 1)
|
// measureData.pictureBaseStr = canvas.toDataURL('image/png', 1)
|
||||||
this.$emit('setMeasureData', measureData)
|
this.$emit('setMeasureData', measureData)
|
||||||
cornerstoneTools.setToolPassiveForElement(this.canvas, e.detail.toolName)
|
cornerstoneTools.setToolPassiveForElement(this.canvas, e.detail.toolName)
|
||||||
} else if (e.detail.toolName === 'Bidirectional') {
|
} else if (e.detail.toolName === 'Bidirectional') {
|
||||||
|
@ -1367,8 +1363,22 @@ export default {
|
||||||
measureData.location = this.dicomInfo.location
|
measureData.location = this.dicomInfo.location
|
||||||
measureData.ww = Math.round(viewport.voi.windowWidth)
|
measureData.ww = Math.round(viewport.voi.windowWidth)
|
||||||
measureData.wc = Math.round(viewport.voi.windowCenter)
|
measureData.wc = Math.round(viewport.voi.windowCenter)
|
||||||
const canvas = this.canvas.querySelector('canvas')
|
// const canvas = this.canvas.querySelector('canvas')
|
||||||
measureData.pictureBaseStr = canvas.toDataURL('image/png', 1)
|
// measureData.pictureBaseStr = canvas.toDataURL('image/png', 1)
|
||||||
|
this.$emit('setMeasureData', measureData)
|
||||||
|
cornerstoneTools.setToolPassiveForElement(this.canvas, e.detail.toolName)
|
||||||
|
} else if (e.detail.toolName === 'Probe') {
|
||||||
|
const measureData = {}
|
||||||
|
measureData.studyId = this.stack.studyId
|
||||||
|
measureData.seriesId = this.stack.seriesId
|
||||||
|
measureData.instanceId = instanceId
|
||||||
|
measureData.frame = this.stack.frame ? this.stack.frame : 0
|
||||||
|
measureData.data = e.detail.measurementData
|
||||||
|
measureData.type = e.detail.toolName
|
||||||
|
measureData.thick = this.dicomInfo.thick
|
||||||
|
measureData.location = this.dicomInfo.location
|
||||||
|
measureData.ww = Math.round(viewport.voi.windowWidth)
|
||||||
|
measureData.wc = Math.round(viewport.voi.windowCenter)
|
||||||
this.$emit('setMeasureData', measureData)
|
this.$emit('setMeasureData', measureData)
|
||||||
cornerstoneTools.setToolPassiveForElement(this.canvas, e.detail.toolName)
|
cornerstoneTools.setToolPassiveForElement(this.canvas, e.detail.toolName)
|
||||||
} else if (!e.detail.toolName) {
|
} else if (!e.detail.toolName) {
|
||||||
|
@ -1448,7 +1458,7 @@ export default {
|
||||||
},
|
},
|
||||||
onMeasurementmodified(e) {
|
onMeasurementmodified(e) {
|
||||||
// 移动
|
// 移动
|
||||||
// console.log('modified')
|
console.log('modified')
|
||||||
if (this.readingTaskState >= 2) return
|
if (this.readingTaskState >= 2) return
|
||||||
const { measurementData, toolType } = e.detail
|
const { measurementData, toolType } = e.detail
|
||||||
var element = cornerstone.getEnabledElement(this.canvas)
|
var element = cornerstone.getEnabledElement(this.canvas)
|
||||||
|
@ -1466,8 +1476,8 @@ export default {
|
||||||
var markName = this.measureData[idx].OrderMarkName
|
var markName = this.measureData[idx].OrderMarkName
|
||||||
if (this.disabledMarks.indexOf(markName) === -1 || !this.disabledMarks) {
|
if (this.disabledMarks.indexOf(markName) === -1 || !this.disabledMarks) {
|
||||||
var questionInfo = this.measureData[idx]
|
var questionInfo = this.measureData[idx]
|
||||||
const canvas = this.canvas.querySelector('canvas')
|
// const canvas = this.canvas.querySelector('canvas')
|
||||||
measureData.pictureBaseStr = canvas.toDataURL('image/png', 1)
|
// measureData.pictureBaseStr = canvas.toDataURL('image/png', 1)
|
||||||
measureData.studyId = this.stack.studyId
|
measureData.studyId = this.stack.studyId
|
||||||
measureData.seriesId = this.stack.seriesId
|
measureData.seriesId = this.stack.seriesId
|
||||||
measureData.instanceId = instanceId
|
measureData.instanceId = instanceId
|
||||||
|
@ -1479,6 +1489,10 @@ export default {
|
||||||
measureData.ww = Math.round(viewport.voi.windowWidth)
|
measureData.ww = Math.round(viewport.voi.windowWidth)
|
||||||
measureData.wc = Math.round(viewport.voi.windowCenter)
|
measureData.wc = Math.round(viewport.voi.windowCenter)
|
||||||
measureData.data.active = false
|
measureData.data.active = false
|
||||||
|
var criterionType = parseInt(localStorage.getItem('CriterionType'))
|
||||||
|
if (criterionType === 21) {
|
||||||
|
measureData.tableQuestionId = this.measureData[idx].TableQuestionId
|
||||||
|
}
|
||||||
this.$emit('modifyMeasureData', { measureData, questionInfo })
|
this.$emit('modifyMeasureData', { measureData, questionInfo })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -493,6 +493,14 @@
|
||||||
:is-show="isShow"
|
:is-show="isShow"
|
||||||
:is-reading-show-subject-info="isReadingShowSubjectInfo"
|
:is-reading-show-subject-info="isReadingShowSubjectInfo"
|
||||||
/>
|
/>
|
||||||
|
<MRIPDFF
|
||||||
|
v-else-if="CriterionType === 21"
|
||||||
|
ref="measurementList"
|
||||||
|
:question-form-change-state="questionFormChangeState"
|
||||||
|
:question-form-change-num="questionFormChangeNum"
|
||||||
|
:is-show="isShow"
|
||||||
|
:is-reading-show-subject-info="isReadingShowSubjectInfo"
|
||||||
|
/>
|
||||||
<h2 v-else style="color:#ddd">
|
<h2 v-else style="color:#ddd">
|
||||||
Developing...
|
Developing...
|
||||||
</h2>
|
</h2>
|
||||||
|
@ -786,6 +794,7 @@ import PCWGQuestionList from './PCWG/QuestionList'
|
||||||
import LuganoQuestionList from './Lugano/QuestionList'
|
import LuganoQuestionList from './Lugano/QuestionList'
|
||||||
import IVUSList from './IVUS/QuestionList'
|
import IVUSList from './IVUS/QuestionList'
|
||||||
import OCTList from './OCT/QuestionList'
|
import OCTList from './OCT/QuestionList'
|
||||||
|
import MRIPDFF from './MRIPDFF/QuestionList'
|
||||||
import CustomWwwcForm from './CustomWwwcForm'
|
import CustomWwwcForm from './CustomWwwcForm'
|
||||||
import Manuals from './Manuals'
|
import Manuals from './Manuals'
|
||||||
import Hotkeys from './Hotkeys'
|
import Hotkeys from './Hotkeys'
|
||||||
|
@ -818,6 +827,7 @@ export default {
|
||||||
LuganoQuestionList,
|
LuganoQuestionList,
|
||||||
IVUSList,
|
IVUSList,
|
||||||
OCTList,
|
OCTList,
|
||||||
|
MRIPDFF,
|
||||||
'download-dicom-and-nonedicom': downloadDicomAndNonedicom,
|
'download-dicom-and-nonedicom': downloadDicomAndNonedicom,
|
||||||
'upload-dicom-and-nonedicom': uploadDicomAndNonedicom,
|
'upload-dicom-and-nonedicom': uploadDicomAndNonedicom,
|
||||||
SignForm
|
SignForm
|
||||||
|
@ -978,7 +988,8 @@ export default {
|
||||||
taskId: '',
|
taskId: '',
|
||||||
signVisible: false,
|
signVisible: false,
|
||||||
signCode: null,
|
signCode: null,
|
||||||
currentUser: zzSessionStorage.getItem('userName')
|
currentUser: zzSessionStorage.getItem('userName'),
|
||||||
|
tmpData: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1067,6 +1078,10 @@ export default {
|
||||||
this.measuredTools = []
|
this.measuredTools = []
|
||||||
} else if (this.CriterionType === 20) {
|
} else if (this.CriterionType === 20) {
|
||||||
this.measuredTools = []
|
this.measuredTools = []
|
||||||
|
} else if (this.CriterionType === 21) {
|
||||||
|
this.measuredTools = [{
|
||||||
|
toolName: 'Probe', text: this.$t('trials:reading:button:circle'), icon: 'oval', isDisabled: false, disabledReason: ''
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
this.rotateList[0] = '1'
|
this.rotateList[0] = '1'
|
||||||
this.colorList[0] = ''
|
this.colorList[0] = ''
|
||||||
|
@ -1178,6 +1193,11 @@ export default {
|
||||||
this.petctWindow.close()
|
this.petctWindow.close()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
DicomEvent.$on('addAnnotation', async obj => {
|
||||||
|
this.tmpData = Object.assign({}, obj.question)
|
||||||
|
await this.imageLocation(obj.locateInfo)
|
||||||
|
this.setToolActive('Probe', true, null, 'tableQuestion')
|
||||||
|
})
|
||||||
window.addEventListener('beforeunload', () => {
|
window.addEventListener('beforeunload', () => {
|
||||||
if (this.petctWindow) {
|
if (this.petctWindow) {
|
||||||
this.petctWindow.close()
|
this.petctWindow.close()
|
||||||
|
@ -1600,7 +1620,7 @@ export default {
|
||||||
var activeCanvasTaskId = obj.visitTaskId
|
var activeCanvasTaskId = obj.visitTaskId
|
||||||
|
|
||||||
var index = this.visitTaskList.findIndex(i => i.VisitTaskId === activeCanvasTaskId)
|
var index = this.visitTaskList.findIndex(i => i.VisitTaskId === activeCanvasTaskId)
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
resolve()
|
resolve()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -2046,6 +2066,9 @@ export default {
|
||||||
},
|
},
|
||||||
// 设置测量工具启用(不会对输入作出反应)
|
// 设置测量工具启用(不会对输入作出反应)
|
||||||
setToolActive(toolName, isMeasuredTool, e, type) {
|
setToolActive(toolName, isMeasuredTool, e, type) {
|
||||||
|
if (!type) {
|
||||||
|
this.tmpData = null
|
||||||
|
}
|
||||||
if (isMeasuredTool) {
|
if (isMeasuredTool) {
|
||||||
// var i = this.measuredTools.findIndex(item => item.toolName === toolName)
|
// var i = this.measuredTools.findIndex(item => item.toolName === toolName)
|
||||||
// if (i === -1 && this.measuredTools[i].isDisabled) return
|
// if (i === -1 && this.measuredTools[i].isDisabled) return
|
||||||
|
@ -2144,13 +2167,27 @@ export default {
|
||||||
},
|
},
|
||||||
// 添加标记
|
// 添加标记
|
||||||
setMeasureData(data) {
|
setMeasureData(data) {
|
||||||
this.$refs['measurementList'].setMeasuredData(data)
|
if (this.CriterionType === 21) {
|
||||||
|
if (this.tmpData) {
|
||||||
|
data.tableQuestionId = this.tmpData.Id
|
||||||
|
data.tableQuestionMark = this.tmpData.QuestionMark
|
||||||
|
this.$refs['measurementList'].setMeasuredData(data)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.$refs['measurementList'].setMeasuredData(data)
|
||||||
|
}
|
||||||
this.activeTool = ''
|
this.activeTool = ''
|
||||||
|
|
||||||
},
|
},
|
||||||
// 修改标记
|
// 修改标记
|
||||||
modifyMeasureData(data) {
|
modifyMeasureData(data) {
|
||||||
this.$refs['measurementList'].modifyMeasuredData(data)
|
if (this.CriterionType === 21 && data.measureData.tableQuestionId) {
|
||||||
|
this.$refs['measurementList'].modifyMeasuredData(data)
|
||||||
|
} else {
|
||||||
|
this.$refs['measurementList'].modifyMeasuredData(data)
|
||||||
|
}
|
||||||
this.activeTool = ''
|
this.activeTool = ''
|
||||||
|
|
||||||
},
|
},
|
||||||
async saveImage() {
|
async saveImage() {
|
||||||
// this.$refs[`dicomCanvas${this.currentDicomCanvasIndex}`][0].saveImage()
|
// this.$refs[`dicomCanvas${this.currentDicomCanvasIndex}`][0].saveImage()
|
||||||
|
|
|
@ -0,0 +1,771 @@
|
||||||
|
<template>
|
||||||
|
<el-form
|
||||||
|
v-if="isRender"
|
||||||
|
ref="measurementForm"
|
||||||
|
v-loading="loading"
|
||||||
|
:model="questionForm"
|
||||||
|
size="mini"
|
||||||
|
class="measurement-form"
|
||||||
|
>
|
||||||
|
<div class="base-dialog-body">
|
||||||
|
<div style="display: flex;justify-content: space-between;">
|
||||||
|
<h3 v-if="questionName" style="color: #ddd;padding: 5px 0px;margin: 0;">
|
||||||
|
<!-- {{ `${questionName} (${orderMark}${String(rowIndex).padStart(2, '0')})` }} -->
|
||||||
|
{{ lesionName }}
|
||||||
|
</h3>
|
||||||
|
<!-- 关闭 -->
|
||||||
|
<div>
|
||||||
|
<i class="el-icon-circle-close" style="font-size: 25px;cursor: pointer;" @click="handleClose" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<el-form-item
|
||||||
|
v-for="qs in questions"
|
||||||
|
v-show="qs.ShowQuestion!==2"
|
||||||
|
:key="qs.Id"
|
||||||
|
:label="`${qs.QuestionName}`"
|
||||||
|
:prop="qs.Id"
|
||||||
|
:rules="[
|
||||||
|
{ required: (qs.IsRequired === 0 || (qs.IsRequired ===1 && qs.RelevanceId && (String(questionForm[qs.RelevanceId]) === qs.RelevanceValue)) || (qs.QuestionMark === 6 && questionForm.IsCanEditPosition === true) || (questionForm.IsCanEditPosition && qs.QuestionMark === 10)) && qs.Type!=='group' && qs.Type!=='summary',
|
||||||
|
message:['radio', 'select', 'checkbox'].includes(qs.Type) ? $t('common:ruleMessage:select') : $t('common:ruleMessage:specify'), trigger: ['blur','change']},
|
||||||
|
]"
|
||||||
|
style="flex-wrap: wrap"
|
||||||
|
>
|
||||||
|
|
||||||
|
<!-- 输入框 -->
|
||||||
|
<template v-if="(qs.Type==='input' || qs.Type==='number') && (qs.QuestionMark === 1101 || qs.QuestionMark === 1102 || qs.QuestionMark === 1103)">
|
||||||
|
<div style="display: flex;flex-direction: row;justify-content: flex-start;align-items: center;">
|
||||||
|
<el-input
|
||||||
|
v-model="questionForm[qs.Id]"
|
||||||
|
disabled
|
||||||
|
style="width: 100px;"
|
||||||
|
>
|
||||||
|
<template v-if="qs.Unit" slot="append">
|
||||||
|
{{ $fd('ValueUnit', parseInt(qs.Unit)) }}
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
<!-- 测量 -->
|
||||||
|
<el-button
|
||||||
|
v-if="!questionForm[qs.Id] && readingTaskState!== 2"
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
@click="addAnnotation(qs)"
|
||||||
|
>
|
||||||
|
测量
|
||||||
|
</el-button>
|
||||||
|
<!-- 清除标记 -->
|
||||||
|
<el-button
|
||||||
|
v-if="getAnnotationStatus(qs) && readingTaskState!== 2"
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
@click="removeAnnotation(qs)"
|
||||||
|
style="margin-left: 0px"
|
||||||
|
>
|
||||||
|
清除
|
||||||
|
</el-button>
|
||||||
|
<!-- 定位 -->
|
||||||
|
<el-button
|
||||||
|
v-if="questionForm[qs.Id]"
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
@click="locateAnnotation(qs)"
|
||||||
|
style="margin-left: 0px"
|
||||||
|
>
|
||||||
|
定位
|
||||||
|
</el-button>
|
||||||
|
<!-- 保存 -->
|
||||||
|
<el-button
|
||||||
|
v-if="readingTaskState!== 2"
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
@click="saveAnnotation(qs)"
|
||||||
|
style="margin-left: 0px"
|
||||||
|
>
|
||||||
|
<!-- 未保存 -->
|
||||||
|
<el-tooltip v-if="getAnnotationSaveEnum(qs) === 0" class="item" effect="dark" :content="$t('trials:reading:button:unsaved')" placement="bottom">
|
||||||
|
<i class="el-icon-warning" style="color:red" />
|
||||||
|
</el-tooltip>
|
||||||
|
{{ $t('common:button:save') }}
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="qs.Type==='input' || qs.Type==='number'">
|
||||||
|
<el-input
|
||||||
|
v-model="questionForm[qs.Id]"
|
||||||
|
:disabled="!isCurrentTask || readingTaskState>=2"
|
||||||
|
@change="((val)=>{formItemChange(val, qs)})"
|
||||||
|
>
|
||||||
|
<template v-if="(qs.QuestionMark===0 || qs.QuestionMark===1) && qs.Unit" slot="append">
|
||||||
|
{{ $fd('ValueUnit', parseInt(qs.Unit)) }}
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</template>
|
||||||
|
<!-- 多行文本输入框 -->
|
||||||
|
<el-input
|
||||||
|
v-else-if="qs.Type==='textarea'"
|
||||||
|
v-model="questionForm[qs.Id]"
|
||||||
|
type="textarea"
|
||||||
|
:autosize="{ minRows: 2, maxRows: 4}"
|
||||||
|
:disabled="!isCurrentTask || readingTaskState>=2"
|
||||||
|
@change="((val)=>{formItemChange(val, qs)})"
|
||||||
|
/>
|
||||||
|
<!-- 下拉框 -->
|
||||||
|
|
||||||
|
<el-select
|
||||||
|
v-else-if="qs.Type==='select'"
|
||||||
|
v-model="questionForm[qs.Id]"
|
||||||
|
filterable
|
||||||
|
:placeholder="$t('common:placeholder:select')"
|
||||||
|
:disabled="!isCurrentTask || readingTaskState>=2 || qs.QuestionMark === 1106"
|
||||||
|
@change="((val)=>{formItemChange(val, qs)})"
|
||||||
|
>
|
||||||
|
<template v-if="qs.TableQuestionType === 1">
|
||||||
|
<el-option
|
||||||
|
v-for="item in organList"
|
||||||
|
:key="item.Id"
|
||||||
|
:label="item[qs.DataTableColumn]"
|
||||||
|
:value="item[qs.DataTableColumn]"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="qs.DictionaryCode">
|
||||||
|
<el-option
|
||||||
|
v-for="item of $d[qs.DictionaryCode]"
|
||||||
|
:key="item.id"
|
||||||
|
:value="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<el-option
|
||||||
|
v-for="val in qs.TypeValue.split('|')"
|
||||||
|
:key="val"
|
||||||
|
:label="val"
|
||||||
|
:value="val"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</el-select>
|
||||||
|
<!-- 单选 -->
|
||||||
|
<el-radio-group
|
||||||
|
v-else-if="qs.Type==='radio'"
|
||||||
|
v-model="questionForm[qs.Id]"
|
||||||
|
:disabled="!isCurrentTask || readingTaskState>=2"
|
||||||
|
@change="((val)=>{formItemChange(val, qs)})"
|
||||||
|
>
|
||||||
|
<template v-if="qs.DictionaryCode.length > 0">
|
||||||
|
<el-radio
|
||||||
|
v-for="item in $d[qs.DictionaryCode]"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.value"
|
||||||
|
>
|
||||||
|
{{ item.label }}
|
||||||
|
</el-radio>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="qs.options.length > 0">
|
||||||
|
<el-radio
|
||||||
|
v-for="val in qs.options.split('|')"
|
||||||
|
:key="val"
|
||||||
|
:label="val"
|
||||||
|
>
|
||||||
|
{{ val }}
|
||||||
|
</el-radio>
|
||||||
|
</template>
|
||||||
|
</el-radio-group>
|
||||||
|
<!-- 自动计算 -->
|
||||||
|
<el-input
|
||||||
|
v-else-if="qs.Type==='calculation'"
|
||||||
|
v-model="questionForm[qs.Id]"
|
||||||
|
disabled
|
||||||
|
@change="((val)=>{formItemChange(val, qs)})"
|
||||||
|
>
|
||||||
|
<template v-if="qs.Unit" slot="append">
|
||||||
|
{{ $fd('ValueUnit', parseInt(qs.Unit)) }}
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="isCurrentTask && readingTaskState<2"
|
||||||
|
class="base-dialog-footer"
|
||||||
|
style="text-align:right;margin-top:10px;"
|
||||||
|
>
|
||||||
|
<!-- 保存 -->
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
@click="handleSave"
|
||||||
|
>
|
||||||
|
{{ $t('common:button:save') }}
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { submitTableQuestion } from '@/api/trials'
|
||||||
|
import { saveTableQuestionMark } from '@/api/reading'
|
||||||
|
import DicomEvent from './../DicomEvent'
|
||||||
|
import store from '@/store'
|
||||||
|
export default {
|
||||||
|
name: 'MeasurementForm',
|
||||||
|
props: {
|
||||||
|
questions: {
|
||||||
|
type: Array,
|
||||||
|
default() { return [] }
|
||||||
|
},
|
||||||
|
answers: {
|
||||||
|
type: Object,
|
||||||
|
default() { return {} }
|
||||||
|
},
|
||||||
|
lesionType: {
|
||||||
|
type: Number,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
visitTaskId: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
parentQsId: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
isCurrentTask: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
readingTaskState: {
|
||||||
|
type: Number,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
isBaseLineTask: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
orderMark: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
questionName: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
rowIndex: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
tableQuestions: {
|
||||||
|
type: Array,
|
||||||
|
default() { return [] }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
questionForm: {},
|
||||||
|
loading: false,
|
||||||
|
trialId: '',
|
||||||
|
originalQuestionForm: {},
|
||||||
|
isRender: false,
|
||||||
|
lesionName: '',
|
||||||
|
lesionMark: '',
|
||||||
|
activeQuestionId: '',
|
||||||
|
activeQuestionMark: '',
|
||||||
|
markList: [],
|
||||||
|
digitPlaces: 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.trialId = this.$route.query.trialId
|
||||||
|
let digitPlaces = Number(localStorage.getItem('digitPlaces'))
|
||||||
|
this.digitPlaces = digitPlaces === -1 ? this.digitPlaces : digitPlaces
|
||||||
|
this.initForm()
|
||||||
|
DicomEvent.$on('handleImageQualityAbnormal', () => {
|
||||||
|
this.setState()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
DicomEvent.$off('handleImageQualityAbnormal')
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async initForm() {
|
||||||
|
this.isRender = false
|
||||||
|
// const loading = this.$loading({ fullscreen: true })
|
||||||
|
this.questions.forEach(item => {
|
||||||
|
var val = this.answers[item.Id]
|
||||||
|
if (item.DictionaryCode) {
|
||||||
|
val = isNaN(parseInt(this.answers[item.Id])) ? this.answers[item.Id] : parseInt(this.answers[item.Id])
|
||||||
|
}
|
||||||
|
if (this.isBaseLineTask && item.QuestionMark === 7 && this.lesionType === 0) {
|
||||||
|
val = 0
|
||||||
|
}
|
||||||
|
if (this.isBaseLineTask && item.QuestionMark === 7 && this.lesionType === 1) {
|
||||||
|
val = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$set(this.questionForm, item.Id, val)
|
||||||
|
})
|
||||||
|
this.$set(this.questionForm, 'MeasureData', this.answers.MeasureData ? JSON.parse(this.answers.MeasureData) : '')
|
||||||
|
this.$set(this.questionForm, 'RowIndex', this.answers.RowIndex ? this.answers.RowIndex : '')
|
||||||
|
this.$set(this.questionForm, 'RowId', this.answers.RowId ? this.answers.RowId : '')
|
||||||
|
|
||||||
|
// saveTypeEnum 0:未保存过(新建病灶);1:已保存,信息不完整(随访初始化病灶/分裂病灶,通过状态判断);2:已保存,信息完整
|
||||||
|
let isMeasurable = this.getQuestionVal(1105)
|
||||||
|
this.$set(this.questionForm, 'saveTypeEnum', isMeasurable === '' ? 1 : 2)
|
||||||
|
|
||||||
|
this.lesionName = this.getLesionInfo(this.orderMark, this.rowIndex)
|
||||||
|
this.lesionMark = this.getLesionName(this.orderMark, 1101)
|
||||||
|
this.originalQuestionForm = { ...this.questionForm }
|
||||||
|
this.markList = []
|
||||||
|
if (this.answers.TableQuestionMarkList) {
|
||||||
|
let arr = JSON.parse(this.answers.TableQuestionMarkList)
|
||||||
|
arr.map(i=>{
|
||||||
|
|
||||||
|
this.markList.push({tableQuestionId: i.TableQuestionId, measureData: i, saveEnum: 1})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.isRender = true
|
||||||
|
// loading.close()
|
||||||
|
},
|
||||||
|
getLesionName(orderMark, questionMark) {
|
||||||
|
// 根据肝脏分段枚举和第一次(或第二次或第三次)测量问题标识定义标记名称
|
||||||
|
// I II III IV V VI VII VIII
|
||||||
|
// L-I-01 L-I-02 L-I-03
|
||||||
|
// L-II-01 L-II-02 L-II-03
|
||||||
|
let segArr = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII']
|
||||||
|
let lessionName = ''
|
||||||
|
let segmentId = this.getQuestionId(1106)
|
||||||
|
let segmentVal = this.answers[segmentId]
|
||||||
|
segmentVal = segmentVal ? parseInt(segmentVal) : null
|
||||||
|
if (segmentVal) {
|
||||||
|
let i = questionMark === 1101 ? '01' : questionMark === 1102 ? '02' : questionMark === 1103 ? '03' : ''
|
||||||
|
lessionName = `${orderMark}-${segArr[segmentVal - 1]}-${i}`
|
||||||
|
}
|
||||||
|
return lessionName
|
||||||
|
},
|
||||||
|
getLesionInfo(orderMark, rowIndex) {
|
||||||
|
var arr = []
|
||||||
|
var lessionName = ''
|
||||||
|
var rowIndexArr = rowIndex.split('.')
|
||||||
|
var x = parseInt(rowIndexArr[0])
|
||||||
|
var y = parseInt(rowIndexArr[1])
|
||||||
|
if (y > 0) {
|
||||||
|
y = String.fromCharCode(parseInt(rowIndexArr[1]) - 1 + 65 + 32)
|
||||||
|
lessionName = `${orderMark}${String(x).padStart(2, '0')}${y}`
|
||||||
|
arr.push(lessionName)
|
||||||
|
} else {
|
||||||
|
lessionName = `${orderMark}${String(x).padStart(2, '0')}`
|
||||||
|
arr.push(lessionName)
|
||||||
|
}
|
||||||
|
return arr.join(' ')
|
||||||
|
},
|
||||||
|
getQuestionId(questionMark) {
|
||||||
|
var idx = this.questions.findIndex(i => i.QuestionMark === questionMark)
|
||||||
|
if (idx > -1) {
|
||||||
|
return this.questions[idx].Id
|
||||||
|
} else {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getOrganInfoList(isLymphNodes = null) {
|
||||||
|
return new Promise(async resolve => {
|
||||||
|
// var param = {
|
||||||
|
// trialId: this.trialId,
|
||||||
|
// visitTaskId: this.visitTaskId,
|
||||||
|
// lesionType: this.lesionType,
|
||||||
|
// isEnable: true
|
||||||
|
// }
|
||||||
|
// if (isLymphNodes !== undefined && isLymphNodes !== null) {
|
||||||
|
// param.isLymphNodes = isLymphNodes
|
||||||
|
// }
|
||||||
|
// getTrialOrganList(param).then(res => {
|
||||||
|
// this.organList = res.Result
|
||||||
|
// resolve()
|
||||||
|
// })
|
||||||
|
if (!sessionStorage.getItem('organList')) {
|
||||||
|
await store.dispatch('reading/getOrganInfo', this.visitTaskId)
|
||||||
|
}
|
||||||
|
var organList = sessionStorage.getItem('organList') ? JSON.parse(sessionStorage.getItem('organList')) : []
|
||||||
|
var idx = organList.findIndex(i => i.LesionType === this.lesionType)
|
||||||
|
if (idx > -1) {
|
||||||
|
organList = organList[idx].OrganList
|
||||||
|
|
||||||
|
if (!isNaN(parseInt(isLymphNodes))) {
|
||||||
|
this.organList = organList.filter((item) => item.IsLymphNodes === parseInt(isLymphNodes))
|
||||||
|
} else {
|
||||||
|
this.organList = organList
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resolve()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async formItemChange(v, qs) {
|
||||||
|
// 维护平均值、是否可测量等信息
|
||||||
|
this.$set(this.questionForm, 'saveTypeEnum', 1)
|
||||||
|
const mean = this.getQuestionVal(1104)
|
||||||
|
if (qs.QuestionMark === 1101 || qs.QuestionMark === 1102 || qs.QuestionMark === 1103) {
|
||||||
|
let newMean = this.getMean()
|
||||||
|
if (newMean !== mean) {
|
||||||
|
let meanId = this.getQuestionId(1104)
|
||||||
|
this.$set(this.questionForm, meanId, newMean ? newMean : '')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const isMeasurable = this.getQuestionVal(1105)
|
||||||
|
this.$emit('resetQuestions', { mean, isMeasurable, saveTypeEnum: this.questionForm.saveTypeEnum, rowIndex: this.rowIndex, questionId: this.parentQsId, anwsers: this.questionForm })
|
||||||
|
},
|
||||||
|
getMean() {
|
||||||
|
let mean = null
|
||||||
|
let l1 = this.getQuestionVal(1101)
|
||||||
|
let l2 = this.getQuestionVal(1102)
|
||||||
|
let l3 = this.getQuestionVal(1103)
|
||||||
|
if (!isNaN(parseFloat(l1)) && !isNaN(parseFloat(l2)) && !isNaN(parseFloat(l3))) {
|
||||||
|
const sum = l1 + l2 + l3
|
||||||
|
mean = sum / 3
|
||||||
|
}
|
||||||
|
|
||||||
|
return mean ? mean.toFixed(this.digitPlaces) : null;
|
||||||
|
},
|
||||||
|
setMeasureData(measureData, isInit = false) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
if (!measureData || (measureData && measureData.tableQuestionId !== this.activeQuestionId)) {
|
||||||
|
resolve()
|
||||||
|
}
|
||||||
|
var data = {}
|
||||||
|
// 创建标记
|
||||||
|
if (!measureData.data.remark) {
|
||||||
|
// 维护标记信息
|
||||||
|
measureData.data.remark = this.getLesionName(this.orderMark, this.activeQuestionMark)
|
||||||
|
}
|
||||||
|
this.$set(this.questionForm, measureData.tableQuestionId, measureData.data.cachedStats.mean)
|
||||||
|
data = {
|
||||||
|
Id: '',
|
||||||
|
StudyId: measureData.studyId,
|
||||||
|
InstanceId: measureData.instanceId,
|
||||||
|
SeriesId: measureData.seriesId,
|
||||||
|
MeasureData: measureData,
|
||||||
|
QuestionId: this.parentQsId,
|
||||||
|
RowIndex: this.questionForm.RowIndex,
|
||||||
|
RowId: this.questionForm.RowId,
|
||||||
|
VisitTaskId: this.visitTaskId,
|
||||||
|
NumberOfFrames: isNaN(parseInt(measureData.frame)) ? 0 : measureData.frame,
|
||||||
|
frame: isNaN(parseInt(measureData.frame)) ? 0 : measureData.frame,
|
||||||
|
OrderMarkName: measureData.data.remark,
|
||||||
|
TableQuestionId: measureData.tableQuestionId
|
||||||
|
}
|
||||||
|
store.dispatch('reading/addMeasuredData', { visitTaskId: this.visitTaskId, data: data })
|
||||||
|
let mean = this.getQuestionVal(1104)
|
||||||
|
let newMean = this.getMean()
|
||||||
|
if (newMean !== mean) {
|
||||||
|
mean = newMean
|
||||||
|
let meanId = this.getQuestionId(1104)
|
||||||
|
this.$set(this.questionForm, meanId, newMean ? newMean : '')
|
||||||
|
}
|
||||||
|
const isMeasurable = this.getQuestionVal(1105)
|
||||||
|
this.$emit('resetQuestions', { mean, isMeasurable, saveTypeEnum: this.questionForm.saveTypeEnum, rowIndex: this.rowIndex, questionId: this.parentQsId, anwsers: this.questionForm })
|
||||||
|
|
||||||
|
DicomEvent.$emit('refreshStudyListMeasureData')
|
||||||
|
let i = this.markList.findIndex(i=>i.tableQuestionId === measureData.tableQuestionId)
|
||||||
|
if (i === -1) {
|
||||||
|
this.markList.push({tableQuestionId: measureData.tableQuestionId, measureData: data, saveEnum: 0})
|
||||||
|
} else {
|
||||||
|
this.markList[i].saveEnum = 0
|
||||||
|
this.markList[i].measureData = data
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
addAnnotation(qs) {
|
||||||
|
let orderMarkName = this.getLesionName(this.orderMark, qs.QuestionMark)
|
||||||
|
this.activeQuestionId = qs.Id
|
||||||
|
this.activeQuestionMark= qs.QuestionMark
|
||||||
|
DicomEvent.$emit('addAnnotation', {question: qs, locateInfo: { questionId: this.parentQsId, rowIndex: this.questionForm.RowIndex, visitTaskId: this.visitTaskId, lesionName: orderMarkName, lesionType: null, markTool: 'Probe', readingTaskState: this.readingTaskState, isMarked: true }})
|
||||||
|
},
|
||||||
|
getAnnotationSaveEnum(qs) {
|
||||||
|
let i = this.markList.findIndex(i=>i.tableQuestionId === qs.Id)
|
||||||
|
if (i > -1) {
|
||||||
|
return this.markList[i].saveEnum
|
||||||
|
} else {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getAnnotationStatus(qs) {
|
||||||
|
let i = this.markList.findIndex(i=>i.tableQuestionId === qs.Id)
|
||||||
|
if (i > -1 && this.markList[i].measureData && this.markList[i].measureData.MeasureData) {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async removeAnnotation(qs) {
|
||||||
|
let i = this.markList.findIndex(i=>i.tableQuestionId === qs.Id)
|
||||||
|
DicomEvent.$emit('imageLocation', { questionId: this.parentQsId, rowIndex: this.questionForm.RowIndex, visitTaskId: this.visitTaskId, lesionName: this.markList[i].measureData.OrderMarkName, lesionType: null, markTool: 'Probe', readingTaskState: this.readingTaskState, isMarked: true })
|
||||||
|
// 是否确认清除标记?
|
||||||
|
const confirm = await this.$confirm(
|
||||||
|
this.$t('trials:reading:warnning:msg47'),
|
||||||
|
{
|
||||||
|
type: 'warning',
|
||||||
|
distinguishCancelAndClose: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if (confirm !== 'confirm') return
|
||||||
|
|
||||||
|
let measureData = Object.assign({}, this.markList[i].measureData)
|
||||||
|
// 移除缓存中的measureData
|
||||||
|
await store.dispatch('reading/removeMeasuredData', { visitTaskId: this.visitTaskId, measureData: measureData, questionId: this.parentQsId, rowIndex: this.questionForm.RowIndex, orderMarkName: measureData.OrderMarkName})
|
||||||
|
DicomEvent.$emit('getMeasureData')
|
||||||
|
this.markList[i].measureData = null
|
||||||
|
this.markList[i].saveEnum = 0
|
||||||
|
// 清除测量值、清除平均值
|
||||||
|
this.$set(this.questionForm, this.markList[i].tableQuestionId, '')
|
||||||
|
let meanId = this.getQuestionId(1104)
|
||||||
|
this.$set(this.questionForm, meanId, '')
|
||||||
|
},
|
||||||
|
locateAnnotation(qs) {
|
||||||
|
let i = this.markList.findIndex(i=>i.tableQuestionId === qs.Id)
|
||||||
|
let measureData = this.markList[i].measureData
|
||||||
|
// 定位
|
||||||
|
var markTool = 'Probe'
|
||||||
|
var readingTaskState = this.readingTaskState
|
||||||
|
var isMarked = !!measureData
|
||||||
|
DicomEvent.$emit('imageLocation', { questionId: this.parentQsId, rowIndex: this.questionForm.RowIndex, visitTaskId: this.visitTaskId, lesionName: measureData.OrderMarkName, lesionType: null, markTool, readingTaskState, isMarked })
|
||||||
|
},
|
||||||
|
async saveAnnotation(qs) {
|
||||||
|
const loading = this.$loading({ fullscreen: true })
|
||||||
|
try {
|
||||||
|
let i = this.markList.findIndex(i=>i.tableQuestionId === qs.Id)
|
||||||
|
let params = {}
|
||||||
|
if (i > -1 && this.markList[i].measureData) {
|
||||||
|
let measureData = this.markList[i].measureData.MeasureData
|
||||||
|
// 上传截图
|
||||||
|
DicomEvent.$emit('getScreenshots', { questionId: this.parentQsId, rowIndex: this.questionForm.RowIndex, visitTaskId: this.visitTaskId, lesionName: measureData.OrderMarkName, lesionType: null, isMarked: !!measureData }, async val => {
|
||||||
|
params = Object.assign({}, this.markList[i].measureData)
|
||||||
|
if (val) {
|
||||||
|
let pictureObj = await this.uploadScreenshots(`${new Date().getTime()}`, val)
|
||||||
|
params.PicturePath = pictureObj.isSuccess ? this.$getObjectName(pictureObj.result.url) : ''
|
||||||
|
}
|
||||||
|
let tableQuestionId = this.markList[i].tableQuestionId
|
||||||
|
params.Answer = this.questionForm[tableQuestionId]
|
||||||
|
params.MeasureData = JSON.stringify(this.markList[i].measureData.MeasureData)
|
||||||
|
loading.close()
|
||||||
|
this.saveTableQuestionInfo(params, qs)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
params = {
|
||||||
|
Answer: "",
|
||||||
|
VisitTaskId: this.visitTaskId,
|
||||||
|
QuestionId: this.parentQsId,
|
||||||
|
InstanceId: '',
|
||||||
|
SeriesId: '',
|
||||||
|
StudyId: '',
|
||||||
|
MarkTool:'',
|
||||||
|
PicturePath: '',
|
||||||
|
NumberOfFrames: 0,
|
||||||
|
MeasureData: '',
|
||||||
|
QuestionType: 0,
|
||||||
|
OrderMarkName: '',
|
||||||
|
RowId: this.questionForm.RowId,
|
||||||
|
TableQuestionId: qs.Id,
|
||||||
|
RowIndex: this.questionForm.RowIndex
|
||||||
|
}
|
||||||
|
loading.close()
|
||||||
|
this.saveTableQuestionInfo(params, qs)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch(e) {
|
||||||
|
console.log(e)
|
||||||
|
loading.close()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async saveTableQuestionInfo(params, qs) {
|
||||||
|
const loading = this.$loading({ fullscreen: true })
|
||||||
|
try {
|
||||||
|
let res = await saveTableQuestionMark(params)
|
||||||
|
if (res.IsSuccess) {
|
||||||
|
// 保存后设置保存状态
|
||||||
|
let i = this.markList.findIndex(i=>i.tableQuestionId === qs.Id)
|
||||||
|
this.markList[i].saveEnum = 1
|
||||||
|
// 保存成功
|
||||||
|
this.$message.success(this.$t('common:message:savedSuccessfully'))
|
||||||
|
// 刷新表格、刷新标记信息
|
||||||
|
this.$emit('getReadingQuestionAndAnswer')
|
||||||
|
loading.close()
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
console.log(e)
|
||||||
|
loading.close()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
returnFloat(num) {
|
||||||
|
if (num) return
|
||||||
|
var value = Math.round(parseFloat(num) * 100) / 100
|
||||||
|
var s = value.toString().split('.')
|
||||||
|
if (s.length === 1) {
|
||||||
|
value = value.toString() + '.00'
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
if (s.length > 1) {
|
||||||
|
if (s[1].length < 2) {
|
||||||
|
value = value.toString() + '0'
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getQuestionVal(questionMark) {
|
||||||
|
const idx = this.questions.findIndex(i => i.QuestionMark === questionMark)
|
||||||
|
if (idx > -1) {
|
||||||
|
const questionId = this.questions[idx].Id
|
||||||
|
const answer = this.questionForm[questionId]
|
||||||
|
if (isNaN(parseFloat(answer))) {
|
||||||
|
return answer
|
||||||
|
} else {
|
||||||
|
return parseFloat(answer)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async uploadScreenshots(fileName, file) {
|
||||||
|
try {
|
||||||
|
file = this.convertBase64ToBlob(file)
|
||||||
|
var trialId = this.$route.query.trialId
|
||||||
|
var subjectId = this.$route.query.trialId
|
||||||
|
const result = await this.OSSclient.put(`/${trialId}/Read/${subjectId}/Visit/${fileName}.png`, file)
|
||||||
|
return { isSuccess: true, result: result }
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
return { isSuccess: false, result: e }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
convertBase64ToBlob(imageEditorBase64) {
|
||||||
|
var base64Arr = imageEditorBase64.split(',')
|
||||||
|
var imgtype = ''
|
||||||
|
var base64String = ''
|
||||||
|
if (base64Arr.length > 1) {
|
||||||
|
// 如果是图片base64,去掉头信息
|
||||||
|
base64String = base64Arr[1]
|
||||||
|
imgtype = base64Arr[0].substring(
|
||||||
|
base64Arr[0].indexOf(':') + 1,
|
||||||
|
base64Arr[0].indexOf(';')
|
||||||
|
)
|
||||||
|
}
|
||||||
|
// 将base64解码
|
||||||
|
var bytes = atob(base64String)
|
||||||
|
// var bytes = base64;
|
||||||
|
var bytesCode = new ArrayBuffer(bytes.length)
|
||||||
|
// 转换为类型化数组
|
||||||
|
var byteArray = new Uint8Array(bytesCode)
|
||||||
|
|
||||||
|
// 将base64转换为ascii码
|
||||||
|
for (var i = 0; i < bytes.length; i++) {
|
||||||
|
byteArray[i] = bytes.charCodeAt(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生成Blob对象(文件对象)
|
||||||
|
return new Blob([bytesCode], { type: imgtype })
|
||||||
|
},
|
||||||
|
async handleSave() {
|
||||||
|
const valid = await this.$refs.measurementForm.validate()
|
||||||
|
if (!valid) return
|
||||||
|
// 检验是否有标记为保存
|
||||||
|
let i = this.markList.findIndex(i=>i.saveEnum === 0)
|
||||||
|
if (i > -1) {
|
||||||
|
this.$message.warning('请先保存标注信息!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const loading = this.$loading({ fullscreen: true })
|
||||||
|
|
||||||
|
try {
|
||||||
|
var answers = []
|
||||||
|
var reg = new RegExp(/^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$/)
|
||||||
|
for (const k in this.questionForm) {
|
||||||
|
if (reg.test(k)) {
|
||||||
|
if (answers.findIndex(i => i.tableQuestionId === k) === -1) {
|
||||||
|
answers.push({ tableQuestionId: k, answer: this.questionForm[k] })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var params = {
|
||||||
|
questionId: this.parentQsId,
|
||||||
|
rowId: this.questionForm.RowId,
|
||||||
|
rowIndex: this.answers.RowIndex,
|
||||||
|
visitTaskId: this.visitTaskId,
|
||||||
|
trialId: this.trialId,
|
||||||
|
answerList: answers,
|
||||||
|
isDicomReading: true
|
||||||
|
}
|
||||||
|
const res = await submitTableQuestion(params)
|
||||||
|
if (res.IsSuccess) {
|
||||||
|
// 保存成功!
|
||||||
|
this.$message.success(this.$t('common:message:savedSuccessfully'))
|
||||||
|
this.$set(this.questionForm, 'saveTypeEnum', 2)
|
||||||
|
this.originalQuestionForm = { ...this.questionForm }
|
||||||
|
this.$set(this.questionForm, 'RowId', res.Result.RowId)
|
||||||
|
// 维护平均值、是否可测量数据
|
||||||
|
const isMeasurable = this.getQuestionVal(1105)
|
||||||
|
const mean = this.getQuestionVal(1104)
|
||||||
|
this.$emit('resetQuestions', { isMeasurable, mean, saveTypeEnum: this.questionForm.saveTypeEnum,rowIndex: this.rowIndex, questionId: this.parentQsId, anwsers: this.questionForm })
|
||||||
|
this.$emit('close')
|
||||||
|
DicomEvent.$emit('getReportInfo', true)
|
||||||
|
DicomEvent.$emit('setMeasuredToolsPassive')
|
||||||
|
}
|
||||||
|
loading.close()
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
loading.close()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async handleClose() {
|
||||||
|
this.$emit('close')
|
||||||
|
},
|
||||||
|
setState() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (this.isCurrentTask && this.readingTaskState < 2) {
|
||||||
|
// 是否要将是否可测量设置为否?
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.measurement-form{
|
||||||
|
/deep/ .el-form-item__label{
|
||||||
|
color: #c3c3c3;
|
||||||
|
}
|
||||||
|
/deep/ .el-input .el-input__inner{
|
||||||
|
background-color: transparent;
|
||||||
|
color: #ddd;
|
||||||
|
border: 1px solid #5e5e5e;
|
||||||
|
}
|
||||||
|
/deep/ .el-form-item{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
/deep/ .el-form-item__content{
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
/deep/ .el-input.is-disabled .el-input__inner{
|
||||||
|
background-color: #646464a1;
|
||||||
|
}
|
||||||
|
/deep/ .el-select.is-disabled .el-input__inner{
|
||||||
|
background-color: #646464a1;
|
||||||
|
}
|
||||||
|
/deep/ .el-button--mini, .el-button--mini.is-round {
|
||||||
|
padding: 7px 10px;
|
||||||
|
}
|
||||||
|
.el-form-item__content
|
||||||
|
.el-select{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.input-width1{
|
||||||
|
width: calc(100% -60px)!important;
|
||||||
|
}
|
||||||
|
.input-width2{
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
|
@ -0,0 +1,616 @@
|
||||||
|
<template>
|
||||||
|
<div class="measurement-wrapper">
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="basic-info">
|
||||||
|
<h3 v-if="isReadingShowSubjectInfo">
|
||||||
|
<span v-if="subjectCode">{{ subjectCode }} </span>
|
||||||
|
<span style="margin-left:5px;">{{ taskBlindName }}</span>
|
||||||
|
</h3>
|
||||||
|
<div v-if="readingTaskState < 2">
|
||||||
|
<el-tooltip class="item" effect="dark" :content="$t('trials:dicomReading:message:confirmReset')" placement="bottom">
|
||||||
|
<i
|
||||||
|
class="el-icon-refresh-left"
|
||||||
|
@click="resetMeasuredData"
|
||||||
|
/>
|
||||||
|
</el-tooltip>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 非测量问题 -->
|
||||||
|
<div class="lesions">
|
||||||
|
<Questions ref="ecrf" :groupClassify="1" :question-form-change-state="questionFormChangeState" :question-form-change-num="questionFormChangeNum" />
|
||||||
|
</div>
|
||||||
|
<!-- 测量问题 -->
|
||||||
|
<template >
|
||||||
|
<div v-for="(qs,index) in questions" :key="index" v-loading="loading" class="lesions lesions_wrapper">
|
||||||
|
<h4 v-if="qs.Type === 'group'" style="color: #ddd;padding: 5px 0px;margin: 0;">
|
||||||
|
{{ language==='en'?qs.GroupEnName:qs.GroupName }}
|
||||||
|
</h4>
|
||||||
|
<div class="lesion_list">
|
||||||
|
<div v-for="item in qs.Childrens" v-show="!(isBaseLineTask && item.LesionType === 2)" :key="item.Id">
|
||||||
|
<div v-if="item.Type === 'table'" class="flex-row" style="margin:3px 0;">
|
||||||
|
<div class="title">{{ item.QuestionName }}</div>
|
||||||
|
</div>
|
||||||
|
<div style="color: #ddd;text-align: left;padding: 5px 10px;border-bottom: 1px solid #5a5a5a; font-size: 15px;">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="7">分段</el-col>
|
||||||
|
<el-col :span="8">是否可测量</el-col>
|
||||||
|
<el-col :span="6">平均值</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-collapse
|
||||||
|
v-if="item.Type === 'table' && item.TableQuestions"
|
||||||
|
v-model="activeName"
|
||||||
|
accordion
|
||||||
|
@change="handleCollapseChange"
|
||||||
|
>
|
||||||
|
<el-collapse-item
|
||||||
|
v-for="(q,i) in item.TableQuestions.Answers"
|
||||||
|
:key="`${item.Id}_${q.RowIndex}`"
|
||||||
|
:name="`${item.Id}_${q.RowIndex}`"
|
||||||
|
@contextmenu.prevent.native="collapseRightClick($event,q,item.Id,q.RowIndex)"
|
||||||
|
>
|
||||||
|
<template slot="title">
|
||||||
|
<div style="width:300px;position: relative;" :style="{color:(activeName===item.Id+q.RowIndex?'#ffeb3b':'#fff')}">
|
||||||
|
|
||||||
|
{{ getLesionName(item.TableQuestions.Questions, q) }}
|
||||||
|
<!-- 未保存 -->
|
||||||
|
<el-tooltip v-if="readingTaskState<2 && parseInt(item.TableQuestions.Answers[i].saveTypeEnum) === 0" class="item" effect="dark" :content="$t('trials:reading:button:unsaved')" placement="bottom">
|
||||||
|
<i class="el-icon-warning" style="color:red" />
|
||||||
|
</el-tooltip>
|
||||||
|
<!-- 信息不完整 -->
|
||||||
|
<el-tooltip v-if="readingTaskState<2 && parseInt(item.TableQuestions.Answers[i].saveTypeEnum) ===1" class="item" effect="dark" :content="$t('trials:reading:button:incompleteInfor')" placement="bottom">
|
||||||
|
<i class="el-icon-warning" style="color:#ff9800" />
|
||||||
|
</el-tooltip>
|
||||||
|
<div style="position: absolute;left: 90px;top: 2px;">
|
||||||
|
<!-- white-space: nowrap;overflow: hidden;text-overflow: ellipsis; -->
|
||||||
|
<div style="font-size: 13px;width:220px;height: 30px;">
|
||||||
|
<div style="display: inline-block;margin-left:10px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;width:110px">
|
||||||
|
{{ $fd('ReadingYesOrNo', parseInt(item.TableQuestions.Answers[i].isMeasurable)) }}
|
||||||
|
</div>
|
||||||
|
<div style="display: inline-block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;width:80px">
|
||||||
|
{{ item.TableQuestions.Answers[i].mean }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<QuestionForm
|
||||||
|
:ref="`${item.Id}_${q.RowIndex}`"
|
||||||
|
:questions="item.TableQuestions.Questions"
|
||||||
|
:answers="item.TableQuestions.Answers[i]"
|
||||||
|
:lesion-type="item.LesionType"
|
||||||
|
:order-mark="item.OrderMark"
|
||||||
|
:table-questions="tableQuestions"
|
||||||
|
:row-index="String(q.RowIndex)"
|
||||||
|
:question-name="item.QuestionName"
|
||||||
|
:parent-qs-id="item.Id"
|
||||||
|
:visit-task-id="visitTaskId"
|
||||||
|
:is-current-task="isCurrentTask"
|
||||||
|
:reading-task-state="readingTaskState"
|
||||||
|
:is-base-line-task="isBaseLineTask"
|
||||||
|
@getReadingQuestionAndAnswer="getReadingQuestionAndAnswer"
|
||||||
|
@resetQuestions="resetQuestions"
|
||||||
|
@close="close"
|
||||||
|
/>
|
||||||
|
</el-collapse-item>
|
||||||
|
|
||||||
|
</el-collapse>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { splitLesion } from '@/api/trials'
|
||||||
|
import { resetReadingTask } from '@/api/reading'
|
||||||
|
import DicomEvent from './../DicomEvent'
|
||||||
|
import store from '@/store'
|
||||||
|
import { mapGetters } from 'vuex'
|
||||||
|
import Questions from './../Questions'
|
||||||
|
import QuestionForm from './QuestionForm'
|
||||||
|
export default {
|
||||||
|
name: 'MeasurementList',
|
||||||
|
components: {
|
||||||
|
Questions,
|
||||||
|
QuestionForm
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
isShow: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
isReadingShowSubjectInfo: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
questionFormChangeState: {
|
||||||
|
type: Boolean,
|
||||||
|
default() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
questionFormChangeNum: {
|
||||||
|
type: Number,
|
||||||
|
default() {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
questions: [],
|
||||||
|
activeName: '',
|
||||||
|
activeItem: {
|
||||||
|
activeRowIndex: null,
|
||||||
|
activeCollapseId: null
|
||||||
|
},
|
||||||
|
visitTaskId: '',
|
||||||
|
isCurrentTask: false,
|
||||||
|
loading: false,
|
||||||
|
unSaveTargets: [],
|
||||||
|
temporaryLesions: [],
|
||||||
|
readingTaskState: 2,
|
||||||
|
isBaseLineTask: false,
|
||||||
|
taskBlindName: '',
|
||||||
|
tableQuestions: [],
|
||||||
|
isFirstRender: false,
|
||||||
|
CriterionType: null,
|
||||||
|
subjectCode: '',
|
||||||
|
liverSegmentId: '',
|
||||||
|
liverSegmentDicCode: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(['visitTaskList', 'language', 'lastCanvasTaskId', 'currentReadingTaskState'])
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
lastCanvasTaskId: {
|
||||||
|
immediate: true,
|
||||||
|
handler(val) {
|
||||||
|
if (val) {
|
||||||
|
this.initList()
|
||||||
|
}
|
||||||
|
console.log('lastCanvasTaskId', val)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
currentReadingTaskState: {
|
||||||
|
immediate: true,
|
||||||
|
handler(val) {
|
||||||
|
if (val) {
|
||||||
|
this.readingTaskState = val
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
// this.subjectCode = this.$router.currentRoute.query.subjectCode
|
||||||
|
this.subjectCode = localStorage.getItem('subjectCode')
|
||||||
|
this.CriterionType = parseInt(localStorage.getItem('CriterionType'))
|
||||||
|
DicomEvent.$on('setCollapseActive', measureData => {
|
||||||
|
this.setCollapseActive(measureData)
|
||||||
|
console.log('setCollapseActive')
|
||||||
|
})
|
||||||
|
DicomEvent.$on('getAllUnSaveLesions', (callback) => {
|
||||||
|
var list = this.getAllUnSaveLesions()
|
||||||
|
callback(list)
|
||||||
|
console.log('getAllUnSaveLesions')
|
||||||
|
})
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
DicomEvent.$off('setCollapseActive')
|
||||||
|
DicomEvent.$off('getUnSaveTarget')
|
||||||
|
DicomEvent.$off('getAllUnSaveLesions')
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async initList() {
|
||||||
|
var i = this.visitTaskList.findIndex(i => i.VisitTaskId === this.lastCanvasTaskId)
|
||||||
|
if (i > -1) {
|
||||||
|
this.visitTaskId = this.visitTaskList[i].VisitTaskId
|
||||||
|
this.taskBlindName = this.visitTaskList[i].TaskBlindName
|
||||||
|
this.readingTaskState = this.visitTaskList[i].ReadingTaskState
|
||||||
|
this.isBaseLineTask = this.visitTaskList[i].IsBaseLineTask
|
||||||
|
this.isCurrentTask = this.visitTaskList[i].IsCurrentTask
|
||||||
|
this.activeName = ''
|
||||||
|
this.activeItem.activeRowIndex = null
|
||||||
|
this.activeItem.activeCollapseId = null
|
||||||
|
if (!this.visitTaskList[i].IsInit) {
|
||||||
|
var loading = this.$loading({ fullscreen: true })
|
||||||
|
var triald = this.trialId = this.$router.currentRoute.query.trialId
|
||||||
|
if (!this.visitTaskList[i].measureDataInit) {
|
||||||
|
await store.dispatch('reading/getMeasuredData', this.visitTaskList[i].VisitTaskId)
|
||||||
|
}
|
||||||
|
if (!this.visitTaskList[i].studyListInit) {
|
||||||
|
await store.dispatch('reading/getStudyInfo', { trialId: triald, subjectVisitId: this.visitTaskList[i].VisitId, visitTaskId: this.visitTaskList[i].VisitTaskId, taskBlindName: this.visitTaskList[i].TaskBlindName })
|
||||||
|
}
|
||||||
|
if (!this.visitTaskList[i].readingQuestionsInit) {
|
||||||
|
await store.dispatch('reading/getReadingQuestionAndAnswer', { trialId: triald, visitTaskId: this.visitTaskList[i].VisitTaskId })
|
||||||
|
}
|
||||||
|
if (!this.visitTaskList[i].questionsInit) {
|
||||||
|
await store.dispatch('reading/getDicomReadingQuestionAnswer', { trialId: triald, visitTaskId: this.visitTaskList[i].VisitTaskId })
|
||||||
|
}
|
||||||
|
|
||||||
|
await store.dispatch('reading/setStatus', { visitTaskId: this.visitTaskList[i].VisitTaskId })
|
||||||
|
loading.close()
|
||||||
|
}
|
||||||
|
this.questions = this.visitTaskList[i].ReadingQuestions
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs['ecrf'].getQuestions(this.visitTaskId)
|
||||||
|
this.getTableQuestions()
|
||||||
|
this.tableQuestions.forEach(item => {
|
||||||
|
item.TableQuestions.Answers.forEach(i => {
|
||||||
|
var refName = `${item.Id}_${i.RowIndex}`
|
||||||
|
this.$refs[refName] && this.$refs[refName][0].initForm()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async resetQuestions(obj) {
|
||||||
|
this.setQuestions(this.questions, obj)
|
||||||
|
await store.dispatch('reading/setReadingQuestionAndAnswer', { questions: this.questions, visitTaskId: this.visitTaskId })
|
||||||
|
|
||||||
|
this.getTableQuestions()
|
||||||
|
},
|
||||||
|
setQuestions(questions, obj) {
|
||||||
|
questions.forEach(item => {
|
||||||
|
if (item.Type === 'table' && item.Id === obj.questionId) {
|
||||||
|
var idx = item.TableQuestions.Answers.findIndex(i => i.RowIndex === obj.rowIndex)
|
||||||
|
item.TableQuestions.Answers[idx].isMeasurable = obj.isMeasurable
|
||||||
|
console.log(obj.isMeasurable)
|
||||||
|
item.TableQuestions.Answers[idx].mean = obj.mean
|
||||||
|
item.TableQuestions.Answers[idx].saveTypeEnum = obj.saveTypeEnum
|
||||||
|
|
||||||
|
for (const i in obj.anwsers) {
|
||||||
|
if (i === 'MeasureData' && obj.anwsers[i]) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
item.TableQuestions.Answers[idx][i] = String(obj.anwsers[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (item.Childrens.length > 0) {
|
||||||
|
this.setQuestions(item.Childrens, obj)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getQuestions(questions) {
|
||||||
|
questions.forEach(item => {
|
||||||
|
if (item.Type === 'table' && item.TableQuestions && item.TableQuestions.Answers.length > 0) {
|
||||||
|
item.TableQuestions.Answers.forEach(answerObj => {
|
||||||
|
let isMeasurable = this.getQuestionAnswer(item.TableQuestions.Questions, 1105, answerObj)
|
||||||
|
this.$set(answerObj, 'isMeasurable', isMeasurable)
|
||||||
|
this.$set(answerObj, 'mean', this.getQuestionAnswer(item.TableQuestions.Questions, 1104, answerObj))
|
||||||
|
if (answerObj.RowId) {
|
||||||
|
this.$set(answerObj, 'saveTypeEnum', isNaN(parseInt(isMeasurable)) ? 1 : 2)
|
||||||
|
} else {
|
||||||
|
this.$set(answerObj, 'saveTypeEnum', 0)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (item.Childrens.length > 0) {
|
||||||
|
this.getQuestions(item.Childrens)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return questions
|
||||||
|
},
|
||||||
|
getTableQuestions() {
|
||||||
|
this.tableQuestions = []
|
||||||
|
this.questions.map(item => {
|
||||||
|
if (item.Type === 'table') {
|
||||||
|
this.tableQuestions.push(item)
|
||||||
|
}
|
||||||
|
if (item.Childrens.length > 0) {
|
||||||
|
this.getTableQuestionsChild(item.Childrens)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getTableQuestionsChild(obj) {
|
||||||
|
obj.map(item => {
|
||||||
|
if (item.Type === 'table') {
|
||||||
|
this.tableQuestions.push(item)
|
||||||
|
}
|
||||||
|
if (item.Childrens.length > 0) {
|
||||||
|
this.getTableQuestionsChild(item.Childrens)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
refreshReadingQuestionAndAnswer(type) {
|
||||||
|
if (type === 0) {
|
||||||
|
// 删除
|
||||||
|
this.activeName = ''
|
||||||
|
this.activeItem.activeRowIndex = null
|
||||||
|
this.activeItem.activeCollapseId = null
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getReadingQuestionAndAnswer(this.visitTaskId)
|
||||||
|
},
|
||||||
|
getReadingQuestionAndAnswer(showLoading = true) {
|
||||||
|
return new Promise(async resolve => {
|
||||||
|
try {
|
||||||
|
let loading = null
|
||||||
|
if (showLoading) {
|
||||||
|
loading = this.$loading({ fullscreen: true })
|
||||||
|
}
|
||||||
|
await store.dispatch('reading/refreshReadingQuestionAndAnswer', { trialId: this.$router.currentRoute.query.trialId, visitTaskId: this.visitTaskId }).then(() => {
|
||||||
|
var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId)
|
||||||
|
if (idx > -1) {
|
||||||
|
if (this.visitTaskList[idx].ReadingQuestions.length > 0) {
|
||||||
|
this.questions = this.visitTaskList[idx].ReadingQuestions
|
||||||
|
}
|
||||||
|
this.readingTaskState = this.visitTaskList[idx].ReadingTaskState
|
||||||
|
this.isBaseLineTask = this.visitTaskList[idx].IsBaseLineTask
|
||||||
|
this.isCurrentTask = this.visitTaskList[idx].IsCurrentTask
|
||||||
|
}
|
||||||
|
this.getTableQuestions()
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.tableQuestions.forEach(item => {
|
||||||
|
item.TableQuestions.Answers.forEach(i => {
|
||||||
|
var refName = `${item.Id}_${i.RowIndex}`
|
||||||
|
this.$refs[refName] && this.$refs[refName][0].initForm()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
await store.dispatch('reading/refreshMeasuredData', this.visitTaskId)
|
||||||
|
DicomEvent.$emit('getMeasureData')
|
||||||
|
|
||||||
|
loading ? loading.close() : ''
|
||||||
|
resolve()
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
loading ? loading.close() : ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getQuestionAnswer(questions, questionMark, answers) {
|
||||||
|
var idx = questions.findIndex(i => i.QuestionMark === questionMark)
|
||||||
|
if (idx > -1) {
|
||||||
|
var questionId = questions[idx].Id
|
||||||
|
return answers[questionId]
|
||||||
|
} else {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isCanActiveTool(toolName) {
|
||||||
|
return { isCanActiveTool: true, reason: '' }
|
||||||
|
},
|
||||||
|
|
||||||
|
checkToolCanActive(toolName) {
|
||||||
|
return { isCanActiveTool: true, reason: '' }
|
||||||
|
},
|
||||||
|
|
||||||
|
getLesionName(questions, q) {
|
||||||
|
let liverSegmentStr = ''
|
||||||
|
if (!this.liverSegmentId) {
|
||||||
|
let i = questions.findIndex(i=>i.QuestionMark === 1106)
|
||||||
|
if (i === -1) return
|
||||||
|
this.liverSegmentId = questions[i].Id
|
||||||
|
this.liverSegmentDicCode = questions[i].DictionaryCode
|
||||||
|
}
|
||||||
|
if (q && q[this.liverSegmentId]) {
|
||||||
|
liverSegmentStr = this.$fd(this.liverSegmentDicCode, parseInt(q[this.liverSegmentId]))
|
||||||
|
}
|
||||||
|
return liverSegmentStr
|
||||||
|
},
|
||||||
|
handleCollapseChange(val) {
|
||||||
|
if (this.activeName) {
|
||||||
|
var arr = this.activeName.split('_')
|
||||||
|
this.activeItem.activeRowIndex = arr[1]
|
||||||
|
this.activeItem.activeCollapseId = arr[0]
|
||||||
|
this.$nextTick(() => {
|
||||||
|
const refName = `${this.activeItem.activeCollapseId}_${this.activeItem.activeRowIndex}`
|
||||||
|
if (this.$refs[refName][0].questionForm.IsDicomReading !== false) {
|
||||||
|
var markTool = this.$refs[refName][0].currentMarkTool
|
||||||
|
var readingTaskState = this.readingTaskState
|
||||||
|
var isMarked = !!this.$refs[refName][0].questionForm.MeasureData
|
||||||
|
DicomEvent.$emit('imageLocation', { questionId: this.activeItem.activeCollapseId, rowIndex: this.activeItem.activeRowIndex, visitTaskId: this.visitTaskId, lesionName: this.$refs[refName][0].lesionMark, lesionType: this.$refs[refName][0].lesionType, markTool, readingTaskState, isMarked })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.activeItem.activeRowIndex = null
|
||||||
|
this.activeItem.activeCollapseId = null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
collapseRightClick(e, obj, activeCollapseId, activeRowIndex) {
|
||||||
|
if (obj.IsDicomReading !== false) {
|
||||||
|
const refName = `${activeCollapseId}_${activeRowIndex}`
|
||||||
|
DicomEvent.$emit('imageLocation', { questionId: activeCollapseId, rowIndex: activeRowIndex, visitTaskId: this.visitTaskId, lesionName: this.$refs[refName][0].lesionMark, lesionType: this.$refs[refName][0].lesionType })
|
||||||
|
}
|
||||||
|
e.stopImmediatePropagation()
|
||||||
|
e.stopPropagation()
|
||||||
|
e.preventDefault()
|
||||||
|
},
|
||||||
|
setCollapseActive(measureData) {
|
||||||
|
if (measureData) {
|
||||||
|
if (this.activeItem.activeRowIndex === measureData.RowIndex && this.activeItem.activeCollapseId === measureData.QuestionId) {
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
this.activeItem.activeCollapseId = measureData.QuestionId
|
||||||
|
this.activeItem.activeRowIndex = measureData.RowIndex
|
||||||
|
this.activeName = `${this.activeItem.activeCollapseId}_${this.activeItem.activeRowIndex}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
modifyMeasuredData(measureObj) {
|
||||||
|
if (measureObj.questionInfo) {
|
||||||
|
this.activeItem.activeCollapseId = measureObj.questionInfo.QuestionId
|
||||||
|
this.activeItem.activeRowIndex = String(measureObj.questionInfo.RowIndex)
|
||||||
|
this.activeName = `${this.activeItem.activeCollapseId}_${this.activeItem.activeRowIndex}`
|
||||||
|
const refName = `${this.activeItem.activeCollapseId}_${this.activeItem.activeRowIndex}`
|
||||||
|
this.$refs[refName][0].setMeasureData(measureObj.measureData)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 设置测量数据
|
||||||
|
setMeasuredData(measureData) {
|
||||||
|
if (this.activeItem.activeCollapseId) {
|
||||||
|
// 判断是否存在测量数据
|
||||||
|
this.$nextTick(() => {
|
||||||
|
const refName = `${this.activeItem.activeCollapseId}_${this.activeItem.activeRowIndex}`
|
||||||
|
if (!this.$refs[refName][0].questionForm.MeasureData || (this.$refs[refName][0].questionForm && this.$refs[refName][0].questionForm.MeasureData && measureData.data.uuid === this.$refs[refName][0].questionForm.MeasureData.data.uuid)) {
|
||||||
|
this.$refs[refName][0].setMeasureData(measureData)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async close(questionsObj) {
|
||||||
|
if (questionsObj) {
|
||||||
|
this.getReadingQuestionAndAnswer(questionsObj.visitTaskId)
|
||||||
|
}
|
||||||
|
this.activeItem.activeRowIndex = null
|
||||||
|
this.activeItem.activeCollapseId = null
|
||||||
|
this.activeName = ''
|
||||||
|
},
|
||||||
|
getECRFQuestions(obj) {
|
||||||
|
this.$refs['ecrf'].getQuestions(obj.visitTaskId)
|
||||||
|
},
|
||||||
|
async resetMeasuredData() {
|
||||||
|
const confirm = await this.$confirm(
|
||||||
|
this.$t('trials:dicomReading:message:confirmReset1'),
|
||||||
|
this.$t('trials:dicomReading:message:confirmReset2'),
|
||||||
|
{
|
||||||
|
type: 'warning',
|
||||||
|
distinguishCancelAndClose: true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if (confirm !== 'confirm') return
|
||||||
|
const loading = this.$loading({ fullscreen: true })
|
||||||
|
try {
|
||||||
|
const res = await resetReadingTask({ visitTaskId: this.visitTaskId })
|
||||||
|
this.loading = false
|
||||||
|
if (res.IsSuccess) {
|
||||||
|
// 刷新标注、表单、报告页信息
|
||||||
|
this.activeName = ''
|
||||||
|
this.activeItem.activeRowIndex = null
|
||||||
|
this.activeItem.activeCollapseId = null
|
||||||
|
await this.getReadingQuestionAndAnswer(this.visitTaskId)
|
||||||
|
const triald = this.$router.currentRoute.query.trialId
|
||||||
|
await store.dispatch('reading/refreshDicomReadingQuestionAnswer', { trialId: triald, visitTaskId: this.visitTaskId })
|
||||||
|
this.$refs['ecrf'].getQuestions(this.visitTaskId, true)
|
||||||
|
DicomEvent.$emit('getMeasureData')
|
||||||
|
DicomEvent.$emit('getReportInfo', true)
|
||||||
|
DicomEvent.$emit('refreshStudyListMeasureData')
|
||||||
|
}
|
||||||
|
loading.close()
|
||||||
|
} catch (e) {
|
||||||
|
loading.close()
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getAllUnSaveLesions() {
|
||||||
|
var arr = []
|
||||||
|
this.tableQuestions.map(item => {
|
||||||
|
if (item.TableQuestions && item.TableQuestions.Answers) {
|
||||||
|
item.TableQuestions.Answers.map(t => {
|
||||||
|
const refName = `${item.Id}_${t.RowIndex}`
|
||||||
|
if (this.$refs[refName] && this.$refs[refName][0] && this.$refs[refName][0].questionForm.saveTypeEnum !== 2) {
|
||||||
|
var lessionName = this.getLesionName(item.OrderMark, t.RowIndex)
|
||||||
|
arr.push({ lessionName: lessionName, rowIndex: t.RowIndex, questionId: item.Id })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return arr
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.measurement-wrapper{
|
||||||
|
height: 100%;
|
||||||
|
overflow-y: auto;
|
||||||
|
// overflow: hidden;
|
||||||
|
|
||||||
|
.container{
|
||||||
|
padding: 10px;
|
||||||
|
.basic-info{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
h3{
|
||||||
|
color: #ddd;
|
||||||
|
padding: 5px 0px;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
i{
|
||||||
|
color: #fff;
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: bold;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.title{
|
||||||
|
padding: 5px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #ddd;
|
||||||
|
font-size: 15px;
|
||||||
|
|
||||||
|
}
|
||||||
|
.add-icon{
|
||||||
|
padding: 5px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #ddd;
|
||||||
|
font-size: 15px;
|
||||||
|
border: 1px solid #938b8b;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.add-icon:hover{
|
||||||
|
background-color: #607d8b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-row{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
background-color: #424242;
|
||||||
|
|
||||||
|
}
|
||||||
|
.lesion_list{
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.el-collapse{
|
||||||
|
border-bottom:none;
|
||||||
|
border-top:none;
|
||||||
|
/deep/ .el-collapse-item{
|
||||||
|
background-color: #000!important;
|
||||||
|
color: #ddd;
|
||||||
|
|
||||||
|
}
|
||||||
|
/deep/ .el-collapse-item__header{
|
||||||
|
background-color: #000!important;
|
||||||
|
color: #ddd;
|
||||||
|
border-bottom-color:#5a5a5a;
|
||||||
|
padding-left: 5px;
|
||||||
|
height: 35px;
|
||||||
|
line-height: 35px;
|
||||||
|
}
|
||||||
|
/deep/ .el-collapse-item__wrap{
|
||||||
|
background-color: #000!important;
|
||||||
|
color: #ddd;
|
||||||
|
}
|
||||||
|
/deep/ .el-collapse-item__content{
|
||||||
|
width:260px;
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
right: 0px;
|
||||||
|
// border: 1px solid #ffeb3b;
|
||||||
|
border: 1px solid #fff;
|
||||||
|
z-index: 1;
|
||||||
|
color: #ddd;
|
||||||
|
padding: 5px;
|
||||||
|
background-color:#1e1e1e;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -373,13 +373,13 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async beforeLeave() {
|
async beforeLeave() {
|
||||||
if (this.questionFormChangeState && this.CriterionType !== 2) {
|
// if (this.questionFormChangeState && this.CriterionType !== 2) {
|
||||||
var msg = this.$t('trials:readingReport:message:msg5')
|
// var msg = this.$t('trials:readingReport:message:msg5')
|
||||||
var isgo = await this.myConfirm(msg)
|
// var isgo = await this.myConfirm(msg)
|
||||||
if (!isgo) {
|
// if (!isgo) {
|
||||||
return Promise.resolve(true)
|
// return Promise.resolve(true)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
var list = null
|
var list = null
|
||||||
DicomEvent.$emit('getAllUnSaveLesions', val => {
|
DicomEvent.$emit('getAllUnSaveLesions', val => {
|
||||||
list = val
|
list = val
|
||||||
|
|
|
@ -0,0 +1,404 @@
|
||||||
|
import * as cornerstoneTools from 'cornerstone-tools'
|
||||||
|
const external = cornerstoneTools.external
|
||||||
|
// State
|
||||||
|
const getToolState = cornerstoneTools.getToolState
|
||||||
|
const textStyle = cornerstoneTools.textStyle
|
||||||
|
const toolColors = cornerstoneTools.toolColors
|
||||||
|
const toolStyle = cornerstoneTools.toolStyle
|
||||||
|
// Drawing
|
||||||
|
const getNewContext = cornerstoneTools.import('drawing/getNewContext')
|
||||||
|
const draw = cornerstoneTools.import('drawing/draw')
|
||||||
|
const drawHandles = cornerstoneTools.import('drawing/drawHandles')
|
||||||
|
const drawTextBox = cornerstoneTools.import('drawing/drawTextBox')
|
||||||
|
// Utilities
|
||||||
|
const getRGBPixels = cornerstoneTools.import('util/getRGBPixels')
|
||||||
|
const calculateSUV = cornerstoneTools.import('util/calculateSUV')
|
||||||
|
// import { probeCursor } from '../cursors/index.js';
|
||||||
|
// import { getLogger } from '../../util/logger.js';
|
||||||
|
const throttle = cornerstoneTools.import('util/throttle')
|
||||||
|
const getModule = cornerstoneTools.getModule
|
||||||
|
const getPixelSpacing = cornerstoneTools.import('util/getPixelSpacing')
|
||||||
|
// import numbersWithCommas from './../../util/numbersWithCommas.js';
|
||||||
|
const numbersWithCommas = cornerstoneTools.import('util/numbersWithCommas')
|
||||||
|
// const logger = getLogger('tools:annotation:ProbeTool');
|
||||||
|
import calculateEllipseStatistics from './calculateEllipseStatistics'
|
||||||
|
import getCircleCoords from './getCircleCoords'
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
* @class ProbeTool
|
||||||
|
* @memberof Tools.Annotation
|
||||||
|
* @classdesc Tool which provides a probe of the image data at the
|
||||||
|
* desired position.
|
||||||
|
* @extends Tools.Base.BaseAnnotationTool
|
||||||
|
*/
|
||||||
|
export default class ProbeTool extends cornerstoneTools.ProbeTool {
|
||||||
|
constructor(props = {}) {
|
||||||
|
const defaultProps = {
|
||||||
|
name: 'Probe',
|
||||||
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
||||||
|
// svgCursor: probeCursor,
|
||||||
|
configuration: {
|
||||||
|
drawHandles: true,
|
||||||
|
renderDashed: false,
|
||||||
|
handleRadius: 0,
|
||||||
|
fixedRadius: 0,
|
||||||
|
hideHandlesIfMoving: false,
|
||||||
|
digits: 1,
|
||||||
|
showRadius: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
super(props, defaultProps);
|
||||||
|
|
||||||
|
this.throttledUpdateCachedStats = throttle(this.updateCachedStats, 110);
|
||||||
|
}
|
||||||
|
|
||||||
|
createNewMeasurement(eventData) {
|
||||||
|
const goodEventData =
|
||||||
|
eventData && eventData.currentPoints && eventData.currentPoints.image;
|
||||||
|
|
||||||
|
if (!goodEventData) {
|
||||||
|
logger.error(
|
||||||
|
`required eventData not supplied to tool ${this.name}'s createNewMeasurement`
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
visible: true,
|
||||||
|
active: true,
|
||||||
|
color: undefined,
|
||||||
|
invalidated: true,
|
||||||
|
handles: {
|
||||||
|
// start: {
|
||||||
|
// x: eventData.currentPoints.image.x,
|
||||||
|
// y: eventData.currentPoints.image.y,
|
||||||
|
// highlight: true,
|
||||||
|
// active: false,
|
||||||
|
// },
|
||||||
|
end: {
|
||||||
|
x: eventData.currentPoints.image.x,
|
||||||
|
y: eventData.currentPoints.image.y,
|
||||||
|
highlight: true,
|
||||||
|
active: true,
|
||||||
|
radius: 0
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param {*} element
|
||||||
|
* @param {*} data
|
||||||
|
* @param {*} coords
|
||||||
|
* @returns {Boolean}
|
||||||
|
*/
|
||||||
|
pointNearTool(element, data, coords) {
|
||||||
|
const hasEndHandle = data && data.handles && data.handles.end;
|
||||||
|
const validParameters = hasEndHandle;
|
||||||
|
|
||||||
|
if (!validParameters) {
|
||||||
|
logger.warn(
|
||||||
|
`invalid parameters supplied to tool ${this.name}'s pointNearTool`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!validParameters || data.visible === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const probeCoords = external.cornerstone.pixelToCanvas(
|
||||||
|
element,
|
||||||
|
data.handles.end
|
||||||
|
);
|
||||||
|
|
||||||
|
return external.cornerstoneMath.point.distance(probeCoords, coords) < 5;
|
||||||
|
}
|
||||||
|
// pointNearTool(element, data, coords) {
|
||||||
|
// const hasEndHandle = data && data.handles && data.handles.end;
|
||||||
|
// const validParameters = hasEndHandle;
|
||||||
|
|
||||||
|
// if (!validParameters) {
|
||||||
|
// logger.warn(
|
||||||
|
// `invalid parameters supplied to tool ${this.name}'s pointNearTool`
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (!validParameters || data.visible === false) {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// // data.handles.end.x = data.handles.end.x + 10
|
||||||
|
// let endCoords = {
|
||||||
|
// x: data.handles.end.x + 50,
|
||||||
|
// y: data.handles.end.y,
|
||||||
|
// highlight: data.handles.end.highlight,
|
||||||
|
// active: data.handles.end.active,
|
||||||
|
// }
|
||||||
|
// const probeCoords = external.cornerstone.pixelToCanvas(
|
||||||
|
// element,
|
||||||
|
// endCoords
|
||||||
|
// );
|
||||||
|
|
||||||
|
// return external.cornerstoneMath.point.distance(probeCoords, coords) < 5;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// updateCachedStats(image, element, data) {
|
||||||
|
// const x = Math.round(data.handles.end.x);
|
||||||
|
// const y = Math.round(data.handles.end.y);
|
||||||
|
|
||||||
|
// const stats = {};
|
||||||
|
|
||||||
|
// if (x >= 0 && y >= 0 && x < image.columns && y < image.rows) {
|
||||||
|
// stats.x = x;
|
||||||
|
// stats.y = y;
|
||||||
|
|
||||||
|
// if (image.color) {
|
||||||
|
// stats.storedPixels = getRGBPixels(element, x, y, 1, 1);
|
||||||
|
// } else {
|
||||||
|
// stats.storedPixels = external.cornerstone.getStoredPixels(
|
||||||
|
// element,
|
||||||
|
// x,
|
||||||
|
// y,
|
||||||
|
// 1,
|
||||||
|
// 1
|
||||||
|
// );
|
||||||
|
// stats.sp = stats.storedPixels[0];
|
||||||
|
// stats.mo = stats.sp * image.slope + image.intercept;
|
||||||
|
// stats.suv = calculateSUV(image, stats.sp);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// data.cachedStats = stats;
|
||||||
|
// data.invalidated = false;
|
||||||
|
// }
|
||||||
|
updateCachedStats(image, element, data) {
|
||||||
|
const seriesModule =
|
||||||
|
external.cornerstone.metaData.get('generalSeriesModule', image.imageId) ||
|
||||||
|
{};
|
||||||
|
const modality = seriesModule.modality;
|
||||||
|
const pixelSpacing = getPixelSpacing(image);
|
||||||
|
const { fixedRadius, digits } = this.configuration;
|
||||||
|
const stats = _calculateStats(
|
||||||
|
image,
|
||||||
|
element,
|
||||||
|
data.handles,
|
||||||
|
modality,
|
||||||
|
pixelSpacing,
|
||||||
|
fixedRadius,
|
||||||
|
digits
|
||||||
|
);
|
||||||
|
|
||||||
|
data.cachedStats = stats;
|
||||||
|
data.invalidated = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
renderToolData(evt) {
|
||||||
|
const eventData = evt.detail;
|
||||||
|
const { fixedRadius, renderDashed } = this.configuration;
|
||||||
|
const toolData = getToolState(evt.currentTarget, this.name);
|
||||||
|
|
||||||
|
if (!toolData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We have tool data for this element - iterate over each one and draw it
|
||||||
|
const context = getNewContext(eventData.canvasContext.canvas);
|
||||||
|
const { image, element } = eventData;
|
||||||
|
const fontHeight = textStyle.getFontSize();
|
||||||
|
const lineDash = getModule('globalConfiguration').configuration.lineDash;
|
||||||
|
const pixelSpacing = getPixelSpacing(image);
|
||||||
|
// Meta
|
||||||
|
const seriesModule =
|
||||||
|
external.cornerstone.metaData.get('generalSeriesModule', image.imageId) ||
|
||||||
|
{};
|
||||||
|
|
||||||
|
// Pixel Spacing
|
||||||
|
const modality = seriesModule.modality;
|
||||||
|
const hasPixelSpacing = pixelSpacing && pixelSpacing.rowPixelSpacing && pixelSpacing.colPixelSpacing;
|
||||||
|
for (let i = 0; i < toolData.data.length; i++) {
|
||||||
|
const data = toolData.data[i];
|
||||||
|
if (data.visible === false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
draw(context, context => {
|
||||||
|
const color = toolColors.getColorIfActive(data);
|
||||||
|
|
||||||
|
if (this.configuration.drawHandles) {
|
||||||
|
// Draw the handles
|
||||||
|
let radius = getCanvasRadius(data.handles, fixedRadius, element, pixelSpacing)
|
||||||
|
data.handles.end.radius = radius
|
||||||
|
const handleOptions = { handleRadius: radius, color };
|
||||||
|
|
||||||
|
if (renderDashed) {
|
||||||
|
handleOptions.lineDash = lineDash;
|
||||||
|
}
|
||||||
|
drawHandles(context, eventData, data.handles, handleOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update textbox stats
|
||||||
|
if (data.invalidated === true) {
|
||||||
|
if (data.cachedStats) {
|
||||||
|
this.throttledUpdateCachedStats(image, element, data);
|
||||||
|
} else {
|
||||||
|
this.updateCachedStats(image, element, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// let text, str;
|
||||||
|
let textLines = []
|
||||||
|
const { x, y, area, mean, radius } = data.cachedStats;
|
||||||
|
|
||||||
|
if (x >= 0 && y >= 0 && x < image.columns && y < image.rows) {
|
||||||
|
// text = `${x}, ${y}`;
|
||||||
|
if (data.remark) {
|
||||||
|
textLines.push(`${data.remark}`)
|
||||||
|
}
|
||||||
|
if (!image.color) {
|
||||||
|
// Draw text
|
||||||
|
let unit = _getUnit(modality, this.configuration.showHounsfieldUnits);
|
||||||
|
|
||||||
|
// textLines.push(_formatArea(area, hasPixelSpacing));
|
||||||
|
if (mean) {
|
||||||
|
// str += `mean: ${parseFloat(mean.toFixed(3))}`;
|
||||||
|
textLines.push(`Mean: ${mean} ${unit}`)
|
||||||
|
}
|
||||||
|
// if (radius) {
|
||||||
|
// str += `radius: ${parseFloat(radius.toFixed(3))}`;
|
||||||
|
// textLines.push(`radius: ${parseFloat(radius.toFixed(3))}`)
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
let r = getPixelRadius(fixedRadius, pixelSpacing)
|
||||||
|
// Coords for text
|
||||||
|
const coords = {
|
||||||
|
// Translate the x/y away from the cursor
|
||||||
|
x: data.handles.end.x + r,
|
||||||
|
y: data.handles.end.y - r,
|
||||||
|
};
|
||||||
|
const textCoords = external.cornerstone.pixelToCanvas(
|
||||||
|
eventData.element,
|
||||||
|
coords
|
||||||
|
);
|
||||||
|
drawTextBox(
|
||||||
|
context,
|
||||||
|
textLines,
|
||||||
|
textCoords.x,
|
||||||
|
textCoords.y ,
|
||||||
|
color
|
||||||
|
);
|
||||||
|
// drawTextBox(context, '', textCoords.x, textCoords.y, color);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function _getUnit(modality, showHounsfieldUnits) {
|
||||||
|
return modality === 'CT' && showHounsfieldUnits !== false ? 'HU' : '';
|
||||||
|
}
|
||||||
|
function _formatArea(area, hasPixelSpacing) {
|
||||||
|
const suffix = hasPixelSpacing
|
||||||
|
? ` mm${String.fromCharCode(178)}`
|
||||||
|
: ` px${String.fromCharCode(178)}`;
|
||||||
|
|
||||||
|
return `Area: ${numbersWithCommas(area.toFixed(2))}${suffix}`;
|
||||||
|
}
|
||||||
|
function getCanvasRadius(handles, fixedRadius, element, pixelSpacing) {
|
||||||
|
let startCoords = {
|
||||||
|
x: handles.end.x,
|
||||||
|
y: handles.end.y
|
||||||
|
}
|
||||||
|
const handleCanvasStartCoords = external.cornerstone.pixelToCanvas(
|
||||||
|
element,
|
||||||
|
startCoords
|
||||||
|
);
|
||||||
|
let r = getPixelRadius(fixedRadius, pixelSpacing)
|
||||||
|
let endCoords = {
|
||||||
|
x: handles.end.x + r,
|
||||||
|
y: handles.end.y
|
||||||
|
}
|
||||||
|
const handleCanvasEndCoords = external.cornerstone.pixelToCanvas(
|
||||||
|
element,
|
||||||
|
endCoords
|
||||||
|
);
|
||||||
|
return Math.abs(handleCanvasEndCoords.x - handleCanvasStartCoords.x)
|
||||||
|
}
|
||||||
|
function getPixelRadius(r, pixelSpacing) {
|
||||||
|
return r / ((pixelSpacing && pixelSpacing.colPixelSpacing) || 1)
|
||||||
|
}
|
||||||
|
function _calculateStats(image, element, handles, modality, pixelSpacing, fixedRadius, digits) {
|
||||||
|
// Retrieve the bounds of the ellipse in image coordinates
|
||||||
|
let startCoords = {
|
||||||
|
x: handles.end.x,
|
||||||
|
y: handles.end.y
|
||||||
|
}
|
||||||
|
let r = getPixelRadius(fixedRadius, pixelSpacing)
|
||||||
|
let endCoords = {
|
||||||
|
x: handles.end.x + r,
|
||||||
|
y: handles.end.y
|
||||||
|
}
|
||||||
|
const circleCoordinates = getCircleCoords(startCoords, endCoords);
|
||||||
|
|
||||||
|
// Retrieve the array of pixels that the ellipse bounds cover
|
||||||
|
const pixels = external.cornerstone.getPixels(
|
||||||
|
element,
|
||||||
|
circleCoordinates.left,
|
||||||
|
circleCoordinates.top,
|
||||||
|
circleCoordinates.width,
|
||||||
|
circleCoordinates.height
|
||||||
|
);
|
||||||
|
|
||||||
|
// Calculate the mean & standard deviation from the pixels and the ellipse details.
|
||||||
|
const ellipseMeanStdDev = calculateEllipseStatistics(
|
||||||
|
pixels,
|
||||||
|
circleCoordinates
|
||||||
|
);
|
||||||
|
|
||||||
|
let meanStdDevSUV;
|
||||||
|
|
||||||
|
if (modality === 'PT') {
|
||||||
|
meanStdDevSUV = {
|
||||||
|
mean: calculateSUV(image, ellipseMeanStdDev.mean, true) || 0,
|
||||||
|
stdDev: calculateSUV(image, ellipseMeanStdDev.stdDev, true) || 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const radius =
|
||||||
|
(circleCoordinates.width *
|
||||||
|
((pixelSpacing && pixelSpacing.colPixelSpacing) || 1)) /
|
||||||
|
2;
|
||||||
|
const perimeter = 2 * Math.PI * radius;
|
||||||
|
const area =
|
||||||
|
Math.PI *
|
||||||
|
((circleCoordinates.width *
|
||||||
|
((pixelSpacing && pixelSpacing.colPixelSpacing) || 1)) /
|
||||||
|
2) *
|
||||||
|
((circleCoordinates.height *
|
||||||
|
((pixelSpacing && pixelSpacing.rowPixelSpacing) || 1)) /
|
||||||
|
2);
|
||||||
|
const x = Math.round(handles.end.x);
|
||||||
|
const y = Math.round(handles.end.y);
|
||||||
|
|
||||||
|
const stats = {};
|
||||||
|
|
||||||
|
if (x >= 0 && y >= 0 && x < image.columns && y < image.rows) {
|
||||||
|
stats.x = x;
|
||||||
|
stats.y = y;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
area: area || 0,
|
||||||
|
radius: radius || 0,
|
||||||
|
perimeter: perimeter || 0,
|
||||||
|
mean: ellipseMeanStdDev.mean.toFixed(digits) || 0,
|
||||||
|
stdDev: ellipseMeanStdDev.stdDev.toFixed(digits) || 0,
|
||||||
|
min: ellipseMeanStdDev.min.toFixed(digits) || 0,
|
||||||
|
max: ellipseMeanStdDev.max.toFixed(digits) || 0,
|
||||||
|
meanStdDevSUV,
|
||||||
|
x: stats.x,
|
||||||
|
y: stats.y
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
import pointInEllipse from './pointInEllipse.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculates the statistics of an elliptical region of interest.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @function calculateEllipseStatistics
|
||||||
|
*
|
||||||
|
* @param {number[]} sp - Array of the image data's pixel values.
|
||||||
|
* @param {Object} ellipse - { top, left, height, width } - An object describing the ellipse.
|
||||||
|
* @returns {Object} { count, mean, variance, stdDev, min, max }
|
||||||
|
*/
|
||||||
|
export default function(sp, ellipse) {
|
||||||
|
let sum = 0;
|
||||||
|
let sumSquared = 0;
|
||||||
|
let count = 0;
|
||||||
|
let index = 0;
|
||||||
|
let min = null;
|
||||||
|
let max = null;
|
||||||
|
|
||||||
|
for (let y = ellipse.top; y < ellipse.top + ellipse.height; y++) {
|
||||||
|
for (let x = ellipse.left; x < ellipse.left + ellipse.width; x++) {
|
||||||
|
const point = {
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (pointInEllipse(ellipse, point)) {
|
||||||
|
if (min === null) {
|
||||||
|
min = sp[index];
|
||||||
|
max = sp[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
sum += sp[index];
|
||||||
|
sumSquared += sp[index] * sp[index];
|
||||||
|
min = Math.min(min, sp[index]);
|
||||||
|
max = Math.max(max, sp[index]);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count === 0) {
|
||||||
|
return {
|
||||||
|
count,
|
||||||
|
mean: 0.0,
|
||||||
|
variance: 0.0,
|
||||||
|
stdDev: 0.0,
|
||||||
|
min: 0.0,
|
||||||
|
max: 0.0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const mean = sum / count;
|
||||||
|
const variance = sumSquared / count - mean * mean;
|
||||||
|
|
||||||
|
return {
|
||||||
|
count,
|
||||||
|
mean,
|
||||||
|
variance,
|
||||||
|
stdDev: Math.sqrt(variance),
|
||||||
|
min,
|
||||||
|
max,
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
import * as cornerstoneTools from 'cornerstone-tools'
|
||||||
|
const external = cornerstoneTools.external
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the bounds of the circle in image coordinates
|
||||||
|
*
|
||||||
|
* @param {*} startHandle
|
||||||
|
* @param {*} endHandle
|
||||||
|
* @returns {{ left: number, top: number, width: number, height: number }}
|
||||||
|
*/
|
||||||
|
export default function getCircleCoords(startHandle, endHandle) {
|
||||||
|
const { distance } = external.cornerstoneMath.point
|
||||||
|
const radius = distance(startHandle, endHandle)
|
||||||
|
|
||||||
|
return {
|
||||||
|
left: Math.floor(Math.min(startHandle.x - radius, endHandle.x)),
|
||||||
|
top: Math.floor(Math.min(startHandle.y - radius, endHandle.y)),
|
||||||
|
width: radius * 2,
|
||||||
|
height: radius * 2
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
/**
|
||||||
|
* Returns true if a point is within an ellipse
|
||||||
|
* @export @public @method
|
||||||
|
* @name pointInEllipse
|
||||||
|
*
|
||||||
|
* @param {Object} ellipse Object defining the ellipse.
|
||||||
|
* @param {Object} location The location of the point.
|
||||||
|
* @returns {boolean} True if the point is within the ellipse.
|
||||||
|
*/
|
||||||
|
export default function(ellipse, location) {
|
||||||
|
const xRadius = ellipse.width / 2;
|
||||||
|
const yRadius = ellipse.height / 2;
|
||||||
|
|
||||||
|
if (xRadius <= 0.0 || yRadius <= 0.0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const center = {
|
||||||
|
x: ellipse.left + xRadius,
|
||||||
|
y: ellipse.top + yRadius,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This is a more general form of the circle equation
|
||||||
|
*
|
||||||
|
* X^2/a^2 + Y^2/b^2 <= 1
|
||||||
|
*/
|
||||||
|
|
||||||
|
const normalized = {
|
||||||
|
x: location.x - center.x,
|
||||||
|
y: location.y - center.y,
|
||||||
|
};
|
||||||
|
|
||||||
|
const inEllipse =
|
||||||
|
(normalized.x * normalized.x) / (xRadius * xRadius) +
|
||||||
|
(normalized.y * normalized.y) / (yRadius * yRadius) <=
|
||||||
|
1.0;
|
||||||
|
|
||||||
|
return inEllipse;
|
||||||
|
}
|
Loading…
Reference in New Issue