多帧下载及进度条维护
continuous-integration/drone/push Build is passing Details

uat_us
caiyiling 2024-07-30 14:55:59 +08:00
parent fbb41e3fd9
commit 1eae9eda28
10 changed files with 408 additions and 457 deletions

View File

@ -41,6 +41,7 @@ const getters = {
lastCanvasTaskId: state => state.reading.lastCanvasTaskId,
imageQuality: state => state.reading.imageQuality,
imageQualityIssues: state => state.reading.imageQualityIssues,
currentLoadIns: state => state.reading.currentLoadIns,
language: state => state.lang.language,
TotalNeedSignSystemDocCount: state => state.user.TotalNeedSignSystemDocCount,
TotalNeedSignTrialDocCount: state => state.user.TotalNeedSignTrialDocCount,

View File

@ -30,7 +30,8 @@ const getDefaultState = () => {
activeSeries: {},
lastCanvasTaskId: '',
imageQuality: null,
imageQualityIssues: null
imageQualityIssues: null,
currentLoadIns: []
}
}
function getQuestions(questions) {
@ -139,6 +140,22 @@ function getQuestionAnswer(questions, questionMark, answers) {
return ''
}
}
// function getKeySeriesInfo(keyInstance, series) {
// const obj = {}
// const set = new Set()
// var instances = series.instanceList.concat(keyInstance).filter((item) => {
// if (set.has(item)) {
// return true
// } else {
// set.add(item)
// return false
// }
// })
// instances.map(item => {
// obj[item] = { seriesId: series.seriesId, studyIndex: series.studyIndex, seriesIndex: series.seriesIndex }
// })
// return obj
// }
const state = getDefaultState
@ -759,7 +776,17 @@ const actions = {
resolve()
} else {
var studyList = []
var keyImages = []
getReadingVisitStudyList(obj.trialId, obj.subjectVisitId, obj.visitTaskId).then(res => {
const i = res.Result.findIndex(i => i.IsCriticalSequence)
if (i > -1) {
const seriesList = res.Result[i].SeriesList && res.Result[i].SeriesList
seriesList.map(i => {
i.InstanceInfoList.map(k => {
keyImages.push({ instanceId: k.Id })
})
})
}
res.Result.forEach((study, studyIndex) => {
const data = {}
data.StudyId = study.StudyId
@ -785,16 +812,22 @@ const actions = {
series.InstanceInfoList.forEach(instance => {
if (instance.NumberOfFrames && instance.NumberOfFrames > 1) {
for (let i = 0; i < instance.NumberOfFrames; i++) {
const imageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?frame=${i}&instanceId=${instance.Id}&visitTaskId=${obj.visitTaskId}&idx=${studyIndex}|${seriesIndex}`
const imageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?frame=${i}&instanceId=${instance.Id}&visitTaskId=${obj.visitTaskId}&idx=${studyIndex}|${seriesIndex}|${index}`
imageIds.push(imageId)
}
instance.ImageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?frame=${0}&instanceId=${instance.Id}&visitTaskId=${obj.visitTaskId}&idx=${studyIndex}|${seriesIndex}`
instance.ImageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?frame=${0}&instanceId=${instance.Id}&visitTaskId=${obj.visitTaskId}&idx=${studyIndex}|${seriesIndex}|${index}`
} else {
const imageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?instanceId=${instance.Id}&visitTaskId=${obj.visitTaskId}&idx=${studyIndex}|${seriesIndex}`
const imageId = `wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?instanceId=${instance.Id}&visitTaskId=${obj.visitTaskId}&idx=${studyIndex}|${seriesIndex}|${index}`
imageIds.push(imageId)
instance.ImageId = imageId
}
if (!study.IsCriticalSequence && series.IsBeMark) {
const i = keyImages.findIndex(i => i.instanceId === instance.Id)
if (i > -1) {
keyImages[i].studyIndex = studyIndex
keyImages[i].seriesIndex = seriesIndex
}
}
instanceList.push(instance.Id)
})
seriesList.push({
@ -837,6 +870,7 @@ const actions = {
})
state.visitTaskList[index].StudyList = studyList
state.visitTaskList[index].studyListInit = true
state.visitTaskList[index].KeyImages = keyImages
// sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '')
resolve()
}).catch(() => { resolve() })
@ -895,11 +929,114 @@ const actions = {
resolve()
})
},
setImageLoadedProgress({ state }, obj) {
const studyIndex = parseInt(obj.idx.split('|')[0])
const seriesIndex = parseInt(obj.idx.split('|')[1])
const visitTaskIndex = parseInt(obj.idx.split('|')[2])
let pStudyIndex = null
let pSeriesIndex = null
let pSeries = null
try {
const study = state.visitTaskList[visitTaskIndex].StudyList[studyIndex]
const series = state.visitTaskList[visitTaskIndex].StudyList[studyIndex].SeriesList[seriesIndex]
const keyImages = state.visitTaskList[visitTaskIndex].KeyImages
if (study.IsCriticalSequence) {
const i = keyImages.findIndex(i => i.instanceId === obj.instanceId)
if (i > -1) {
pStudyIndex = keyImages[i].studyIndex
pSeriesIndex = keyImages[i].seriesIndex
}
} else if (series.isBeMark) {
if (keyImages.length > 0) {
pStudyIndex = 0
pSeriesIndex = 0
}
}
if (pStudyIndex !== null && pSeriesIndex !== null) {
pSeries = state.visitTaskList[visitTaskIndex].StudyList[pStudyIndex].SeriesList[pSeriesIndex]
}
var prefetchInstanceCount = series.prefetchInstanceCount
var instanceCount = series.instanceCount
var prefetchInstanceCount2 = pSeries ? pSeries.prefetchInstanceCount : null
var instanceCount2 = pSeries ? pSeries.instanceCount : null
if (series.imageloadedArr.indexOf(obj.instanceId) < 0) {
const i = state.currentLoadIns.findIndex(i => i.instanceId === obj.instanceId)
if (i > -1) {
prefetchInstanceCount = prefetchInstanceCount + obj.percentComplete - state.currentLoadIns[i].percentComplete
prefetchInstanceCount2 = prefetchInstanceCount2 !== null ? prefetchInstanceCount2 + obj.percentComplete - state.currentLoadIns[i].percentComplete : null
state.currentLoadIns[i].percentComplete = obj.percentComplete
if (obj.percentComplete >= 100) {
state.currentLoadIns.splice(i, 1)
}
} else {
if (obj.percentComplete !== 100) {
state.currentLoadIns.push({ instanceId: obj.instanceId, percentComplete: obj.percentComplete })
}
prefetchInstanceCount = prefetchInstanceCount + obj.percentComplete
prefetchInstanceCount2 = prefetchInstanceCount2 !== null ? prefetchInstanceCount2 + obj.percentComplete : null
}
series.prefetchInstanceCount = prefetchInstanceCount
if (pSeries) {
pSeries.prefetchInstanceCount = prefetchInstanceCount2
}
if (obj.percentComplete >= 100) {
series.imageloadedArr.push(obj.instanceId)
if (pSeries) {
pSeries.imageloadedArr.push(obj.instanceId)
}
}
}
if (prefetchInstanceCount >= instanceCount * 100) {
series.prefetchInstanceCount = instanceCount * 100
// 设置当前序列状态为已下载完成
series.loadStatus = true
}
if (prefetchInstanceCount2 !== null && instanceCount2 !== null && prefetchInstanceCount2 >= instanceCount2 * 100) {
pSeries.prefetchInstanceCount = instanceCount2 * 100
// 设置当前序列状态为已下载完成
pSeries.loadStatus = true
}
} catch (e) {
console.log('error')
}
},
setImageloadedInfo({ state }, obj) {
var index = state.visitTaskList.findIndex(i => i.VisitTaskId === obj.visitTaskId)
const prefetchInstanceCount = state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].prefetchInstanceCount
state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].prefetchInstanceCount = prefetchInstanceCount + 100
state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].imageloadedArr.push(obj.imageId)
console.log('setImageloadedInfo', obj)
// if(obj.instance === '20dd8fc9-51b0-ec63-942b-cb3006c72650')
// var index = state.visitTaskList.findIndex(i => i.VisitTaskId === obj.visitTaskId)
// // const prefetchInstanceCount = state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].prefetchInstanceCount
// const instanceList = state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].instanceList
// const idx = state.visitTaskList[index].StudyList.findIndex(i => i.IsCriticalSequence)
// if (!state.visitTaskList[index].StudyList[obj.studyIndex].IsCriticalSequence) {
// // 当前下载的非关键序列
// console.log('当前下载的非关键序列')
// if (idx > -1) {
// const keyInstance = state.visitTaskList[index].StudyList[idx].SeriesList[0].instanceList
// obj.markedImages = getKeySeriesInfo(keyInstance, state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex])
// instanceList.map(i => {
// if (obj.markedImages.hasOwnProperty(i) && state.visitTaskList[index].StudyList[idx].SeriesList[0].imageloadedArr.indexOf(i) < 0) {
// state.visitTaskList[index].StudyList[idx].SeriesList[0].imageloadedArr.push(i)
// state.visitTaskList[index].StudyList[idx].SeriesList[0].prefetchInstanceCount = state.visitTaskList[index].StudyList[idx].SeriesList[0].prefetchInstanceCount + 100
// }
// })
// if (state.visitTaskList[index].StudyList[idx].SeriesList[0].imageloadedArr >= state.visitTaskList[index].StudyList[idx].SeriesList[0].instanceCount) {
// state.visitTaskList[index].StudyList[idx].SeriesList[0].loadStatus = true
// }
// }
// }
// state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].prefetchInstanceCount = state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].instanceCount * 100
// state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].imageloadedArr = instanceList
// state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].loadStatus = true
// const imageloadedArr = state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].imageloadedArr
// if (imageloadedArr.indexOf())
// if (state.visitTaskList[index].StudyList[0].IsCriticalSequence){
// state.visitTaskList[index].StudyList[0].SeriesList[0].prefetchInstanceCount = prefetchInstanceCount + 100
// state.visitTaskList[index].StudyList[obj.studyIndex].SeriesList[obj.seriesIndex].imageloadedArr.push(obj.imageId)
// }
},
setStatus({ state }, obj) {
var index = state.visitTaskList.findIndex(i => i.VisitTaskId === obj.visitTaskId)

View File

@ -13,7 +13,7 @@
<!-- 临床数据 -->
<div v-if="stack.isExistsClinicalData" class="info-cd" @click.stop="handleViewCD($event)">
<el-tooltip class="item" effect="dark" :content="$t('trials:reading:button:clinicalData')" placement="bottom">
<svg-icon icon-class="documentation" class="svg-icon"/>
<svg-icon icon-class="documentation" class="svg-icon" />
</el-tooltip>
</div>
@ -222,7 +222,8 @@ export default {
taskBlindName: '',
frame: null,
imageRendered: false,
isExistsClinicalData:false
isExistsClinicalData: false,
isExistMutiFrames: false
// preventCache: true
},
dicomInfo: {
@ -758,7 +759,7 @@ export default {
const imageInfo = this.getInstanceInfo(imageId)
var instanceId = imageInfo.instanceId
var frame = imageInfo.frame
this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0
this.stack.frame = this.stack.isExistMutiFrames ? parseInt(frame) : null
const ToolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager
for (var m = 0; m < this.measuredTools.length; m++) {
var toolType = this.measuredTools[m]
@ -880,7 +881,6 @@ export default {
return seriesList[seriesIdx].loadStatus ? 1 : 0
},
renderMeasuredData(e) {
this.stack.frame = !isNaN(parseInt(this.stack.frame)) ? parseInt(this.stack.frame) : 0
var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.stack.visitTaskId)
if (idx === -1) return
this.measureData = this.visitTaskList[idx].MeasureData
@ -899,9 +899,7 @@ export default {
} else {
cornerstoneTools.setToolEnabledForElement(element, data.MeasureData.type, { mouseButtonMask: 1 })
}
// console.log('renderMeasuredData', this.stack.frame)
if (this.stack.instanceId.includes(data.InstanceId) && ((data.NumberOfFrames === this.stack.frame) || !data.NumberOfFrames) && data.MeasureData) {
if (this.stack.instanceId.includes(data.InstanceId) && ((this.stack.isExistMutiFrames && data.MeasureData.frame === this.stack.frame && data.MeasureData) || (!this.stack.isExistMutiFrames && data.MeasureData))) {
const toolState = ToolStateManager.getImageIdToolState(e.detail.image.imageId, data.MeasureData.type)
if (toolState && toolState.data.length > 0) {
var idx = toolState.data.findIndex(item => item.uuid === data.MeasureData.data.uuid)
@ -988,7 +986,7 @@ export default {
const imageInfo = this.getInstanceInfo(imageId)
var instanceId = imageInfo.instanceId
var frame = imageInfo.frame
this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0
this.stack.frame = this.stack.isExistMutiFrames ? parseInt(frame) : null
const ToolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager
for (let t = 0; t < this.measuredTools.length; t++) {
var toolType = this.measuredTools[t]
@ -1056,7 +1054,7 @@ export default {
this.stack.studyId = dicomSeries.studyId
this.stack.seriesNumber = dicomSeries.seriesNumber
this.stack.imageIds = dicomSeries.imageIds
this.stack.currentImageIdIndex = dicomSeries.imageIdIndex ? dicomSeries.imageIdIndex : 0
this.stack.currentImageIdIndex = dicomSeries.imageIdIndex && dicomSeries.imageIdIndex < dicomSeries.imageIds.length - 1 ? dicomSeries.imageIdIndex : 0
this.stack.imageIdIndex = dicomSeries.imageIdIndex
this.stack.firstImageLoading = true
this.stack.visitTaskId = dicomSeries.visitTaskId
@ -1067,6 +1065,7 @@ export default {
this.stack.sliceThickness = dicomSeries.sliceThickness
this.stack.instanceCount = dicomSeries.instanceCount
this.stack.isExistsClinicalData = dicomSeries.isExistsClinicalData
this.stack.isExistMutiFrames = dicomSeries.isExistMutiFrames
// this.measuredData = dicomSeries.measuredData
var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === dicomSeries.visitTaskId)
this.stack.visitTaskNum = this.visitTaskList[idx].VisitTaskNum
@ -1087,7 +1086,7 @@ export default {
const imageInfo = this.getInstanceInfo(imageId)
var instanceId = imageInfo.instanceId
var frame = imageInfo.frame
this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0
this.stack.frame = this.stack.isExistMutiFrames ? parseInt(frame) : null
this.stack.instanceId = instanceId
const ToolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager
ToolStateManager.clearImageIdToolState(dicomSeries.imageIds)
@ -1201,7 +1200,7 @@ export default {
const imageInfo = this.getInstanceInfo(image.imageId)
var instanceId = imageInfo.instanceId
var frame = imageInfo.frame
this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0
this.stack.frame = this.stack.isExistMutiFrames ? parseInt(frame) : null
this.stack.instanceId = instanceId
this.height = (this.stack.currentImageIdIndex) * 100 / (this.stack.imageIds.length - 1)
this.resetWwwc()
@ -1276,7 +1275,7 @@ export default {
const imageInfo = this.getInstanceInfo(imageId)
var instanceId = imageInfo.instanceId
var frame = imageInfo.frame
this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0
this.stack.frame = this.stack.isExistMutiFrames ? parseInt(frame) : null
if (this.imageId !== instanceId) {
this.getOrientationMarker(e.detail.element)
//
@ -1335,13 +1334,13 @@ export default {
const imageInfo = this.getInstanceInfo(imageId)
var instanceId = imageInfo.instanceId
var frame = imageInfo.frame
this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0
this.stack.frame = this.stack.isExistMutiFrames ? parseInt(frame) : null
if (e.detail.toolName === 'Length' || e.detail.toolName === 'ArrowAnnotate' || e.detail.toolName === 'RectangleRoi') {
const measureData = {}
measureData.studyId = this.stack.studyId
measureData.seriesId = this.stack.seriesId
measureData.instanceId = instanceId
measureData.frame = this.stack.frame ? this.stack.frame : 0
measureData.frame = this.stack.frame
measureData.data = e.detail.measurementData
measureData.type = e.detail.toolName
measureData.thick = this.dicomInfo.thick
@ -1455,7 +1454,7 @@ export default {
const imageInfo = this.getInstanceInfo(imageId)
var instanceId = imageInfo.instanceId
var frame = imageInfo.frame
this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0
this.stack.frame = this.stack.isExistMutiFrames ? parseInt(frame) : null
var uuid = measurementData.uuid
var idx = this.measureData.findIndex(item => item.MeasureData && item.MeasureData.data && item.MeasureData.data.uuid === uuid)

View File

@ -878,7 +878,7 @@ export default {
activeSeries: {
immediate: true,
handler(v) {
console.log('activeSeries', v)
// console.log('activeSeries', v)
if (v && v.isCurrentTask && this.studyList.length === 0) {
this.activeTaskInfo.taskName = v.taskBlindName
this.activeTaskInfo.visitTaskId = v.visitTaskId
@ -1021,6 +1021,10 @@ export default {
if (!this.petctWindow) return
this.petctWindow.postMessage({ type: 'readingPageUpdate', data: data }, window.location)
})
DicomEvent.$on('resetPage', () => {
if (!this.petctWindow) return
this.petctWindow.postMessage({ type: 'resetPage' }, window.location)
})
DicomEvent.$on('setReadingState', (data) => {
if (!this.petctWindow) return
this.petctWindow.postMessage({ type: 'setReadingState', data: data }, window.location)
@ -1058,28 +1062,30 @@ export default {
})
},
methods: {
getWwcTpl() {
const loading = this.$loading({ fullscreen: true })
getUserWLTemplateList().then(res => {
async getWwcTpl() {
// const loading = this.$loading({ fullscreen: true })
try {
const res = await getUserWLTemplateList()
this.customWwcTpl = []
res.Result.map(i => {
this.customWwcTpl.push({ label: i.TemplateName, wc: i.WL, ww: i.WW })
})
this.wwwcArr = [...this.defaultWwwc, ...this.customWwcTpl]
loading.close()
}).catch(() => { loading.close() })
} catch (e) {
console.log(e)
}
},
getHotKeys() {
const loading = this.$loading({ fullscreen: true })
getDoctorShortcutKey({ imageToolType: 0 }).then(res => {
async getHotKeys() {
// const loading = this.$loading({ fullscreen: true })
try {
const res = await getDoctorShortcutKey({ imageToolType: 0 })
res.Result.map(item => {
this.hotKeyList.push({ id: item.Id, altKey: item.AltKey, ctrlKey: item.CtrlKey, shiftKey: item.ShiftKey, metaKey: item.MetaKey, key: item.Keyboardkey, code: item.Code, text: item.Text, shortcutKeyEnum: item.ShortcutKeyEnum })
})
this.bindHotKey()
loading.close()
}).catch(() => {
loading.close()
})
} catch (e) {
console.log(e)
}
},
resetHotkeyList(arr) {
this.hotKeyList = []
@ -1102,7 +1108,7 @@ export default {
var container = this.$refs['container']
// window.addEventListener
container.addEventListener('keydown', event => {
console.log(event)
// console.log(event)
event.preventDefault()
var idx = this.hotKeyList.findIndex(i => i.code === event.code && i.ctrlKey === event.ctrlKey && i.shiftKey === event.shiftKey && i.altKey === event.altKey)
@ -1582,7 +1588,9 @@ export default {
var seriesIdx = studyList[studyIdx].SeriesList.findIndex(s => s.seriesId === seriesId)
if (seriesIdx > -1) {
var series = studyList[studyIdx].SeriesList[seriesIdx]
var instanceIdx = series.instanceList.findIndex(imageId => !!~imageId.indexOf(instanceId))
const frame = this.visitTaskList[index].MeasureData[idx].MeasureData.frame
const filterStr = series.isExistMutiFrames ? `frame=${frame}&instanceId=${instanceId}` : `instanceId=${instanceId}`
var instanceIdx = series.imageIds.findIndex(imageId => imageId.includes(filterStr))
if (instanceIdx > -1) {
series.imageIdIndex = instanceIdx
seriesInfo = series

View File

@ -72,6 +72,13 @@ import DicomEvent from './DicomEvent'
import store from '@/store'
import { getToken } from '@/utils/auth'
import { mapGetters } from 'vuex'
import * as dicomParser from 'dicom-parser'
import * as cornerstone from 'cornerstone-core'
import * as cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader'
cornerstoneWADOImageLoader.external.dicomParser = dicomParser
cornerstoneWADOImageLoader.external.cornerstone = cornerstone
const maximumSizeInBytes = 1024 * 1024 * 1024 * 6
cornerstone.imageCache.setMaximumSizeBytes(maximumSizeInBytes)
export default {
name: 'ReadPage',
components: {
@ -210,14 +217,20 @@ export default {
this.$refs[this.activeTaskVisitId][0].selectSeries(data)
})
})
cornerstone.events.addEventListener('cornerstoneimageloadprogress', this.cornerstoneimageloadprogress)
window.addEventListener('beforeunload', e => {
cornerstone.imageCache.purgeCache()
})
},
beforeDestroy() {
cornerstone.imageCache.purgeCache()
DicomEvent.$off('getNextVisitInfo')
DicomEvent.$off('toggleSeries')
DicomEvent.$off('isCanActiveNoneDicomTool')
DicomEvent.$off('removeNoneDicomMeasureData')
DicomEvent.$off('addNoneDicomMeasureData')
DicomEvent.$off('selectSeries')
window.removeEventListener('beforeunload', e => { cornerstone.imageCache.purgeCache() })
},
methods: {
async getVisitInfo() {
@ -400,7 +413,7 @@ export default {
idx > -1 ? obj = seriesList[idx] : ''
}
if (obj) {
const index = Math.floor(obj.imageIds.length * ((baseSeries.imageIdIndex + 1) / baseSeries.instanceCount))
const index = Math.floor(obj.imageIds.length * ((baseSeries.imageIdIndex + 1) / baseSeries.imageIds))
obj.imageIdIndex = index > 0 ? index - 1 : 0
}
return obj
@ -464,7 +477,10 @@ export default {
var seriesIdx = studyList[studyIdx].SeriesList.findIndex(s => s.seriesId === seriesId)
if (seriesIdx > -1) {
var series = studyList[studyIdx].SeriesList[seriesIdx]
var instanceIdx = series.instanceList.findIndex(imageId => !!~imageId.indexOf(instanceId))
// var instanceIdx = series.instanceList.findIndex(imageId => !!~imageId.indexOf(instanceId))
const frame = this.visitTaskList[index].MeasureData[idx].MeasureData.frame
const filterStr = series.isExistMutiFrames ? `frame=${frame}&instanceId=${instanceId}` : `instanceId=${instanceId}`
var instanceIdx = series.imageIds.findIndex(imageId => imageId.includes(filterStr))
if (instanceIdx > -1) {
series.imageIdIndex = instanceIdx
// series.studyIndex = studyIdx
@ -485,6 +501,16 @@ export default {
seriesInfo = this.getLinkedSeries(baseSeries, visitTaskId, visitTaskIdx)
}
return seriesInfo
},
cornerstoneimageloadprogress(e) {
const imageId = e.detail.imageId
const params = {}
const searchParams = new URLSearchParams(imageId.split('?')[1])
for (const [key, value] of searchParams.entries()) {
params[key] = value
}
params.percentComplete = e.detail.percentComplete
store.dispatch('reading/setImageLoadedProgress', params)
}
}
}

View File

@ -158,18 +158,13 @@
</div>
</template>
<script>
import * as dicomParser from 'dicom-parser'
import * as cornerstone from 'cornerstone-core'
import * as cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader'
// import * as cornerstone from 'cornerstone-core'
import requestPoolManager from '@/utils/request-pool'
import DicomEvent from './DicomEvent'
import { mapGetters } from 'vuex'
import store from '@/store'
import SrList from './SrList'
cornerstoneWADOImageLoader.external.dicomParser = dicomParser
cornerstoneWADOImageLoader.external.cornerstone = cornerstone
const maximumSizeInBytes = 1024 * 1024 * 1024 * 6
cornerstone.imageCache.setMaximumSizeBytes(maximumSizeInBytes)
export default {
name: 'StudyList',
components: { SrList },
@ -218,9 +213,7 @@ export default {
srDialogVisible: false,
srInfo: {},
digitPlaces: 2,
visitTaskIdx: -1,
currentLoadIns: [],
keySeriesLoad: []
visitTaskIdx: -1
}
},
@ -270,18 +263,18 @@ export default {
// }
// })
// const debouncedInputHandler = this.debounce(this.cornerstoneimageloadprogress, 100)
cornerstone.events.addEventListener('cornerstoneimageloadprogress', this.cornerstoneimageloadprogress)
cornerstone.events.addEventListener('cornerstoneimageloaded', this.cornerstoneImageLoaded)
// cornerstone.events.addEventListener('cornerstoneimageloadprogress', this.cornerstoneimageloadprogress)
// cornerstone.events.addEventListener('cornerstoneimageloaded', this.cornerstoneImageLoaded)
// cornerstone.events.addEventListener('cornerstoneimagecachefull', this.cornerstoneimagecachefull)
// cornerstone.events.addEventListener('cornerstoneimagecachechanged', this.cornerstoneimagecachechanged)
window.addEventListener('beforeunload', e => {
cornerstone.imageCache.purgeCache()
})
// window.addEventListener('beforeunload', e => {
// cornerstone.imageCache.purgeCache()
// })
},
beforeDestroy() {
cornerstone.imageCache.purgeCache()
// cornerstone.imageCache.purgeCache()
DicomEvent.$off('refreshStudyListMeasureData')
window.removeEventListener('beforeunload', e => { cornerstone.imageCache.purgeCache() })
// window.removeEventListener('beforeunload', e => { cornerstone.imageCache.purgeCache() })
},
methods: {
debounce(fn, delay) {
@ -360,8 +353,27 @@ export default {
this.studyIndex = sIdx
this.seriesIndex = 0
this.activeNames = [`${this.studyList[sIdx].StudyId}`]
this.loadImages(this.visitTaskList[idx])
//
const i = this.studyList.findIndex(i => i.IsCriticalSequence)
if (i > -1 && this.studyList[i].SeriesList[0].length > 0) {
const series = this.studyList[i].SeriesList[0]
if (!series.loadStatus) {
let priority = parseInt(new Date().getTime())
if (series.isExistMutiFrames) {
series.instanceInfoList.map(image => {
priority = priority - 1
this.imageList.push({ imageId: image.ImageId, seriesId: series.seriesId, studyIndex: i, seriesIndex: 0, visitTaskId: series.visitTaskId, priority })
})
} else {
series.imageIds.map(imageId => {
priority = priority - 1
this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex: i, seriesIndex: 0, visitTaskId: series.visitTaskId, priority })
})
}
}
}
this.loopLoad()
// this.loadImages(this.visitTaskList[idx])
}
}
this.isRender = true
@ -369,7 +381,6 @@ export default {
},
async getInitSeries() {
console.log('getInitSeries')
var seriesList = []
var isReadingTaskViewInOrder = parseInt(this.$router.currentRoute.query.isReadingTaskViewInOrder)
var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId)
@ -444,9 +455,10 @@ export default {
const sdIndx = studyList.findIndex(sd => sd.StudyId === measureDatas[i].StudyId)
const seriesList = studyList[sdIndx].SeriesList
const srIdx = seriesList.findIndex(sr => sr.seriesId === measureDatas[i].SeriesId)
// const instanceList = seriesList[srIdx].imageIds
const instanceList = seriesList[srIdx].instanceList
const isIdx = instanceList.findIndex(is => is.includes(measureDatas[i].InstanceId))
// const instanceList = seriesList[srIdx].instanceList
const imageIds = seriesList[srIdx].imageIds
const filterStr = seriesList[srIdx].isExistMutiFrames ? `frame=${measureDatas[i].MeasureData.frame}&instanceId=${measureDatas[i].InstanceId}` : `instanceId=${measureDatas[i].InstanceId}`
const isIdx = imageIds.findIndex(is => is.includes(filterStr))
const series = seriesList[srIdx]
series.imageIdIndex = isIdx
@ -517,8 +529,9 @@ export default {
const seriesList = studyList[sdIndx].SeriesList
const srIdx = seriesList.findIndex(sr => sr.seriesId === measureDatas[mIdx].SeriesId)
// const instanceList = seriesList[srIdx].imageIds
const instanceList = seriesList[srIdx].instanceList
const isIdx = instanceList.findIndex(is => is.includes(measureDatas[mIdx].InstanceId))
const imageIds = seriesList[srIdx].imageIds
const filterStr = seriesList[srIdx].isExistMutiFrames ? `frame=${measureDatas[mIdx].MeasureData.frame}&instanceId=${measureDatas[mIdx].InstanceId}` : `instanceId=${measureDatas[mIdx].InstanceId}`
const isIdx = imageIds.findIndex(is => is.includes(filterStr))
const series = seriesList[srIdx]
series.imageIdIndex = isIdx
@ -617,6 +630,7 @@ export default {
this.seriesIndex = seriesIndex
this.studyList[studyIndex].SeriesList[seriesIndex].measureData = this.measureData
var dicomStatck = this.studyList[studyIndex].SeriesList[seriesIndex]
dicomStatck.imageIdIndex = 0
this.$emit('loadImageStack', dicomStatck)
if (!series.loadStatus && series.modality !== 'SR') {
this.loopLoadStatus = -1
@ -658,13 +672,14 @@ export default {
},
showMultiFrames(studyIndex, series, seriesIndex, instanceInfo) {
this.currentSeriesIndex = seriesIndex
var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId)
const imageIds = []
if (instanceInfo.NumberOfFrames && instanceInfo.NumberOfFrames > 1) {
for (let j = 0; j < instanceInfo.NumberOfFrames; j++) {
imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${instanceInfo.Path}?frame=${j}&instanceId=${instanceInfo.Id}&visitTaskId=${this.visitTaskId}&idx=${studyIndex}|${seriesIndex}`)
imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${instanceInfo.Path}?frame=${j}&instanceId=${instanceInfo.Id}&visitTaskId=${this.visitTaskId}&idx=${studyIndex}|${seriesIndex}|${idx}`)
}
} else {
imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${instanceInfo.Path}?instanceId=${instanceInfo.Id}&visitTaskId=${this.visitTaskId}&idx=${studyIndex}|${seriesIndex}`)
imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${instanceInfo.Path}?instanceId=${instanceInfo.Id}&visitTaskId=${this.visitTaskId}&idx=${studyIndex}|${seriesIndex}|${idx}`)
}
this.studyIndex = studyIndex
this.seriesIndex = seriesIndex
@ -712,7 +727,8 @@ export default {
var activeNames = `${this.studyList[obj.studyIndex].StudyId}`
if (this.activeNames.includes(activeNames)) return
this.activeNames.push(activeNames)
this.loadImages(this.visitTaskList[idx])
// console.log('setSeriesActive', obj)
this.loadImages(obj)
},
selectSeries(obj) {
var seriseList = this.studyList.map(s => s.SeriesList).flat()
@ -737,10 +753,27 @@ export default {
var activeNames = `${this.studyList[series.studyIndex].StudyId}`
if (this.activeNames.includes(activeNames)) return
this.activeNames.push(activeNames)
this.loadImages(this.visitTaskList[idx])
this.loadImages(series)
store.dispatch('reading/setActiveSeries', series)
},
loadImages(taskInfo) {
loadImages(series) {
var priority = parseInt(new Date().getTime())
if (!series.loadStatus && series.isDicom && series.modality !== 'SR') {
if (series.isExistMutiFrames) {
series.instanceInfoList.map(image => {
priority = priority - 1
this.imageList.push({ imageId: image.ImageId, seriesId: series.seriesId, studyIndex: series.studyIndex, seriesIndex: series.seriesIndex, visitTaskId: series.visitTaskId, priority })
})
} else {
series.imageIds.map(imageId => {
priority = priority - 1
this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex: series.studyIndex, seriesIndex: series.seriesIndex, visitTaskId: series.visitTaskId, priority })
})
}
}
this.loopLoad()
},
loadImages1(taskInfo) {
// const isBaseLineTask = taskInfo.IsBaseLineTask
const isCurrentTask = taskInfo.IsCurrentTask
// var priority = isCurrentTask ? parseInt(new Date().getTime()) : 999
@ -832,141 +865,6 @@ export default {
console.log('stopLoadSeries')
requestPoolManager.removeTask(series.seriesId)
this.$set(this.studyList[studyIndex].SeriesList[seriesIndex], 'isLoading', false)
},
async imageLoaded(image, seriesUid) {
// await store.dispatch('reading/updateStudyList', { visitTaskId: image.visitTaskId, imageId: image.imageId, seriesUid })
// console.log(this.studyList[image.studyIndex].SeriesList[image.seriesIndex])
if (image.studyIndex > -1 && image.seriesIndex > -1) {
var prefetchInstanceCount = this.studyList[image.studyIndex].SeriesList[image.seriesIndex].prefetchInstanceCount
var instanceCount = this.studyList[image.studyIndex].SeriesList[image.seriesIndex].instanceCount
if (this.studyList[image.studyIndex].SeriesList[image.seriesIndex].imageloadedArr.indexOf(image.imageId) < 0) {
this.studyList[image.studyIndex].SeriesList[image.seriesIndex].imageloadedArr.push(image.imageId)
prefetchInstanceCount = prefetchInstanceCount + 1
this.studyList[image.studyIndex].SeriesList[image.seriesIndex].prefetchInstanceCount = prefetchInstanceCount
}
if (prefetchInstanceCount >= instanceCount) {
this.studyList[image.studyIndex].SeriesList[image.seriesIndex].prefetchInstanceCount = this.studyList[image.studyIndex].SeriesList[image.seriesIndex].instanceCount
//
this.studyList[image.studyIndex].SeriesList[image.seriesIndex].loadStatus = true
}
}
// store.dispatch('reading/updateSeriesList', { visitTaskindex: this.visitTaskIdx, studyIndex: image.studyIndex, seriesIndex: image.seriesIndex, imageId: image.imageId })
},
// instance
async cornerstoneImageLoaded(e) {
// var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId)
// if (idx === -1) return
// this.studyList = this.visitTaskList[idx].StudyList
// if (!this.studyList || this.studyList.length === 0) {
// return
// }
// if (!this.visitTaskList[idx].IsInit) {
// const loading = this.$loading({ fullscreen: true })
// await store.dispatch('reading/getMeasuredData', this.visitTaskList[idx].VisitTaskId)
// await store.dispatch('reading/getStudyInfo', { trialId: this.trialId, subjectVisitId: this.visitTaskList[idx].VisitId, visitTaskId: this.visitTaskList[idx].VisitTaskId, taskBlindName: this.visitTaskList[idx].TaskBlindName })
// await store.dispatch('reading/getReadingQuestionAndAnswer', { trialId: this.trialId, visitTaskId: this.visitTaskList[idx].VisitTaskId })
// await store.dispatch('reading/getDicomReadingQuestionAnswer', { trialId: this.trialId, visitTaskId: this.visitTaskList[idx].VisitTaskId })
// await store.dispatch('reading/setStatus', { visitTaskId: this.visitTaskList[idx].VisitTaskId })
// loading.close()
// }
// await store.dispatch('reading/updateStudyList', { visitTaskId: this.visitTaskId, imageId: e.detail.image.imageId, seriesUid: e.detail.image.data.string('x0020000e') })
// const uri = e.detail.image.sharedCacheKey
// const index = this.cachedImages.findIndex(item => item.uri === uri)
// if (index === -1) {
// this.cachedImages.push({ uri: uri, timestamp: new Date().getTime() })
// } else {
// this.cachedImages[index].timestamp = new Date().getTime()
// }
// var imageId = e.detail.image.imageId
// var seriesUid = e.detail.image.data.string('x0020000e')
// var studyIndex = -1
// var seriesIndex = -1
// for (let i = 0; i < this.studyList.length; ++i) {
// for (let j = 0; j < this.studyList[i].SeriesList.length; ++j) {
// if (this.studyList[i].SeriesList[j].seriesUid === seriesUid) {
// studyIndex = i
// seriesIndex = j
// break
// }
// }
// if (studyIndex > 0) break
// }
// if (seriesIndex < 0) return
// const imageIdIndex = this.studyList[studyIndex].SeriesList[seriesIndex].imageIds.indexOf(imageId)
// if (imageIdIndex < 0) return
// if (this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.indexOf(imageId) < 0) {
// if (this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount >= this.studyList[studyIndex].SeriesList[seriesIndex].instanceCount) {
// //
// this.studyList[studyIndex].SeriesList[seriesIndex].loadStatus = true
// }
// }
},
cornerstoneimageloadprogress(e) {
const imageId = e.detail.imageId
const params = {}
const searchParams = new URLSearchParams(imageId.split('?')[1])
for (const [key, value] of searchParams.entries()) {
params[key] = value
}
if (this.visitTaskId !== params.visitTaskId) return
const percentComplete = e.detail.percentComplete
const studyIndex = parseInt(params.idx.split('|')[0])
const seriesIndex = parseInt(params.idx.split('|')[1])
//
const seriesId = this.studyList[studyIndex].SeriesList[seriesIndex].seriesId
const i = this.keySeriesLoad.findIndex(i => i.seriesId === seriesId)
if (this.studyList[studyIndex].IsCriticalSequence && percentComplete >= 100) {
//
if (i === -1) {
this.keySeriesLoad.push({ seriesId: seriesId, loadCount: 1, imageIds: [imageId] })
} else {
++this.keySeriesLoad[i].loadCount
this.keySeriesLoad[i].imageIds.push(imageId)
}
}
if (!this.studyList[studyIndex].IsCriticalSequence && i > -1) {
this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount = this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount + 100 * this.keySeriesLoad[i].loadCount
this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr = [this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr, this.keySeriesLoad[i].imageIds]
this.keySeriesLoad.splice(i, 1)
}
var prefetchInstanceCount = this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount
var instanceCount = this.studyList[studyIndex].SeriesList[seriesIndex].instanceCount
if (this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.indexOf(imageId) < 0) {
const i = this.currentLoadIns.findIndex(i => i.imageId === imageId)
if (i > -1) {
prefetchInstanceCount = prefetchInstanceCount + percentComplete - this.currentLoadIns[i].percentComplete
this.currentLoadIns[i].percentComplete = percentComplete
if (percentComplete >= 100) {
this.currentLoadIns.splice(i, 1)
}
} else {
if (percentComplete !== 100) {
this.currentLoadIns.push({ imageId, percentComplete })
}
prefetchInstanceCount = prefetchInstanceCount + percentComplete
}
this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount = prefetchInstanceCount
if (percentComplete >= 100) {
this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.push(imageId)
}
}
if (prefetchInstanceCount >= instanceCount * 100) {
this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount = instanceCount * 100
//
this.studyList[studyIndex].SeriesList[seriesIndex].loadStatus = true
// this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.push(imageId)
}
},
cornerstoneimagecachechanged(e) {
const cacheInfo = cornerstone.imageCache.getCacheInfo()
console.log(cacheInfo)
},
cornerstoneimagecachefull(e) {
console.log('超过内存了')
}
}
}

View File

@ -222,7 +222,8 @@ export default {
taskBlindName: '',
frame: null,
imageRendered: false,
isExistsClinicalData: false
isExistsClinicalData: false,
isExistMutiFrames: false
// preventCache: true
},
dicomInfo: {
@ -746,7 +747,7 @@ export default {
const imageInfo = this.getInstanceInfo(imageId)
var instanceId = imageInfo.instanceId
var frame = imageInfo.frame
this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0
this.stack.frame = this.stack.isExistMutiFrames ? parseInt(frame) : null
const ToolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager
for (var m = 0; m < this.measuredTools.length; m++) {
var toolType = this.measuredTools[m]
@ -868,7 +869,6 @@ export default {
return seriesList[seriesIdx].loadStatus ? 1 : 0
},
renderMeasuredData(e) {
this.stack.frame = !isNaN(parseInt(this.stack.frame)) ? parseInt(this.stack.frame) : 0
var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.stack.visitTaskId)
if (idx === -1) return
this.measureData = this.visitTaskList[idx].MeasureData
@ -889,9 +889,9 @@ export default {
cornerstoneTools.setToolPassiveForElement(element, data.MeasureData.type, { mouseButtonMask: 1 })
}
// console.log('renderMeasuredData', this.stack.frame)
if (this.stack.instanceId.includes(data.InstanceId) && ((data.NumberOfFrames === this.stack.frame) || !data.NumberOfFrames) && data.MeasureData) {
if (this.stack.instanceId.includes(data.InstanceId) && ((this.stack.isExistMutiFrames && data.MeasureData.frame === this.stack.frame && data.MeasureData) || (!this.stack.isExistMutiFrames && data.MeasureData))) {
// console.log('renderMeasuredData', this.stack.frame,data.MeasureData.frame,this.stack.isExistMutiFrames)
const toolState = ToolStateManager.getImageIdToolState(e.detail.image.imageId, data.MeasureData.type)
if (toolState && toolState.data.length > 0) {
var idx = toolState.data.findIndex(item => item.uuid === data.MeasureData.data.uuid)
@ -978,7 +978,7 @@ export default {
const imageInfo = this.getInstanceInfo(imageId)
var instanceId = imageInfo.instanceId
var frame = imageInfo.frame
this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0
this.stack.frame = this.stack.isExistMutiFrames ? parseInt(frame) : null
const ToolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager
for (let t = 0; t < this.measuredTools.length; t++) {
var toolType = this.measuredTools[t]
@ -1039,7 +1039,7 @@ export default {
this.stack.studyId = dicomSeries.studyId
this.stack.seriesNumber = dicomSeries.seriesNumber
this.stack.imageIds = dicomSeries.imageIds
this.stack.currentImageIdIndex = dicomSeries.imageIdIndex ? dicomSeries.imageIdIndex : 0
this.stack.currentImageIdIndex = dicomSeries.imageIdIndex && dicomSeries.imageIdIndex < dicomSeries.imageIds.length - 1 ? dicomSeries.imageIdIndex : 0
this.stack.imageIdIndex = dicomSeries.imageIdIndex
this.stack.firstImageLoading = true
this.stack.visitTaskId = dicomSeries.visitTaskId
@ -1063,7 +1063,7 @@ export default {
const imageInfo = this.getInstanceInfo(imageId)
var instanceId = imageInfo.instanceId
var frame = imageInfo.frame
this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0
this.stack.frame = this.stack.isExistMutiFrames ? parseInt(frame) : null
this.stack.instanceId = instanceId
const ToolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager
ToolStateManager.clearImageIdToolState(dicomSeries.imageIds)
@ -1178,7 +1178,7 @@ export default {
const imageInfo = this.getInstanceInfo(image.imageId)
var instanceId = imageInfo.instanceId
var frame = imageInfo.frame
this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0
this.stack.frame = this.stack.isExistMutiFrames ? parseInt(frame) : null
this.stack.instanceId = instanceId
this.height = (this.stack.currentImageIdIndex) * 100 / (this.stack.imageIds.length - 1)
this.resetWwwc()
@ -1253,7 +1253,7 @@ export default {
const imageInfo = this.getInstanceInfo(imageId)
var instanceId = imageInfo.instanceId
var frame = imageInfo.frame
this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0
this.stack.frame = this.stack.isExistMutiFrames ? parseInt(frame) : null
if (this.imageId !== instanceId) {
this.getOrientationMarker(e.detail.element)
//
@ -1434,7 +1434,7 @@ export default {
const imageInfo = this.getInstanceInfo(imageId)
var instanceId = imageInfo.instanceId
var frame = imageInfo.frame
this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0
this.stack.frame = this.stack.isExistMutiFrames ? parseInt(frame) : null
var uuid = measurementData.uuid
var idx = this.measureData.findIndex(item => item.MeasureData && item.MeasureData.data && item.MeasureData.data.uuid === uuid)

View File

@ -914,7 +914,7 @@ export default {
this.getWwcTpl()
// cornerstone.imageCache.setMaximumSizeBytes(0)
// const maximumSizeInBytes = 1024 * 1024 * 1024 * 6
// const maximumSizeInBytes = 1024 * 1024 * 1024 * 3 // 1 GB
// const maximumSizeInBytes = 1024 * 1024 * 500
// cornerstone.imageCache.setMaximumSizeBytes(maximumSizeInBytes)
this.customWwc = {
@ -993,6 +993,7 @@ export default {
}
console.log('getMeasureData')
})
DicomEvent.$on('getScreenshots', (callback) => {
var base64Str =
this.$refs[
@ -1051,11 +1052,11 @@ export default {
this.uploadStatus = status
this.uploadImageVisible = true
},
getWwcTpl() {
const loading = this.$loading({ fullscreen: true })
getUserWLTemplateList()
.then((res) => {
this.customWwcTpl = []
async getWwcTpl() {
// const loading = this.$loading({ fullscreen: true })
try {
let res = await getUserWLTemplateList()
this.customWwcTpl = []
res.Result.map((i) => {
this.customWwcTpl.push({
label: i.TemplateName,
@ -1064,35 +1065,32 @@ export default {
})
})
this.wwwcArr = [...this.defaultWwwc, ...this.customWwcTpl]
loading.close()
})
.catch(() => {
loading.close()
})
} catch(e) {
console.log(e)
}
},
getHotKeys() {
const loading = this.$loading({ fullscreen: true })
getDoctorShortcutKey({ imageToolType: 0 })
.then((res) => {
res.Result.map((item) => {
this.hotKeyList.push({
id: item.Id,
altKey: item.AltKey,
ctrlKey: item.CtrlKey,
shiftKey: item.ShiftKey,
metaKey: item.MetaKey,
key: item.Keyboardkey,
code: item.Code,
text: item.Text,
shortcutKeyEnum: item.ShortcutKeyEnum
})
async getHotKeys() {
// const loading = this.$loading({ fullscreen: true })
try {
let res = await getDoctorShortcutKey({ imageToolType: 0 })
res.Result.map((item) => {
this.hotKeyList.push({
id: item.Id,
altKey: item.AltKey,
ctrlKey: item.CtrlKey,
shiftKey: item.ShiftKey,
metaKey: item.MetaKey,
key: item.Keyboardkey,
code: item.Code,
text: item.Text,
shortcutKeyEnum: item.ShortcutKeyEnum
})
this.bindHotKey()
loading.close()
})
.catch(() => {
loading.close()
})
this.bindHotKey()
} catch(e) {
console.log(e)
}
},
resetHotkeyList(arr) {
this.hotKeyList = []
@ -1702,10 +1700,13 @@ export default {
(s) => s.seriesId === seriesId
)
if (seriesIdx > -1) {
var series = studyList[studyIdx].SeriesList[seriesIdx]
var instanceIdx = series.instanceList.findIndex(
(imageId) => !!~imageId.indexOf(instanceId)
)
var series = studyList[studyIdx].SeriesList[seriesIdx];
let frame = this.visitTaskList[index].MeasureData[idx].MeasureData.frame
let filterStr = series.isExistMutiFrames ? `frame=${frame}&instanceId=${instanceId}` : `instanceId=${instanceId}`
var instanceIdx = series.imageIds.findIndex(imageId => imageId.includes(filterStr))
// var instanceIdx = series.instanceList.findIndex(
// (imageId) => !!~imageId.indexOf(instanceId)
// );
if (instanceIdx > -1) {
series.imageIdIndex = instanceIdx
seriesInfo = series

View File

@ -74,6 +74,13 @@ import DicomEvent from "./../components/DicomEvent";
import store from "@/store";
import { getToken } from "@/utils/auth";
import { mapGetters } from "vuex";
import * as dicomParser from 'dicom-parser'
import * as cornerstone from 'cornerstone-core'
import * as cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader'
cornerstoneWADOImageLoader.external.dicomParser = dicomParser
cornerstoneWADOImageLoader.external.cornerstone = cornerstone
const maximumSizeInBytes = 1024 * 1024 * 1024 * 6
cornerstone.imageCache.setMaximumSizeBytes(maximumSizeInBytes)
export default {
name: "CustomizeReadPage",
components: {
@ -229,6 +236,10 @@ export default {
this.$refs[this.activeTaskVisitId][0].selectSeries(data);
});
});
cornerstone.events.addEventListener('cornerstoneimageloadprogress', this.cornerstoneimageloadprogress)
window.addEventListener('beforeunload', e => {
cornerstone.imageCache.purgeCache()
})
},
beforeDestroy() {
DicomEvent.$off("getNextVisitInfo");
@ -237,6 +248,7 @@ export default {
DicomEvent.$off("removeNoneDicomMeasureData");
DicomEvent.$off("addNoneDicomMeasureData");
DicomEvent.$off("selectSeries");
window.removeEventListener('beforeunload', e => { cornerstone.imageCache.purgeCache() })
},
methods: {
async getVisitInfo() {
@ -523,7 +535,7 @@ export default {
if (obj) {
let index = Math.floor(
obj.imageIds.length *
((baseSeries.imageIdIndex + 1) / baseSeries.instanceCount)
((baseSeries.imageIdIndex + 1) / baseSeries.imageIds)
);
obj.imageIdIndex = index > 0 ? index - 1 : 0;
}
@ -607,9 +619,12 @@ export default {
);
if (seriesIdx > -1) {
var series = studyList[studyIdx].SeriesList[seriesIdx];
var instanceIdx = series.instanceList.findIndex(
(imageId) => !!~imageId.indexOf(instanceId)
);
// var instanceIdx = series.instanceList.findIndex(
// (imageId) => !!~imageId.indexOf(instanceId)
// );
let frame = this.visitTaskList[index].MeasureData[idx].MeasureData.frame
let filterStr = series.isExistMutiFrames ? `frame=${frame}&instanceId=${instanceId}` : `instanceId=${instanceId}`
var instanceIdx = series.imageIds.findIndex(imageId => imageId.includes(filterStr))
if (instanceIdx > -1) {
series.imageIdIndex = instanceIdx;
// series.studyIndex = studyIdx
@ -643,6 +658,16 @@ export default {
}
return seriesInfo;
},
cornerstoneimageloadprogress(e) {
const imageId = e.detail.imageId
const params = {}
const searchParams = new URLSearchParams(imageId.split('?')[1])
for (const [key, value] of searchParams.entries()) {
params[key] = value
}
params.percentComplete = e.detail.percentComplete
store.dispatch('reading/setImageLoadedProgress', params)
}
},
};
</script>

View File

@ -157,18 +157,11 @@
</div>
</template>
<script>
import * as dicomParser from 'dicom-parser'
import * as cornerstone from 'cornerstone-core'
import * as cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader'
import requestPoolManager from '@/utils/request-pool'
import DicomEvent from './../components/DicomEvent'
import { mapGetters } from 'vuex'
import store from '@/store'
import SrList from './../components/SrList'
cornerstoneWADOImageLoader.external.dicomParser = dicomParser
cornerstoneWADOImageLoader.external.cornerstone = cornerstone
const maximumSizeInBytes = 1024 * 1024 * 1024 * 6
cornerstone.imageCache.setMaximumSizeBytes(maximumSizeInBytes)
export default {
name: 'StudyList',
components: { SrList },
@ -217,9 +210,7 @@ export default {
srDialogVisible: false,
srInfo: {},
digitPlaces: 2,
visitTaskIdx: -1,
currentLoadIns: [],
keySeriesLoad: []
visitTaskIdx: -1
}
},
@ -257,24 +248,19 @@ export default {
this.subjectCode = localStorage.getItem('subjectCode')
var digitPlaces = Number(localStorage.getItem('digitPlaces'))
this.digitPlaces = digitPlaces === -1 ? this.digitPlaces : digitPlaces
DicomEvent.$on('refreshStudyListMeasureData', () => {
var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId)
this.measureData = this.visitTaskList[idx].MeasureData
})
// DicomEvent.$on('setReadingState', readingTaskState => {
// var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId)
// if (idx > -1) {
// this.studyList = this.visitTaskList[idx].StudyList
// }
// })
cornerstone.events.addEventListener('cornerstoneimageloadprogress', this.cornerstoneimageloadprogress)
cornerstone.events.addEventListener('cornerstoneimageloaded', this.cornerstoneImageLoaded)
// cornerstone.events.addEventListener('cornerstoneimagecachefull', this.cornerstoneimagecachefull)
// cornerstone.events.addEventListener('cornerstoneimagecachechanged', this.cornerstoneimagecachechanged)
window.addEventListener('beforeunload', e => {
cornerstone.imageCache.purgeCache()
})
},
beforeDestroy() {
cornerstone.imageCache.purgeCache()
window.removeEventListener('beforeunload', e => { cornerstone.imageCache.purgeCache() })
},
methods: {
initStudyInfo() {
@ -326,7 +312,6 @@ export default {
requestPoolManager.loadAndCacheImagePlus(imageId, seriesInfo.seriesId, p * 100)
},
getStudyList() {
console.log('getStudyList')
if (!this.isRender) {
var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId)
if (idx > -1 && this.visitTaskList[idx].StudyList && this.visitTaskList[idx].StudyList.length > 0) {
@ -337,8 +322,27 @@ export default {
this.studyIndex = sIdx
this.seriesIndex = 0
this.activeNames = [`${this.studyList[sIdx].StudyId}`]
this.loadImages(this.visitTaskList[idx])
//
const i = this.studyList.findIndex(i => i.IsCriticalSequence)
if (i > -1 && this.studyList[i].SeriesList[0].length > 0) {
const series = this.studyList[i].SeriesList[0]
if (!series.loadStatus) {
let priority = parseInt(new Date().getTime())
if (series.isExistMutiFrames) {
series.instanceInfoList.map(image => {
priority = priority - 1
this.imageList.push({ imageId: image.ImageId, seriesId: series.seriesId, studyIndex: i, seriesIndex: 0, visitTaskId: series.visitTaskId, priority })
})
} else {
series.imageIds.map(imageId => {
priority = priority - 1
this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex: i, seriesIndex: 0, visitTaskId: series.visitTaskId, priority })
})
}
}
}
this.loopLoad()
// this.loadImages(this.visitTaskList[idx])
}
}
this.isRender = true
@ -420,9 +424,11 @@ export default {
const sdIndx = studyList.findIndex(sd => sd.StudyId === measureDatas[i].StudyId)
const seriesList = studyList[sdIndx].SeriesList
const srIdx = seriesList.findIndex(sr => sr.seriesId === measureDatas[i].SeriesId)
// const instanceList = seriesList[srIdx].imageIds
const instanceList = seriesList[srIdx].instanceList
const isIdx = instanceList.findIndex(is => is.includes(measureDatas[i].InstanceId))
// const instanceList = seriesList[srIdx].instanceList
// const isIdx = instanceList.findIndex(is => is.includes(measureDatas[i].InstanceId))
const imageIds = seriesList[srIdx].imageIds
let filterStr = seriesList[srIdx].isExistMutiFrames ? `frame=${measureDatas[i].MeasureData.frame}&instanceId=${measureDatas[i].InstanceId}` : `instanceId=${measureDatas[i].InstanceId}`
const isIdx = imageIds.findIndex(is => is.includes(filterStr))
const series = seriesList[srIdx]
series.imageIdIndex = isIdx
@ -492,9 +498,11 @@ export default {
if (sdIndx > -1) {
const seriesList = studyList[sdIndx].SeriesList
const srIdx = seriesList.findIndex(sr => sr.seriesId === measureDatas[mIdx].SeriesId)
// const instanceList = seriesList[srIdx].imageIds
const instanceList = seriesList[srIdx].instanceList
const isIdx = instanceList.findIndex(is => is.includes(measureDatas[mIdx].InstanceId))
// const instanceList = seriesList[srIdx].instanceList
// const isIdx = instanceList.findIndex(is => is.includes(measureDatas[mIdx].InstanceId))
const imageIds = seriesList[srIdx].imageIds
let filterStr = seriesList[srIdx].isExistMutiFrames ? `frame=${measureDatas[mIdx].MeasureData.frame}&instanceId=${measureDatas[mIdx].InstanceId}` : `instanceId=${measureDatas[mIdx].InstanceId}`
const isIdx = imageIds.findIndex(is => is.includes(filterStr))
const series = seriesList[srIdx]
series.imageIdIndex = isIdx
@ -688,7 +696,8 @@ export default {
var activeNames = `${this.studyList[obj.studyIndex].StudyId}`
if (this.activeNames.includes(activeNames)) return
this.activeNames.push(activeNames)
this.loadImages(this.visitTaskList[idx])
// this.loadImages(this.visitTaskList[idx])
this.loadImages(obj)
},
selectSeries(obj) {
var seriseList = this.studyList.map(s => s.SeriesList).flat()
@ -713,45 +722,25 @@ export default {
var activeNames = `${this.studyList[series.studyIndex].StudyId}`
if (this.activeNames.includes(activeNames)) return
this.activeNames.push(activeNames)
this.loadImages(this.visitTaskList[idx])
this.loadImages(series)
// this.loadImages(this.visitTaskList[idx])
store.dispatch('reading/setActiveSeries', series)
},
loadImages(taskInfo) {
// const isBaseLineTask = taskInfo.IsBaseLineTask
const isCurrentTask = taskInfo.IsCurrentTask
// var priority = isCurrentTask ? parseInt(new Date().getTime()) : 999
loadImages(series) {
var priority = parseInt(new Date().getTime())
this.studyList.map((study, studyIndex) => {
study.SeriesList.map((series, seriesIndex) => {
if (!series.loadStatus && series.isDicom && series.modality !== 'SR') {
// if (isCurrentTask || isBaseLineTask) {
// // /线
// series.imageIds.map(image => {
// this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
// })
// } else if (!isBaseLineTask && !isCurrentTask && study.IsCriticalSequence) {
// // 访
// series.imageIds.map(image => {
// this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
// })
// }
//
if (!isCurrentTask && study.IsCriticalSequence) {
if (series.isExistMutiFrames) {
series.instanceInfoList.map(image => {
priority = priority - 1
this.imageList.push({ imageId: image.ImageId, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
})
} else {
series.imageIds.map(imageId => {
priority = priority - 1
this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
})
}
}
}
})
})
if (!series.loadStatus && series.isDicom && series.modality !== 'SR') {
if (series.isExistMutiFrames) {
series.instanceInfoList.map(image => {
priority = priority - 1
this.imageList.push({ imageId: image.ImageId, seriesId: series.seriesId, studyIndex: series.studyIndex, seriesIndex: series.seriesIndex, visitTaskId: series.visitTaskId, priority })
})
} else {
series.imageIds.map(imageId => {
priority = priority - 1
this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex: series.studyIndex, seriesIndex: series.seriesIndex, visitTaskId: series.visitTaskId, priority })
})
}
}
this.loopLoad()
},
@ -808,139 +797,6 @@ export default {
requestPoolManager.removeTask(series.seriesId)
this.$set(this.studyList[studyIndex].SeriesList[seriesIndex], 'isLoading', false)
},
async imageLoaded(image, seriesUid) {
// await store.dispatch('reading/updateStudyList', { visitTaskId: image.visitTaskId, imageId: image.imageId, seriesUid })
// console.log(this.studyList[image.studyIndex].SeriesList[image.seriesIndex])
if (image.studyIndex > -1 && image.seriesIndex > -1) {
var prefetchInstanceCount = this.studyList[image.studyIndex].SeriesList[image.seriesIndex].prefetchInstanceCount
var instanceCount = this.studyList[image.studyIndex].SeriesList[image.seriesIndex].instanceCount
if (this.studyList[image.studyIndex].SeriesList[image.seriesIndex].imageloadedArr.indexOf(image.imageId) < 0) {
this.studyList[image.studyIndex].SeriesList[image.seriesIndex].imageloadedArr.push(image.imageId)
prefetchInstanceCount = prefetchInstanceCount + 1
this.studyList[image.studyIndex].SeriesList[image.seriesIndex].prefetchInstanceCount = prefetchInstanceCount
}
if (prefetchInstanceCount >= instanceCount) {
this.studyList[image.studyIndex].SeriesList[image.seriesIndex].prefetchInstanceCount = this.studyList[image.studyIndex].SeriesList[image.seriesIndex].instanceCount
//
this.studyList[image.studyIndex].SeriesList[image.seriesIndex].loadStatus = true
}
}
// store.dispatch('reading/updateSeriesList', { visitTaskindex: this.visitTaskIdx, studyIndex: image.studyIndex, seriesIndex: image.seriesIndex, imageId: image.imageId })
},
// instance
async cornerstoneImageLoaded(e) {
// var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId)
// if (idx === -1) return
// this.studyList = this.visitTaskList[idx].StudyList
// if (!this.studyList || this.studyList.length === 0) {
// return
// }
// if (!this.visitTaskList[idx].IsInit) {
// const loading = this.$loading({ fullscreen: true })
// await store.dispatch('reading/getMeasuredData', this.visitTaskList[idx].VisitTaskId)
// await store.dispatch('reading/getStudyInfo', { trialId: this.trialId, subjectVisitId: this.visitTaskList[idx].VisitId, visitTaskId: this.visitTaskList[idx].VisitTaskId, taskBlindName: this.visitTaskList[idx].TaskBlindName })
// await store.dispatch('reading/getReadingQuestionAndAnswer', { trialId: this.trialId, visitTaskId: this.visitTaskList[idx].VisitTaskId })
// await store.dispatch('reading/getDicomReadingQuestionAnswer', { trialId: this.trialId, visitTaskId: this.visitTaskList[idx].VisitTaskId })
// await store.dispatch('reading/setStatus', { visitTaskId: this.visitTaskList[idx].VisitTaskId })
// loading.close()
// }
// await store.dispatch('reading/updateStudyList', { visitTaskId: this.visitTaskId, imageId: e.detail.image.imageId, seriesUid: e.detail.image.data.string('x0020000e') })
// const uri = e.detail.image.sharedCacheKey
// const index = this.cachedImages.findIndex(item => item.uri === uri)
// if (index === -1) {
// this.cachedImages.push({ uri: uri, timestamp: new Date().getTime() })
// } else {
// this.cachedImages[index].timestamp = new Date().getTime()
// }
// var imageId = e.detail.image.imageId
// var seriesUid = e.detail.image.data.string('x0020000e')
// var studyIndex = -1
// var seriesIndex = -1
// for (let i = 0; i < this.studyList.length; ++i) {
// for (let j = 0; j < this.studyList[i].SeriesList.length; ++j) {
// if (this.studyList[i].SeriesList[j].seriesUid === seriesUid) {
// studyIndex = i
// seriesIndex = j
// break
// }
// }
// if (studyIndex > 0) break
// }
// if (seriesIndex < 0) return
// const imageIdIndex = this.studyList[studyIndex].SeriesList[seriesIndex].imageIds.indexOf(imageId)
// if (imageIdIndex < 0) return
// if (this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.indexOf(imageId) < 0) {
// if (this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount >= this.studyList[studyIndex].SeriesList[seriesIndex].instanceCount) {
// //
// this.studyList[studyIndex].SeriesList[seriesIndex].loadStatus = true
// }
// }
},
cornerstoneimageloadprogress(e) {
const imageId = e.detail.imageId
const percentComplete = e.detail.percentComplete
const params = {}
const searchParams = new URLSearchParams(imageId.split('?')[1])
for (const [key, value] of searchParams.entries()) {
params[key] = value
}
if (this.visitTaskId === params.visitTaskId) {
const studyIndex = params.idx.split('|')[0]
const seriesIndex = params.idx.split('|')[1]
const seriesId = this.studyList[studyIndex].SeriesList[seriesIndex].seriesId
const i = this.keySeriesLoad.findIndex(i => i.seriesId === seriesId)
if (this.studyList[studyIndex].IsCriticalSequence && percentComplete >= 100) {
//
if (i === -1) {
this.keySeriesLoad.push({ seriesId: seriesId, loadCount: 1, imageIds: [imageId] })
} else {
++this.keySeriesLoad[i].loadCount
this.keySeriesLoad[i].imageIds.push(imageId)
}
}
if (!this.studyList[studyIndex].IsCriticalSequence && i > -1) {
this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount = this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount + 100 * this.keySeriesLoad[i].loadCount
this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr = [this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr, this.keySeriesLoad[i].imageIds]
this.keySeriesLoad.splice(i, 1)
}
var prefetchInstanceCount = this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount
var instanceCount = this.studyList[studyIndex].SeriesList[seriesIndex].instanceCount
if (this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.indexOf(imageId) < 0) {
const i = this.currentLoadIns.findIndex(i => i.imageId === imageId)
if (i > -1) {
prefetchInstanceCount = prefetchInstanceCount - this.currentLoadIns[i].percentComplete + percentComplete
this.currentLoadIns[i].percentComplete = percentComplete
if (percentComplete === 100) {
this.currentLoadIns.splice(i, 1)
}
} else {
if (percentComplete !== 100) {
this.currentLoadIns.push({ imageId, percentComplete })
}
prefetchInstanceCount = prefetchInstanceCount + percentComplete
}
this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount = prefetchInstanceCount
if (percentComplete >= 100) {
this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.push(imageId)
}
}
if (prefetchInstanceCount >= instanceCount * 100) {
this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount = instanceCount * 100
//
this.studyList[studyIndex].SeriesList[seriesIndex].loadStatus = true
}
}
},
cornerstoneimagecachechanged(e) {
const cacheInfo = cornerstone.imageCache.getCacheInfo()
console.log(cacheInfo)
},
cornerstoneimagecachefull(e) {
console.log('超过内存了')
}
}
}
</script>