mpr查看标记和标记截图问题

main
wangxiaoshuang 2025-12-04 13:40:23 +08:00
parent ae536a7fc4
commit 09e5bcb3b7
2 changed files with 67 additions and 27 deletions

View File

@ -703,7 +703,7 @@ export default {
},
immediate: true
},
currentReadingTaskState() { console.log(this.currentReadingTaskState, 'currentReadingTaskState') },
// currentReadingTaskState() { console.log(this.currentReadingTaskState, 'currentReadingTaskState') },
activeTaskId: {
immediate: true,
handler(id) {
@ -722,7 +722,7 @@ export default {
this.clipPlaying = false
this.fps = 15
}
if (index === this.cells.length - 1 && series) {
if (index === this.cells.length - 1 && series && series.TaskInfo) {
this.lastViewportTaskId = series.TaskInfo.VisitTaskId
this.currentVisitInfo = series.TaskInfo
}
@ -1047,7 +1047,6 @@ export default {
const element2 = this.$refs['viewport-1'][0].$el
const element3 = this.$refs['viewport-2'][0].$el
const element4 = this.$refs['viewport-3'][0].$el
console.log(Enums.OrientationAxis)
let viewportInputArray = [
{
viewportId: 'viewport-0',
@ -1089,7 +1088,7 @@ export default {
type: ViewportType.ORTHOGRAPHIC,
element: volumeElement2,
defaultOptions: {
orientation: Enums.OrientationAxis.CORONAL
orientation: Enums.OrientationAxis.SAGITTAL
}
},
{
@ -1097,7 +1096,7 @@ export default {
type: ViewportType.ORTHOGRAPHIC,
element: volumeElement3,
defaultOptions: {
orientation: Enums.OrientationAxis.SAGITTAL
orientation: Enums.OrientationAxis.CORONAL
}
},
]
@ -1506,7 +1505,6 @@ export default {
const referencedImageId = annotation.metadata.referencedImageId
console.log(annotation, 'annotation')
const params = this.getInstanceInfo(referencedImageId)
console.log(params, 'params')
annotation.visitTaskId = series.TaskInfo.VisitTaskId
annotation.studyId = series.StudyId
annotation.seriesId = series.Id
@ -2725,20 +2723,31 @@ export default {
const i = this.visitTaskList.findIndex(i => i.VisitTaskId === obj.visitTaskId)
if (i === -1) return
const studyList = this.visitTaskList[i].StudyList
const series = this.getMarkedSeries(studyList, obj.annotation, true)
let series = this.getMarkedSeries(studyList, obj.annotation, true)
if (series) {
this.activeViewportIndex = this.cells.length - 1
if (obj.annotation.from === 'MPR') {
let res = await this.openMPRViewport(series)
let viewPlaneNormal = obj.annotation?.metadata?.viewPlaneNormal.map(i => i == 0 ? 0 : i).join(',')
if (viewPlaneNormal === '0,0,-1') {
this.activeViewportIndex = 0
series = Object.assign({ orientation: 'AXIAL' }, series)
} else if (viewPlaneNormal === '0,-1,0') {
this.activeViewportIndex = 1
} else if (viewPlaneNormal === '1,0,0') {
this.activeViewportIndex = 2
series = Object.assign({ orientation: 'CORONAL' }, series)
} else if (viewPlaneNormal === '1,0,0') {
this.activeViewportIndex = 1
series = Object.assign({ orientation: 'SAGITTAL' }, series)
}
let res = await this.openMPRViewport(series)
if (!res) return false
} else {
if (this.isMPR) {
this.isMPR = false
this.rows = 1
this.cols = 1
this.activeViewportIndex = 0
// return this.activeSeries(series)
}
}
this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].setSeriesInfo(series, true)
this.$refs[series.TaskInfo.VisitTaskId][0].setSeriesActive(series.StudyIndex, series.SeriesIndex)
@ -2748,17 +2757,41 @@ export default {
const i = this.visitTaskList.findIndex(i => i.VisitTaskId === obj.visitTaskId)
if (i === -1) return
const studyList = this.visitTaskList[i].StudyList
const series = this.getMarkedSeries(studyList, obj.annotation, true)
let series = this.getMarkedSeries(studyList, obj.annotation, true)
if (series) {
this.activeViewportIndex = this.cells.length - 1
if (obj.annotation.from === 'MPR') {
let viewPlaneNormal = obj.annotation?.metadata?.viewPlaneNormal.map(i => i == 0 ? 0 : i).join(',')
if (viewPlaneNormal === '0,0,-1') {
this.activeViewportIndex = 0
series = Object.assign({ orientation: 'AXIAL' }, series)
} else if (viewPlaneNormal === '0,-1,0') {
this.activeViewportIndex = 1
} else if (viewPlaneNormal === '1,0,0') {
this.activeViewportIndex = 2
series = Object.assign({ orientation: 'CORONAL' }, series)
} else if (viewPlaneNormal === '1,0,0') {
this.activeViewportIndex = 1
series = Object.assign({ orientation: 'SAGITTAL' }, series)
}
let res = await this.openMPRViewport(series)
if (!res) {
this.$refs[series.TaskInfo.VisitTaskId][0].setSeriesActive(series.StudyIndex, series.SeriesIndex)
setTimeout(async () => {
const divForDownloadViewport = document.querySelector(
`div[data-viewport-uid="${this.viewportKey}-${this.activeViewportIndex}"]`
)
const canvas = await html2canvas(divForDownloadViewport)
const base64Str = canvas.toDataURL('image/png', 1)
callback(base64Str)
}, 200)
return false
}
} else {
if (this.isMPR) {
this.isMPR = false
this.rows = 1
this.cols = 1
this.activeViewportIndex = 0
// return this.activeSeries(series)
}
}
this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].setSeriesInfo(series, true)
@ -2770,7 +2803,7 @@ export default {
const canvas = await html2canvas(divForDownloadViewport)
const base64Str = canvas.toDataURL('image/png', 1)
callback(base64Str)
}, 500)
}, 200)
}
},
async getScreenshots(measureData, callback) {
@ -3124,24 +3157,27 @@ export default {
},
async openMPRViewport(data = null) {
return new Promise(async (resolve, reject) => {
if (this.isMPR) return resolve(true)
if (this.isMPR) {
if (!data) return resolve(false)
let viewportSeries = this.$refs[`viewport-volume-0`][0].series
if (data && viewportSeries.SeriesInstanceUid === data.SeriesInstanceUid) return resolve(true)
}
this.isMPR = true
this.rows = 3
this.cols = 1
this.loading = true
this.loadingText = this.$t('trials:lugano:message:loadVolumes')
const series = data ? data : this.$refs[`viewport-${this.activeViewportIndex}`][0].series
this.activeViewportIndex = 0
// this.$refs[`viewport-0`][0].setSeriesInfo(series)
// this.$refs[`viewport-1`][0].setSeriesInfo(series)
// this.$refs[`viewport-2`][0].setSeriesInfo(series)
// this.$refs[`viewport-3`][0].setSeriesInfo(series)
if (!data) this.activeViewportIndex = 0
const visitTaskId = this.visitTaskList[this.activeTaskIndex].VisitTaskId
this.$refs[visitTaskId][0].setSeriesActive(series.StudyIndex, series.SeriesIndex)
await this.getVolume(series)
this.loading = false
this.loadingText = null
this.$refs[`viewport-volume-0`][0].setSeriesInfo(Object.assign({ orientation: 'AXIAL' }, series))
this.$refs[`viewport-volume-1`][0].setSeriesInfo(Object.assign({ orientation: 'CORONAL' }, series))
this.$refs[`viewport-volume-2`][0].setSeriesInfo(Object.assign({ orientation: 'SAGITTAL' }, series))
this.$refs[`viewport-volume-0`][0].setSeriesInfo(Object.assign({ orientation: 'AXIAL', isLocation: data && this.activeViewportIndex === 0 }, series))
this.$refs[`viewport-volume-1`][0].setSeriesInfo(Object.assign({ orientation: 'SAGITTAL', isLocation: data && this.activeViewportIndex === 1 }, series))
this.$refs[`viewport-volume-2`][0].setSeriesInfo(Object.assign({ orientation: 'CORONAL', isLocation: data && this.activeViewportIndex === 2 }, series))
resolve(false)
})

View File

@ -40,10 +40,10 @@
<div v-if="series" class="right-bottom-text">
<div v-show="imageInfo.location">Location: {{
`${Number(imageInfo.location).toFixed(digitPlaces)} mm`
}}</div>
}}</div>
<div v-show="imageInfo.sliceThickness">Slice Thickness: {{
`${Number(imageInfo.sliceThickness).toFixed(digitPlaces)} mm`
}}</div>
}}</div>
<div v-show="imageInfo.wwwc">WW/WL: {{ imageInfo.wwwc }}</div>
</div>
<div class="orientation-top">
@ -402,7 +402,7 @@ export default {
async setSeriesInfo(obj, isLocate = false) {
try {
let data = obj
if (this.series && data.Id === this.series.Id && data.Description === this.series.Description && !isLocate) {
if (this.series && data.Id === this.series.Id && data.Description === this.series.Description && !isLocate && !data.isLocation) {
data.SliceIndex = this.series.SliceIndex
}
const renderingEngine = getRenderingEngine(this.renderingEngineId)
@ -421,7 +421,11 @@ export default {
}
console.log("渲染成功")
}
}])
}]).then(res => {
if (data.isLocation) {
setTimeout(() => { csUtils.jumpToSlice(viewport.element, { imageIndex: data.SliceIndex }); })
}
})
viewport.render()
} catch (e) {
console.log(e)