From f767451a4e72eea7973a9def9e45df5d9e8a4b7c Mon Sep 17 00:00:00 2001 From: caiyiling <1321909229@qq.com> Date: Thu, 23 May 2024 13:49:51 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=85=E7=89=87=E6=A3=80=E6=9F=A5=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E7=BB=93=E6=9E=84=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/reading.js | 119 ++--- .../reading/dicoms/components/DicomCanvas.vue | 96 ++-- .../reading/dicoms/components/DicomViewer.vue | 105 ++++- .../reading/dicoms/components/StudyList.vue | 107 ++++- .../dicoms/customize/CustomizeDicomCanvas.vue | 412 +++++++++--------- .../dicoms/customize/CustomizeDicomViewer.vue | 105 ++++- .../dicoms/customize/CustomizeStudyList.vue | 104 ++++- 7 files changed, 716 insertions(+), 332 deletions(-) diff --git a/src/store/modules/reading.js b/src/store/modules/reading.js index 467b4655..75beef40 100644 --- a/src/store/modules/reading.js +++ b/src/store/modules/reading.js @@ -20,8 +20,8 @@ const hangingAgreement = [ ] const getDefaultState = () => { return { - // visitTaskList: [], - visitTaskList: sessionStorage.getItem('visitTaskList') ? JSON.parse(sessionStorage.getItem('visitTaskList')) : [], + visitTaskList: [], + // visitTaskList: sessionStorage.getItem('visitTaskList') ? JSON.parse(sessionStorage.getItem('visitTaskList')) : [], organList: [], seriesStack: [], activeHangingAgreement: hangingAgreement[0], @@ -166,7 +166,7 @@ const actions = { item.IsInit = false }) state.visitTaskList = res.Result - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') const currentTaskIdx = res.Result.findIndex(item => item.IsCurrentTask) if (currentTaskIdx > -1) { state.currentTaskId = res.Result[currentTaskIdx].VisitTaskId @@ -178,7 +178,7 @@ const actions = { }, resetVisitTasks({ state }) { return new Promise(resolve => { - sessionStorage.setItem('visitTaskList', '') + // sessionStorage.setItem('visitTaskList', '') state.visitTaskList = [] state.currentTaskId = '' state.activeSeries = {} @@ -209,14 +209,25 @@ const actions = { var seriesList = [] study.SeriesList.forEach((series, index) => { const imageIds = [] - - series.InstancePathList.forEach((path) => { - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${path}`) + const instanceList = [] + // series.InstancePathList.forEach((path) => { + // imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${path}`) + // }) + series.InstanceInfoList.forEach(instance => { + if (instance.NumberOfFrames && instance.NumberOfFrames > 1) { + for (let i = 0; i < instance.NumberOfFrames; i++) { + const path = `${instance.Path}?frame=${i}&instanceId=${instance.Id}` + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${path}`) + } + } else { + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?instanceId=${instance.Id}`) + } + instanceList.push(instance.Id) }) seriesList.push({ isDicom: study.IsDicom, imageIds: imageIds, - instanceList: series.InstanceList, + instanceList: instanceList, seriesId: series.Id, imageIdIndex: 0, seriesUid: series.SeriesInstanceUid, @@ -287,7 +298,7 @@ const actions = { } } - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }).catch(() => { resolve() }) }) @@ -303,7 +314,7 @@ const actions = { }) }) } - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }) }, @@ -322,7 +333,7 @@ const actions = { state.visitTaskList[index].Questions = res.Result state.visitTaskList[index].questionsInit = true state.visitTaskList[index].QuestionMarkInfoList = res.OtherInfo.QuestionMarkInfoList - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }).catch(() => { resolve() }) } @@ -340,7 +351,7 @@ const actions = { state.visitTaskList[index].Questions = res.Result state.visitTaskList[index].questionsInit = true state.visitTaskList[index].QuestionMarkInfoList = res.OtherInfo.QuestionMarkInfoList - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }).catch(() => { resolve() }) }) @@ -359,7 +370,7 @@ const actions = { var list = getQuestions(res.Result.SinglePage) state.visitTaskList[index].ReadingQuestions = list state.visitTaskList[index].readingQuestionsInit = true - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }).catch(() => { resolve() }) } @@ -376,7 +387,7 @@ const actions = { var list = getQuestions(res.Result.SinglePage) state.visitTaskList[index].ReadingQuestions = list state.visitTaskList[index].readingQuestionsInit = true - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }).catch(() => { resolve() }) }) @@ -387,7 +398,7 @@ const actions = { if (index > -1) { state.visitTaskList[index].ReadingQuestions = obj.questions } - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }) }, @@ -399,7 +410,7 @@ const actions = { questions = findQuestionAndAddLesion(questions, obj) state.visitTaskList[index].ReadingQuestions = questions } - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }) }, @@ -411,7 +422,7 @@ const actions = { questions = findQuestionAndUpdateLesion(questions, obj) state.visitTaskList[index].ReadingQuestions = questions } - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }) }, @@ -423,7 +434,7 @@ const actions = { questions = findQuestionAndRemoveLesion(questions, obj) state.visitTaskList[index].ReadingQuestions = questions } - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }) }, @@ -444,7 +455,7 @@ const actions = { }) state.visitTaskList[index].MeasureData = arr state.visitTaskList[index].measureDataInit = true - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }).catch(() => { resolve() }) } @@ -471,7 +482,7 @@ const actions = { }) state.visitTaskList[index].MeasureData = arr state.visitTaskList[index].measureDataInit = true - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }).catch(() => { resolve() }) } @@ -511,7 +522,7 @@ const actions = { await deleteCustomTag(obj.questionInfo.Id) state.visitTaskList[index].MeasureData = measureData } - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }) }, @@ -529,7 +540,7 @@ const actions = { }) state.visitTaskList[index].MeasureData = arr state.visitTaskList[index].measureDataInit = true - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }).catch(() => { resolve() }) }) @@ -548,7 +559,7 @@ const actions = { }) state.visitTaskList[index].MeasureData = arr state.visitTaskList[index].measureDataInit = true - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }).catch(() => { resolve() }) }) @@ -580,7 +591,7 @@ const actions = { state.visitTaskList[index].MeasureData.push(obj.data) console.log('新增标记成功') } - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') console.log(state.visitTaskList) resolve() }) @@ -602,7 +613,7 @@ const actions = { state.visitTaskList[index].MeasureData.push(obj.data) console.log('新增标记成功') } - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }) }, @@ -622,7 +633,7 @@ const actions = { } state.visitTaskList[index].MeasureData = measureData } - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }) }, @@ -641,7 +652,7 @@ const actions = { Id: obj.Id }) console.log('新增标记成功') - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() } var idx = measureData.findIndex(item => item.Id === obj.questionInfo.Id) @@ -657,7 +668,7 @@ const actions = { state.visitTaskList[index].MeasureData.push(obj.MeasureData.data) console.log('新增标记成功') } - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }) }, @@ -702,7 +713,7 @@ const actions = { // state.visitTaskList[index].MeasureData = measureData // } - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }) }, @@ -715,7 +726,7 @@ const actions = { measureData[idx].MeasureData.data.status = obj.status state.visitTaskList[index].MeasureData = measureData } - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }) }, @@ -726,8 +737,6 @@ const actions = { resolve() } else { var studyList = [] - // getVisitStudyList - // getReadingVisitStudyList getReadingVisitStudyList(obj.trialId, obj.subjectVisitId, obj.visitTaskId).then(res => { res.Result.forEach((study, studyIndex) => { const data = {} @@ -743,19 +752,30 @@ const actions = { var seriesList = [] study.SeriesList.forEach((series, seriesIndex) => { const imageIds = [] - try { - // if (~window.location.href.indexOf('3c210000-3e2c-0016-4247-08dabf28e96b')) { - series.InstancePathList.forEach((path) => { - // var path = id.split('/')[id.split('/').length - 1] - imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${path}`) - }) - } catch (e) { - console.log(e) - } + const instanceList = [] + // try { + // series.InstancePathList.forEach((path) => { + // imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${path}`) + // }) + // } catch (e) { + // console.log(e) + // } + series.InstanceInfoList.forEach(instance => { + if (instance.NumberOfFrames && instance.NumberOfFrames > 1) { + for (let i = 0; i < instance.NumberOfFrames; i++) { + const path = `${instance.Path}?frame=${i}&instanceId=${instance.Id}` + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${path}`) + } + } else { + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? Vue.prototype.OSSclientConfig.basePath : Vue.prototype.OSSclientConfig.basePath}${instance.Path}?instanceId=${instance.Id}`) + } + instanceList.push(instance.Id) + }) seriesList.push({ isDicom: study.IsDicom, imageIds: imageIds, - instanceList: series.InstanceList, + instanceInfoList: series.InstanceInfoList, + instanceList: instanceList, seriesId: series.Id, imageIdIndex: 0, seriesUid: series.SeriesInstanceUid, @@ -782,7 +802,8 @@ const actions = { isLoading: false, isBeMark: series.IsBeMark, ww: series.WindowWidth, - wc: series.WindowCenter + wc: series.WindowCenter, + isExistMutiFrames: series.IsExistMutiFrames }) }) data.SeriesList = seriesList @@ -790,7 +811,7 @@ const actions = { }) state.visitTaskList[index].StudyList = studyList state.visitTaskList[index].studyListInit = true - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }).catch(() => { resolve() }) } @@ -823,7 +844,7 @@ const actions = { } } state.visitTaskList[index].StudyList = studyList - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') } else { // console.log(obj) } @@ -843,7 +864,7 @@ const actions = { studyList[obj.studyIndex].SeriesList[obj.seriesIndex].loadStatus = true } state.visitTaskList[obj.visitTaskindex].StudyList = studyList - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') } resolve() }) @@ -851,7 +872,7 @@ const actions = { setStatus({ state }, obj) { var index = state.visitTaskList.findIndex(i => i.VisitTaskId === obj.visitTaskId) state.visitTaskList[index].IsInit = true - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') }, setActiveSeries({ state }, series) { return new Promise(resolve => { @@ -896,7 +917,7 @@ const actions = { state.visitTaskList[index].QuestionMarkInfoList.push(obj.data) console.log('新增标记成功') } - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }) }, @@ -912,7 +933,7 @@ const actions = { } state.visitTaskList[index].QuestionMarkInfoList = measureData } - sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') + // sessionStorage.setItem('visitTaskList', state.visitTaskList.length > 0 ? JSON.stringify(state.visitTaskList) : '') resolve() }) } diff --git a/src/views/trials/trials-panel/reading/dicoms/components/DicomCanvas.vue b/src/views/trials/trials-panel/reading/dicoms/components/DicomCanvas.vue index d6d7cc23..2f5a46d6 100644 --- a/src/views/trials/trials-panel/reading/dicoms/components/DicomCanvas.vue +++ b/src/views/trials/trials-panel/reading/dicoms/components/DicomCanvas.vue @@ -754,14 +754,10 @@ export default { getToolStateInfo(e) { const { element, currentPoints, image, viewport } = e.detail var imageId = image.imageId - var instanceId = imageId.split('/')[imageId.split('/').length - 1] - var frame = null - if (instanceId.includes('?frame=')) { - frame = instanceId.split('?frame=')[1] - instanceId = instanceId.split('?frame=')[0] - } + const imageInfo = this.getInstanceInfo(imageId) + var instanceId = imageInfo.instanceId + var frame = imageInfo.frame this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0 - instanceId = instanceId.split('.')[0] const ToolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager for (var m = 0; m < this.measuredTools.length; m++) { var toolType = this.measuredTools[m] @@ -924,11 +920,8 @@ export default { if (this.readingTaskState >= 2) return var element = cornerstone.getEnabledElement(this.canvas) var { imageId } = element.image - var instanceId = imageId.split('/')[imageId.split('/').length - 1] - if (instanceId.includes('?frame=')) { - instanceId = instanceId.split('?frame=')[0] - } - instanceId = instanceId.split('.')[0] + const imageInfo = this.getInstanceInfo(imageId) + var instanceId = imageInfo.instanceId var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.stack.visitTaskId && i.IsCurrentTask && i.ReadingTaskState < 2) if (idx === -1) return this.measureData = this.visitTaskList[idx].MeasureData @@ -991,15 +984,10 @@ export default { mouseClick(e) { const { element, currentPoints, image, viewport } = e.detail var imageId = image.imageId - var instanceId = imageId.split('/')[imageId.split('/').length - 1] - var frame = null - if (instanceId.includes('?frame=')) { - frame = instanceId.split('?frame=')[1] - instanceId = instanceId.split('?frame=')[0] - } + const imageInfo = this.getInstanceInfo(imageId) + var instanceId = imageInfo.instanceId + var frame = imageInfo.frame this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0 - instanceId = instanceId.split('.')[0] - const ToolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager for (let t = 0; t < this.measuredTools.length; t++) { var toolType = this.measuredTools[t] @@ -1095,14 +1083,10 @@ export default { this.minVistNum = this.visitTaskList[0].VisitTaskNum this.measureData = this.visitTaskList[idx].MeasureData const imageId = this.stack.imageIds[this.stack.currentImageIdIndex] - var instanceId = imageId.split('/')[imageId.split('/').length - 1] - var frame = null - if (instanceId.includes('?frame=')) { - frame = instanceId.split('?frame=')[1] - instanceId = instanceId.split('?frame=')[0] - } + const imageInfo = this.getInstanceInfo(imageId) + var instanceId = imageInfo.instanceId + var frame = imageInfo.frame this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0 - instanceId = instanceId.split('.')[0] this.stack.instanceId = instanceId const ToolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager ToolStateManager.clearImageIdToolState(dicomSeries.imageIds) @@ -1126,15 +1110,18 @@ export default { // } // resolve() // }) + this.loading = true cornerstone.loadAndCacheImage(this.stack.imageIds[this.stack.currentImageIdIndex]) .then(async image => { await scope.onFirstImageLoaded(image) + scope.loading = false resolve() }) .catch((error) => { if (error.error && error.error.message) { this.$alert(error.error.message) } + scope.loading = false resolve() }) }) @@ -1208,14 +1195,10 @@ export default { this.stack.firstImageLoading = false this.toolState.dicomInfoVisible = true - var instanceId = image.imageId.split('/')[image.imageId.split('/').length - 1] - var frame = null - if (instanceId.includes('?frame=')) { - frame = instanceId.split('?frame=')[1] - instanceId = instanceId.split('?frame=')[0] - } + const imageInfo = this.getInstanceInfo(image.imageId) + var instanceId = imageInfo.instanceId + var frame = imageInfo.frame this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0 - instanceId = instanceId.split('.')[0] this.stack.instanceId = instanceId this.height = (this.stack.currentImageIdIndex) * 100 / (this.stack.imageIds.length - 1) this.resetWwwc() @@ -1281,14 +1264,10 @@ export default { this.stack.imageRendered = true // const { element } = e.detail var imageId = e.detail.image.imageId - var instanceId = imageId.split('/')[imageId.split('/').length - 1] - var frame = null - if (instanceId.includes('?frame=')) { - frame = instanceId.split('?frame=')[1] - instanceId = instanceId.split('?frame=')[0] - } + const imageInfo = this.getInstanceInfo(imageId) + var instanceId = imageInfo.instanceId + var frame = imageInfo.frame this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0 - instanceId = instanceId.split('.')[0] if (this.imageId !== instanceId) { this.getOrientationMarker(e.detail.element) // 初次加载时,如果该影像存在标记,则以标记的窗宽窗位为初始化默认值,否则以序列的窗宽窗位为初始化默认值 @@ -1344,14 +1323,10 @@ export default { this.activeTool = 1 this.activeToolName = '' var { imageId } = element.image - var instanceId = imageId.split('/')[imageId.split('/').length - 1] - var frame = null - if (instanceId.includes('?frame=')) { - frame = instanceId.split('?frame=')[1] - instanceId = instanceId.split('?frame=')[0] - } + const imageInfo = this.getInstanceInfo(imageId) + var instanceId = imageInfo.instanceId + var frame = imageInfo.frame this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0 - instanceId = instanceId.split('.')[0] if (e.detail.toolName === 'Length' || e.detail.toolName === 'ArrowAnnotate' || e.detail.toolName === 'RectangleRoi') { const measureData = {} measureData.studyId = this.stack.studyId @@ -1468,14 +1443,10 @@ export default { var element = cornerstone.getEnabledElement(this.canvas) var viewport = element.viewport var { imageId } = element.image - var instanceId = imageId.split('/')[imageId.split('/').length - 1] - var frame = null - if (instanceId.includes('?frame=')) { - frame = instanceId.split('?frame=')[1] - instanceId = instanceId.split('?frame=')[0] - } + const imageInfo = this.getInstanceInfo(imageId) + var instanceId = imageInfo.instanceId + var frame = imageInfo.frame this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0 - instanceId = instanceId.split('.')[0] var uuid = measurementData.uuid var idx = this.measureData.findIndex(item => item.MeasureData && item.MeasureData.data && item.MeasureData.data.uuid === uuid) @@ -1533,11 +1504,8 @@ export default { // 判断有没有标记 获取第一个标记 var element = cornerstone.getEnabledElement(this.canvas) var { imageId } = element.image - var instanceId = imageId.split('/')[imageId.split('/').length - 1] - if (instanceId.includes('?frame=')) { - instanceId = instanceId.split('?frame=')[0] - } - instanceId = instanceId.split('.')[0] + const imageInfo = this.getInstanceInfo(imageId) + var instanceId = imageInfo.instanceId var idx = this.measureData.findIndex(item => item.InstanceId === instanceId) var measureData = null if (idx > -1) { @@ -1952,6 +1920,14 @@ export default { } } }, + getInstanceInfo(imageId) { + const params = {} + const searchParams = new URLSearchParams(imageId.split('?')[1]) + for (const [key, value] of searchParams.entries()) { + params[key] = value + } + return params + }, preventDefault(e) { e.stopImmediatePropagation() e.stopPropagation() diff --git a/src/views/trials/trials-panel/reading/dicoms/components/DicomViewer.vue b/src/views/trials/trials-panel/reading/dicoms/components/DicomViewer.vue index 11e546d0..68450171 100644 --- a/src/views/trials/trials-panel/reading/dicoms/components/DicomViewer.vue +++ b/src/views/trials/trials-panel/reading/dicoms/components/DicomViewer.vue @@ -292,6 +292,51 @@
{{ $t('trials:lugano:button:fusion') }}
+
+ + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+ + + + +
@@ -789,7 +834,8 @@ export default { digitPlaces: 2, activeCanvasWW: null, activeCanvasWC: null, - activeTaskInfo: {} + activeTaskInfo: {}, + clipPlaying: false } }, @@ -844,6 +890,16 @@ export default { imageQualityIssues: { immediate: true, handler(v) {} + }, + currentDicomCanvasIndex: { + immediate: true, + handler(v) { + if (this.$refs[`dicomCanvas${this.currentDicomCanvasIndex}`] && this.$refs[`dicomCanvas${this.currentDicomCanvasIndex}`][0]) { + this.clipPlaying = this.$refs[`dicomCanvas${this.currentDicomCanvasIndex}`][0].toolState.clipPlaying + } else { + this.clipPlaying = false + } + } } }, @@ -1870,6 +1926,18 @@ export default { } this.activeTool = toolName }, + // 切换帧 + scrollPage(i) { + this.$refs[`dicomCanvas${this.currentDicomCanvasIndex}`][0].scrollPage(i) + }, + // 播放/暂停 + toggleClipPlay() { + this.clipPlaying = !this.clipPlaying + this.$refs[`dicomCanvas${this.currentDicomCanvasIndex}`][0].toggleClipPlay() + }, + setDicomCanvasfps(event) { + this.$refs[`dicomCanvas${this.currentDicomCanvasIndex}`][0].setFps(event.target.value) + }, // 添加标记 setMeasureData(data) { this.$refs['measurementList'].setMeasuredData(data) @@ -2129,7 +2197,7 @@ export default { flex-direction: column; justify-content: center; align-items: center; - margin-right: 30px; + margin-right: 20px; .icon{ padding: 5px; border: 1px solid #404040; @@ -2148,6 +2216,39 @@ export default { display: none; } } + .tool-frame{ + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + margin-right: 20px; + border: 1px solid #404040; + .icon{ + padding: 5px; + border-right: 1px solid #404040; + cursor: pointer; + text-align: center; + .svg-icon{ + font-size:20px; + color:#ddd; + } + } + .select-wrapper{ + width: 60px; + background-color: black; + color: #ddd; + border: none; + font-size: 13px; + outline: none; + } + .text{ + position: relative; + font-size: 12px; + margin-top: 5px; + color: #d0d0d0; + display: none; + } + } .tool_active{ background-color: #607d8b; } diff --git a/src/views/trials/trials-panel/reading/dicoms/components/StudyList.vue b/src/views/trials/trials-panel/reading/dicoms/components/StudyList.vue index 1db2d6cb..28bed335 100644 --- a/src/views/trials/trials-panel/reading/dicoms/components/StudyList.vue +++ b/src/views/trials/trials-panel/reading/dicoms/components/StudyList.vue @@ -49,7 +49,42 @@ />
-
#{{ series.seriesNumber }}
+
+
#{{ series.seriesNumber }}
+
+ +
+ +
+
{{ instance.InstanceNumber }}
+
{{ `${instance.NumberOfFrames > 0 ? instance.NumberOfFrames : 1} frame` }}
+
+ +
+ +
+
+
+
@@ -367,6 +402,7 @@ 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) @@ -647,6 +683,48 @@ export default { store.dispatch('reading/setActiveSeries', series) }, + showMultiFrames(studyIndex, series, seriesIndex, instanceInfo) { + this.currentSeriesIndex = seriesIndex + const imageIds = [] + if (instanceInfo.NumberOfFrames && instanceInfo.NumberOfFrames > 1) { + for (let j = 0; j < instanceInfo.NumberOfFrames; j++) { + const path = `${instanceInfo.Path}?frame=${j}&instanceId=${instanceInfo.Id}` + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${path}`) + } + } else { + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${instanceInfo.Path}?instanceId=${instanceInfo.Id}`) + } + this.studyIndex = studyIndex + this.seriesIndex = seriesIndex + this.studyList[studyIndex].SeriesList[seriesIndex].measureData = this.measureData + var dicomStatck = this.studyList[studyIndex].SeriesList[seriesIndex] + dicomStatck.imageIds = imageIds + dicomStatck.imageIdIndex = 0 + console.log(dicomStatck) + this.$emit('loadImageStack', dicomStatck) + 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 }) + }, setSeriesActive(obj) { var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId) if (idx === -1) return @@ -936,6 +1014,7 @@ export default { padding: 1px; margin: 0px; } + } } /deep/.el-collapse{ @@ -986,5 +1065,29 @@ export default { } } } - + + diff --git a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeDicomCanvas.vue b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeDicomCanvas.vue index 3f8dedb8..7a5ae40f 100644 --- a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeDicomCanvas.vue +++ b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeDicomCanvas.vue @@ -43,7 +43,7 @@
-
+

{{ subjectCode }} {{ stack.taskBlindName }}

Series: #{{ dicomInfo.series }}
Image: #{{ dicomInfo.frame }}
@@ -99,8 +99,8 @@
-
Location: {{ dicomInfo.location }}
-
Slice Thickness: {{ dicomInfo.thick }}mm
+
Location: {{ `${Number(dicomInfo.location).toFixed(digitPlaces)} mm` }}
+
Slice Thickness: {{ `${dicomInfo.thick} mm` }}
WW/WL: {{ dicomInfo.wwwc }}
@@ -220,7 +220,8 @@ export default { visitTaskId: '', taskBlindName: '', frame: null, - imageRendered: false + imageRendered: false, + isExistsClinicalData: false // preventCache: true }, dicomInfo: { @@ -297,7 +298,7 @@ export default { ], scrollSyncInfo: { offset: 0 }, hideMeasureArr: [] - + } }, computed: { @@ -330,6 +331,7 @@ export default { }, mounted() { + console.log(cornerstoneTools) this.subjectCode = this.$router.currentRoute.query.subjectCode document.addEventListener('mouseup', () => { this.sliderMouseup() @@ -373,10 +375,10 @@ export default { } ) - // this.canvas.addEventListener( - // 'cornerstonetoolsmeasurementremoved', - // this.onMeasurementremoved - // ) + this.canvas.addEventListener( + 'cornerstonetoolsmeasurementremoved', + this.onMeasurementremoved + ) // EVENTS.MOUSE_UP this.canvas.addEventListener('cornerstonetoolsmouseup', this.mouseUp) this.canvas.addEventListener('cornerstonetoolsmousedown', this.mouseDown) @@ -477,7 +479,6 @@ export default { }, methods: { goViewer(e) { - console.log('goViewer') console.log(this.$refs['sliderBox'].clientHeight) var height = e.offsetY * 100 / this.$refs['sliderBox'].clientHeight this.height = height @@ -566,6 +567,7 @@ export default { showCancelButton: false, type: 'warning' }).then(() => { + }).catch(() => {}) e.stopImmediatePropagation() e.stopPropagation() @@ -651,7 +653,7 @@ export default { if (PX < 0) return if (PX > boxHeight) return var height = PX * 100 / boxHeight - var index = Math.trunc(this.stack.imageIds.length * this.height / 100) + var index = Math.trunc(this.stack.imageIds.length * height / 100) index = index > this.stack.imageIds.length ? this.stack.imageIds.length : index < 0 ? 0 : index // if (!cornerstone.imageCache.getImageLoadObject(this.stack.imageIds[index])) return this.height = height @@ -663,6 +665,7 @@ export default { this.sliderInfo.isMove = false }, getMeasureData() { + console.log('getMeasureData') var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.stack.visitTaskId) this.measureData = this.visitTaskList[idx].MeasureData const ToolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager @@ -736,14 +739,10 @@ export default { getToolStateInfo(e) { const { element, currentPoints, image, viewport } = e.detail var imageId = image.imageId - var instanceId = imageId.split('/')[imageId.split('/').length - 1] - var frame = null - if (instanceId.includes('?frame=')) { - frame = instanceId.split('?frame=')[1] - instanceId = instanceId.split('?frame=')[0] - } + const imageInfo = this.getInstanceInfo(imageId) + var instanceId = imageInfo.instanceId + var frame = imageInfo.frame this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0 - instanceId = instanceId.split('.')[0] const ToolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager for (var m = 0; m < this.measuredTools.length; m++) { var toolType = this.measuredTools[m] @@ -771,6 +770,7 @@ export default { measureData.data = toolState.data[i] measureData.type = toolType measureData.thick = this.dicomInfo.thick + measureData.location = this.dicomInfo.location var uuid = toolState.data[i].uuid var idx = this.measureData.findIndex(item => item.MeasureData && item.MeasureData.data && item.MeasureData.data.uuid === uuid) if (idx > -1) { @@ -866,6 +866,7 @@ export default { 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 const { element } = e.detail const ToolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager @@ -904,11 +905,8 @@ export default { if (this.readingTaskState >= 2) return var element = cornerstone.getEnabledElement(this.canvas) var { imageId } = element.image - var instanceId = imageId.split('/')[imageId.split('/').length - 1] - if (instanceId.includes('?frame=')) { - instanceId = instanceId.split('?frame=')[0] - } - instanceId = instanceId.split('.')[0] + const imageInfo = this.getInstanceInfo(imageId) + var instanceId = imageInfo.instanceId var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.stack.visitTaskId && i.IsCurrentTask && i.ReadingTaskState < 2) if (idx === -1) return this.measureData = this.visitTaskList[idx].MeasureData @@ -968,18 +966,13 @@ export default { } } }, - async mouseClick(e) { + mouseClick(e) { const { element, currentPoints, image, viewport } = e.detail var imageId = image.imageId - var instanceId = imageId.split('/')[imageId.split('/').length - 1] - var frame = null - if (instanceId.includes('?frame=')) { - frame = instanceId.split('?frame=')[1] - instanceId = instanceId.split('?frame=')[0] - } + const imageInfo = this.getInstanceInfo(imageId) + var instanceId = imageInfo.instanceId + var frame = imageInfo.frame this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0 - instanceId = instanceId.split('.')[0] - const ToolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager for (let t = 0; t < this.measuredTools.length; t++) { var toolType = this.measuredTools[t] @@ -1010,6 +1003,7 @@ export default { measureData.data = toolState.data[i] measureData.type = toolType measureData.thick = this.dicomInfo.thick + measureData.location = this.dicomInfo.location measureData.ww = Math.round(viewport.voi.windowWidth) measureData.wc = Math.round(viewport.voi.windowCenter) measureData.data.active = false @@ -1049,6 +1043,7 @@ export default { this.stack.seriesIndex = dicomSeries.seriesIndex this.stack.sliceThickness = dicomSeries.sliceThickness this.stack.instanceCount = dicomSeries.instanceCount + this.stack.isExistsClinicalData = dicomSeries.isExistsClinicalData // this.measuredData = dicomSeries.measuredData var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === dicomSeries.visitTaskId) this.stack.visitTaskNum = this.visitTaskList[idx].VisitTaskNum @@ -1058,18 +1053,15 @@ export default { } else { this.disabledMarks = [] } + this.maxVistNum = this.visitTaskList[this.visitTaskList.length - 1].VisitTaskNum this.minVistNum = this.visitTaskList[0].VisitTaskNum this.measureData = this.visitTaskList[idx].MeasureData const imageId = this.stack.imageIds[this.stack.currentImageIdIndex] - var instanceId = imageId.split('/')[imageId.split('/').length - 1] - var frame = null - if (instanceId.includes('?frame=')) { - frame = instanceId.split('?frame=')[1] - instanceId = instanceId.split('?frame=')[0] - } + const imageInfo = this.getInstanceInfo(imageId) + var instanceId = imageInfo.instanceId + var frame = imageInfo.frame this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0 - instanceId = instanceId.split('.')[0] this.stack.instanceId = instanceId const ToolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager ToolStateManager.clearImageIdToolState(dicomSeries.imageIds) @@ -1093,99 +1085,100 @@ export default { // } // resolve() // }) + this.loading = true cornerstone.loadAndCacheImage(this.stack.imageIds[this.stack.currentImageIdIndex]) - .then(image => { - scope.onFirstImageLoaded(image) + .then(async image => { + await scope.onFirstImageLoaded(image) + scope.loading = false resolve() }) .catch((error) => { if (error.error && error.error.message) { this.$alert(error.error.message) } + scope.loading = false resolve() }) }) }, onFirstImageLoaded(image) { console.log('onFirstImageLoaded') + return new Promise(async resolve => { + const element = this.$refs.canvas + var viewport = cornerstone.getDefaultViewportForImage(this.canvas, image) + cornerstone.displayImage(this.canvas, image, viewport) - const element = this.$refs.canvas - var viewport = cornerstone.getDefaultViewportForImage(this.canvas, image) - cornerstone.displayImage(this.canvas, image, viewport) + if (!this.toolState.initialized) { + this.toolState.initialized = true + const toolButtons = document.querySelectorAll('[data-tool]') - if (!this.toolState.initialized) { - this.toolState.initialized = true - const toolButtons = document.querySelectorAll('[data-tool]') - - // const scope = this - Array.from(toolButtons).forEach((toolBtn) => { + // const scope = this + Array.from(toolButtons).forEach((toolBtn) => { // Add the tool - const toolName = toolBtn.getAttribute('data-tool') - const apiTool = cornerstoneTools[`${toolName}Tool`] - if (apiTool) { - const toolAlreadyAddedToElement = cornerstoneTools.getToolForElement(element, apiTool) + const toolName = toolBtn.getAttribute('data-tool') + const apiTool = cornerstoneTools[`${toolName}Tool`] + if (apiTool) { + const toolAlreadyAddedToElement = cornerstoneTools.getToolForElement(element, apiTool) - if (!toolAlreadyAddedToElement) { - if (toolName === 'Length') { - cornerstoneTools.addToolForElement(element, LengthTool, { configuration: { handleRadius: false, drawHandlesOnHover: true, hideHandlesIfMoving: true, digits: this.digitPlaces, drawHandles: true }}) - } else if (toolName === 'Bidirectional') { + if (!toolAlreadyAddedToElement) { + if (toolName === 'Length') { + cornerstoneTools.addToolForElement(element, LengthTool, { configuration: { handleRadius: false, drawHandlesOnHover: true, hideHandlesIfMoving: true, digits: this.digitPlaces, drawHandles: true }}) + } else if (toolName === 'Bidirectional') { // cornerstoneTools.addToolForElement(element, BidirectionalTool, { digits: this.digitPlaces }) // , handleRadius: false, drawHandlesOnHover: true, hideHandlesIfMoving: true - cornerstoneTools.addToolForElement(element, BidirectionalTool, { configuration: { digits: this.digitPlaces, hideHandlesIfMoving: true }}) - } else if (toolName === 'ArrowAnnotate') { - cornerstoneTools.addToolForElement(element, ArrowAnnotateTool, { configuration: { allowEmptyLabel: true, handleRadius: false, drawHandlesOnHover: true, hideHandlesIfMoving: true }}) - } else if (toolName === 'RectangleRoi') { - cornerstoneTools.addToolForElement(element, RectangleRoiTool, { configuration: { allowEmptyLabel: true, handleRadius: false, drawHandlesOnHover: true, hideHandlesIfMoving: true }}) - } else { - cornerstoneTools.addToolForElement(element, apiTool) + cornerstoneTools.addToolForElement(element, BidirectionalTool, { configuration: { digits: this.digitPlaces, hideHandlesIfMoving: true }}) + } else if (toolName === 'ArrowAnnotate') { + cornerstoneTools.addToolForElement(element, ArrowAnnotateTool, { configuration: { allowEmptyLabel: true, handleRadius: false, drawHandlesOnHover: true, hideHandlesIfMoving: true }}) + } else if (toolName === 'RectangleRoi') { + cornerstoneTools.addToolForElement(element, RectangleRoiTool, { configuration: { allowEmptyLabel: true, handleRadius: false, drawHandlesOnHover: true, hideHandlesIfMoving: true }}) + } else { + cornerstoneTools.addToolForElement(element, apiTool) + } } } + }) + if (!cornerstoneTools.getToolForElement(element, cornerstoneTools.WwwcRegionTool)) { + cornerstoneTools.addToolForElement(element, cornerstoneTools.WwwcRegionTool) } - }) - if (!cornerstoneTools.getToolForElement(element, cornerstoneTools.WwwcRegionTool)) { - cornerstoneTools.addToolForElement(element, cornerstoneTools.WwwcRegionTool) - } - if (!cornerstoneTools.getToolForElement(element, cornerstoneTools.StackScrollMouseWheelTool)) { - cornerstoneTools.addToolForElement(element, cornerstoneTools.StackScrollMouseWheelTool) - } - cornerstoneTools.setToolActiveForElement(element, 'StackScrollMouseWheel', {}) + if (!cornerstoneTools.getToolForElement(element, cornerstoneTools.StackScrollMouseWheelTool)) { + cornerstoneTools.addToolForElement(element, cornerstoneTools.StackScrollMouseWheelTool) + } + cornerstoneTools.setToolActiveForElement(element, 'StackScrollMouseWheel', {}) - if (!cornerstoneTools.getToolForElement(element, ScaleOverlayTool)) { - cornerstoneTools.addToolForElement(element, ScaleOverlayTool) - } - cornerstoneTools.setToolActiveForElement(element, 'ScaleOverlay', {}) - cornerstoneTools.setToolActiveForElement(this.canvas, 'Zoom', { - mouseButtonMask: 2 - }) - cornerstoneTools.setToolActiveForElement(this.canvas, 'Pan', { - mouseButtonMask: 4 - }) + if (!cornerstoneTools.getToolForElement(element, ScaleOverlayTool)) { + cornerstoneTools.addToolForElement(element, ScaleOverlayTool) + } + cornerstoneTools.setToolActiveForElement(element, 'ScaleOverlay', {}) + cornerstoneTools.setToolActiveForElement(this.canvas, 'Zoom', { + mouseButtonMask: 2 + }) + cornerstoneTools.setToolActiveForElement(this.canvas, 'Pan', { + mouseButtonMask: 4 + }) // if (!cornerstoneTools.getToolForElement(element, OrientationMarkersTool)) { // cornerstoneTools.addToolForElement(element, OrientationMarkersTool) // } // cornerstoneTools.setToolActiveForElement(element, 'OrientationMarkers', { }) - } + } - // cornerstoneTools.addStackStateManager(this.canvas, ['stack', 'stackPrefetch', 'playClip']) - cornerstoneTools.addStackStateManager(this.canvas, ['stack', 'playClip']) - cornerstoneTools.addToolState(this.canvas, 'stack', this.stack) - // cornerstoneTools.stackPrefetch.enable(this.canvas) - cornerstone.updateImage(element, true) + // cornerstoneTools.addStackStateManager(this.canvas, ['stack', 'stackPrefetch', 'playClip']) + cornerstoneTools.addStackStateManager(this.canvas, ['stack', 'playClip']) + cornerstoneTools.addToolState(this.canvas, 'stack', this.stack) + // cornerstoneTools.stackPrefetch.enable(this.canvas) + cornerstone.updateImage(element, true) - this.stack.firstImageLoading = false - this.toolState.dicomInfoVisible = true - var instanceId = image.imageId.split('/')[image.imageId.split('/').length - 1] - var frame = null - if (instanceId.includes('?frame=')) { - frame = instanceId.split('?frame=')[1] - instanceId = instanceId.split('?frame=')[0] - } - this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0 - instanceId = instanceId.split('.')[0] - this.stack.instanceId = instanceId - this.height = (this.stack.currentImageIdIndex) * 100 / (this.stack.imageIds.length - 1) - this.resetWwwc() + this.stack.firstImageLoading = false + this.toolState.dicomInfoVisible = true + 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.instanceId = instanceId + this.height = (this.stack.currentImageIdIndex) * 100 / (this.stack.imageIds.length - 1) + this.resetWwwc() + resolve() + }) }, onNewImage(e) { console.log('cornerstonenewimage') @@ -1246,14 +1239,10 @@ export default { this.stack.imageRendered = true // const { element } = e.detail var imageId = e.detail.image.imageId - var instanceId = imageId.split('/')[imageId.split('/').length - 1] - var frame = null - if (instanceId.includes('?frame=')) { - frame = instanceId.split('?frame=')[1] - instanceId = instanceId.split('?frame=')[0] - } + const imageInfo = this.getInstanceInfo(imageId) + var instanceId = imageInfo.instanceId + var frame = imageInfo.frame this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0 - instanceId = instanceId.split('.')[0] if (this.imageId !== instanceId) { this.getOrientationMarker(e.detail.element) // 初次加载时,如果该影像存在标记,则以标记的窗宽窗位为初始化默认值,否则以序列的窗宽窗位为初始化默认值 @@ -1290,20 +1279,11 @@ export default { if (!imagePlane || !imagePlane.rowCosines || !imagePlane.columnCosines) { return } - const row = getOrientationString(imagePlane.rowCosines) const column = getOrientationString(imagePlane.columnCosines) const oppositeRow = invertOrientationString(row) const oppositeColumn = invertOrientationString(column) - const markers = { - top: oppositeColumn, - bottom: column, - left: oppositeRow, - right: row - } - if (!markers) { - return - } + this.orientationMarkers = [oppositeColumn, row, column, oppositeRow] this.originalMarkers = [oppositeColumn, row, column, oppositeRow] this.setMarkers() @@ -1318,14 +1298,10 @@ export default { this.activeTool = 1 this.activeToolName = '' var { imageId } = element.image - var instanceId = imageId.split('/')[imageId.split('/').length - 1] - var frame = null - if (instanceId.includes('?frame=')) { - frame = instanceId.split('?frame=')[1] - instanceId = instanceId.split('?frame=')[0] - } + const imageInfo = this.getInstanceInfo(imageId) + var instanceId = imageInfo.instanceId + var frame = imageInfo.frame this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0 - instanceId = instanceId.split('.')[0] if (e.detail.toolName === 'Length' || e.detail.toolName === 'ArrowAnnotate' || e.detail.toolName === 'RectangleRoi') { const measureData = {} measureData.studyId = this.stack.studyId @@ -1335,6 +1311,7 @@ export default { measureData.data = e.detail.measurementData measureData.type = e.detail.toolName measureData.thick = this.dicomInfo.thick + measureData.location = this.dicomInfo.location measureData.ww = Math.round(viewport.voi.windowWidth) measureData.wc = Math.round(viewport.voi.windowCenter) @@ -1351,6 +1328,7 @@ export default { measureData.data = e.detail.measurementData measureData.type = e.detail.toolName measureData.thick = this.dicomInfo.thick + measureData.location = this.dicomInfo.location measureData.ww = Math.round(viewport.voi.windowWidth) measureData.wc = Math.round(viewport.voi.windowCenter) const canvas = this.canvas.querySelector('canvas') @@ -1402,9 +1380,9 @@ export default { var element = cornerstone.getEnabledElement(this.canvas) const { rowPixelSpacing, colPixelSpacing } = this.getPixelSpacing(element.image) const dx = - (data.handles.end.x - data.handles.start.x) * (colPixelSpacing || 1) + (data.handles.end.x - data.handles.start.x) * (colPixelSpacing || 1) const dy = - (data.handles.end.y - data.handles.start.y) * (rowPixelSpacing || 1) + (data.handles.end.y - data.handles.start.y) * (rowPixelSpacing || 1) const length = Math.sqrt(dx * dx + dy * dy) return length.toFixed(this.digitPlaces) @@ -1418,9 +1396,9 @@ export default { if (imagePlane) { return { rowPixelSpacing: - imagePlane.rowPixelSpacing || imagePlane.rowImagePixelSpacing, + imagePlane.rowPixelSpacing || imagePlane.rowImagePixelSpacing, colPixelSpacing: - imagePlane.columnPixelSpacing || imagePlane.colImagePixelSpacing + imagePlane.columnPixelSpacing || imagePlane.colImagePixelSpacing } } @@ -1430,7 +1408,7 @@ export default { } }, onMeasurementremoved(e) { - + console.log('================移除病灶=================', e) }, onMeasurementmodified(e) { // 移动 @@ -1440,14 +1418,10 @@ export default { var element = cornerstone.getEnabledElement(this.canvas) var viewport = element.viewport var { imageId } = element.image - var instanceId = imageId.split('/')[imageId.split('/').length - 1] - var frame = null - if (instanceId.includes('?frame=')) { - frame = instanceId.split('?frame=')[1] - instanceId = instanceId.split('?frame=')[0] - } + const imageInfo = this.getInstanceInfo(imageId) + var instanceId = imageInfo.instanceId + var frame = imageInfo.frame this.stack.frame = !isNaN(parseInt(frame)) ? parseInt(frame) : 0 - instanceId = instanceId.split('.')[0] var uuid = measurementData.uuid var idx = this.measureData.findIndex(item => item.MeasureData && item.MeasureData.data && item.MeasureData.data.uuid === uuid) @@ -1465,6 +1439,7 @@ export default { measureData.data = measurementData measureData.type = toolType measureData.thick = this.dicomInfo.thick + measureData.location = this.dicomInfo.location measureData.ww = Math.round(viewport.voi.windowWidth) measureData.wc = Math.round(viewport.voi.windowCenter) measureData.data.active = false @@ -1504,11 +1479,8 @@ export default { // 判断有没有标记 获取第一个标记 var element = cornerstone.getEnabledElement(this.canvas) var { imageId } = element.image - var instanceId = imageId.split('/')[imageId.split('/').length - 1] - if (instanceId.includes('?frame=')) { - instanceId = instanceId.split('?frame=')[0] - } - instanceId = instanceId.split('.')[0] + const imageInfo = this.getInstanceInfo(imageId) + var instanceId = imageInfo.instanceId var idx = this.measureData.findIndex(item => item.InstanceId === instanceId) var measureData = null if (idx > -1) { @@ -1923,6 +1895,14 @@ export default { } } }, + getInstanceInfo(imageId) { + const params = {} + const searchParams = new URLSearchParams(imageId.split('?')[1]) + for (const [key, value] of searchParams.entries()) { + params[key] = value + } + return params + }, preventDefault(e) { e.stopImmediatePropagation() e.stopPropagation() @@ -1940,87 +1920,87 @@ export default { diff --git a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeDicomViewer.vue b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeDicomViewer.vue index 714acea8..882a259d 100644 --- a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeDicomViewer.vue +++ b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeDicomViewer.vue @@ -280,6 +280,51 @@
{{ tool.text }}
-->
+
+ + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+ + + + +
-
#{{ series.seriesNumber }}
+
+
#{{ series.seriesNumber }}
+
+ +
+ +
+
{{ instance.InstanceNumber }}
+
{{ `${instance.NumberOfFrames > 0 ? instance.NumberOfFrames : 1} frame` }}
+
+ +
+ +
+
+
+
@@ -638,6 +673,48 @@ export default { store.dispatch('reading/setActiveSeries', series) }, + showMultiFrames(studyIndex, series, seriesIndex, instanceInfo) { + this.currentSeriesIndex = seriesIndex + const imageIds = [] + if (instanceInfo.NumberOfFrames && instanceInfo.NumberOfFrames > 1) { + for (let j = 0; j < instanceInfo.NumberOfFrames; j++) { + const path = `${instanceInfo.Path}?frame=${j}&instanceId=${instanceInfo.Id}` + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${path}`) + } + } else { + imageIds.push(`wadouri:${localStorage.getItem('location') !== 'USA' ? this.OSSclientConfig.basePath : this.OSSclientConfig.basePath}${instanceInfo.Path}?instanceId=${instanceInfo.Id}`) + } + this.studyIndex = studyIndex + this.seriesIndex = seriesIndex + this.studyList[studyIndex].SeriesList[seriesIndex].measureData = this.measureData + var dicomStatck = this.studyList[studyIndex].SeriesList[seriesIndex] + dicomStatck.imageIds = imageIds + dicomStatck.imageIdIndex = 0 + console.log(dicomStatck) + this.$emit('loadImageStack', dicomStatck) + 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 }) + }, setSeriesActive(obj) { var idx = this.visitTaskList.findIndex(i => i.VisitTaskId === this.visitTaskId) if (idx === -1) return @@ -977,3 +1054,28 @@ export default { } +