Compare commits
2 Commits
608bd42836
...
599fad48ba
| Author | SHA1 | Date |
|---|---|---|
|
|
599fad48ba | |
|
|
72b5d515ba |
|
|
@ -670,30 +670,32 @@ export default {
|
|||
this.series = { ...data }
|
||||
if (this.isMip) {
|
||||
let volume = cache.getVolume(this.volumeId)
|
||||
const ptVolumeDimensions = volume.dimensions;
|
||||
const ptVolumeDimensions = volume.dimensions
|
||||
const slabThickness = Math.sqrt(
|
||||
ptVolumeDimensions[0] * ptVolumeDimensions[0] +
|
||||
ptVolumeDimensions[1] * ptVolumeDimensions[1] +
|
||||
ptVolumeDimensions[2] * ptVolumeDimensions[2]
|
||||
);
|
||||
viewport
|
||||
.setVolumes([{
|
||||
volumeId: this.volumeId,
|
||||
callback: (r) => {
|
||||
if (this.series.Modality === 'NM') {
|
||||
setMipTransferFunctionForVolumeActor({ ...r, volumeId: this.volumeId })
|
||||
} else {
|
||||
setPetTransferFunctionForVolumeActor(r)
|
||||
}
|
||||
// setPetColorMapTransferFunctionForVolumeActor(r)
|
||||
console.log("mip渲染成功")
|
||||
},
|
||||
slabThickness,
|
||||
blendMode: BlendModes.MAXIMUM_INTENSITY_BLEND,
|
||||
defaultOptions: {
|
||||
orientation: OrientationAxis.CORONAL
|
||||
)
|
||||
|
||||
await viewport.setVolumes([{
|
||||
volumeId: this.volumeId,
|
||||
callback: (r) => {
|
||||
if (this.series.Modality === 'NM') {
|
||||
setMipTransferFunctionForVolumeActor({ ...r, volumeId: this.volumeId })
|
||||
} else {
|
||||
setPetTransferFunctionForVolumeActor(r)
|
||||
}
|
||||
}])
|
||||
console.log("mip渲染成功")
|
||||
},
|
||||
slabThickness,
|
||||
blendMode: BlendModes.MAXIMUM_INTENSITY_BLEND,
|
||||
defaultOptions: {
|
||||
orientation: OrientationAxis.CORONAL
|
||||
}
|
||||
}])
|
||||
|
||||
// viewport.setBlendMode(BlendModes.MAXIMUM_INTENSITY_BLEND)
|
||||
// viewport.setSlabThickness(slabThickness)
|
||||
} else {
|
||||
viewport
|
||||
.setVolumes([{
|
||||
|
|
@ -873,7 +875,8 @@ export default {
|
|||
if (x < 0) x = 0
|
||||
if (x > containerWidth - sliderWidth) x = containerWidth - sliderWidth
|
||||
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.rotateBarLeft = x
|
||||
},
|
||||
|
|
@ -925,7 +928,8 @@ export default {
|
|||
const sliderWidth = slider.offsetWidth
|
||||
const x = Math.trunc(e.offsetX)
|
||||
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.rotateBarLeft = x
|
||||
},
|
||||
|
|
|
|||
|
|
@ -816,6 +816,8 @@ export default {
|
|||
segIndex: null,
|
||||
curSegSeries: {},
|
||||
fusionOverlayModality: null,
|
||||
fusionOverlayDefaultUpper: null,
|
||||
fusionOverlayDefaultRange: null,
|
||||
lastUpper: null,
|
||||
hasFusionUpperInitialized: false,
|
||||
timer: {},
|
||||
|
|
@ -1604,7 +1606,7 @@ export default {
|
|||
} else if (toolGroupId === this.fusionToolGroupId) {
|
||||
toolGroup.addTool(CrosshairsTool.toolName, {
|
||||
getReferenceLineColor: this.setCrosshairsToolLineColor,
|
||||
getReferenceLineSlabThicknessControlsOn: (otherViewportId) => otherViewportId !== 'viewport-fusion-3'
|
||||
getReferenceLineSlabThicknessControlsOn: () => false
|
||||
});
|
||||
} else {
|
||||
toolGroup.addTool(WindowLevelTool.toolName)
|
||||
|
|
@ -1918,6 +1920,7 @@ export default {
|
|||
const { annotation } = e.detail
|
||||
try {
|
||||
if (!annotation) return
|
||||
if (annotation.metadata.toolName === CrosshairsTool.toolName) return
|
||||
if (this.readingTaskState === 2 && !annotation.data.label) return false
|
||||
if (this.readingTaskState === 2) {
|
||||
const errorMsg = { message: 'annotation Not allowed to operate' }
|
||||
|
|
@ -2063,6 +2066,7 @@ export default {
|
|||
try {
|
||||
// if ( this.resetAnnotation && this.isFusion ) 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) {
|
||||
const errorMsg = { message: 'annotation Not allowed to operate' }
|
||||
|
|
@ -2589,19 +2593,19 @@ export default {
|
|||
})
|
||||
if (toolName === CrosshairsTool.toolName) {
|
||||
if (this.isFusion) {
|
||||
const instance = toolGroup.getToolInstance?.(CrosshairsTool.toolName)
|
||||
if (instance && !instance.__fusionSameForPatched) {
|
||||
instance.__fusionSameForPatched = true
|
||||
const original = instance._checkIfViewportsRenderingSameScene?.bind(instance)
|
||||
instance._checkIfViewportsRenderingSameScene = (viewport, otherViewport) => {
|
||||
try {
|
||||
const a = viewport?.getFrameOfReferenceUID?.()
|
||||
const b = otherViewport?.getFrameOfReferenceUID?.()
|
||||
if (a && b && a === b) return true
|
||||
} catch (e) { }
|
||||
return original ? original(viewport, otherViewport) : true
|
||||
}
|
||||
}
|
||||
// const instance = toolGroup.getToolInstance?.(CrosshairsTool.toolName)
|
||||
// if (instance && !instance.__fusionSameForPatched) {
|
||||
// instance.__fusionSameForPatched = true
|
||||
// const original = instance._checkIfViewportsRenderingSameScene?.bind(instance)
|
||||
// instance._checkIfViewportsRenderingSameScene = (viewport, otherViewport) => {
|
||||
// try {
|
||||
// const a = viewport?.getFrameOfReferenceUID?.()
|
||||
// const b = otherViewport?.getFrameOfReferenceUID?.()
|
||||
// if (a && b && a === b) return true
|
||||
// } catch (e) { }
|
||||
// return original ? original(viewport, otherViewport) : true
|
||||
// }
|
||||
// }
|
||||
}
|
||||
this.setFusionMipJumpEnabled(false)
|
||||
this.setFusionMipRotateEnabled(false)
|
||||
|
|
@ -2611,11 +2615,33 @@ export default {
|
|||
},
|
||||
hoverFusionViewport(index) {
|
||||
if (!this.isFusion) return
|
||||
if (this.activeTool === CrosshairsTool.toolName) return
|
||||
const toolGroup = ToolGroupManager.getToolGroup(this.fusionToolGroupId)
|
||||
if (!toolGroup) return
|
||||
|
||||
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)
|
||||
if (isMip) {
|
||||
if (toolGroup.hasTool(StackScrollTool.toolName)) {
|
||||
|
|
@ -2821,16 +2847,70 @@ export default {
|
|||
}
|
||||
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()
|
||||
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 viewport = renderingEngine.getViewport(viewportId)
|
||||
this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].resetOrientationMarkers()
|
||||
let index = this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].series.SliceIndex
|
||||
if (this.readingTool !== 3) {
|
||||
viewport.resetCamera({ resetPan: true, resetZoom: true, resetToCenter: true })
|
||||
viewport.resetCamera({ resetPan: true, resetZoom: true, resetToCenter: true, resetRotation: true })
|
||||
}
|
||||
viewport.resetProperties()
|
||||
if (this.isMPR) {
|
||||
|
|
@ -4086,11 +4166,18 @@ export default {
|
|||
const nmMax = Number(rawWidth)
|
||||
if (Number.isFinite(nmMax) && nmMax > 0) {
|
||||
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.upper = halfMax
|
||||
this.$refs.colorMap.upperRangeChange(Math.round(nmMax))
|
||||
this.voiChange(halfMax)
|
||||
}
|
||||
} else {
|
||||
this.fusionOverlayDefaultRange = null
|
||||
this.fusionOverlayDefaultUpper = null
|
||||
}
|
||||
})
|
||||
} catch (err) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue