博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ClearCanvas DICOM 开发系列 一
阅读量:7283 次
发布时间:2019-06-30

本文共 4152 字,大约阅读时间需要 13 分钟。

概述

C#开源的DICOM server.支持影像处理、影像归档、影像管理、影像传输和影像浏览功能。开源代码可学习地方很多。

 

官方网站:

 

building ImageViewer 的代码,

1、打开ImageViewer.sln/Trunk/ImageViewer 用VS2008编译它.

2、运行ClearCanvas.Desktop.Executable Bin\debug 或Bin\Release下的项目.

 

 

  1. 编译通过ImageServer.sln/Trunk/ImageServer
  2. 修改 connectionStringsImageServer_Shreds_dist.config 的user 和 password 在你安装了ImageServer数据库后.
  3. 编辑/Trunk/ImageServer/Executable/Logging.config 的ConnectionString 的 user 和 password .
  4. 编译通过这个项目
  5. 开启 ClearCanvas.ImageServer.ShredHostService ,运行里面的wcf server,可以在Bin\Log 看到开启后的日志.

结果如下

 

运行 ClearCanvas.Desktop.Executable 的结果如下

 

 

测试往Server加入.dcm文件的代码如下

[TestFixture]	public class ScuTests : AbstractTest	{		[TestFixtureSetUp]		public void Init()		{			_serverType = TestTypes.Receive;		}		[TestFixtureTearDown]		public void Cleanup()		{		}		TestTypes _serverType;		public IDicomServerHandler ServerHandlerCreator(DicomServer server, ServerAssociationParameters assoc)		{			return new ServerHandler(this, _serverType);		}		private StorageScu SetupScu()		{			StorageScu scu = new StorageScu("TestAe", "AssocTestServer", "localhost", 104);			IList
list = SetupMRSeries(4, 2, DicomUid.GenerateUid().UID); foreach (DicomAttributeCollection collection in list) { DicomFile file = new DicomFile("test", new DicomAttributeCollection(), collection); file.TransferSyntax = TransferSyntax.ExplicitVrLittleEndian; file.MediaStorageSopClassUid = SopClass.MrImageStorage.Uid; file.MediaStorageSopInstanceUid = collection[DicomTags.SopInstanceUid].ToString(); scu.AddStorageInstance(new StorageInstance(file)); } return scu; } [Test] public void ScuAbortTest() { int port = 2112; /* Setup the Server */ ServerAssociationParameters serverParameters = new ServerAssociationParameters("AssocTestServer", new IPEndPoint(IPAddress.Any, port)); byte pcid = serverParameters.AddPresentationContext(SopClass.MrImageStorage); serverParameters.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrLittleEndian); serverParameters.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrBigEndian); serverParameters.AddTransferSyntax(pcid, TransferSyntax.ImplicitVrLittleEndian); _serverType = TestTypes.Receive; DicomServer.StartListening(serverParameters, ServerHandlerCreator); StorageScu scu = SetupScu(); IList
list = SetupMRSeries(4, 2, DicomUid.GenerateUid().UID); foreach (DicomAttributeCollection collection in list) { DicomFile file = new DicomFile("test",new DicomAttributeCollection(),collection ); file.TransferSyntax = TransferSyntax.ExplicitVrLittleEndian; file.MediaStorageSopClassUid = SopClass.MrImageStorage.Uid; file.MediaStorageSopInstanceUid = collection[DicomTags.SopInstanceUid].ToString(); scu.AddStorageInstance(new StorageInstance(file)); } scu.ImageStoreCompleted += delegate(object o, StorageInstance instance) { // Test abort scu.Abort(); }; scu.Send(); scu.Join(); Assert.AreEqual(scu.Status, ScuOperationStatus.NetworkError); // StopListening DicomServer.StopListening(serverParameters); } }

 

 

 

如果直接是filePath的话也可以这样

 

public class ImageStoreDAL    {        private ConnectModel _connectModel;        public ImageStoreDAL(ConnectModel connectModel)        {            _connectModel = connectModel;        }        public ConnectModel ConnectModelInstance        {            get { return _connectModel; }            set { _connectModel = value; }        }        private StorageScu SetupScu(string filePath)        {            StorageScu scu = new StorageScu(_connectModel.ClientAETitle, _connectModel.RemoteAE, _connectModel.RemoteHost, _connectModel.RemotePort);            DicomFile file = new DicomFile(filePath);            scu.AddStorageInstance(new StorageInstance(file));            return scu;        }        public ScuOperationStatus ImageStoreByFilePath(string filePath)        {            StorageScu scu = SetupScu(filePath);            scu.Send();            return scu.Status;        }    }

 

 

欢迎各位参与讨论,如果觉得对你有帮助,请点击    推荐下,万分谢谢.

作者:

出处:

本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

你可能感兴趣的文章
httpd详解
查看>>
ansible(七)Conditionals 和 loops,自定义loops插件
查看>>
Spring 中优雅的获取泛型信息
查看>>
Haproxy 配置详细讲解
查看>>
zabbix 监控 TCP 连接数
查看>>
Python 学习资源汇总
查看>>
zabbix3.4.4集成graphtrees图文笔记
查看>>
Android中的管理工具类log可以这么些.....
查看>>
CentOS上Broadcom无线网卡驱动安装
查看>>
寻找系统参与者的15个问题
查看>>
工厂模式
查看>>
78.LAMP架构介绍,MYSQL和MariaDB介绍,MYSQL安装
查看>>
SSL *** Reconnect
查看>>
2014-02-27 连贯操作(没带U盘。本文当笔记用,明天改
查看>>
Docker修改默认的网段
查看>>
694 - The Collatz Sequence
查看>>
Centos7.5-重定向和文件的查找
查看>>
Android开发环境搭建全程演示(jdk+eclipse+android sdk)
查看>>
python随机生成指定长度的密码
查看>>
matlab-高数 int 二重积分 四限皆数、四限含参
查看>>