Compare commits

..

No commits in common. "599fad48ba7337b84e20fca077614b4cd3cd33cd" and "608bd428365094f1306cb3efbc89d4c97d810ce5" have entirely different histories.

2 changed files with 38 additions and 129 deletions

View File

@ -670,14 +670,14 @@ 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
await viewport.setVolumes([{ .setVolumes([{
volumeId: this.volumeId, volumeId: this.volumeId,
callback: (r) => { callback: (r) => {
if (this.series.Modality === 'NM') { if (this.series.Modality === 'NM') {
@ -685,6 +685,7 @@ export default {
} else { } else {
setPetTransferFunctionForVolumeActor(r) setPetTransferFunctionForVolumeActor(r)
} }
// setPetColorMapTransferFunctionForVolumeActor(r)
console.log("mip渲染成功") console.log("mip渲染成功")
}, },
slabThickness, slabThickness,
@ -693,9 +694,6 @@ export default {
orientation: OrientationAxis.CORONAL orientation: OrientationAxis.CORONAL
} }
}]) }])
// viewport.setBlendMode(BlendModes.MAXIMUM_INTENSITY_BLEND)
// viewport.setSlabThickness(slabThickness)
} else { } else {
viewport viewport
.setVolumes([{ .setVolumes([{
@ -875,8 +873,7 @@ 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
}, },
@ -928,8 +925,7 @@ 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
}, },

View File

@ -816,8 +816,6 @@ 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: {},
@ -1606,7 +1604,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: () => false getReferenceLineSlabThicknessControlsOn: (otherViewportId) => otherViewportId !== 'viewport-fusion-3'
}); });
} else { } else {
toolGroup.addTool(WindowLevelTool.toolName) toolGroup.addTool(WindowLevelTool.toolName)
@ -1920,7 +1918,6 @@ 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' }
@ -2066,7 +2063,6 @@ 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' }
@ -2593,19 +2589,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)
@ -2615,33 +2611,11 @@ 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)) {
@ -2847,70 +2821,16 @@ 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)
})
},
// //
async resetViewport() { 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, resetRotation: true }) viewport.resetCamera({ resetPan: true, resetZoom: true, resetToCenter: true })
} }
viewport.resetProperties() viewport.resetProperties()
if (this.isMPR) { if (this.isMPR) {
@ -4166,18 +4086,11 @@ 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) {