非dicom阅片测量工具更改
continuous-integration/drone/push Build is passing Details

uat
caiyiling 2025-03-18 16:53:03 +08:00
parent 5678e3302b
commit d753fbc2ab
1 changed files with 84 additions and 25 deletions

View File

@ -217,6 +217,26 @@
</div>
</div>
</div>
<el-dialog
:title="$t('trials:noneDicom:message:msg2')"
:visible.sync="dialogVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
:show-close="false"
width="400px"
>
<el-form :model="form" :rules="rules" ref="lengthForm">
<el-form-item label="" prop="length">
<el-input v-model="form.length" type="number">
<template slot="append">mm</template>
</el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveForm">{{ $t('common:button:save') }}</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
@ -288,7 +308,18 @@ export default {
readingTaskState: 2,
renderHistoryAnnotationTaskIds: [],
imageType: ['image/jpeg', 'image/jpg', 'image/bmp', 'image/png'],
digitPlaces: 2
digitPlaces: 2,
dialogVisible: false,
form: {
length: null,
annotationObj: {}
},
rules: {
length: [
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' },
{ pattern: /^\d+$/, message: this.$t('trials:noneDicom:message:msg3'), trigger: ['blur', 'change'] }
],
}
}
},
computed: {
@ -764,7 +795,8 @@ export default {
let idx = annotations.findIndex(i=>i.metadata.referencedImageId === imageId && i.metadata.toolName === 'Length')
if (idx > -1) {
this.activeTool = ''
this.$message.warning('当前图像已标注比例尺!')
//
this.$message.warning(this.$t('trials:noneDicom:message:msg4'))
return
}
}
@ -852,6 +884,7 @@ export default {
annotation.data.ps = ps
this.$emit('setPS', {NoneDicomFileId: fileList[fileIndex].Id,Path: fileList[fileIndex].Path, PS: ps})
}
this.setToolsPassive()
}
const params = {
id: annotation.annotationId,
@ -880,27 +913,20 @@ export default {
const fileIndex = fileList.findIndex(f => f.Path === path)
if (fileIndex === -1) return
if (annotation.metadata.toolName === 'Length') {
const value = await this.$prompt('请录入物理长度mm', '', {
showClose: false,
showCancelButton: false,
closeOnClickModal: false,
inputPattern: /^\d+$/,
inputErrorMessage: '请输入数值'
}).then(({ value }) => {
return value
}).catch(() => {
return null
})
if (value) {
annotation.data.l = parseFloat(value)
let cachedStats = Object.keys(annotation.data.cachedStats)
let ps = parseFloat(value) / annotation.data.cachedStats[cachedStats[0]].length
annotation.data.ps = ps
this.$emit('setPS', {NoneDicomFileId: fileList[fileIndex].Id,Path: fileList[fileIndex].Path, PS: ps})
} else {
cornerstoneTools.annotation.state.removeAnnotation(annotation.annotationUID)
return
this.form.annotationObj = {
id: '',
visitTaskId: this.viewportInfos[i].taskInfo.VisitTaskId,
studyId: this.viewportInfos[i].studyId,
noneDicomFileId: fileList[fileIndex].Id,
path: fileList[fileIndex].Path,
annotation,
fileList,
fileIndex
}
this.form.length = null
this.dialogVisible = true
this.setToolsPassive()
return
}
const params = {
@ -920,6 +946,39 @@ export default {
//
// this.$message.success(this.$t('common:message:savedSuccessfully'))
},
async saveForm() {
let validate = await this.$refs.lengthForm.validate()
if (!validate) return
let value = this.form.length
let annotation = this.form.annotationObj.annotation
let fileList = this.form.annotationObj.fileList
let fileIndex = this.form.annotationObj.fileIndex
if (value) {
annotation.data.l = parseFloat(value)
let cachedStats = Object.keys(annotation.data.cachedStats)
let ps = parseFloat(value) / annotation.data.cachedStats[cachedStats[0]].length
annotation.data.ps = ps
this.$emit('setPS', {NoneDicomFileId: fileList[fileIndex].Id,Path: fileList[fileIndex].Path, PS: ps})
} else {
cornerstoneTools.annotation.state.removeAnnotation(annotation.annotationUID)
return
}
const params = {
id: '',
visitTaskId: this.form.annotationObj.visitTaskId,
studyId: this.form.annotationObj.studyId,
noneDicomFileId: this.form.annotationObj.noneDicomFileId,
path: this.form.annotationObj.path,
measureData: JSON.stringify(annotation)
}
const res = await addNoneDicomMark(params)
annotation.annotationId = res.Result
const renderingEngine = getRenderingEngine(renderingEngineId)
const viewport = renderingEngine.getViewport(`canvas-${this.activeCanvasIndex}`)
viewport.render()
this.dialogVisible = false
},
getLengthToolTextLines(data, targetId) {
const cachedVolumeStats = data.cachedStats[targetId]
const { length, unit } = cachedVolumeStats
@ -933,7 +992,7 @@ export default {
textLines.push(`P: ${parseFloat(length).toFixed(this.digitPlaces)} ${unit}`)
if (data.l) {
textLines.push(`L: ${parseFloat(data.l).toFixed(this.digitPlaces)} mm`)
textLines.push(`PS: ${parseFloat(data.l / length).toFixed(this.digitPlaces)} mm/px`)
textLines.push(`PS: ${parseFloat(data.l / length).toFixed(3)} mm/px`)
}
return textLines;
},
@ -962,7 +1021,7 @@ export default {
if (area) {
const areaLine = isEmptyArea
? `Area: Oblique not supported`
: `Area: ${ps ? parseFloat(area * ps).toFixed(this.digitPlaces) : parseFloat(area).toFixed(this.digitPlaces)} ${ps ? 'mm' + '\xb2' : areaUnit}`;
: `Area: ${ps ? parseFloat(area * ps * ps).toFixed(this.digitPlaces) : parseFloat(area).toFixed(this.digitPlaces)} ${ps ? 'mm' + '\xb2' : areaUnit}`;
textLines.push(areaLine);
}
if (mean) {
@ -1008,7 +1067,7 @@ export default {
ps = parseFloat(this.psArr[i].PS).toFixed(3)
}
if (ps) {
textLines.push(`Area: ${parseFloat(area * ps).toFixed(this.digitPlaces)} ${'mm' + '\xb2'}`);
textLines.push(`Area: ${parseFloat(area * ps * ps).toFixed(this.digitPlaces)} ${'mm' + '\xb2'}`);
} else {
textLines.push(`Area: ${parseFloat(area).toFixed(this.digitPlaces)} ${areaUnit}`);
}