融合视口标注绑定信息更改

main
caiyiling 2026-05-27 15:06:19 +08:00
parent d83a086087
commit 312e85d9b3
3 changed files with 39 additions and 4 deletions

View File

@ -1959,7 +1959,8 @@ export default {
if (annotation.metadata.toolName.includes('histogram_')) return this.$refs.histogram.initToolValue(annotation)
if (this.readingTaskState === 2) return
if (annotation.metadata.toolName === 'PlanarFreehandROI' && !annotation.data.contour.closed) return
const series = this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].series
let viewportIndex = this.fusion ? 2 : this.activeViewportIndex
const series = this.$refs[`${this.viewportKey}-${viewportIndex}`][0].series
if (series && series.TaskInfo.VisitTaskId && series.TaskInfo.VisitTaskId === this.taskInfo.VisitTaskId) {
const referencedImageId = annotation.metadata.referencedImageId
const params = this.getInstanceInfo(referencedImageId)
@ -2028,6 +2029,7 @@ export default {
}
},
async customAnnotationCompletedListener(e) {
console.log('completed')
const { annotation } = e.detail
if (!annotation) return
if (annotation.metadata.toolName === FusionJumpToPointTool.toolName) return
@ -2040,7 +2042,8 @@ export default {
}
if (annotation.metadata.segmentationId) return
if (annotation.metadata.toolName === 'PlanarFreehandROI' && !annotation.data.contour.closed) return
const series = this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].series
let viewportIndex = this.fusion ? 2 : this.activeViewportIndex
const series = this.$refs[`${this.viewportKey}-${viewportIndex}`][0].series
if (series && series.TaskInfo.VisitTaskId && series.TaskInfo.VisitTaskId === this.taskInfo.VisitTaskId) {
const referencedImageId = annotation.metadata.referencedImageId
const params = this.getInstanceInfo(referencedImageId)
@ -2116,6 +2119,7 @@ export default {
}
},
customAnnotationModifiedListener(e) {
console.log('modified')
const { annotation, changeType } = e.detail
const isStatsUpdated = changeType === ChangeTypes.StatsUpdated
if (!annotation) return

View File

@ -1464,7 +1464,9 @@ export default {
if (!referencedImageId) return null
const cacheKey = annotation.from || annotation.metadata.volumeId ? `volumeId:${referencedImageId}` : `imageId:${referencedImageId}`
const points = ['x', 'y', 'z'];
const cachedStats = annotation.markTool === "ArrowAnnotate" ? annotation.data?.handles?.points[0] : annotation.data?.cachedStats?.[cacheKey]
const cachedStats = annotation.markTool === "ArrowAnnotate"
? annotation.data?.handles?.points[0]
: this.getAnnotationCachedStats(annotation, cacheKey, prop)
const hasProp = cachedStats
&& (Object.prototype.hasOwnProperty.call(cachedStats, prop) || cachedStats[points.indexOf(prop)])
if (!hasProp) return null
@ -1481,10 +1483,30 @@ export default {
} else if (this.isNoneDicom && value !== null) {
value = this.reRound(csUtils.roundNumber(value), this.digitPlaces)
}
if (prop === 'total' && value !== null) {
return this.formatStatSum(value)
}
return value !== null
? parseFloat(value).toFixed(this.digitPlaces)
: value
},
getAnnotationCachedStats(annotation, cacheKey, prop) {
const cachedStatsMap = annotation?.data?.cachedStats || {}
const matchedStats = cachedStatsMap[cacheKey]
if (prop !== 'total') return matchedStats
const nmStats = Object.values(cachedStatsMap).find(item => item?.Modality === 'NM' && item.total !== undefined && item.total !== null)
return nmStats || matchedStats
},
formatStatSum(value) {
const num = Number(value)
if (!Number.isFinite(num)) return value
if (Math.abs(num - Math.round(num)) < 1e-6) {
return String(Math.round(num))
}
return this.reRound(num, this.digitPlaces)
},
reRound(result, finalPrecision) {
if (typeof result === 'string' && result.includes(', ')) {
const numStrs = result.split(', ')

View File

@ -1246,7 +1246,9 @@ export default {
if (!referencedImageId) return null
const cacheKey = annotation.from || annotation.metadata.volumeId ? `volumeId:${referencedImageId}` : `imageId:${referencedImageId}`
const points = ['x', 'y', 'z']
const cachedStats = annotation.markTool === "ArrowAnnotate" ? annotation.data?.handles?.points[0] : annotation.data?.cachedStats?.[cacheKey]
const cachedStats = annotation.markTool === "ArrowAnnotate"
? annotation.data?.handles?.points[0]
: this.getAnnotationCachedStats(annotation, cacheKey, prop)
const hasProp = cachedStats
&& (Object.prototype.hasOwnProperty.call(cachedStats, prop) || cachedStats[points.indexOf(prop)])
if (!hasProp) return null
@ -1270,6 +1272,13 @@ export default {
? parseFloat(value).toFixed(this.digitPlaces)
: value
},
getAnnotationCachedStats(annotation, cacheKey, prop) {
const cachedStatsMap = annotation?.data?.cachedStats || {}
const matchedStats = cachedStatsMap[cacheKey]
if (prop !== 'total') return matchedStats
const nmStats = Object.values(cachedStatsMap).find(item => item?.Modality === 'NM' && item.total !== undefined && item.total !== null)
return nmStats || matchedStats
},
formatStatSum(value) {
const num = Number(value)
if (!Number.isFinite(num)) return value