修改访视影像下载及自定义阅片影像下载

uat_us
caiyiling 2024-01-29 15:50:22 +08:00
parent 7581b430d6
commit a138f62ac8
4 changed files with 358 additions and 197 deletions

View File

@ -17,7 +17,7 @@ async function executeTask() {
if (taskPool.length > 0) {
// let startSortTime = performance.now()
if( sortType ){
sortTaskPool()
maxRequest = 6
}
// let endSortTime = performance.now()
var requestNum = Math.min(taskPool.length, maxRequest)

View File

@ -160,7 +160,7 @@ export default {
this.type = this.$router.currentRoute.query.type ? this.$router.currentRoute.query.type : ''
this.visitNum = this.$router.currentRoute.query.visitNum ? parseInt(this.$router.currentRoute.query.visitNum) : 0
cornerstone.events.addEventListener('cornerstoneimageloaded', this.cornerstoneImageLoaded)
// cornerstone.events.addEventListener('cornerstoneimageloaded', this.cornerstoneImageLoaded)
// cornerstone.events.addEventListener('datasetscachechanged', this.datasetsCacheChanged)
if (this.$router.currentRoute.query.TokenKey) {
store.dispatch('user/setToken', this.$router.currentRoute.query.TokenKey)
@ -240,6 +240,7 @@ export default {
})
scope.seriesList = seriesList
if (scope.seriesList.length > 0) {
this.loadAllImages()
scope.$refs.dicomViewer.loadImageStack(scope.seriesList[0], scope.labels[scope.tpCode])
scope.firstInstanceId = scope.seriesList[0].imageIds[0]
}
@ -445,11 +446,16 @@ export default {
},
loadAllImages() {
var priority = new Date().getTime()
this.seriesList.forEach(series => {
this.seriesList.forEach((series, index) => {
series.imageIds.forEach(imageId => {
priority--
var p = null
if (this.firstInstanceId === imageId) {
p = priority * 100
} else {
p = priority - 1
}
// this.load(imageId, series.seriesId, priority)
this.imageList.push({ imageId: imageId, seriesId: series.seriesId, priority })
this.imageList.push({ imageId: imageId, seriesId: series.seriesId, seriesIndex: index, priority: p })
})
})
if (this.imageList.length > 0) {
@ -459,12 +465,13 @@ export default {
loopLoad() {
if (this.imageList.length > 0) {
requestPoolManager.startTaskTimer()
console.log('loopLoad')
this.imageList.map(image => {
requestPoolManager.loadAndCacheImagePlus(image.imageId, image.seriesId, image.priority).then(res => {
this.imageLoaded(image, res.data.string('x0020000e'))
})
})
requestPoolManager.sortTaskPool()
this.imageList = []
}
},
@ -479,7 +486,24 @@ export default {
})
})
},
imageLoaded(imageId, seriesUid) {
imageLoaded(image, seriesUid) {
var seriesIndex = image.seriesIndex
if (seriesIndex < 0) return
if (this.seriesList[seriesIndex].imageloadedArr.indexOf(image.imageId) < 0) {
++this.seriesList[seriesIndex].prefetchInstanceCount
this.seriesList[seriesIndex].imageloadedArr.push(image.imageId)
if (this.seriesList[seriesIndex].prefetchInstanceCount >= this.seriesList[seriesIndex].instanceCount) {
this.seriesList[seriesIndex].prefetchInstanceCount = this.seriesList[seriesIndex].instanceCount
//
this.seriesList[seriesIndex].loadStatus = true
// if (!this.isLoadedAll) {
// this.loadAllImages()
// }
}
}
},
imageLoaded2(imageId, seriesUid) {
var seriesIndex = -1
for (let i = 0; i < this.seriesList.length; ++i) {
if (this.seriesList[i].seriesUid === seriesUid) {

View File

@ -248,7 +248,7 @@ export default {
this.visitInfo = this.$router.currentRoute.query.visitInfo
this.isReading = this.$router.currentRoute.query.isReading ? this.$router.currentRoute.query.isReading * 1 : 0
this.showDelete = parseInt(this.$router.currentRoute.query.showDelete)
cornerstone.events.addEventListener('cornerstoneimageloaded', this.cornerstoneImageLoaded)
// cornerstone.events.addEventListener('cornerstoneimageloaded', this.cornerstoneImageLoaded)
this.getStudiesInfo()
},
beforeDestroy() {
@ -311,6 +311,7 @@ export default {
instanceId = instanceId.split('.')[0]
this.firstInstanceId = instanceId
this.activeNames = [this.studyList[0].StudyId]
this.loadAllImages()
}
})
},
@ -497,14 +498,23 @@ export default {
},
loadAllImages() {
var priority = parseInt(new Date().getTime())
this.studyList.map(study => {
study.SeriesList.map(series => {
if (!series.loadStatus && series.seriesId !== this.firstSeriesId) {
series.imageIds.map(imageId => {
// imageIds.push({ imageId: image, seriesId: series.seriesId, priority })
this.imageList.push({ imageId: imageId, seriesId: series.seriesId, priority })
})
}
this.studyList.map((study, studyIndex) => {
study.SeriesList.map((series, seriesIndex) => {
series.imageIds.map(imageId => {
var p = null
if (this.firstInstanceId === imageId) {
p = priority * 100
} else {
p = priority - 1
}
this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex, seriesIndex, priority: p })
})
// if (!series.loadStatus && series.seriesId !== this.firstSeriesId) {
// series.imageIds.map(imageId => {
// // imageIds.push({ imageId: image, seriesId: series.seriesId, priority })
// this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex, seriesIndex, priority })
// })
// }
})
})
if (this.imageList.length > 0) {
@ -562,26 +572,13 @@ export default {
//
}
},
imageLoaded(imageId, seriesUid) {
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) {
imageLoaded(image, seriesUid) {
var studyIndex = image.studyIndex
var seriesIndex = image.seriesIndex
if (seriesIndex < 0 || studyIndex < 0) return
if (this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.indexOf(image.imageId) < 0) {
++this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount
this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.push(imageId)
this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.push(image.imageId)
if (this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount >= this.studyList[studyIndex].SeriesList[seriesIndex].instanceCount) {
this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount = this.studyList[studyIndex].SeriesList[seriesIndex].instanceCount

View File

@ -49,18 +49,18 @@
/>
<div class="image-desc">
<div class="flex-div">
<div>#{{ series.seriesNumber }} </div>
<div v-if="series.isDicom && series.prefetchInstanceCount<series.instanceCount">
<div v-if="!study.IsCriticalSequence">#{{ series.seriesNumber }} </div>
<div v-if="series.isDicom && series.prefetchInstanceCount<series.instanceCount && series.modality!== 'SR'">
<!-- 下载 -->
<el-tooltip v-if="!series.isLoading" class="item" effect="dark" :content="$t('trials:reading:button:download')" placement="bottom">
<i class="el-icon-video-play" style="font-size: 18px;margin-right: 5px;color: #ffeb3b;cursor: pointer;" @click.stop="loadSeries(series,index,i)" />
</el-tooltip>
<!-- 暂停 -->
<el-tooltip v-else class="item" effect="dark" :content="$t('trials:reading:button:pause')" placement="bottom">
<!-- <el-tooltip v-else class="item" effect="dark" :content="$t('trials:reading:button:pause')" placement="bottom">
<i class="el-icon-video-pause" style="font-size: 18px;margin-right: 5px;color: #ffeb3b;cursor: pointer;" @click.stop="stopLoadSeries(series,index,i)" />
</el-tooltip>
</el-tooltip> -->
</div>
<el-tooltip v-else-if="series.prefetchInstanceCount === 0" class="item" effect="dark" :content="$t('trials:reading:button:download')" placement="bottom">
<el-tooltip v-else-if="series.isDicom && series.prefetchInstanceCount === 0 &&series.modality!== 'SR'" class="item" effect="dark" :content="$t('trials:reading:button:download')" placement="bottom">
<i class="el-icon-video-play" style="font-size: 18px;margin-right: 5px;color: #ffeb3b;cursor: pointer;" @click.stop="loadSeries(series,index,i)" />
</el-tooltip>
</div>
@ -70,15 +70,15 @@
</el-tooltip>
</p>
<p v-show="series.sliceThickness">
T: {{ series.sliceThickness }}
<p v-show="series.sliceThickness && !study.IsCriticalSequence">
T: {{ parseFloat(series.sliceThickness).toFixed(digitPlaces) }}
</p>
<p v-show="series.instanceCount">
{{ series.modality }}: {{ series.instanceCount }} image
</p>
<div class="flex-div">
<div v-if="measureData && measureData.findIndex(v=>v.SeriesId === series.seriesId) > -1">
<div v-if="measureData.findIndex(v=>v.SeriesId === series.seriesId && v.MeasureData) > -1">
<!-- 有标注 -->
<el-tooltip class="item" effect="dark" :content="$t('trials:reading:button:marked')" placement="right">
<i class="el-icon-star-on" style="font-size: 16px;color: #ff5722;" />
@ -99,22 +99,47 @@
</el-collapse-item>
</el-collapse>
</div>
<div class="sr-wrapper">
<el-dialog
:visible.sync="srDialogVisible"
:custom-class="isSrFullscreen?'sr-full-dialog-container':'sr-dialog-container'"
:show-close="false"
:close-on-click-modal="false"
:fullscreen="isSrFullscreen"
>
<span slot="title" class="dialog-footer">
<div style="position: absolute;right: 20px;top: 10px;">
<svg-icon :icon-class="isSrFullscreen?'exit-fullscreen':'fullscreen'" style="cursor: pointer;font-size: 20px;color:#000;" @click="isSrFullscreen=!isSrFullscreen" />
<svg-icon icon-class="dClose" style="cursor: pointer;font-size: 25px;margin-left: 10px;" @click="srDialogVisible = false" />
</div>
</span>
<div style="height: 100%;margin:0;">
<SrList
v-if="srDialogVisible"
:sr-info="srInfo"
/>
</div>
</el-dialog>
</div>
</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 // 1 GB
const maximumSizeInBytes = 1024 * 1024 * 1024 // 1 GB
cornerstone.imageCache.setMaximumSizeBytes(maximumSizeInBytes)
export default {
name: 'StudyList',
components: { SrList },
props: {
trialId: {
type: String,
@ -145,6 +170,7 @@ export default {
return {
studyList: [],
cachedImages: [],
showSeriesList: [],
studyIndex: null,
seriesIndex: null,
loading: false,
@ -154,9 +180,15 @@ export default {
activeNames: [],
seriesArr: [],
imageList: [],
loopLoadStatus: 0 // -1 0 1
loopLoadStatus: 0, // -1 0 1
isSrFullscreen: false,
srDialogVisible: false,
srInfo: {},
digitPlaces: 2,
visitTaskIdx: -1
}
},
computed: {
...mapGetters(['visitTaskList', 'currentTaskId', 'activeSeries'])
},
@ -168,6 +200,14 @@ export default {
if (idx === -1) return
this.measureData = this.visitTaskList[idx].MeasureData
}
},
visitTaskId: {
immediate: true,
handler(val) {
var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId)
if (idx === -1) return
this.visitTaskIdx = idx
}
}
// activeSeries: {
// immediate: true,
@ -180,10 +220,8 @@ export default {
},
mounted() {
this.subjectCode = this.$router.currentRoute.query.subjectCode
// DicomEvent.$on('getMeasureData', () => {
// var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId)
// this.measureData = this.visitTaskList[idx].MeasureData
// })
var digitPlaces = Number(localStorage.getItem('digitPlaces'))
this.digitPlaces = digitPlaces === -1 ? this.digitPlaces : digitPlaces
// DicomEvent.$on('setReadingState', readingTaskState => {
// var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId)
@ -191,12 +229,12 @@ export default {
// this.studyList = this.visitTaskList[idx].StudyList
// }
// })
cornerstone.events.addEventListener('cornerstoneimageloaded', this.cornerstoneImageLoaded)
// cornerstone.events.addEventListener('cornerstoneimagecachefull', this.cornerstoneimagecachefull)
// cornerstone.events.addEventListener('cornerstoneimagecachechanged', this.cornerstoneimagecachechanged)
},
beforeDestroy() {
cornerstone.imageCache.purgeCache()
// DicomEvent.$off('getMeasureData')
},
methods: {
initStudyInfo() {
@ -209,7 +247,54 @@ export default {
})
var i = res.findIndex(s => s.isCurrentTask)
if (i > -1) {
var p = this.visitTaskId === this.currentTaskId ? parseInt(new Date().getTime()) : 999 //
var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId)
if (idx > -1) {
this.measureData = this.visitTaskList[idx].MeasureData
this.studyList = this.visitTaskList[idx].StudyList
var priority = parseInt(new Date().getTime())
res[i].imageIds.map(image => {
priority--
this.imageList.push({ imageId: image, seriesId: res[i].seriesId, studyIndex: res[i].studyIndex, seriesIndex: res[i].seriesIndex, visitTaskId: res[i].visitTaskId, priority })
})
// this.studyList.map((study, studyIndex) => {
// study.SeriesList.map((series, seriesIndex) => {
// if (series.modality !== 'SR') {
// series.imageIds.map(image => {
// var p = priority - seriesIndex
// if (series.seriesId === res[i].seriesId) {
// p = priority
// } else {
// --p
// }
// this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority: p })
// })
// }
// })
// })
this.loopLoad()
}
}
DicomEvent.$emit('loadImageStacks', res)
loading.close()
this.isRender = true
}).catch(() => {
loading.close()
})
},
initStudyInfo2() {
console.log('initStudyInfo')
const loading = this.$loading({ fullscreen: true })
//
this.getInitSeries().then((res) => {
requestPoolManager.startTaskTimer()
res.map((item) => {
this.loadInitialImage(item)
})
var i = res.findIndex(s => s.isCurrentTask)
if (i > -1) {
var p = parseInt(new Date().getTime())
// var p = this.visitTaskId === this.currentTaskId ? parseInt(new Date().getTime()) : 999 //
var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId)
if (idx > -1) {
this.measureData = this.visitTaskList[idx].MeasureData
@ -217,7 +302,8 @@ export default {
this.studyList.map((study, studyIndex) => {
study.SeriesList.map((series, seriesIndex) => {
var sliceThickness = isNaN(parseInt(series.sliceThickness)) ? null : parseInt(series.sliceThickness)
if (series.modality !== 'SR') {
// var sliceThickness = isNaN(parseInt(series.sliceThickness)) ? null : parseInt(series.sliceThickness)
// if (sliceThickness === 5 || series.instanceCount <= 100) {
series.imageIds.map(image => {
let priority = 0
@ -228,26 +314,31 @@ export default {
}
this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
})
}
})
})
this.loopLoad()
}
}
DicomEvent.$emit('loadImageStacks', res)
loading.close()
this.isRender = true
}).catch(() => {
loading.close()
})
this.isRender = true
loading.close()
},
//
loadInitialImage(seriesInfo) {
var p = parseInt(new Date().getTime())
var imageId = seriesInfo.imageIds[seriesInfo.imageIdIndex]
requestPoolManager.loadAndCacheImagePlus(imageId, seriesInfo.seriesId, p * 100).then(res => {
this.imageLoaded(seriesInfo, res.data.string('x0020000e'))
if (seriesInfo.isCurrentTask) {
this.imageLoaded({ studyIndex: seriesInfo.studyIndex, seriesIndex: seriesInfo.seriesIndex, imageId: res.imageId }, res.data.string('x0020000e'))
}
})
},
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) {
@ -319,7 +410,8 @@ export default {
} else {
const sIdx = this.studyList.findIndex(s => s.IsDicom)
const series = this.studyList[sIdx].SeriesList[0]
series.imageIdIndex = Math.floor(series.imageIds.length / 2) - 1
const imageIdIndex = Math.floor(series.imageIds.length / 2)
series.imageIdIndex = imageIdIndex > 0 ? imageIdIndex - 1 : 0
seriesList.push(series)
this.studyIndex = sIdx
this.seriesIndex = 0
@ -384,7 +476,7 @@ export default {
idx > -1 ? seriesInfo = seriesList[idx] : seriesInfo = seriesList[0]
}
if (seriesInfo) {
let index = Math.floor(seriesInfo.imageIds.length * ((baseObj.series.imageIdIndex+ 1) / baseObj.series.instanceCount))
const index = Math.floor(seriesInfo.imageIds.length * ((baseObj.series.imageIdIndex + 1) / baseObj.series.instanceCount))
seriesInfo.imageIdIndex = index > 0 ? index - 1 : 0
obj.studyIndex = seriesInfo.studyIndex
obj.seriesIndex = seriesInfo.seriesIndex
@ -437,7 +529,9 @@ export default {
if (seriesObj) {
obj.studyIndex = seriesObj.studyIndex
obj.seriesIndex = seriesObj.seriesIdx
seriesObj.series.imageIdIndex = Math.floor(seriesObj.series.imageIds.length / 2) - 1
const imageIdIndex = Math.floor(seriesObj.series.imageIds.length / 2)
seriesObj.series.imageIdIndex = imageIdIndex > 0 ? imageIdIndex - 1 : 0
obj.series = seriesObj.series
obj.seriesId = seriesObj.series.seriesId
obj.isMarked = false
@ -446,11 +540,11 @@ export default {
if (sIdx > -1) {
// 5
const series = studyList[sIdx].SeriesList[0]
var imageIdIndex = Math.floor(series.imageIds.length / 2) - 1
var imageIdIndex = series.imageIds.length > 1 ? Math.floor(series.imageIds.length / 2) - 1 : 0
obj.studyIndex = sIdx
obj.seriesIndex = 0
obj.series = series
obj.series.imageIdIndex = imageIdIndex
obj.series.imageIdIndex = imageIdIndex >= 0 ? imageIdIndex : 0
obj.seriesId = series.seriesId
obj.isMarked = false
}
@ -496,31 +590,47 @@ export default {
},
showSeriesImage(studyIndex, seriesIndex, series) {
if (series.isDicom) {
this.studyIndex = studyIndex
this.seriesIndex = seriesIndex
this.studyList[studyIndex].SeriesList[seriesIndex].measureData = this.measureData
var dicomStatck = this.studyList[studyIndex].SeriesList[seriesIndex]
this.$emit('loadImageStack', dicomStatck)
if (!series.loadStatus) {
this.loopLoadStatus = -1
series.isLoading = true
var p = parseInt(new Date().getTime())
series.imageIds.map((imageId, i) => {
var priority = ''
if (i === 0) {
priority = parseInt(new Date().getTime()) * 10
} else {
priority = --p
}
this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
})
if (this.imageList.length > 0) {
this.loopLoadStatus = 0
this.loopLoad()
if (series.modality === 'SR') {
this.studyIndex = studyIndex
this.seriesIndex = seriesIndex
this.studyList[studyIndex].SeriesList[seriesIndex].measureData = this.measureData
this.srDialogVisible = true
this.srInfo = {
SubjectCode: series.studyCode,
TaskBlindName: series.taskBlindName,
SrList: series.instanceHtmlPathList
}
} else {
this.studyIndex = studyIndex
this.seriesIndex = seriesIndex
this.studyList[studyIndex].SeriesList[seriesIndex].measureData = this.measureData
var dicomStatck = this.studyList[studyIndex].SeriesList[seriesIndex]
this.$emit('loadImageStack', dicomStatck)
if (!series.loadStatus && series.modality !== 'SR') {
this.loopLoadStatus = -1
series.isLoading = true
var isAddToTakPool = false
if (this.showSeriesList.includes(`${studyIndex}_${seriesIndex}`)) {
isAddToTakPool = true
} else {
this.showSeriesList.push(`${studyIndex}_${seriesIndex}`)
}
if (!isAddToTakPool) {
var priority = parseInt(new Date().getTime())
series.imageIds.map((imageId) => {
this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
})
if (this.imageList.length > 0) {
this.loopLoadStatus = 0
this.loopLoad()
}
} else {
requestPoolManager.changePriority(series.seriesId)
}
}
}
DicomEvent.$emit('loadMeasurementList', { visitTaskId: this.visitTaskId, taskBlindName: this.taskBlindName })
DicomEvent.$emit('loadMeasurementList', { visitTaskId: this.visitTaskId, taskBlindName: this.taskBlindName })
}
} else {
// Dicom
this.$emit('previewNoneDicoms', { visitTaskId: this.visitTaskId })
@ -565,40 +675,27 @@ export default {
this.loadImages(this.visitTaskList[idx])
store.dispatch('reading/setActiveSeries', series)
},
loadImages1(taskInfo) {
var priority = taskInfo.IsCurrentTask ? parseInt(new Date().getTime()) : 999
this.studyList.map((study, studyIndex) => {
study.SeriesList.map((series, seriesIndex) => {
if (!series.loadStatus) {
var sliceThickness = isNaN(parseInt(series.sliceThickness)) ? null : parseInt(series.sliceThickness)
if (series.isBeMark || sliceThickness === 5 || series.instanceCount <= 100) {
series.imageIds.map(image => {
priority = priority - 1
this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
})
}
}
})
})
this.loopLoad()
},
loadImages(taskInfo) {
const isBaseLineTask = taskInfo.IsBaseLineTask
// const isBaseLineTask = taskInfo.IsBaseLineTask
const isCurrentTask = taskInfo.IsCurrentTask
// var priority = isCurrentTask ? parseInt(new Date().getTime()) : 999
var priority = parseInt(new Date().getTime())
this.studyList.map((study, studyIndex) => {
study.SeriesList.map((series, seriesIndex) => {
if (!series.loadStatus && series.isDicom) {
if (isCurrentTask || isBaseLineTask) {
// /线
series.imageIds.map(image => {
priority = priority - 1
this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
})
} else if (!isBaseLineTask && !isCurrentTask && study.IsCriticalSequence) {
// 访
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) {
series.imageIds.map(image => {
priority = priority - 1
this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
@ -609,47 +706,16 @@ export default {
})
this.loopLoad()
},
loadImages2(taskInfo) {
var priority = parseInt(new Date().getTime())
// 5mm 100
if (taskInfo.IsCurrentTask) {
this.studyList.map((study, studyIndex) => {
study.SeriesList.map((series, seriesIndex) => {
var sliceThickness = isNaN(parseInt(series.sliceThickness)) ? null : parseInt(series.sliceThickness)
if (sliceThickness === 5 || series.instanceCount <= 100) {
series.imageIds.map(image => {
priority = priority - 1
this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
})
}
})
})
this.loopLoad()
} else {
//
var idx = this.studyList.findIndex(study => study.IsCriticalSequence)
if (idx === -1) return
this.studyList[idx].SeriesList.forEach((series, seriesIndex) => {
if (!series.loadStatus) {
series.imageIds.map(image => {
priority--
this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: idx, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
})
}
})
this.loopLoad()
}
},
loopLoad() {
if (this.imageList.length > 0) {
requestPoolManager.startTaskTimer()
// requestPoolManager.startTaskTimer()
this.imageList.map(image => {
requestPoolManager.loadAndCacheImagePlus(image.imageId, image.seriesId, image.priority).then(res => {
this.imageLoaded(image, res.data.string('x0020000e'))
})
})
requestPoolManager.sortTaskPool()
this.imageList = []
}
@ -659,15 +725,26 @@ export default {
console.log('loadSeries')
this.loopLoadStatus = -1
this.$set(this.studyList[studyIndex].SeriesList[seriesIndex], 'isLoading', true)
const priority = parseInt(new Date().getTime())
series.imageIds.map(image => {
if (series.imageloadedArr.indexOf(image) === -1) {
this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
var isAddToTakPool = false
if (this.showSeriesList.includes(`${studyIndex}_${seriesIndex}`)) {
isAddToTakPool = true
} else {
this.showSeriesList.push(`${studyIndex}_${seriesIndex}`)
}
if (!isAddToTakPool) {
const priority = parseInt(new Date().getTime())
series.imageIds.map(image => {
const index = this.cachedImages.findIndex(item => item.uri === image)
if (index === -1) {
this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
}
})
if (this.imageList.length > 0) {
this.loopLoadStatus = 0
this.loopLoad()
}
})
if (this.imageList.length > 0) {
this.loopLoadStatus = 0
this.loopLoad()
} else {
requestPoolManager.changePriority(series.seriesId)
}
},
//
@ -677,47 +754,81 @@ export default {
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 })
// 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) {
await store.dispatch('reading/updateStudyList', { visitTaskId: this.visitTaskId, imageId: e.detail.image.imageId, seriesUid: e.detail.image.data.string('x0020000e') })
var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId)
this.studyList = this.visitTaskList[idx].StudyList
if (!this.studyList || this.studyList.length === 0) {
return
}
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
// 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
}
}
// 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
// }
// }
},
cornerstoneimagecachechanged(e) {
const cacheInfo = cornerstone.imageCache.getCacheInfo()
console.log(cacheInfo)
},
cornerstoneimagecachefull(e) {
console.log('超过内存了')
}
}
}
@ -730,6 +841,7 @@ export default {
width:100%;
height: 100%;
overflow-y: auto;
overflow-x: hidden;
.dicom-desc{
font-weight: bold;
font-size: 13px;
@ -746,7 +858,7 @@ export default {
background-color: #607d8b!important;
border: 1px solid #607d8b!important;
}
/deep/ .el-progress__text{
/deep/.el-progress__text{
color: #ccc;
font-size: 12px;
}
@ -812,18 +924,18 @@ export default {
}
}
}
.el-collapse{
/deep/.el-collapse{
border: none;
/deep/ .el-collapse-item{
.el-collapse-item{
background-color: #000!important;
color: #ddd;
}
/deep/ .el-collapse-item__content{
.el-collapse-item__content{
padding-bottom:5px;
background-color: #000!important;
}
/deep/ .el-collapse-item__header{
.el-collapse-item__header{
background-color: #000!important;
color: #ddd;
border-bottom-color:#5a5a5a;
@ -832,5 +944,33 @@ export default {
line-height: 20px;
}
}
.sr-wrapper{
/deep/.el-dialog{
background: #fff !important;
border: 1px solid #ddd;
// color: #ddd;
.el-dialog__title{
color:#fff;
}
}
/deep/.sr-dialog-container{
margin-top: 50px !important;
width:75%;
height:80%;
}
/deep/.el-dialog__body{
padding: 10px;
height: calc(100% - 50px);
}
.el-dialog__header{
position: relative;
}
.sr-full-dialog-container{
/deep/.is-fullscreen .el-dialog__body{
height: calc(100% - 50px);
}
}
}
}
</style>