feat: dd
This commit is contained in:
parent
f245d3c210
commit
2761357eac
|
@ -90,9 +90,6 @@ export const CrosshairMpr = (props: CrosshairMprProps) => {
|
|||
const renderingEngine = useRef<RenderingEngine>();
|
||||
const imageIds = useRef<string[]>();
|
||||
|
||||
cornerstoneTools.addTool(StackScrollMouseWheelTool);
|
||||
cornerstoneTools.addTool(CrosshairsTool);
|
||||
|
||||
const run = async () => {
|
||||
initDemo();
|
||||
|
||||
|
@ -107,7 +104,7 @@ export const CrosshairMpr = (props: CrosshairMprProps) => {
|
|||
|
||||
// Define a volume in memory
|
||||
const volume = await volumeLoader.createAndCacheVolume(volumeId, {
|
||||
imageIds: imageIds.current,
|
||||
imageIds: imageIds.current ?? [],
|
||||
});
|
||||
|
||||
// Instantiate a rendering engine
|
||||
|
@ -146,6 +143,8 @@ export const CrosshairMpr = (props: CrosshairMprProps) => {
|
|||
|
||||
renderingEngine.current.setViewports(viewportInputArray);
|
||||
|
||||
console.log(volume);
|
||||
|
||||
// Set the volume to load
|
||||
volume.load();
|
||||
|
||||
|
@ -164,6 +163,7 @@ export const CrosshairMpr = (props: CrosshairMprProps) => {
|
|||
// Define tool groups to add the segmentation display tool to
|
||||
const toolGroup = ToolGroupManager.createToolGroup(toolGroupId);
|
||||
|
||||
if (toolGroup) {
|
||||
// For the crosshairs to operate, the viewports must currently be
|
||||
// added ahead of setting the tool active. This will be improved in the future.
|
||||
toolGroup.addViewport(viewportId1, renderingEngineId);
|
||||
|
@ -189,6 +189,7 @@ export const CrosshairMpr = (props: CrosshairMprProps) => {
|
|||
// As the Stack Scroll mouse wheel is a tool using the `mouseWheelCallback`
|
||||
// hook instead of mouse buttons, it does not need to assign any mouse button.
|
||||
toolGroup.setToolActive(StackScrollMouseWheelTool.toolName);
|
||||
}
|
||||
|
||||
renderingEngine.current.renderViewports([
|
||||
viewportId1,
|
||||
|
@ -198,14 +199,36 @@ export const CrosshairMpr = (props: CrosshairMprProps) => {
|
|||
};
|
||||
|
||||
useEffect(() => {
|
||||
cornerstoneTools.addTool(StackScrollMouseWheelTool);
|
||||
cornerstoneTools.addTool(CrosshairsTool);
|
||||
console.log("添加tool1");
|
||||
|
||||
run();
|
||||
|
||||
return () => {
|
||||
// TODO: 是否需要写在组件,根据页面需要
|
||||
console.log("卸载tool2");
|
||||
cornerstoneTools.removeTool(StackScrollMouseWheelTool);
|
||||
cornerstoneTools.removeTool(CrosshairsTool);
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
window.addEventListener("resize", () => {
|
||||
renderingEngine.current?.resize();
|
||||
});
|
||||
}, []);
|
||||
|
||||
const test = () => {
|
||||
// console.log(volumeLoader)
|
||||
console.log(cornerstone.cache.getVolume(volumeId).getScalarData());
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
document.addEventListener(Enums.Events.VOLUME_CACHE_VOLUME_ADDED, () => {
|
||||
console.log(111);
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
@ -214,6 +237,7 @@ export const CrosshairMpr = (props: CrosshairMprProps) => {
|
|||
<div style={{ width: 300, height: 300 }} ref={viewportId2Ref}></div>
|
||||
<div style={{ width: 300, height: 300 }} ref={viewportId3Ref}></div>
|
||||
</div>
|
||||
<button onClick={test}>测试</button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -26,14 +26,8 @@ export default function initCornerstoneDICOMImageLoader() {
|
|||
},
|
||||
});
|
||||
|
||||
let maxWebWorkers = 1;
|
||||
|
||||
if (navigator.hardwareConcurrency) {
|
||||
maxWebWorkers = Math.min(navigator.hardwareConcurrency, 7);
|
||||
}
|
||||
|
||||
var config = {
|
||||
maxWebWorkers,
|
||||
const config = {
|
||||
maxWebWorkers: navigator.hardwareConcurrency ? Math.min(navigator.hardwareConcurrency, 7) : 1,
|
||||
startWebWorkersOnDemand: false,
|
||||
taskConfiguration: {
|
||||
decodeTask: {
|
||||
|
|
Loading…
Reference in New Issue
Block a user