feat: 调整for 演示

This commit is contained in:
mozzie 2024-09-22 22:11:12 +08:00
parent 66d3350edc
commit fb2fdeda7a
4 changed files with 25 additions and 12 deletions

View File

@ -34,7 +34,8 @@ export const registerCommonHandler = () => {
} }
}); });
ipcMain.handle("model:infer", async (_event, SeriesInstanceUIDs) => { ipcMain.on("model:infer", async (event, SeriesInstanceUIDs) => {
console.log('SeriesInstanceUIDs', SeriesInstanceUIDs)
// 构造推理任务参数列表 // 构造推理任务参数列表
const pu = InferDeviceEnum.GPU; const pu = InferDeviceEnum.GPU;
const module = InferStructuralEnum.AORTA; const module = InferStructuralEnum.AORTA;
@ -50,9 +51,10 @@ export const registerCommonHandler = () => {
SeriesInstanceUID SeriesInstanceUID
); );
const task = { save_path, pu, module, turbo, seg_schedule, img_path }; const task = { save_path, pu, module, turbo, seg_schedule, img_path };
console.log(task); console.log('infer task: ', task);
const result = await executeInferTask(task, (data) => { const result = await executeInferTask(task, (data) => {
console.log(data); console.log(data)
event.reply('infer:progress', data)
}); });
console.log("end: ", result); console.log("end: ", result);
} }

View File

@ -15,7 +15,8 @@ import { ScrollArea } from "@/components/ui/scroll-area";
const Boot = () => { const Boot = () => {
const location = useLocation(); const location = useLocation();
const [messageText, setMessageText] = useState(["进度信息简化"]); const [messageText, setMessageText] = useState("进度信息简化");
const series = location.state?.series;
/** /**
* windows系统右键启动应用菜单的入口路径 * windows系统右键启动应用菜单的入口路径
@ -26,13 +27,20 @@ const Boot = () => {
* electron主进程 * electron主进程
*/ */
const handleTasks = () => { const handleTasks = () => {
const SeriesInstanceUIDs = [ const SeriesInstanceUIDs = [series.MainDicomTags.SeriesInstanceUID];
"1.3.12.2.1107.5.1.4.73399.30000020080900171669200001479", window.ipcRenderer.send("model:infer", SeriesInstanceUIDs);
"1.2.156.112605.14038010222575.230518044041.3.4344.300061",
];
window.ipcRenderer.invoke("model:infer", SeriesInstanceUIDs);
}; };
useEffect(() => {
const receiveInfer = (_event: any, data: string) => {
setMessageText(data);
};
window.ipcRenderer.on("infer:progress", receiveInfer);
return () => {
window.ipcRenderer.off("infer:progress", receiveInfer);
};
}, []);
useEffect(() => { useEffect(() => {
window.ipcRenderer.on("context-menu-launch", (_, data) => { window.ipcRenderer.on("context-menu-launch", (_, data) => {
console.log("右键菜单拉起启动文件夹路径", data); console.log("右键菜单拉起启动文件夹路径", data);
@ -60,7 +68,7 @@ const Boot = () => {
<ResizablePanel defaultSize={38.2}> <ResizablePanel defaultSize={38.2}>
<div className="flex flex-col h-full"> <div className="flex flex-col h-full">
<ScrollArea className="flex-grow w-full h-full px-4 pb-2"> <ScrollArea className="flex-grow w-full h-full px-4 pb-2">
<div className="w-full flex flex-col gap-y-2"></div> <div className="w-full flex flex-col gap-y-2"></div>
</ScrollArea> </ScrollArea>
<div className="flex-shrink-0 flex items-center justify-end gap-2 px-4 py-4"> <div className="flex-shrink-0 flex items-center justify-end gap-2 px-4 py-4">
<Button onClick={handleTasks}> <Button onClick={handleTasks}>

View File

@ -48,8 +48,8 @@ export const SeriesCard = ({ series, onAction }: SeriesCardProps) => {
<Rotate3DIcon className="w-4 h-4" /> <Rotate3DIcon className="w-4 h-4" />
</DropdownMenuShortcut> </DropdownMenuShortcut>
</DropdownMenuItem> </DropdownMenuItem>
<DropdownMenuItem onClick={() => onAction("view3D", series)}> <DropdownMenuItem onClick={() => onAction("ai", series)}>
3D AI
<DropdownMenuShortcut> <DropdownMenuShortcut>
<Torus className="w-4 h-4" /> <Torus className="w-4 h-4" />
</DropdownMenuShortcut> </DropdownMenuShortcut>

View File

@ -73,6 +73,9 @@ export const Datasource = () => {
case "viewMpr": case "viewMpr":
navigate(`/viewer?${query}`, { replace: true }); navigate(`/viewer?${query}`, { replace: true });
break; break;
case "ai":
navigate("/", { state: { series } });
break;
// 其他操作逻辑 // 其他操作逻辑
default: default:
break; break;