系统问题配置
commit
33be113d8d
|
@ -690,46 +690,46 @@ export default {
|
|||
})
|
||||
|
||||
const debouncedCallback = this.debounce((e) => {
|
||||
const { annotation } = e.detail
|
||||
const { cachedStats } = annotation.data
|
||||
var isNotValidAnnotationNum = 0
|
||||
for (const volumeId in cachedStats) {
|
||||
var statObj = cachedStats[volumeId]
|
||||
var arr = Object.keys(statObj)
|
||||
if (arr.length < 2) {
|
||||
++isNotValidAnnotationNum
|
||||
}
|
||||
}
|
||||
if (isNotValidAnnotationNum === 0) {
|
||||
this.onAnnotationModified(e)
|
||||
} else {
|
||||
// console.log('异常标记:', annotation)
|
||||
// const { remark } = annotation.data
|
||||
// if (remark === 'Liver' || remark === 'Mediastinum') {
|
||||
// this.$refs['questions'].setOutsideMeasuredData(annotation)
|
||||
// } else {
|
||||
// this.$refs['tableQuestions'].setOutsideMeasuredData(annotation)
|
||||
// }
|
||||
// 移除标记
|
||||
this.removeAnnotation({ otherMeasureData: annotation })
|
||||
const { remark } = annotation.data
|
||||
// 清除病灶上的标记信息
|
||||
if (remark === 'Liver' || remark === 'Mediastinum') {
|
||||
this.$refs['questions'].clearMeasuredData(remark)
|
||||
// 激活工具
|
||||
this.setNonTargetMeasurementStatus({ status: true, toolName: 'CircleROI' })
|
||||
} else {
|
||||
this.$refs['tableQuestions'].clearMeasuredData()
|
||||
// 激活工具
|
||||
this.setBasicToolActive('CircleROI')
|
||||
}
|
||||
}
|
||||
// const { annotation } = e.detail
|
||||
this.onAnnotationModified(e)
|
||||
// const { cachedStats } = annotation.data
|
||||
// var isNotValidAnnotationNum = 0
|
||||
// for (const volumeId in cachedStats) {
|
||||
// var statObj = cachedStats[volumeId]
|
||||
// var arr = Object.keys(statObj)
|
||||
// if (arr.length < 2) {
|
||||
// ++isNotValidAnnotationNum
|
||||
// }
|
||||
// }
|
||||
// if (!annotation.isHandleOutsideImage) {
|
||||
// this.onAnnotationModified(e)
|
||||
// } else {
|
||||
// // console.log('异常标记:', annotation)
|
||||
// // const { remark } = annotation.data
|
||||
// // if (remark === 'Liver' || remark === 'Mediastinum') {
|
||||
// // this.$refs['questions'].setOutsideMeasuredData(annotation)
|
||||
// // } else {
|
||||
// // this.$refs['tableQuestions'].setOutsideMeasuredData(annotation)
|
||||
// // }
|
||||
// // 移除标记
|
||||
// // this.removeAnnotation({ otherMeasureData: annotation })
|
||||
// // const { remark } = annotation.data
|
||||
// // // 清除病灶上的标记信息
|
||||
// // if (remark === 'Liver' || remark === 'Mediastinum') {
|
||||
// // this.$refs['questions'].clearMeasuredData(remark)
|
||||
// // // 激活工具
|
||||
// // this.setNonTargetMeasurementStatus({ status: true, toolName: 'CircleROI' })
|
||||
// // } else {
|
||||
// // this.$refs['tableQuestions'].clearMeasuredData()
|
||||
// // // 激活工具
|
||||
// // this.setBasicToolActive('CircleROI')
|
||||
// // }
|
||||
// }
|
||||
}, 120)
|
||||
eventTarget.addEventListener(cornerstoneTools.Enums.Events.ANNOTATION_MODIFIED, (e) => {
|
||||
debouncedCallback(e)
|
||||
})
|
||||
eventTarget.addEventListener(cornerstoneTools.Enums.Events.ANNOTATION_SELECTION_CHANGE, (e) => {
|
||||
console.log(e)
|
||||
const { detail } = e
|
||||
const { selection } = detail
|
||||
if (selection && selection.length > 0) {
|
||||
|
@ -833,7 +833,6 @@ export default {
|
|||
if (this.isNonTargetMeasurement || annotation.data.remark === 'Liver' || annotation.data.remark === 'Mediastinum') {
|
||||
this.$refs['questions'].setMeasuredData(measureData)
|
||||
} else {
|
||||
console.log('onAnnotationAdded')
|
||||
this.$refs['tableQuestions'] && this.$refs['tableQuestions'].setMeasuredData(measureData)
|
||||
}
|
||||
|
||||
|
|
|
@ -234,7 +234,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { uploadReadingAnswerImage } from '@/api/trials'
|
||||
// import { uploadReadingAnswerImage } from '@/api/trials'
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
name: 'QuestionItem',
|
||||
|
|
|
@ -60,7 +60,8 @@ export default {
|
|||
suvmaxId: '',
|
||||
questionFormChangeState: false,
|
||||
questionFormChangeNum: 0,
|
||||
isInsideVolume: true
|
||||
lungIsInsideVolume: true,
|
||||
liverIsInsideVolume: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -196,7 +197,7 @@ export default {
|
|||
handleSave() {
|
||||
this.$refs['questions'].validate((valid) => {
|
||||
if (!valid) return
|
||||
if (!this.isInsideVolume) {
|
||||
if (!this.lungIsInsideVolume || !this.liverIsInsideVolume) {
|
||||
this.$alert('当前标记在图像外,不允许保存!', '提示', {
|
||||
callback: action => {
|
||||
this.$message({
|
||||
|
@ -308,7 +309,51 @@ export default {
|
|||
FusionEvent.$emit('imageLocation', { otherMeasureData: otherMeasureData })
|
||||
},
|
||||
setMeasuredData(measurement) {
|
||||
this.isInsideVolume = true
|
||||
if (measurement.data.isHandleOutsideImage) {
|
||||
this.setOutsideMeasuredData(measurement)
|
||||
} else {
|
||||
var idx = -1
|
||||
if (this.currentQsId) {
|
||||
// 新增
|
||||
idx = this.measurements.findIndex(i => i.QuestionId === this.currentQsId)
|
||||
this.currentQsId = ''
|
||||
} else {
|
||||
// 编辑
|
||||
idx = this.measurements.findIndex(i => i.OrderMarkName === measurement.data.data.remark)
|
||||
}
|
||||
if (idx === -1) return
|
||||
var obj = this.measurements[idx]
|
||||
var remark = obj.QuestionType === 51 ? 'Liver' : obj.QuestionType === 52 ? 'Mediastinum' : ''
|
||||
obj.QuestionType === 51 ? this.liverIsInsideVolume = true : obj.QuestionType === 52 ? this.lungIsInsideVolume = true : ''
|
||||
measurement.data.data.remark = remark
|
||||
this.measurements[idx].OtherMeasureData = measurement.data
|
||||
this.measurements[idx].OtherMarkTool = measurement.data.metadata.toolName
|
||||
|
||||
// 添加标记
|
||||
var data = {
|
||||
OtherMeasureData: measurement.data,
|
||||
QuestionId: obj.QuestionId,
|
||||
VisitTaskId: this.visitTaskId,
|
||||
OrderMarkName: remark
|
||||
}
|
||||
if (measurement.type === 'CircleROI') {
|
||||
const suvMax = measurement.suvMax
|
||||
this.$set(this.questionForm, obj.QuestionId, suvMax || null)
|
||||
var pet5PS = this.setpet5PS()
|
||||
this.questionForm[this.pet5PSId] = pet5PS
|
||||
this.calculatePet5PS = pet5PS
|
||||
this.setPet5PSCommentDisplay()
|
||||
}
|
||||
FusionEvent.$emit('addOrUpdateAnnotations', { data })
|
||||
this.questionFormChangeState = true
|
||||
}
|
||||
},
|
||||
setOutsideMeasuredData(measurement) {
|
||||
console.log('setOutsideMeasuredData: ', measurement)
|
||||
if ((measurement.data.remark === 'Liver' && this.liverIsInsideVolume === false) || (measurement.data.remark === 'Mediastinum' && this.lungIsInsideVolume === false)) {
|
||||
return
|
||||
}
|
||||
|
||||
var idx = -1
|
||||
if (this.currentQsId) {
|
||||
// 新增
|
||||
|
@ -321,6 +366,7 @@ export default {
|
|||
if (idx === -1) return
|
||||
var obj = this.measurements[idx]
|
||||
var remark = obj.QuestionType === 51 ? 'Liver' : obj.QuestionType === 52 ? 'Mediastinum' : ''
|
||||
obj.QuestionType === 51 ? this.liverIsInsideVolume = false : obj.QuestionType === 52 ? this.lungIsInsideVolume = false : ''
|
||||
measurement.data.data.remark = remark
|
||||
this.measurements[idx].OtherMeasureData = measurement.data
|
||||
this.measurements[idx].OtherMarkTool = measurement.data.metadata.toolName
|
||||
|
@ -333,43 +379,6 @@ export default {
|
|||
OrderMarkName: remark
|
||||
}
|
||||
if (measurement.type === 'CircleROI') {
|
||||
const suvMax = measurement.suvMax
|
||||
this.$set(this.questionForm, obj.QuestionId, suvMax || null)
|
||||
var pet5PS = this.setpet5PS()
|
||||
this.questionForm[this.pet5PSId] = pet5PS
|
||||
this.calculatePet5PS = pet5PS
|
||||
this.setPet5PSCommentDisplay()
|
||||
}
|
||||
FusionEvent.$emit('addOrUpdateAnnotations', { data })
|
||||
this.questionFormChangeState = true
|
||||
},
|
||||
setOutsideMeasuredData(measurement) {
|
||||
this.isInsideVolume = false
|
||||
var idx = -1
|
||||
if (this.currentQsId) {
|
||||
// 新增
|
||||
idx = this.measurements.findIndex(i => i.QuestionId === this.currentQsId)
|
||||
this.currentQsId = ''
|
||||
} else {
|
||||
// 编辑
|
||||
idx = this.measurements.findIndex(i => i.OrderMarkName === measurement.data.remark)
|
||||
}
|
||||
if (idx === -1) return
|
||||
var obj = this.measurements[idx]
|
||||
var remark = obj.QuestionType === 51 ? 'Liver' : obj.QuestionType === 52 ? 'Mediastinum' : ''
|
||||
measurement.data.remark = remark
|
||||
this.measurements[idx].OtherMeasureData = measurement
|
||||
this.measurements[idx].OtherMarkTool = measurement.metadata.toolName
|
||||
|
||||
// 添加标记
|
||||
var data = {
|
||||
OtherMeasureData: measurement,
|
||||
QuestionId: obj.QuestionId,
|
||||
VisitTaskId: this.visitTaskId,
|
||||
OrderMarkName: remark
|
||||
}
|
||||
if (measurement.metadata.toolName === 'CircleROI') {
|
||||
// const suvMax = measurement.suvMax
|
||||
this.$set(this.questionForm, obj.QuestionId, null)
|
||||
var pet5PS = this.setpet5PS()
|
||||
this.questionForm[this.pet5PSId] = pet5PS
|
||||
|
|
|
@ -521,97 +521,104 @@ export default {
|
|||
this.$emit('resetQuestions', { isLymphLesion, lesionPart, lesionOrgan, suvMax, saveTypeEnum: this.questionForm.saveTypeEnum, rowIndex: this.rowIndex, questionId: this.parentQsId, anwsers: this.questionForm })
|
||||
},
|
||||
setMeasureData(measureData, isInit = false) {
|
||||
console.log('setMeasureData')
|
||||
this.isInsideVolume = true
|
||||
return new Promise(resolve => {
|
||||
if (measureData) {
|
||||
// 获取SUVmax(20)
|
||||
var SUVmax = measureData.suvMax ? measureData.suvMax : null
|
||||
var suvObj = this.questions.find(i => i.QuestionMark === 20)
|
||||
this.$set(this.questionForm, suvObj.Id, SUVmax)
|
||||
var data = {}
|
||||
measureData.data.data.remark = this.getLesionName(this.orderMark, this.questionForm.RowIndex)
|
||||
// measureData.data.data.studyId = measureData.studyId
|
||||
// measureData.data.data.seriesId = measureData.seriesId
|
||||
// measureData.data.data.instanceId = measureData.instanceId
|
||||
// measureData.data.data.viewportId = measureData.viewportId
|
||||
// measureData.data.data.questionId = this.parentQsId
|
||||
// measureData.data.data.rowIndex = this.questionForm.RowIndex
|
||||
data = {
|
||||
// OtherStudyId: measureData.studyId,
|
||||
// OtherSeriesId: measureData.seriesId,
|
||||
// OtherInstanceId: measureData.instanceId,
|
||||
OtherMeasureData: measureData.data,
|
||||
QuestionId: this.parentQsId,
|
||||
RowIndex: this.questionForm.RowIndex,
|
||||
RowId: this.questionForm.RowId,
|
||||
VisitTaskId: this.visitTaskId,
|
||||
OrderMarkName: measureData.data.data.remark
|
||||
}
|
||||
FusionEvent.$emit('addOrUpdateAnnotations', { data })
|
||||
}
|
||||
if (!isInit) {
|
||||
// if (this.questionForm.RowId) {
|
||||
// this.$set(this.questionForm, 'saveTypeEnum', 1)
|
||||
// } else {
|
||||
// this.$set(this.questionForm, 'saveTypeEnum', 0)
|
||||
// }
|
||||
// saveTypeEnum 0:未保存过(新建病灶);1:已保存,信息不完整(随访初始化病灶/分裂病灶,通过状态判断)
|
||||
if (this.questionForm.OtherMeasureData) {
|
||||
var annotation = Object.assign({}, this.questionForm.OtherMeasureData)
|
||||
if (measureData.data.isHandleOutsideImage) {
|
||||
this.setOutsideMeasuredData(measureData)
|
||||
} else {
|
||||
this.isInsideVolume = true
|
||||
|
||||
if (annotation && this.firstRenderAnnotation) {
|
||||
for (const k in annotation.data.cachedStats) {
|
||||
if (annotation.data.cachedStats[k].pointsInShape.length !== 0) {
|
||||
this.firstRenderAnnotation = false
|
||||
break
|
||||
if (measureData) {
|
||||
// 获取SUVmax(20)
|
||||
var SUVmax = measureData.suvMax ? measureData.suvMax : null
|
||||
var suvObj = this.questions.find(i => i.QuestionMark === 20)
|
||||
this.$set(this.questionForm, suvObj.Id, SUVmax)
|
||||
var data = {}
|
||||
measureData.data.data.remark = this.getLesionName(this.orderMark, this.questionForm.RowIndex)
|
||||
// measureData.data.data.studyId = measureData.studyId
|
||||
// measureData.data.data.seriesId = measureData.seriesId
|
||||
// measureData.data.data.instanceId = measureData.instanceId
|
||||
// measureData.data.data.viewportId = measureData.viewportId
|
||||
// measureData.data.data.questionId = this.parentQsId
|
||||
// measureData.data.data.rowIndex = this.questionForm.RowIndex
|
||||
data = {
|
||||
// OtherStudyId: measureData.studyId,
|
||||
// OtherSeriesId: measureData.seriesId,
|
||||
// OtherInstanceId: measureData.instanceId,
|
||||
OtherMeasureData: measureData.data,
|
||||
QuestionId: this.parentQsId,
|
||||
RowIndex: this.questionForm.RowIndex,
|
||||
RowId: this.questionForm.RowId,
|
||||
VisitTaskId: this.visitTaskId,
|
||||
OrderMarkName: measureData.data.data.remark
|
||||
}
|
||||
FusionEvent.$emit('addOrUpdateAnnotations', { data })
|
||||
}
|
||||
if (!isInit) {
|
||||
// if (this.questionForm.RowId) {
|
||||
// this.$set(this.questionForm, 'saveTypeEnum', 1)
|
||||
// } else {
|
||||
// this.$set(this.questionForm, 'saveTypeEnum', 0)
|
||||
// }
|
||||
// saveTypeEnum 0:未保存过(新建病灶);1:已保存,信息不完整(随访初始化病灶/分裂病灶,通过状态判断)
|
||||
if (this.questionForm.OtherMeasureData) {
|
||||
var annotation = Object.assign({}, this.questionForm.OtherMeasureData)
|
||||
|
||||
if (annotation && this.firstRenderAnnotation) {
|
||||
for (const k in annotation.data.cachedStats) {
|
||||
if (annotation.data.cachedStats[k].pointsInShape.length !== 0) {
|
||||
this.firstRenderAnnotation = false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.firstRenderAnnotation = false
|
||||
}
|
||||
if (!this.firstRenderAnnotation) {
|
||||
if (this.questionForm.RowId) {
|
||||
this.$set(this.questionForm, 'saveTypeEnum', 1)
|
||||
} else {
|
||||
this.$set(this.questionForm, 'saveTypeEnum', 0)
|
||||
this.firstRenderAnnotation = false
|
||||
}
|
||||
if (!this.firstRenderAnnotation) {
|
||||
if (this.questionForm.RowId) {
|
||||
this.$set(this.questionForm, 'saveTypeEnum', 1)
|
||||
} else {
|
||||
this.$set(this.questionForm, 'saveTypeEnum', 0)
|
||||
}
|
||||
} else {
|
||||
this.$set(this.questionForm, 'saveTypeEnum', 2)
|
||||
this.$emit('close')
|
||||
}
|
||||
} else {
|
||||
this.$set(this.questionForm, 'saveTypeEnum', 2)
|
||||
this.$emit('close')
|
||||
}
|
||||
}
|
||||
this.$set(this.questionForm, 'OtherMeasureData', measureData.data)
|
||||
var isLymph = this.getQuestionVal(2)
|
||||
isLymph = !isNaN(parseInt(isLymph)) ? parseInt(isLymph) : null
|
||||
const lesionPart = this.getQuestionVal(8)
|
||||
const lesionOrgan = this.getQuestionVal(6)
|
||||
var suvMax = this.getQuestionVal(20)
|
||||
this.$emit('resetQuestions', { isLymphLesion: isLymph, lesionPart, lesionOrgan, suvMax, saveTypeEnum: this.questionForm.saveTypeEnum, rowIndex: this.rowIndex, questionId: this.parentQsId, anwsers: this.questionForm })
|
||||
this.toolType = measureData.type
|
||||
if (this.questionForm.MeasureData) {
|
||||
// if (measureData.type === 'Bidirectional') {
|
||||
// this.organList = []
|
||||
// this.getOrganInfoList(1)
|
||||
// } else if (measureData.type === 'Length') {
|
||||
// // 直径测量工具 且是靶病灶 器官只能是非淋巴结类型
|
||||
// this.organList = []
|
||||
// this.getOrganInfoList(0)
|
||||
// } else {
|
||||
// this.organList = []
|
||||
// this.getOrganInfoList()
|
||||
// }
|
||||
this.organList = []
|
||||
this.getOrganInfoList()
|
||||
} else {
|
||||
this.organList = []
|
||||
this.getOrganInfoList()
|
||||
this.$set(this.questionForm, 'OtherMeasureData', measureData.data)
|
||||
var isLymph = this.getQuestionVal(2)
|
||||
isLymph = !isNaN(parseInt(isLymph)) ? parseInt(isLymph) : null
|
||||
const lesionPart = this.getQuestionVal(8)
|
||||
const lesionOrgan = this.getQuestionVal(6)
|
||||
var suvMax = this.getQuestionVal(20)
|
||||
this.$emit('resetQuestions', { isLymphLesion: isLymph, lesionPart, lesionOrgan, suvMax, saveTypeEnum: this.questionForm.saveTypeEnum, rowIndex: this.rowIndex, questionId: this.parentQsId, anwsers: this.questionForm })
|
||||
this.toolType = measureData.type
|
||||
if (this.questionForm.MeasureData) {
|
||||
// if (measureData.type === 'Bidirectional') {
|
||||
// this.organList = []
|
||||
// this.getOrganInfoList(1)
|
||||
// } else if (measureData.type === 'Length') {
|
||||
// // 直径测量工具 且是靶病灶 器官只能是非淋巴结类型
|
||||
// this.organList = []
|
||||
// this.getOrganInfoList(0)
|
||||
// } else {
|
||||
// this.organList = []
|
||||
// this.getOrganInfoList()
|
||||
// }
|
||||
this.organList = []
|
||||
this.getOrganInfoList()
|
||||
} else {
|
||||
this.organList = []
|
||||
this.getOrganInfoList()
|
||||
}
|
||||
}
|
||||
resolve()
|
||||
})
|
||||
},
|
||||
setOutsideMeasuredData(measureData) {
|
||||
if (this.isInsideVolume === false) {
|
||||
return
|
||||
}
|
||||
this.isInsideVolume = false
|
||||
var suvObj = this.questions.find(i => i.QuestionMark === 20)
|
||||
this.$set(this.questionForm, suvObj.Id, '')
|
||||
|
@ -627,7 +634,6 @@ export default {
|
|||
const lesionOrgan = this.getQuestionVal(6)
|
||||
var suvMax = this.getQuestionVal(20)
|
||||
this.$emit('resetQuestions', { isLymphLesion: isLymph, lesionPart, lesionOrgan, suvMax, saveTypeEnum: this.questionForm.saveTypeEnum, rowIndex: this.rowIndex, questionId: this.parentQsId, anwsers: this.questionForm })
|
||||
this.toolType = measureData.type
|
||||
if (this.questionForm.MeasureData) {
|
||||
this.organList = []
|
||||
this.getOrganInfoList()
|
||||
|
@ -730,6 +736,29 @@ export default {
|
|||
})
|
||||
return
|
||||
}
|
||||
// 消失、无法评估状态的病灶限制不能测量SUV值
|
||||
var lesionState = this.getQuestionVal(7)
|
||||
if ((lesionState === 2 || lesionState === 3) && this.questionForm.OtherMeasureData) {
|
||||
this.$confirm(this.$t('评估状态为无法评估或消失的病灶不能测量SUV值!'), {
|
||||
type: 'warning',
|
||||
showCancelButton: false,
|
||||
callback: action => {}
|
||||
})
|
||||
return
|
||||
}
|
||||
// suv测量值可以测量为0,但不能与病灶、肝脏、纵隔血池绑定。
|
||||
if (this.questionForm.OtherMeasureData) {
|
||||
var suvmax = this.getQuestionVal(20)
|
||||
if (suvmax === 0) {
|
||||
this.$confirm(this.$t('当前病灶suv测量值为0,不允许保存!'), {
|
||||
type: 'warning',
|
||||
showCancelButton: false,
|
||||
callback: action => {}
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
const loading = this.$loading({ fullscreen: true })
|
||||
var otherMeasureData = this.questionForm.OtherMeasureData ? Object.assign({}, this.questionForm.OtherMeasureData) : null
|
||||
if (otherMeasureData) {
|
||||
|
|
|
@ -520,7 +520,6 @@ export default {
|
|||
return
|
||||
},
|
||||
getUnSaveTarget() {
|
||||
console.log('getUnSaveTarget')
|
||||
this.unSaveTargets = []
|
||||
this.tableQuestions.map(item => {
|
||||
if (item.TableQuestions && item.TableQuestions.Answers) {
|
||||
|
@ -532,7 +531,6 @@ export default {
|
|||
})
|
||||
}
|
||||
})
|
||||
// console.log(this.unSaveTargets)
|
||||
return this.unSaveTargets
|
||||
},
|
||||
getAllUnSaveLesions() {
|
||||
|
|
|
@ -18,7 +18,7 @@ const {
|
|||
} = cornerstoneTools
|
||||
// const { getWorldWidthAndHeightFromTwoPoints } = utilities.planar
|
||||
// const { roundNumber } = utilities
|
||||
const { hideElementCursor } = cursors.elementCursor
|
||||
const { hideElementCursor,resetElementCursor } = cursors.elementCursor
|
||||
const { getAnnotations,addAnnotation } = annotation.state
|
||||
const { isAnnotationVisible } = annotation.visibility
|
||||
const { isAnnotationLocked } = annotation.locking
|
||||
|
@ -83,81 +83,81 @@ class CircleROITool extends cornerstoneTools.CircleROITool {
|
|||
// )
|
||||
// this._getTextLines = this.getTextLines
|
||||
}
|
||||
// addNewAnnotation = (evt) => {
|
||||
// const eventDetail = evt.detail;
|
||||
// const { currentPoints, element } = eventDetail;
|
||||
// const worldPos = currentPoints.world;
|
||||
// // const canvasPos = currentPoints.canvas;
|
||||
addNewAnnotation = (evt) => {
|
||||
const eventDetail = evt.detail;
|
||||
const { currentPoints, element } = eventDetail;
|
||||
const worldPos = currentPoints.world;
|
||||
// const canvasPos = currentPoints.canvas;
|
||||
|
||||
// const enabledElement = getEnabledElement(element);
|
||||
// const { viewport, renderingEngine } = enabledElement;
|
||||
const enabledElement = getEnabledElement(element);
|
||||
const { viewport, renderingEngine } = enabledElement;
|
||||
|
||||
// this.isDrawing = true;
|
||||
this.isDrawing = true;
|
||||
|
||||
// const camera = viewport.getCamera();
|
||||
// const { viewPlaneNormal, viewUp } = camera;
|
||||
const camera = viewport.getCamera();
|
||||
const { viewPlaneNormal, viewUp } = camera;
|
||||
|
||||
// const referencedImageId = this.getReferencedImageId(
|
||||
// viewport,
|
||||
// worldPos,
|
||||
// viewPlaneNormal,
|
||||
// viewUp
|
||||
// );
|
||||
const referencedImageId = this.getReferencedImageId(
|
||||
viewport,
|
||||
worldPos,
|
||||
viewPlaneNormal,
|
||||
viewUp
|
||||
);
|
||||
|
||||
// const FrameOfReferenceUID = viewport.getFrameOfReferenceUID();
|
||||
const FrameOfReferenceUID = viewport.getFrameOfReferenceUID();
|
||||
|
||||
// const annotation = {
|
||||
// highlighted: true,
|
||||
// invalidated: true,
|
||||
// metadata: {
|
||||
// toolName: this.getToolName(),
|
||||
// viewPlaneNormal: [...viewPlaneNormal],
|
||||
// viewUp: [...viewUp],
|
||||
// FrameOfReferenceUID,
|
||||
// referencedImageId,
|
||||
// },
|
||||
// data: {
|
||||
// label: '',
|
||||
// handles: {
|
||||
// textBox: {
|
||||
// hasMoved: false,
|
||||
// worldPosition: [0, 0, 0],
|
||||
// worldBoundingBox: {
|
||||
// topLeft: [0, 0, 0],
|
||||
// topRight: [0, 0, 0],
|
||||
// bottomLeft: [0, 0, 0],
|
||||
// bottomRight: [0, 0, 0],
|
||||
// },
|
||||
// },
|
||||
// points: [[...worldPos], [...worldPos]],
|
||||
// activeHandleIndex: 1,
|
||||
// },
|
||||
// cachedStats: {},
|
||||
// },
|
||||
// };
|
||||
// addAnnotation(annotation, element);
|
||||
const annotation = {
|
||||
highlighted: true,
|
||||
invalidated: true,
|
||||
metadata: {
|
||||
toolName: this.getToolName(),
|
||||
viewPlaneNormal: [...viewPlaneNormal],
|
||||
viewUp: [...viewUp],
|
||||
FrameOfReferenceUID,
|
||||
referencedImageId,
|
||||
},
|
||||
data: {
|
||||
label: '',
|
||||
handles: {
|
||||
textBox: {
|
||||
hasMoved: false,
|
||||
worldPosition: [0, 0, 0],
|
||||
worldBoundingBox: {
|
||||
topLeft: [0, 0, 0],
|
||||
topRight: [0, 0, 0],
|
||||
bottomLeft: [0, 0, 0],
|
||||
bottomRight: [0, 0, 0],
|
||||
},
|
||||
},
|
||||
points: [[...worldPos], [...worldPos]],
|
||||
activeHandleIndex: 1,
|
||||
},
|
||||
cachedStats: {},
|
||||
},
|
||||
};
|
||||
addAnnotation(annotation, element);
|
||||
|
||||
// const viewportIdsToRender = getViewportIdsWithToolToRender(
|
||||
// element,
|
||||
// this.getToolName()
|
||||
// );
|
||||
const viewportIdsToRender = getViewportIdsWithToolToRender(
|
||||
element,
|
||||
this.getToolName()
|
||||
);
|
||||
|
||||
// this.editData = {
|
||||
// annotation,
|
||||
// viewportIdsToRender,
|
||||
// newAnnotation: true,
|
||||
// hasMoved: false,
|
||||
// };
|
||||
// this._activateDraw(element);
|
||||
this.editData = {
|
||||
annotation,
|
||||
viewportIdsToRender,
|
||||
newAnnotation: true,
|
||||
hasMoved: false,
|
||||
};
|
||||
this._activateDraw(element);
|
||||
|
||||
// hideElementCursor(element);
|
||||
hideElementCursor(element);
|
||||
|
||||
// evt.preventDefault();
|
||||
evt.preventDefault();
|
||||
|
||||
// triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
|
||||
triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
|
||||
|
||||
// return annotation;
|
||||
// };
|
||||
return annotation;
|
||||
};
|
||||
renderAnnotation = (enabledElement, svgDrawingHelper) => {
|
||||
let renderStatus = false
|
||||
const { viewport } = enabledElement
|
||||
|
@ -421,7 +421,161 @@ class CircleROITool extends cornerstoneTools.CircleROITool {
|
|||
|
||||
return renderStatus
|
||||
};
|
||||
_calculateCachedStats = (
|
||||
annotation,
|
||||
viewport,
|
||||
renderingEngine,
|
||||
enabledElement,
|
||||
modalityUnitOptions
|
||||
) => {
|
||||
const data = annotation.data
|
||||
const { viewportId, renderingEngineId } = enabledElement
|
||||
|
||||
const { points } = data.handles
|
||||
|
||||
const canvasCoordinates = points.map((p) => viewport.worldToCanvas(p))
|
||||
const { viewPlaneNormal, viewUp } = viewport.getCamera()
|
||||
|
||||
const [topLeftCanvas, bottomRightCanvas] = (
|
||||
getCanvasCircleCorners(canvasCoordinates)
|
||||
)
|
||||
|
||||
const topLeftWorld = viewport.canvasToWorld(topLeftCanvas)
|
||||
const bottomRightWorld = viewport.canvasToWorld(bottomRightCanvas)
|
||||
const { cachedStats } = data
|
||||
|
||||
const targetIds = Object.keys(cachedStats)
|
||||
const worldPos1 = topLeftWorld
|
||||
const worldPos2 = bottomRightWorld
|
||||
for (let i = 0; i < targetIds.length; i++) {
|
||||
const targetId = targetIds[i]
|
||||
|
||||
const image = this.getTargetIdImage(targetId, renderingEngine)
|
||||
|
||||
// If image does not exists for the targetId, skip. This can be due
|
||||
// to various reasons such as if the target was a volumeViewport, and
|
||||
// the volumeViewport has been decached in the meantime.
|
||||
if (!image) {
|
||||
continue
|
||||
}
|
||||
|
||||
const { dimensions, imageData, metadata } = image
|
||||
|
||||
const worldPos1Index = transformWorldToIndex(imageData, worldPos1)
|
||||
|
||||
worldPos1Index[0] = Math.floor(worldPos1Index[0])
|
||||
worldPos1Index[1] = Math.floor(worldPos1Index[1])
|
||||
worldPos1Index[2] = Math.floor(worldPos1Index[2])
|
||||
|
||||
const worldPos2Index = transformWorldToIndex(imageData, worldPos2)
|
||||
|
||||
worldPos2Index[0] = Math.floor(worldPos2Index[0])
|
||||
worldPos2Index[1] = Math.floor(worldPos2Index[1])
|
||||
worldPos2Index[2] = Math.floor(worldPos2Index[2])
|
||||
|
||||
// Check if one of the indexes are inside the volume, this then gives us
|
||||
// Some area to do stats over.
|
||||
|
||||
if (this._isInsideVolume(worldPos1Index, worldPos2Index, dimensions)) {
|
||||
const iMin = Math.min(worldPos1Index[0], worldPos2Index[0])
|
||||
const iMax = Math.max(worldPos1Index[0], worldPos2Index[0])
|
||||
|
||||
const jMin = Math.min(worldPos1Index[1], worldPos2Index[1])
|
||||
const jMax = Math.max(worldPos1Index[1], worldPos2Index[1])
|
||||
|
||||
const kMin = Math.min(worldPos1Index[2], worldPos2Index[2])
|
||||
const kMax = Math.max(worldPos1Index[2], worldPos2Index[2])
|
||||
|
||||
const boundsIJK = [
|
||||
[iMin, iMax],
|
||||
[jMin, jMax],
|
||||
[kMin, kMax]
|
||||
]
|
||||
|
||||
const center = [
|
||||
(topLeftWorld[0] + bottomRightWorld[0]) / 2,
|
||||
(topLeftWorld[1] + bottomRightWorld[1]) / 2,
|
||||
(topLeftWorld[2] + bottomRightWorld[2]) / 2
|
||||
]
|
||||
|
||||
const ellipseObj = {
|
||||
center,
|
||||
xRadius: Math.abs(topLeftWorld[0] - bottomRightWorld[0]) / 2,
|
||||
yRadius: Math.abs(topLeftWorld[1] - bottomRightWorld[1]) / 2,
|
||||
zRadius: Math.abs(topLeftWorld[2] - bottomRightWorld[2]) / 2
|
||||
}
|
||||
const { worldWidth, worldHeight } = getWorldWidthAndHeightFromTwoPoints(
|
||||
viewPlaneNormal,
|
||||
viewUp,
|
||||
worldPos1,
|
||||
worldPos2
|
||||
)
|
||||
const isEmptyArea = worldWidth === 0 && worldHeight === 0
|
||||
const scale = getCalibratedScale(image)
|
||||
const aspect = getCalibratedAspect(image)
|
||||
const area = Math.abs(
|
||||
Math.PI *
|
||||
(worldWidth / scale / 2) *
|
||||
(worldHeight / aspect / scale / 2)
|
||||
)
|
||||
|
||||
const modalityUnit = getModalityUnit(
|
||||
metadata.Modality,
|
||||
annotation.metadata.referencedImageId,
|
||||
modalityUnitOptions
|
||||
)
|
||||
const pointsInShape = pointInShapeCallback(
|
||||
imageData,
|
||||
(pointLPS, pointIJK) => pointInEllipse(ellipseObj, pointLPS),
|
||||
this.configuration.statsCalculator.statsCallback,
|
||||
boundsIJK
|
||||
)
|
||||
|
||||
const stats = this.configuration.statsCalculator.getStatistics()
|
||||
|
||||
cachedStats[targetId] = {
|
||||
Modality: metadata.Modality,
|
||||
area,
|
||||
mean: stats[1] && stats[1].value ? stats[1].value : null,
|
||||
max: stats[0] && stats[0].value ? stats[0].value : null,
|
||||
stdDev: stats[2] && stats[2].value ? stats[2].value : null,
|
||||
statsArray: stats,
|
||||
pointsInShape: pointsInShape,
|
||||
isEmptyArea,
|
||||
areaUnit: getCalibratedAreaUnits(null, image),
|
||||
radius: worldWidth / 2 / scale,
|
||||
radiusUnit: getCalibratedLengthUnits(null, image),
|
||||
perimeter: (2 * Math.PI * (worldWidth / 2)) / scale,
|
||||
modalityUnit
|
||||
}
|
||||
annotation.isHandleOutsideImage = false
|
||||
} else {
|
||||
this.isHandleOutsideImage = true
|
||||
|
||||
cachedStats[targetId] = {
|
||||
Modality: metadata.Modality,
|
||||
areaUnit: getCalibratedAreaUnits(null, image)
|
||||
}
|
||||
annotation.isHandleOutsideImage = true
|
||||
}
|
||||
}
|
||||
|
||||
annotation.invalidated = false
|
||||
|
||||
// Dispatching annotation modified
|
||||
const eventType = Enums.Events.ANNOTATION_MODIFIED
|
||||
|
||||
const eventDetail = {
|
||||
annotation,
|
||||
viewportId,
|
||||
renderingEngineId
|
||||
}
|
||||
triggerEvent(eventTarget, eventType, eventDetail)
|
||||
|
||||
return cachedStats
|
||||
}
|
||||
}
|
||||
|
||||
function getCanvasCircleCorners(
|
||||
circleCanvasPoints
|
||||
) {
|
||||
|
|
|
@ -680,6 +680,7 @@ export default {
|
|||
// 融合
|
||||
handleMerge(answers, questionId, orderMark) {
|
||||
this.lesionData = []
|
||||
this.mergeList = []
|
||||
this.merge.visible = true
|
||||
this.mergeInfo.questionId = questionId
|
||||
this.mergeInfo.mergeRowId = answers.RowId
|
||||
|
|
Loading…
Reference in New Issue