当前位置: 首页 > news >正文

C#模拟pacs系统接收并解析影像设备数据(DICOM文件解析)

上篇文件介绍了什么dicomhttps://blog.csdn.net/qq_39569480/article/details/149641920?spm=1001.2014.3001.5502 本篇文章我们来使用fo_dicom接收并解析dicom文件。

1.开发环境

visual studio 2019
.netframwork 4.8
fo-dicom 4.0.8

2.环境配置

这里使用的是fo-dicom 4.0.8 大家可根据自己的需求使用对应版本
在这里插入图片描述
在这里插入图片描述

3.关键知识点

dicom三要素为 AE title、IP、port

AE Title(Application Entity Title,应用实体标题)

是DICOM(医学数字成像与通信)标准中用于唯一标识网络中的通信节点的核心参数。它在医疗影像系统(如PACS、影像设备)的互联互通通过唯一命名和长度限制(≤16字符) 确保设备间精准通信。它在影像传输、来源追溯、服务调度中不可或缺,配置错误可能引发传输失败或数据混乱。实际应用中需严格遵循命名唯一性规则。

首先声明允许的ae title集合

private static readonly string[] AllowedAEs = { "PACS_SERVER", "MICRODICOM" }; // 允许的AE Title列表

端口号:用于通信端口

private const int Port = 11112; // PACS标准端口

ip: 服务的ip地址

什么是sop类:

SOP类(Service Object Pair,服务对象对)是DICOM(医学数字成像与通信)标准中的核心概念,定义了如何通过特定服务操作特定类型的医学数据对象。它是DICOM网络通信和数据处理的基础单元,确保不同医疗设备(如CT、MRI、PACS)之间的互操作性。
SOP类的作用与意义:
1.标准化通信
设备通过协商支持的SOP类建立关联(Association),确保双方能理解彼此的请求与响应。例如CT设备需声明支持CT Image Storage SOP Class才能向PACS传输图像5。
2.唯一标识
每个SOP类有唯一的UID(如CT图像存储类UID为1.2.840.10008.5.1.4.1.1.2),避免操作歧义45。
3.功能扩展性
新型医疗技术(如眼科层析成像)可定义专属SOP类,支持复杂数据(如动态多帧图像)8。

4.常见的sop类举例
(1).Verification SOP Class
作用:验证网络连通性(如C-ECHO命令)15。
UID:1.2.840.10008.1.1。
(2).Storage SOP Class
作用:传输图像(如CT/MR图像)。
特点:不同设备有专属UID(如MR图像类UID为1.2.840.10008.5.1.4.1.1.4)14。
(3).Modality Worklist SOP Class
作用:设备从HIS/RIS系统获取待检患者列表(C-FIND查询)6。
UID:1.2.840.10008.5.1.4.31。
(4).Query/Retrieve SOP Class
作用:分层级查询数据(如患者级、检查级)16。
(5).MPPS SOP Class
作用:管理设备执行检查的进度状态2。

设置支持的SOP类UID列表

private static readonly string[] SupportedSopClasses ={// 验证服务类SOP (必须添加)DicomUID.Verification.UID,// 存储类SOPDicomUID.CTImageStorage.UID,DicomUID.MRImageStorage.UID,DicomUID.ComputedRadiographyImageStorage.UID,DicomUID.DigitalXRayImageStorageForPresentation.UID,DicomUID.UltrasoundImageStorage.UID,DicomUID.SecondaryCaptureImageStorage.UID,DicomUID.NuclearMedicineImageStorageRetiredRETIRED.UID,DicomUID.NuclearMedicineImageStorage.UID,DicomUID.PositronEmissionTomographyImageStorage.UID,DicomUID.RTImageStorage.UID,DicomUID.UltrasoundImageStorageRetiredRETIRED.UID,DicomUID.UltrasoundMultiFrameImageStorage.UID,DicomUID.UltrasoundMultiFrameImageStorageRetiredRETIRED.UID,DicomUID.XRayAngiographicImageStorage.UID,DicomUID.XRayRadiofluoroscopicImageStorage.UID,DicomUID.DigitalXRayImageStorageForPresentation.UID,DicomUID.DigitalXRayImageStorageForProcessing.UID,DicomUID.DigitalMammographyXRayImageStorageForPresentation.UID,DicomUID.DigitalMammographyXRayImageStorageForProcessing.UID,DicomUID.DigitalIntraOralXRayImageStorageForPresentation.UID,DicomUID.DigitalIntraOralXRayImageStorageForProcessing.UID,DicomUID.XRayAngiographicBiPlaneImageStorageRETIRED.UID,DicomUID.VLEndoscopicImageStorage.UID,DicomUID.VLMicroscopicImageStorage.UID,DicomUID.VLSlideCoordinatesMicroscopicImageStorage.UID,DicomUID.VLPhotographicImageStorage.UID,DicomUID.GrayscaleSoftcopyPresentationStateStorage.UID,DicomUID.KeyObjectSelectionDocumentStorage.UID// 添加其他需要的SOP类};

完整代码实现

DICOM服务类:

using Dicom;
using Dicom.Imaging;
using Dicom.Network;
using Dicom.Log;
using SixLabors.ImageSharp.Formats.Jpeg;
using System;
using System.Collections.Generic;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace DICOMkztDemo
{public class DICOMServer{private const int Port = 11112; // PACS标准端口private static readonly string StoragePath = @"C:\DICOM_Storage\";private static readonly string JpegOutputPath = @"C:\DICOM_Storage\DICOM_JPG\";private static readonly string[] AllowedAEs = { "PACS_SERVER", "MICRODICOM" }; // 允许的AE Title列表private static readonly DicomTransferSyntax[] AcceptedTransferSyntaxes ={DicomTransferSyntax.ExplicitVRLittleEndian,DicomTransferSyntax.ImplicitVRLittleEndian,DicomTransferSyntax.ImplicitVRBigEndian};// 支持的SOP类UID列表 - 直接使用字符串数组private static readonly string[] SupportedSopClasses ={// 验证服务类SOP (必须添加)DicomUID.Verification.UID,// 存储类SOPDicomUID.CTImageStorage.UID,DicomUID.MRImageStorage.UID,DicomUID.ComputedRadiographyImageStorage.UID,DicomUID.DigitalXRayImageStorageForPresentation.UID,DicomUID
http://www.dtcms.com/a/297757.html

相关文章:

  • Pattern正则表达式知识点
  • 第二十天(正则表达式与功能实际运用)
  • VUE 学习笔记6 vue数据监测原理
  • 设计模式十:单件模式 (Singleton Pattern)
  • 空间信息与数字技术专业能从事什么工作?
  • 【LeetCode数据结构】二叉树的应用(二)——二叉树的前序遍历问题、二叉树的中序遍历问题、二叉树的后序遍历问题详解
  • uniapp创建vue3+ts+pinia+sass项目
  • 2025年RISC-V中国峰会 主要内容
  • 绘图库 Matplotlib Search
  • RISC-V VP、Gem5、Spike
  • 恋爱时间倒计时网页设计与实现方案
  • 借助Aspose.HTML控件,在 Python 中将 SVG 转换为 PDF
  • Vue nextTick
  • 基于超176k铭文数据,谷歌DeepMind发布Aeneas,首次实现古罗马铭文的任意长度修复
  • MySQL存储引擎深度解析与实战指南
  • Java面试题及详细答案120道之(001-020)
  • JAVA_FIFTEEN_异常
  • LeetCode 233:数字 1 的个数
  • Zero-Shot TrackingT0:对象分割+运动感知记——当“切万物”武士学会运动记忆,目标跟踪稳如老狗
  • 力扣面试150题--寻找旋转排序数组中的最小值
  • 互联网金融项目实战(大数据Hadoop hive)
  • 代码随想录算法训练营第五十三天|图论part4
  • Hive【Hive架构及工作原理】
  • Hive-vscode-snippets
  • 微信小程序文件下载与预览功能实现详解
  • nacos安装
  • SpringBoot配置多数据源多数据库
  • Androidstudio 上传当前module 或本地jar包到maven服务器。
  • 线性代数 上
  • Java 大视界 -- 基于 Java 的大数据分布式存储在工业互联网数据管理与边缘计算协同中的创新实践(364)