Compare commits
2 Commits
21914f3077
...
9917b77077
Author | SHA1 | Date | |
---|---|---|---|
|
9917b77077 | ||
|
5814637d7a |
|
@ -68,6 +68,7 @@ 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);
|
||||||
|
@ -89,10 +90,10 @@ export const Viewer = () => {
|
||||||
wadoRsRoot,
|
wadoRsRoot,
|
||||||
});
|
});
|
||||||
// 这一步会对imageIds进行排序,如果不排序imageIds会错误乱,stackViewport顺序会错误
|
// 这一步会对imageIds进行排序,如果不排序imageIds会错误乱,stackViewport顺序会错误
|
||||||
const volume = await volumeLoader.createAndCacheVolume(volumeId, {
|
volumeRef.current = await volumeLoader.createAndCacheVolume(volumeId, {
|
||||||
imageIds,
|
imageIds
|
||||||
});
|
});
|
||||||
volume.load();
|
volumeRef.current.load();
|
||||||
|
|
||||||
const volumeViewportInput: PublicViewportInput[] = [
|
const volumeViewportInput: PublicViewportInput[] = [
|
||||||
{
|
{
|
||||||
|
@ -141,8 +142,8 @@ export const Viewer = () => {
|
||||||
stackViewportId
|
stackViewportId
|
||||||
) as IStackViewport;
|
) as IStackViewport;
|
||||||
|
|
||||||
stackViewport.setStack(volume.imageIds);
|
stackViewport.setStack(volumeRef.current.imageIds);
|
||||||
setImageIds(volume.imageIds);
|
setImageIds(volumeRef.current.imageIds);
|
||||||
|
|
||||||
await setVolumesForViewports(
|
await setVolumesForViewports(
|
||||||
renderingEngineRef.current,
|
renderingEngineRef.current,
|
||||||
|
@ -201,7 +202,8 @@ export const Viewer = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 默认windowWidtth
|
// 默认windowWidtth
|
||||||
const { windowCenter, windowWidth } = volume.cornerstoneImageMetaData;
|
const { windowCenter, windowWidth } =
|
||||||
|
volumeRef.current.cornerstoneImageMetaData;
|
||||||
console.log("默认窗宽/位: ", windowCenter, windowWidth);
|
console.log("默认窗宽/位: ", windowCenter, windowWidth);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -219,10 +221,14 @@ export const Viewer = () => {
|
||||||
ToolGroupManager.destroyToolGroup(toolGroupMprId);
|
ToolGroupManager.destroyToolGroup(toolGroupMprId);
|
||||||
ToolGroupManager.destroyToolGroup(toolGroupStackId);
|
ToolGroupManager.destroyToolGroup(toolGroupStackId);
|
||||||
|
|
||||||
cornerstoneTools.removeTool(StackScrollMouseWheelTool);
|
cornerstoneTools.removeTool(StackScrollMouseWheelTool);1
|
||||||
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]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user