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

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) { if (taskPool.length > 0) {
// let startSortTime = performance.now() // let startSortTime = performance.now()
if( sortType ){ if( sortType ){
sortTaskPool() maxRequest = 6
} }
// let endSortTime = performance.now() // let endSortTime = performance.now()
var requestNum = Math.min(taskPool.length, maxRequest) 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.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 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) // cornerstone.events.addEventListener('datasetscachechanged', this.datasetsCacheChanged)
if (this.$router.currentRoute.query.TokenKey) { if (this.$router.currentRoute.query.TokenKey) {
store.dispatch('user/setToken', this.$router.currentRoute.query.TokenKey) store.dispatch('user/setToken', this.$router.currentRoute.query.TokenKey)
@ -240,6 +240,7 @@ export default {
}) })
scope.seriesList = seriesList scope.seriesList = seriesList
if (scope.seriesList.length > 0) { if (scope.seriesList.length > 0) {
this.loadAllImages()
scope.$refs.dicomViewer.loadImageStack(scope.seriesList[0], scope.labels[scope.tpCode]) scope.$refs.dicomViewer.loadImageStack(scope.seriesList[0], scope.labels[scope.tpCode])
scope.firstInstanceId = scope.seriesList[0].imageIds[0] scope.firstInstanceId = scope.seriesList[0].imageIds[0]
} }
@ -445,11 +446,16 @@ export default {
}, },
loadAllImages() { loadAllImages() {
var priority = new Date().getTime() var priority = new Date().getTime()
this.seriesList.forEach(series => { this.seriesList.forEach((series, index) => {
series.imageIds.forEach(imageId => { 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.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) { if (this.imageList.length > 0) {
@ -459,12 +465,13 @@ export default {
loopLoad() { loopLoad() {
if (this.imageList.length > 0) { if (this.imageList.length > 0) {
requestPoolManager.startTaskTimer() requestPoolManager.startTaskTimer()
console.log('loopLoad')
this.imageList.map(image => { this.imageList.map(image => {
requestPoolManager.loadAndCacheImagePlus(image.imageId, image.seriesId, image.priority).then(res => { requestPoolManager.loadAndCacheImagePlus(image.imageId, image.seriesId, image.priority).then(res => {
this.imageLoaded(image, res.data.string('x0020000e')) this.imageLoaded(image, res.data.string('x0020000e'))
}) })
}) })
requestPoolManager.sortTaskPool()
this.imageList = [] 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 var seriesIndex = -1
for (let i = 0; i < this.seriesList.length; ++i) { for (let i = 0; i < this.seriesList.length; ++i) {
if (this.seriesList[i].seriesUid === seriesUid) { if (this.seriesList[i].seriesUid === seriesUid) {

View File

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

View File

@ -49,18 +49,18 @@
/> />
<div class="image-desc"> <div class="image-desc">
<div class="flex-div"> <div class="flex-div">
<div>#{{ series.seriesNumber }} </div> <div v-if="!study.IsCriticalSequence">#{{ series.seriesNumber }} </div>
<div v-if="series.isDicom && series.prefetchInstanceCount<series.instanceCount"> <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"> <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)" /> <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>
<!-- 暂停 --> <!-- 暂停 -->
<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)" /> <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> </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)" /> <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>
</div> </div>
@ -70,15 +70,15 @@
</el-tooltip> </el-tooltip>
</p> </p>
<p v-show="series.sliceThickness"> <p v-show="series.sliceThickness && !study.IsCriticalSequence">
T: {{ series.sliceThickness }} T: {{ parseFloat(series.sliceThickness).toFixed(digitPlaces) }}
</p> </p>
<p v-show="series.instanceCount"> <p v-show="series.instanceCount">
{{ series.modality }}: {{ series.instanceCount }} image {{ series.modality }}: {{ series.instanceCount }} image
</p> </p>
<div class="flex-div"> <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"> <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;" /> <i class="el-icon-star-on" style="font-size: 16px;color: #ff5722;" />
@ -99,22 +99,47 @@
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
</div> </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> </div>
</template> </template>
<script> <script>
import * as dicomParser from 'dicom-parser' import * as dicomParser from 'dicom-parser'
import * as cornerstone from 'cornerstone-core' import * as cornerstone from 'cornerstone-core'
import * as cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader' import * as cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader'
import requestPoolManager from '@/utils/request-pool' import requestPoolManager from '@/utils/request-pool'
import DicomEvent from './../components/DicomEvent' import DicomEvent from './../components/DicomEvent'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import store from '@/store' import store from '@/store'
import SrList from './../components/SrList'
cornerstoneWADOImageLoader.external.dicomParser = dicomParser cornerstoneWADOImageLoader.external.dicomParser = dicomParser
cornerstoneWADOImageLoader.external.cornerstone = cornerstone cornerstoneWADOImageLoader.external.cornerstone = cornerstone
// const maximumSizeInBytes = 1024 * 1024 * 1024 // 1 GB const maximumSizeInBytes = 1024 * 1024 * 1024 // 1 GB
cornerstone.imageCache.setMaximumSizeBytes(maximumSizeInBytes)
export default { export default {
name: 'StudyList', name: 'StudyList',
components: { SrList },
props: { props: {
trialId: { trialId: {
type: String, type: String,
@ -145,6 +170,7 @@ export default {
return { return {
studyList: [], studyList: [],
cachedImages: [], cachedImages: [],
showSeriesList: [],
studyIndex: null, studyIndex: null,
seriesIndex: null, seriesIndex: null,
loading: false, loading: false,
@ -154,9 +180,15 @@ export default {
activeNames: [], activeNames: [],
seriesArr: [], seriesArr: [],
imageList: [], imageList: [],
loopLoadStatus: 0 // -1 0 1 loopLoadStatus: 0, // -1 0 1
isSrFullscreen: false,
srDialogVisible: false,
srInfo: {},
digitPlaces: 2,
visitTaskIdx: -1
} }
}, },
computed: { computed: {
...mapGetters(['visitTaskList', 'currentTaskId', 'activeSeries']) ...mapGetters(['visitTaskList', 'currentTaskId', 'activeSeries'])
}, },
@ -168,6 +200,14 @@ export default {
if (idx === -1) return if (idx === -1) return
this.measureData = this.visitTaskList[idx].MeasureData 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: { // activeSeries: {
// immediate: true, // immediate: true,
@ -180,10 +220,8 @@ export default {
}, },
mounted() { mounted() {
this.subjectCode = this.$router.currentRoute.query.subjectCode this.subjectCode = this.$router.currentRoute.query.subjectCode
// DicomEvent.$on('getMeasureData', () => { var digitPlaces = Number(localStorage.getItem('digitPlaces'))
// var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId) this.digitPlaces = digitPlaces === -1 ? this.digitPlaces : digitPlaces
// this.measureData = this.visitTaskList[idx].MeasureData
// })
// DicomEvent.$on('setReadingState', readingTaskState => { // DicomEvent.$on('setReadingState', readingTaskState => {
// var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId) // var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId)
@ -191,12 +229,12 @@ export default {
// this.studyList = this.visitTaskList[idx].StudyList // this.studyList = this.visitTaskList[idx].StudyList
// } // }
// }) // })
cornerstone.events.addEventListener('cornerstoneimageloaded', this.cornerstoneImageLoaded) cornerstone.events.addEventListener('cornerstoneimageloaded', this.cornerstoneImageLoaded)
// cornerstone.events.addEventListener('cornerstoneimagecachefull', this.cornerstoneimagecachefull)
// cornerstone.events.addEventListener('cornerstoneimagecachechanged', this.cornerstoneimagecachechanged)
}, },
beforeDestroy() { beforeDestroy() {
cornerstone.imageCache.purgeCache() cornerstone.imageCache.purgeCache()
// DicomEvent.$off('getMeasureData')
}, },
methods: { methods: {
initStudyInfo() { initStudyInfo() {
@ -209,7 +247,54 @@ export default {
}) })
var i = res.findIndex(s => s.isCurrentTask) var i = res.findIndex(s => s.isCurrentTask)
if (i > -1) { 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) var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId)
if (idx > -1) { if (idx > -1) {
this.measureData = this.visitTaskList[idx].MeasureData this.measureData = this.visitTaskList[idx].MeasureData
@ -217,7 +302,8 @@ export default {
this.studyList.map((study, studyIndex) => { this.studyList.map((study, studyIndex) => {
study.SeriesList.map((series, seriesIndex) => { 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) { // if (sliceThickness === 5 || series.instanceCount <= 100) {
series.imageIds.map(image => { series.imageIds.map(image => {
let priority = 0 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.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
}) })
}
}) })
}) })
this.loopLoad() this.loopLoad()
} }
} }
DicomEvent.$emit('loadImageStacks', res) DicomEvent.$emit('loadImageStacks', res)
loading.close()
this.isRender = true
}).catch(() => {
loading.close()
}) })
this.isRender = true
loading.close()
}, },
// //
loadInitialImage(seriesInfo) { loadInitialImage(seriesInfo) {
var p = parseInt(new Date().getTime()) var p = parseInt(new Date().getTime())
var imageId = seriesInfo.imageIds[seriesInfo.imageIdIndex] var imageId = seriesInfo.imageIds[seriesInfo.imageIdIndex]
requestPoolManager.loadAndCacheImagePlus(imageId, seriesInfo.seriesId, p * 100).then(res => { 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() { getStudyList() {
console.log('getStudyList')
if (!this.isRender) { if (!this.isRender) {
var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId) var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId)
if (idx > -1 && this.visitTaskList[idx].StudyList && this.visitTaskList[idx].StudyList.length > 0) { if (idx > -1 && this.visitTaskList[idx].StudyList && this.visitTaskList[idx].StudyList.length > 0) {
@ -319,7 +410,8 @@ export default {
} else { } else {
const sIdx = this.studyList.findIndex(s => s.IsDicom) const sIdx = this.studyList.findIndex(s => s.IsDicom)
const series = this.studyList[sIdx].SeriesList[0] 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) seriesList.push(series)
this.studyIndex = sIdx this.studyIndex = sIdx
this.seriesIndex = 0 this.seriesIndex = 0
@ -384,7 +476,7 @@ export default {
idx > -1 ? seriesInfo = seriesList[idx] : seriesInfo = seriesList[0] idx > -1 ? seriesInfo = seriesList[idx] : seriesInfo = seriesList[0]
} }
if (seriesInfo) { 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 seriesInfo.imageIdIndex = index > 0 ? index - 1 : 0
obj.studyIndex = seriesInfo.studyIndex obj.studyIndex = seriesInfo.studyIndex
obj.seriesIndex = seriesInfo.seriesIndex obj.seriesIndex = seriesInfo.seriesIndex
@ -437,7 +529,9 @@ export default {
if (seriesObj) { if (seriesObj) {
obj.studyIndex = seriesObj.studyIndex obj.studyIndex = seriesObj.studyIndex
obj.seriesIndex = seriesObj.seriesIdx 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.series = seriesObj.series
obj.seriesId = seriesObj.series.seriesId obj.seriesId = seriesObj.series.seriesId
obj.isMarked = false obj.isMarked = false
@ -446,11 +540,11 @@ export default {
if (sIdx > -1) { if (sIdx > -1) {
// 5 // 5
const series = studyList[sIdx].SeriesList[0] 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.studyIndex = sIdx
obj.seriesIndex = 0 obj.seriesIndex = 0
obj.series = series obj.series = series
obj.series.imageIdIndex = imageIdIndex obj.series.imageIdIndex = imageIdIndex >= 0 ? imageIdIndex : 0
obj.seriesId = series.seriesId obj.seriesId = series.seriesId
obj.isMarked = false obj.isMarked = false
} }
@ -496,31 +590,47 @@ export default {
}, },
showSeriesImage(studyIndex, seriesIndex, series) { showSeriesImage(studyIndex, seriesIndex, series) {
if (series.isDicom) { if (series.isDicom) {
this.studyIndex = studyIndex if (series.modality === 'SR') {
this.seriesIndex = seriesIndex this.studyIndex = studyIndex
this.studyList[studyIndex].SeriesList[seriesIndex].measureData = this.measureData this.seriesIndex = seriesIndex
var dicomStatck = this.studyList[studyIndex].SeriesList[seriesIndex] this.studyList[studyIndex].SeriesList[seriesIndex].measureData = this.measureData
this.$emit('loadImageStack', dicomStatck) this.srDialogVisible = true
if (!series.loadStatus) { this.srInfo = {
this.loopLoadStatus = -1 SubjectCode: series.studyCode,
series.isLoading = true TaskBlindName: series.taskBlindName,
var p = parseInt(new Date().getTime()) SrList: series.instanceHtmlPathList
series.imageIds.map((imageId, i) => { }
var priority = '' } else {
if (i === 0) { this.studyIndex = studyIndex
priority = parseInt(new Date().getTime()) * 10 this.seriesIndex = seriesIndex
} else { this.studyList[studyIndex].SeriesList[seriesIndex].measureData = this.measureData
priority = --p var dicomStatck = this.studyList[studyIndex].SeriesList[seriesIndex]
} this.$emit('loadImageStack', dicomStatck)
this.imageList.push({ imageId: imageId, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority }) if (!series.loadStatus && series.modality !== 'SR') {
}) this.loopLoadStatus = -1
if (this.imageList.length > 0) { series.isLoading = true
this.loopLoadStatus = 0 var isAddToTakPool = false
this.loopLoad() 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 { } else {
// Dicom // Dicom
this.$emit('previewNoneDicoms', { visitTaskId: this.visitTaskId }) this.$emit('previewNoneDicoms', { visitTaskId: this.visitTaskId })
@ -565,40 +675,27 @@ export default {
this.loadImages(this.visitTaskList[idx]) this.loadImages(this.visitTaskList[idx])
store.dispatch('reading/setActiveSeries', series) 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) { loadImages(taskInfo) {
const isBaseLineTask = taskInfo.IsBaseLineTask // const isBaseLineTask = taskInfo.IsBaseLineTask
const isCurrentTask = taskInfo.IsCurrentTask const isCurrentTask = taskInfo.IsCurrentTask
// var priority = isCurrentTask ? parseInt(new Date().getTime()) : 999 // var priority = isCurrentTask ? parseInt(new Date().getTime()) : 999
var priority = parseInt(new Date().getTime()) var priority = parseInt(new Date().getTime())
this.studyList.map((study, studyIndex) => { this.studyList.map((study, studyIndex) => {
study.SeriesList.map((series, seriesIndex) => { study.SeriesList.map((series, seriesIndex) => {
if (!series.loadStatus && series.isDicom) { if (!series.loadStatus && series.isDicom && series.modality !== 'SR') {
if (isCurrentTask || isBaseLineTask) { // if (isCurrentTask || isBaseLineTask) {
// /线 // // /线
series.imageIds.map(image => { // series.imageIds.map(image => {
priority = priority - 1 // this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority }) // })
}) // } else if (!isBaseLineTask && !isCurrentTask && study.IsCriticalSequence) {
} 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 => { series.imageIds.map(image => {
priority = priority - 1 priority = priority - 1
this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority }) this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority })
@ -609,47 +706,16 @@ export default {
}) })
this.loopLoad() 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() { loopLoad() {
if (this.imageList.length > 0) { if (this.imageList.length > 0) {
requestPoolManager.startTaskTimer() // requestPoolManager.startTaskTimer()
this.imageList.map(image => { this.imageList.map(image => {
requestPoolManager.loadAndCacheImagePlus(image.imageId, image.seriesId, image.priority).then(res => { requestPoolManager.loadAndCacheImagePlus(image.imageId, image.seriesId, image.priority).then(res => {
this.imageLoaded(image, res.data.string('x0020000e')) this.imageLoaded(image, res.data.string('x0020000e'))
}) })
}) })
requestPoolManager.sortTaskPool()
this.imageList = [] this.imageList = []
} }
@ -659,15 +725,26 @@ export default {
console.log('loadSeries') console.log('loadSeries')
this.loopLoadStatus = -1 this.loopLoadStatus = -1
this.$set(this.studyList[studyIndex].SeriesList[seriesIndex], 'isLoading', true) this.$set(this.studyList[studyIndex].SeriesList[seriesIndex], 'isLoading', true)
const priority = parseInt(new Date().getTime()) var isAddToTakPool = false
series.imageIds.map(image => { if (this.showSeriesList.includes(`${studyIndex}_${seriesIndex}`)) {
if (series.imageloadedArr.indexOf(image) === -1) { isAddToTakPool = true
this.imageList.push({ imageId: image, seriesId: series.seriesId, studyIndex: studyIndex, seriesIndex: seriesIndex, visitTaskId: series.visitTaskId, priority }) } 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()
} }
}) } else {
if (this.imageList.length > 0) { requestPoolManager.changePriority(series.seriesId)
this.loopLoadStatus = 0
this.loopLoad()
} }
}, },
// //
@ -677,47 +754,81 @@ export default {
this.$set(this.studyList[studyIndex].SeriesList[seriesIndex], 'isLoading', false) this.$set(this.studyList[studyIndex].SeriesList[seriesIndex], 'isLoading', false)
}, },
async imageLoaded(image, seriesUid) { 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 // instance
async cornerstoneImageLoaded(e) { 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)
var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId) // if (idx === -1) return
this.studyList = this.visitTaskList[idx].StudyList // this.studyList = this.visitTaskList[idx].StudyList
if (!this.studyList || this.studyList.length === 0) { // if (!this.studyList || this.studyList.length === 0) {
return // return
} // }
const uri = e.detail.image.sharedCacheKey // if (!this.visitTaskList[idx].IsInit) {
const index = this.cachedImages.findIndex(item => item.uri === uri) // const loading = this.$loading({ fullscreen: true })
if (index === -1) { // await store.dispatch('reading/getMeasuredData', this.visitTaskList[idx].VisitTaskId)
this.cachedImages.push({ uri: uri, timestamp: new Date().getTime() }) // await store.dispatch('reading/getStudyInfo', { trialId: this.trialId, subjectVisitId: this.visitTaskList[idx].VisitId, visitTaskId: this.visitTaskList[idx].VisitTaskId, taskBlindName: this.visitTaskList[idx].TaskBlindName })
} else { // await store.dispatch('reading/getReadingQuestionAndAnswer', { trialId: this.trialId, visitTaskId: this.visitTaskList[idx].VisitTaskId })
this.cachedImages[index].timestamp = new Date().getTime() // await store.dispatch('reading/getDicomReadingQuestionAnswer', { trialId: this.trialId, visitTaskId: this.visitTaskList[idx].VisitTaskId })
} // await store.dispatch('reading/setStatus', { visitTaskId: this.visitTaskList[idx].VisitTaskId })
var imageId = e.detail.image.imageId // loading.close()
var seriesUid = e.detail.image.data.string('x0020000e') // }
var studyIndex = -1 // await store.dispatch('reading/updateStudyList', { visitTaskId: this.visitTaskId, imageId: e.detail.image.imageId, seriesUid: e.detail.image.data.string('x0020000e') })
var seriesIndex = -1 // const uri = e.detail.image.sharedCacheKey
for (let i = 0; i < this.studyList.length; ++i) { // const index = this.cachedImages.findIndex(item => item.uri === uri)
for (let j = 0; j < this.studyList[i].SeriesList.length; ++j) { // if (index === -1) {
if (this.studyList[i].SeriesList[j].seriesUid === seriesUid) { // this.cachedImages.push({ uri: uri, timestamp: new Date().getTime() })
studyIndex = i // } else {
seriesIndex = j // this.cachedImages[index].timestamp = new Date().getTime()
break // }
} // var imageId = e.detail.image.imageId
} // var seriesUid = e.detail.image.data.string('x0020000e')
if (studyIndex > 0) break // var studyIndex = -1
} // var seriesIndex = -1
if (seriesIndex < 0) return // 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) // const imageIdIndex = this.studyList[studyIndex].SeriesList[seriesIndex].imageIds.indexOf(imageId)
if (imageIdIndex < 0) return // if (imageIdIndex < 0) return
if (this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.indexOf(imageId) < 0) { // if (this.studyList[studyIndex].SeriesList[seriesIndex].imageloadedArr.indexOf(imageId) < 0) {
if (this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount >= this.studyList[studyIndex].SeriesList[seriesIndex].instanceCount) { // if (this.studyList[studyIndex].SeriesList[seriesIndex].prefetchInstanceCount >= this.studyList[studyIndex].SeriesList[seriesIndex].instanceCount) {
// // //
this.studyList[studyIndex].SeriesList[seriesIndex].loadStatus = true // 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%; width:100%;
height: 100%; height: 100%;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden;
.dicom-desc{ .dicom-desc{
font-weight: bold; font-weight: bold;
font-size: 13px; font-size: 13px;
@ -746,7 +858,7 @@ export default {
background-color: #607d8b!important; background-color: #607d8b!important;
border: 1px solid #607d8b!important; border: 1px solid #607d8b!important;
} }
/deep/ .el-progress__text{ /deep/.el-progress__text{
color: #ccc; color: #ccc;
font-size: 12px; font-size: 12px;
} }
@ -812,18 +924,18 @@ export default {
} }
} }
} }
.el-collapse{ /deep/.el-collapse{
border: none; border: none;
/deep/ .el-collapse-item{ .el-collapse-item{
background-color: #000!important; background-color: #000!important;
color: #ddd; color: #ddd;
} }
/deep/ .el-collapse-item__content{ .el-collapse-item__content{
padding-bottom:5px; padding-bottom:5px;
background-color: #000!important; background-color: #000!important;
} }
/deep/ .el-collapse-item__header{ .el-collapse-item__header{
background-color: #000!important; background-color: #000!important;
color: #ddd; color: #ddd;
border-bottom-color:#5a5a5a; border-bottom-color:#5a5a5a;
@ -832,5 +944,33 @@ export default {
line-height: 20px; 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> </style>