Compare commits

..

No commits in common. "9917b7707793b3d86ab1e99bb1bd59dd9514c737" and "21914f30772b59fbf3882e187f920533cd4b61ab" have entirely different histories.

View File

@ -68,7 +68,6 @@ export const Viewer = () => {
const [imageIds, setImageIds] = useState<string[]>(); const [imageIds, setImageIds] = useState<string[]>();
const renderingEngineId = "renderEngineNo1"; const renderingEngineId = "renderEngineNo1";
const renderingEngineRef = useRef<RenderingEngine>(); const renderingEngineRef = useRef<RenderingEngine>();
const volumeRef = useRef<Record<string, any>>();
useEffect(() => { useEffect(() => {
cornerstoneTools.addTool(StackScrollMouseWheelTool); cornerstoneTools.addTool(StackScrollMouseWheelTool);
@ -90,10 +89,10 @@ export const Viewer = () => {
wadoRsRoot, wadoRsRoot,
}); });
// 这一步会对imageIds进行排序如果不排序imageIds会错误乱,stackViewport顺序会错误 // 这一步会对imageIds进行排序如果不排序imageIds会错误乱,stackViewport顺序会错误
volumeRef.current = await volumeLoader.createAndCacheVolume(volumeId, { const volume = await volumeLoader.createAndCacheVolume(volumeId, {
imageIds imageIds,
}); });
volumeRef.current.load(); volume.load();
const volumeViewportInput: PublicViewportInput[] = [ const volumeViewportInput: PublicViewportInput[] = [
{ {
@ -142,8 +141,8 @@ export const Viewer = () => {
stackViewportId stackViewportId
) as IStackViewport; ) as IStackViewport;
stackViewport.setStack(volumeRef.current.imageIds); stackViewport.setStack(volume.imageIds);
setImageIds(volumeRef.current.imageIds); setImageIds(volume.imageIds);
await setVolumesForViewports( await setVolumesForViewports(
renderingEngineRef.current, renderingEngineRef.current,
@ -202,8 +201,7 @@ export const Viewer = () => {
} }
// 默认windowWidtth // 默认windowWidtth
const { windowCenter, windowWidth } = const { windowCenter, windowWidth } = volume.cornerstoneImageMetaData;
volumeRef.current.cornerstoneImageMetaData;
console.log("默认窗宽/位: ", windowCenter, windowWidth); console.log("默认窗宽/位: ", windowCenter, windowWidth);
}; };
@ -221,14 +219,10 @@ export const Viewer = () => {
ToolGroupManager.destroyToolGroup(toolGroupMprId); ToolGroupManager.destroyToolGroup(toolGroupMprId);
ToolGroupManager.destroyToolGroup(toolGroupStackId); ToolGroupManager.destroyToolGroup(toolGroupStackId);
cornerstoneTools.removeTool(StackScrollMouseWheelTool);1 cornerstoneTools.removeTool(StackScrollMouseWheelTool);
cornerstoneTools.removeTool(CrosshairsTool); cornerstoneTools.removeTool(CrosshairsTool);
cornerstoneTools.removeTool(WindowLevelTool); cornerstoneTools.removeTool(WindowLevelTool);
cornerstoneTools.removeTool(ZoomTool); cornerstoneTools.removeTool(ZoomTool);
renderingEngineRef.current
?.getVolumeViewports()
.forEach((vp) => vp.setVolumes([]));
}; };
}, [SeriesInstanceUID, StudyInstanceUID]); }, [SeriesInstanceUID, StudyInstanceUID]);