融合页面crosshairsTool更改
parent
040f66f182
commit
72b5d515ba
|
|
@ -670,30 +670,32 @@ export default {
|
||||||
this.series = { ...data }
|
this.series = { ...data }
|
||||||
if (this.isMip) {
|
if (this.isMip) {
|
||||||
let volume = cache.getVolume(this.volumeId)
|
let volume = cache.getVolume(this.volumeId)
|
||||||
const ptVolumeDimensions = volume.dimensions;
|
const ptVolumeDimensions = volume.dimensions
|
||||||
const slabThickness = Math.sqrt(
|
const slabThickness = Math.sqrt(
|
||||||
ptVolumeDimensions[0] * ptVolumeDimensions[0] +
|
ptVolumeDimensions[0] * ptVolumeDimensions[0] +
|
||||||
ptVolumeDimensions[1] * ptVolumeDimensions[1] +
|
ptVolumeDimensions[1] * ptVolumeDimensions[1] +
|
||||||
ptVolumeDimensions[2] * ptVolumeDimensions[2]
|
ptVolumeDimensions[2] * ptVolumeDimensions[2]
|
||||||
);
|
)
|
||||||
viewport
|
|
||||||
.setVolumes([{
|
await viewport.setVolumes([{
|
||||||
volumeId: this.volumeId,
|
volumeId: this.volumeId,
|
||||||
callback: (r) => {
|
callback: (r) => {
|
||||||
if (this.series.Modality === 'NM') {
|
if (this.series.Modality === 'NM') {
|
||||||
setMipTransferFunctionForVolumeActor({ ...r, volumeId: this.volumeId })
|
setMipTransferFunctionForVolumeActor({ ...r, volumeId: this.volumeId })
|
||||||
} else {
|
} else {
|
||||||
setPetTransferFunctionForVolumeActor(r)
|
setPetTransferFunctionForVolumeActor(r)
|
||||||
}
|
|
||||||
// setPetColorMapTransferFunctionForVolumeActor(r)
|
|
||||||
console.log("mip渲染成功")
|
|
||||||
},
|
|
||||||
slabThickness,
|
|
||||||
blendMode: BlendModes.MAXIMUM_INTENSITY_BLEND,
|
|
||||||
defaultOptions: {
|
|
||||||
orientation: OrientationAxis.CORONAL
|
|
||||||
}
|
}
|
||||||
}])
|
console.log("mip渲染成功")
|
||||||
|
},
|
||||||
|
slabThickness,
|
||||||
|
blendMode: BlendModes.MAXIMUM_INTENSITY_BLEND,
|
||||||
|
defaultOptions: {
|
||||||
|
orientation: OrientationAxis.CORONAL
|
||||||
|
}
|
||||||
|
}])
|
||||||
|
|
||||||
|
// viewport.setBlendMode(BlendModes.MAXIMUM_INTENSITY_BLEND)
|
||||||
|
// viewport.setSlabThickness(slabThickness)
|
||||||
} else {
|
} else {
|
||||||
viewport
|
viewport
|
||||||
.setVolumes([{
|
.setVolumes([{
|
||||||
|
|
@ -873,7 +875,8 @@ export default {
|
||||||
if (x < 0) x = 0
|
if (x < 0) x = 0
|
||||||
if (x > containerWidth - sliderWidth) x = containerWidth - sliderWidth
|
if (x > containerWidth - sliderWidth) x = containerWidth - sliderWidth
|
||||||
const deltaX = x - this.rotateBarLeft
|
const deltaX = x - this.rotateBarLeft
|
||||||
const angle = Math.sin((deltaX * (360 / (containerWidth - sliderWidth))) * Math.PI / 180)
|
// const angle = Math.sin((deltaX * (360 / (containerWidth - sliderWidth))) * Math.PI / 180)
|
||||||
|
const angle = (deltaX / (containerWidth - sliderWidth)) * (2 * Math.PI)
|
||||||
this.rotate(angle)
|
this.rotate(angle)
|
||||||
this.rotateBarLeft = x
|
this.rotateBarLeft = x
|
||||||
},
|
},
|
||||||
|
|
@ -925,7 +928,8 @@ export default {
|
||||||
const sliderWidth = slider.offsetWidth
|
const sliderWidth = slider.offsetWidth
|
||||||
const x = Math.trunc(e.offsetX)
|
const x = Math.trunc(e.offsetX)
|
||||||
const deltaX = x - this.rotateBarLeft
|
const deltaX = x - this.rotateBarLeft
|
||||||
const angle = Math.sin((deltaX * (360 / (containerWidth - sliderWidth))) * Math.PI / 180)
|
// const angle = Math.sin((deltaX * (360 / (containerWidth - sliderWidth))) * Math.PI / 180)
|
||||||
|
const angle = (deltaX / (containerWidth - sliderWidth)) * (2 * Math.PI)
|
||||||
this.rotate(angle)
|
this.rotate(angle)
|
||||||
this.rotateBarLeft = x
|
this.rotateBarLeft = x
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -816,6 +816,8 @@ export default {
|
||||||
segIndex: null,
|
segIndex: null,
|
||||||
curSegSeries: {},
|
curSegSeries: {},
|
||||||
fusionOverlayModality: null,
|
fusionOverlayModality: null,
|
||||||
|
fusionOverlayDefaultUpper: null,
|
||||||
|
fusionOverlayDefaultRange: null,
|
||||||
lastUpper: null,
|
lastUpper: null,
|
||||||
hasFusionUpperInitialized: false,
|
hasFusionUpperInitialized: false,
|
||||||
timer: {},
|
timer: {},
|
||||||
|
|
@ -1604,7 +1606,7 @@ export default {
|
||||||
} else if (toolGroupId === this.fusionToolGroupId) {
|
} else if (toolGroupId === this.fusionToolGroupId) {
|
||||||
toolGroup.addTool(CrosshairsTool.toolName, {
|
toolGroup.addTool(CrosshairsTool.toolName, {
|
||||||
getReferenceLineColor: this.setCrosshairsToolLineColor,
|
getReferenceLineColor: this.setCrosshairsToolLineColor,
|
||||||
getReferenceLineSlabThicknessControlsOn: (otherViewportId) => otherViewportId !== 'viewport-fusion-3'
|
getReferenceLineSlabThicknessControlsOn: () => false
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
toolGroup.addTool(WindowLevelTool.toolName)
|
toolGroup.addTool(WindowLevelTool.toolName)
|
||||||
|
|
@ -1918,6 +1920,7 @@ export default {
|
||||||
const { annotation } = e.detail
|
const { annotation } = e.detail
|
||||||
try {
|
try {
|
||||||
if (!annotation) return
|
if (!annotation) return
|
||||||
|
if (annotation.metadata.toolName === CrosshairsTool.toolName) return
|
||||||
if (this.readingTaskState === 2 && !annotation.data.label) return false
|
if (this.readingTaskState === 2 && !annotation.data.label) return false
|
||||||
if (this.readingTaskState === 2) {
|
if (this.readingTaskState === 2) {
|
||||||
const errorMsg = { message: 'annotation Not allowed to operate' }
|
const errorMsg = { message: 'annotation Not allowed to operate' }
|
||||||
|
|
@ -2063,6 +2066,7 @@ export default {
|
||||||
try {
|
try {
|
||||||
// if ( this.resetAnnotation && this.isFusion ) return false
|
// if ( this.resetAnnotation && this.isFusion ) return false
|
||||||
if (!annotation) return false
|
if (!annotation) return false
|
||||||
|
if (annotation.metadata.toolName === CrosshairsTool.toolName) return false
|
||||||
if (this.readingTaskState === 2 && !annotation.data.label) return false
|
if (this.readingTaskState === 2 && !annotation.data.label) return false
|
||||||
if (this.readingTaskState === 2) {
|
if (this.readingTaskState === 2) {
|
||||||
const errorMsg = { message: 'annotation Not allowed to operate' }
|
const errorMsg = { message: 'annotation Not allowed to operate' }
|
||||||
|
|
@ -2589,19 +2593,19 @@ export default {
|
||||||
})
|
})
|
||||||
if (toolName === CrosshairsTool.toolName) {
|
if (toolName === CrosshairsTool.toolName) {
|
||||||
if (this.isFusion) {
|
if (this.isFusion) {
|
||||||
const instance = toolGroup.getToolInstance?.(CrosshairsTool.toolName)
|
// const instance = toolGroup.getToolInstance?.(CrosshairsTool.toolName)
|
||||||
if (instance && !instance.__fusionSameForPatched) {
|
// if (instance && !instance.__fusionSameForPatched) {
|
||||||
instance.__fusionSameForPatched = true
|
// instance.__fusionSameForPatched = true
|
||||||
const original = instance._checkIfViewportsRenderingSameScene?.bind(instance)
|
// const original = instance._checkIfViewportsRenderingSameScene?.bind(instance)
|
||||||
instance._checkIfViewportsRenderingSameScene = (viewport, otherViewport) => {
|
// instance._checkIfViewportsRenderingSameScene = (viewport, otherViewport) => {
|
||||||
try {
|
// try {
|
||||||
const a = viewport?.getFrameOfReferenceUID?.()
|
// const a = viewport?.getFrameOfReferenceUID?.()
|
||||||
const b = otherViewport?.getFrameOfReferenceUID?.()
|
// const b = otherViewport?.getFrameOfReferenceUID?.()
|
||||||
if (a && b && a === b) return true
|
// if (a && b && a === b) return true
|
||||||
} catch (e) { }
|
// } catch (e) { }
|
||||||
return original ? original(viewport, otherViewport) : true
|
// return original ? original(viewport, otherViewport) : true
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
this.setFusionMipJumpEnabled(false)
|
this.setFusionMipJumpEnabled(false)
|
||||||
this.setFusionMipRotateEnabled(false)
|
this.setFusionMipRotateEnabled(false)
|
||||||
|
|
@ -2611,11 +2615,33 @@ export default {
|
||||||
},
|
},
|
||||||
hoverFusionViewport(index) {
|
hoverFusionViewport(index) {
|
||||||
if (!this.isFusion) return
|
if (!this.isFusion) return
|
||||||
if (this.activeTool === CrosshairsTool.toolName) return
|
|
||||||
const toolGroup = ToolGroupManager.getToolGroup(this.fusionToolGroupId)
|
const toolGroup = ToolGroupManager.getToolGroup(this.fusionToolGroupId)
|
||||||
if (!toolGroup) return
|
if (!toolGroup) return
|
||||||
|
|
||||||
const isMip = index === 3
|
const isMip = index === 3
|
||||||
|
|
||||||
|
if (this.activeTool === CrosshairsTool.toolName) {
|
||||||
|
this.setFusionMipJumpEnabled(false)
|
||||||
|
if (isMip) {
|
||||||
|
if (toolGroup.hasTool(VolumeRotateTool.toolName)) {
|
||||||
|
toolGroup.setToolDisabled(VolumeRotateTool.toolName)
|
||||||
|
}
|
||||||
|
if (toolGroup.hasTool(StackScrollTool.toolName)) {
|
||||||
|
toolGroup.setToolDisabled(StackScrollTool.toolName)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (toolGroup.hasTool(StackScrollTool.toolName)) {
|
||||||
|
toolGroup.setToolActive(StackScrollTool.toolName, {
|
||||||
|
bindings: [{ mouseButton: MouseBindings.Wheel }]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (toolGroup.hasTool(VolumeRotateTool.toolName)) {
|
||||||
|
toolGroup.setToolDisabled(VolumeRotateTool.toolName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
this.setFusionMipJumpEnabled(isMip)
|
this.setFusionMipJumpEnabled(isMip)
|
||||||
if (isMip) {
|
if (isMip) {
|
||||||
if (toolGroup.hasTool(StackScrollTool.toolName)) {
|
if (toolGroup.hasTool(StackScrollTool.toolName)) {
|
||||||
|
|
@ -2821,16 +2847,70 @@ export default {
|
||||||
}
|
}
|
||||||
this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].rotateOrientationMarkers(type)
|
this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].rotateOrientationMarkers(type)
|
||||||
},
|
},
|
||||||
|
resetCrosshairsAnnotationsForViewports(viewportIds = []) {
|
||||||
|
if (!viewportIds || viewportIds.length === 0) return
|
||||||
|
const viewportIdSet = new Set(viewportIds)
|
||||||
|
const annotations = cornerstoneTools.annotation.state.getAllAnnotations()
|
||||||
|
annotations.forEach((a) => {
|
||||||
|
if (!a) return
|
||||||
|
if (a.metadata.toolName !== CrosshairsTool.toolName) return
|
||||||
|
const vpId = a.data.viewportId
|
||||||
|
if (!vpId || !viewportIdSet.has(vpId)) return
|
||||||
|
cornerstoneTools.annotation.state.removeAnnotation(a.annotationUID)
|
||||||
|
})
|
||||||
|
},
|
||||||
// 重置视口
|
// 重置视口
|
||||||
resetViewport() {
|
async resetViewport() {
|
||||||
this.setToolsPassive()
|
this.setToolsPassive()
|
||||||
const renderingEngine = getRenderingEngine(renderingEngineId)
|
const renderingEngine = getRenderingEngine(renderingEngineId)
|
||||||
|
if (this.isFusion) {
|
||||||
|
const fusionViewportIds = ['viewport-fusion-0', 'viewport-fusion-1', 'viewport-fusion-2', 'viewport-fusion-3']
|
||||||
|
const fusionAllViewportIds = [...fusionViewportIds, 'viewport-fusion-hidden-sag']
|
||||||
|
for (const id of fusionAllViewportIds) {
|
||||||
|
const viewport = renderingEngine.getViewport(id)
|
||||||
|
if (!viewport) continue
|
||||||
|
const ref = this.$refs[id]?.[0]
|
||||||
|
const index = ref?.series?.SliceIndex
|
||||||
|
if (ref.resetOrientationMarkers) ref.resetOrientationMarkers()
|
||||||
|
viewport.resetCamera({ resetPan: true, resetZoom: true, resetToCenter: true, resetRotation: true })
|
||||||
|
if (viewport.resetSlabThickness) viewport.resetSlabThickness()
|
||||||
|
viewport.resetProperties()
|
||||||
|
if (id === 'viewport-fusion-3') {
|
||||||
|
if (ref.rotateBarLeft || ref.rotateBarLeft === 0) ref.rotateBarLeft = 0
|
||||||
|
if (ref.rotateAngle || ref.rotateAngle === 0) ref.rotateAngle = 0
|
||||||
|
const ptSeries = ref?.series
|
||||||
|
if (ptSeries && ptSeries.SeriesInstanceUid) {
|
||||||
|
await ref.setSeriesInfo({ data: ptSeries }, false, { isMip: true, colorMap: false })
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
viewport.render()
|
||||||
|
}
|
||||||
|
if ((index || index === 0) && ref.setFullScreen) {
|
||||||
|
ref.setFullScreen(index)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.resetCrosshairsAnnotationsForViewports(fusionAllViewportIds)
|
||||||
|
renderingEngine.render()
|
||||||
|
if (this.fusionOverlayModality === 'NM' && Number.isFinite(this.fusionOverlayDefaultUpper) && Number.isFinite(this.fusionOverlayDefaultRange)) {
|
||||||
|
this.lastUpper = null
|
||||||
|
this.hasFusionUpperInitialized = false
|
||||||
|
if (this.$refs.colorMap) {
|
||||||
|
this.$refs.colorMap.range = this.fusionOverlayDefaultRange
|
||||||
|
this.$refs.colorMap.upper = this.fusionOverlayDefaultUpper
|
||||||
|
this.$refs.colorMap.upperRangeChange(this.fusionOverlayDefaultRange)
|
||||||
|
this.$refs.colorMap.changeVoi(this.fusionOverlayDefaultUpper)
|
||||||
|
}
|
||||||
|
this.voiChange(this.fusionOverlayDefaultUpper)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const viewportId = `${this.viewportKey}-${this.activeViewportIndex}`
|
const viewportId = `${this.viewportKey}-${this.activeViewportIndex}`
|
||||||
const viewport = renderingEngine.getViewport(viewportId)
|
const viewport = renderingEngine.getViewport(viewportId)
|
||||||
this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].resetOrientationMarkers()
|
this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].resetOrientationMarkers()
|
||||||
let index = this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].series.SliceIndex
|
let index = this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].series.SliceIndex
|
||||||
if (this.readingTool !== 3) {
|
if (this.readingTool !== 3) {
|
||||||
viewport.resetCamera({ resetPan: true, resetZoom: true, resetToCenter: true })
|
viewport.resetCamera({ resetPan: true, resetZoom: true, resetToCenter: true, resetRotation: true })
|
||||||
}
|
}
|
||||||
viewport.resetProperties()
|
viewport.resetProperties()
|
||||||
if (this.isMPR) {
|
if (this.isMPR) {
|
||||||
|
|
@ -4086,11 +4166,18 @@ export default {
|
||||||
const nmMax = Number(rawWidth)
|
const nmMax = Number(rawWidth)
|
||||||
if (Number.isFinite(nmMax) && nmMax > 0) {
|
if (Number.isFinite(nmMax) && nmMax > 0) {
|
||||||
const halfMax = Math.round(nmMax * 0.5)
|
const halfMax = Math.round(nmMax * 0.5)
|
||||||
|
this.fusionOverlayDefaultRange = Math.round(nmMax)
|
||||||
|
this.fusionOverlayDefaultUpper = halfMax
|
||||||
|
this.lastUpper = null
|
||||||
|
this.hasFusionUpperInitialized = false
|
||||||
this.$refs.colorMap.range = Math.round(nmMax)
|
this.$refs.colorMap.range = Math.round(nmMax)
|
||||||
this.$refs.colorMap.upper = halfMax
|
this.$refs.colorMap.upper = halfMax
|
||||||
this.$refs.colorMap.upperRangeChange(Math.round(nmMax))
|
this.$refs.colorMap.upperRangeChange(Math.round(nmMax))
|
||||||
this.voiChange(halfMax)
|
this.voiChange(halfMax)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.fusionOverlayDefaultRange = null
|
||||||
|
this.fusionOverlayDefaultUpper = null
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue