博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
clear canvas
阅读量:5290 次
发布时间:2019-06-14

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

https://sourceforge.net/projects/clearcanvas/?source=navbar

 

 

http://download.csdn.net/download/niehanmin/9650199/?

 

http://www.cnblogs.com/zhangchenliang/archive/2012/02/29/2372679.html

概述

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文件的代码如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
[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<DicomAttributeCollection> 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<DicomAttributeCollection> 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的话也可以这样

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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;
    
}
}

转载于:https://www.cnblogs.com/zhangj391/p/6580756.html

你可能感兴趣的文章
每日一库:Modernizr.js,es5-shim.js,es5-safe.js
查看>>
目录相关的操作
查看>>
解决虚拟机vmware安装64位系统“此主机支持 Intel VT-x,但 Intel VT-x 处于禁用状态”的问题...
查看>>
C++----练习--引用头文件
查看>>
11.基本包装类型
查看>>
ajax连接服务器框架
查看>>
wpf样式绑定 行为绑定 事件关联 路由事件实例
查看>>
利用maven管理项目之POM文件配置
查看>>
用HttpCombiner来减少js和css的请问次数
查看>>
FUSE-用户空间文件系统
查看>>
将tiff文件转化为jpg文件并保存
查看>>
ubuntu 16.04 开机脚本
查看>>
 VS2012 C#调用C++ dll
查看>>
TCL:表格(xls)中写入数据
查看>>
SQL SERVER 2005中如何获取日期(一个月的最后一日、一年的第一日等等)
查看>>
django 学习笔记(转)
查看>>
控制台程序秒变Windows服务(Topshelf)
查看>>
字节流与字符流的区别详解
查看>>
20141026--娱乐-箱子
查看>>
自定义分页
查看>>