From c430ec229b18fb2490ce07de408ef1a4a077e0e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F?= Date: Mon, 13 Apr 2026 13:47:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=B4=E6=98=8E=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 128 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 83 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 0fed7a8..a4c8aac 100644 --- a/README.md +++ b/README.md @@ -2,71 +2,109 @@ ### 系统目标 -XplorePlane 系统用于控制平面 CT 设备的各个子系统(射线源、探测器、运动控制)并完成采集图像的处理与分析,为研发与调试提供统一的软件平台。 +XplorePlane 系统用于控制平面 CT 设备的各个子系统(射线源、探测器、运动控制、相机)并完成采集图像的处理与分析,为研发与调试提供统一的软件平台。 -**总体架构风格** +### 总体架构 -- 客户端框架: WPF + Prism MVVM(项目 XplorePlane,目标框架 net8.0-windows) -- 图像处理内核: 独立类库 ImageProcessing.Core(算子基类与参数模型)和 ImageProcessing.Processors(具体算子实现),基于 EmguCV -- 基础设施: 日志使用 Serilog,序列化使用 Newtonsoft.Json,资源统一通过 WPF 资源系统管理 +- 客户端框架: WPF + Prism MVVM(目标框架 net8.0-windows) +- 图像处理内核: ImageProcessing.Core(算子基类)+ ImageProcessing.Processors(具体算子),基于 EmguCV +- 相机控制: XP.Camera(Basler pylon SDK 封装,支持软件触发、参数读写) +- 硬件抽象: XP.Common + XP.Hardware.RaySource(射线源控制) +- 日志: Serilog +- UI 组件: Telerik RadRibbonView、Fluent.Ribbon -**开发目标** +### 解决方案结构 -在现有图像处理与 UI 基础上,引入并集成: - -- 射线源子系统(X-Ray Source) -- 探测器子系统(Detector) -- 运动控制子系统(Motion Control) -- 通过统一的 CT 扫描工作流,在 UI 中实现一键式扫描、实时状态监控与图像后处理 - -### 项目框架 - -```css -XplorePlane/ -├── XplorePlane.csproj # .NET 8 WPF project file -│ -├── App.xaml # Application + global ResourceDictionary -├── App.xaml.cs -│ -├── Views/ -│ └── MainWindow.xaml # Main window (Grid + StackPanel layout) -│ └── MainWindow.xaml.cs # Code-behind (minimal – only TreeView event) -│ -├── ViewModels/ -│ └── MainViewModel.cs # Root VM: navigation, callouts, props, commands -│ └── NavGroupNode.cs # Tree group node VM -│ └── NavLeafNode.cs # Tree leaf node VM -│ └── InspectionCalloutVM.cs # Overlay callout card VM -│ └── CalloutRowVM.cs # Single callout data row VM -│ └── RelayCommand.cs # ICommand implementation -│ -├── Models/ -│ └── FeatureProperties.cs # Bindable domain model for right panel -│ -└── Assets/ - └── Icons/ # 28×28 toolbar icon PNGs - +``` +XplorePlane.sln +├── XplorePlane/ # 主应用程序(WPF) +├── XP.Camera/ # 相机控制库(Basler) +├── ImageProcessing/ # 独立图像处理应用 +├── ImageProcessing.Core/ # 图像处理算子基类 +├── ImageProcessing.Processors/ # 具体算子实现 +├── ImageProcessing.Controls/ # 图像显示控件(ImageCanvasControl) +├── ImageROIControl/ # ROI 绘制控件 +├── XplorePlane.Tests/ # 单元测试 +└── ExternalLibraries/ # 外部 DLL 和 ONNX 模型 ``` +### XplorePlane 主项目结构 -### XplorePlane.Hardware(硬件库) +``` +XplorePlane/ +├── App.xaml / App.xaml.cs # 应用入口 + DI 容器配置(AppBootstrapper) +├── Views/ +│ ├── Main/ +│ │ ├── MainWindow.xaml # 主窗口(Telerik Ribbon + 三栏布局) +│ │ ├── NavigationPropertyPanelView.xaml # 相机实时预览面板 +│ │ └── MotionControlPanelView.xaml # 运动控制面板 +│ ├── Cnc/ # CNC 编辑器 / 矩阵编排视图 +│ ├── ImageProcessing/ # 图像处理面板视图 +│ └── CameraSettingsWindow.xaml # 相机参数设置对话框 +├── ViewModels/ +│ ├── Main/ +│ │ ├── MainViewModel.cs # 主窗口 ViewModel +│ │ └── NavigationPropertyPanelViewModel.cs # 相机预览 ViewModel +│ ├── Cnc/ # CNC / 矩阵 ViewModel +│ └── ImageProcessing/ # 图像处理 / 流水线 ViewModel +├── Services/ +│ ├── AppState/ # 全局状态管理(线程安全) +│ ├── Camera/ # 相机服务 +│ ├── Cnc/ # CNC 程序服务 +│ ├── Matrix/ # 矩阵编排服务 +│ ├── Measurement/ # 测量数据服务 +│ ├── Pipeline/ # 流水线执行 / 持久化 +│ └── Recipe/ # 检测配方服务 +├── Models/ # 数据模型(State、CNC、Matrix、Pipeline 等) +├── Events/ # Prism 事件 +├── Libs/ +│ ├── Hardware/ # 硬件库 DLL(XP.Common、XP.Hardware.RaySource) +│ └── Native/ # 原生依赖库 +└── Assets/Icons/ # 工具栏图标 +``` +### 相机集成 +相机实时影像集成在主窗口左下角的 NavigationPropertyPanelView 中: -### XplorePlane.ImageProcessing (图像库) +- 连接/断开相机(Basler,通过 ICameraController) +- 开始/停止采集(软件触发模式) +- 实时预览(Live View,勾选"实时"复选框) +- 鼠标悬停显示像素坐标 +- 相机参数设置对话框(曝光时间、增益、分辨率、像素格式) +- 主界面 Ribbon 硬件栏提供"相机设置"快捷按钮 +相机控制逻辑移植自 ImageProcessing 项目,使用 XP.Camera.PixelConverter 进行像素数据转换,通过 Application.Dispatcher.Invoke 保证 UI 线程安全。 +### 依赖注入(DI) +使用 Prism + DryIoc,在 AppBootstrapper.RegisterTypes() 中统一注册: +- ICameraFactory / ICameraController / ICameraService(单例) +- IRaySourceService / IRaySourceFactory(单例) +- IAppStateService(单例,线程安全状态管理) +- NavigationPropertyPanelViewModel(单例,相机预览共享实例) +- 各 Service 和 ViewModel(按需注册) + +### 构建 + +```bash +# Debug +dotnet build XplorePlane.sln -c Debug + +# Release +dotnet build XplorePlane.sln -c Release +``` ### TO-DO List - [x] 软件基于 WPF + Prism 基础的框架 -- [x] 日志库的引用(通过 XplorePlane.Common.dll) +- [x] 日志库的引用(通过 XP.Common.dll) - [x] 按推荐的 DLL 目录结构进行修改 - [x] 通过库依赖的方式调用日志功能 - [x] 界面的布局 +- [x] 相机实时影像集成(连接、采集、Live View、像素坐标显示) +- [x] 相机参数设置对话框(曝光、增益、分辨率、像素格式) +- [x] 主界面硬件栏相机设置按钮 - [ ] 打通与硬件层的调用流程 - [ ] 打通与图像层的调用流程 - -