非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> </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> </div>
</template> </template>
<script> <script>
@ -288,7 +308,18 @@ export default {
readingTaskState: 2, readingTaskState: 2,
renderHistoryAnnotationTaskIds: [], renderHistoryAnnotationTaskIds: [],
imageType: ['image/jpeg', 'image/jpg', 'image/bmp', 'image/png'], 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: { computed: {
@ -764,7 +795,8 @@ export default {
let idx = annotations.findIndex(i=>i.metadata.referencedImageId === imageId && i.metadata.toolName === 'Length') let idx = annotations.findIndex(i=>i.metadata.referencedImageId === imageId && i.metadata.toolName === 'Length')
if (idx > -1) { if (idx > -1) {
this.activeTool = '' this.activeTool = ''
this.$message.warning('当前图像已标注比例尺!') //
this.$message.warning(this.$t('trials:noneDicom:message:msg4'))
return return
} }
} }
@ -852,6 +884,7 @@ export default {
annotation.data.ps = ps annotation.data.ps = ps
this.$emit('setPS', {NoneDicomFileId: fileList[fileIndex].Id,Path: fileList[fileIndex].Path, PS: ps}) this.$emit('setPS', {NoneDicomFileId: fileList[fileIndex].Id,Path: fileList[fileIndex].Path, PS: ps})
} }
this.setToolsPassive()
} }
const params = { const params = {
id: annotation.annotationId, id: annotation.annotationId,
@ -880,27 +913,20 @@ export default {
const fileIndex = fileList.findIndex(f => f.Path === path) const fileIndex = fileList.findIndex(f => f.Path === path)
if (fileIndex === -1) return if (fileIndex === -1) return
if (annotation.metadata.toolName === 'Length') { if (annotation.metadata.toolName === 'Length') {
const value = await this.$prompt('请录入物理长度mm', '', { this.form.annotationObj = {
showClose: false, id: '',
showCancelButton: false, visitTaskId: this.viewportInfos[i].taskInfo.VisitTaskId,
closeOnClickModal: false, studyId: this.viewportInfos[i].studyId,
inputPattern: /^\d+$/, noneDicomFileId: fileList[fileIndex].Id,
inputErrorMessage: '请输入数值' path: fileList[fileIndex].Path,
}).then(({ value }) => { annotation,
return value fileList,
}).catch(() => { fileIndex
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.length = null
this.dialogVisible = true
this.setToolsPassive()
return
} }
const params = { const params = {
@ -920,6 +946,39 @@ export default {
// //
// this.$message.success(this.$t('common:message:savedSuccessfully')) // 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) { getLengthToolTextLines(data, targetId) {
const cachedVolumeStats = data.cachedStats[targetId] const cachedVolumeStats = data.cachedStats[targetId]
const { length, unit } = cachedVolumeStats const { length, unit } = cachedVolumeStats
@ -933,7 +992,7 @@ export default {
textLines.push(`P: ${parseFloat(length).toFixed(this.digitPlaces)} ${unit}`) textLines.push(`P: ${parseFloat(length).toFixed(this.digitPlaces)} ${unit}`)
if (data.l) { if (data.l) {
textLines.push(`L: ${parseFloat(data.l).toFixed(this.digitPlaces)} mm`) 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; return textLines;
}, },
@ -962,7 +1021,7 @@ export default {
if (area) { if (area) {
const areaLine = isEmptyArea const areaLine = isEmptyArea
? `Area: Oblique not supported` ? `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); textLines.push(areaLine);
} }
if (mean) { if (mean) {
@ -1008,7 +1067,7 @@ export default {
ps = parseFloat(this.psArr[i].PS).toFixed(3) ps = parseFloat(this.psArr[i].PS).toFixed(3)
} }
if (ps) { 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 { } else {
textLines.push(`Area: ${parseFloat(area).toFixed(this.digitPlaces)} ${areaUnit}`); textLines.push(`Area: ${parseFloat(area).toFixed(this.digitPlaces)} ${areaUnit}`);
} }