GDCM memo / send scu
var dir = new System.IO.DirectoryInfo(@"c:\dicom");
var filesInfo = dir.GetFiles("*.dcm");
//
var scu = new gdcm.ServiceClassUser();
scu.SetHostname("host");
scu.SetPort((ushort)11112);
scu.SetCalledAETitle("DCM4CHEE");
scu.SetAETitle("any");
scu.SetTimeout(2000);
if (!scu.InitializeConnection())
{ Console.WriteLine("Err :suc initialize connection"); return; }
var ft = new gdcm.FilenamesType();
foreach (FileInfo fi in filesInfo)
ft.Add(fi.FullName);
var g = new gdcm.PresentationContextGenerator();
g.GenerateFromFilenames(ft);
scu.SetPresentationContexts(g.GetPresentationContexts());
if (!scu.StartAssociation())
{ Console.WriteLine(": suc Start Association"); return; }
foreach (FileInfo fi in filesInfo)
{
if (!scu.SendStore(fi.FullName))
{
Console.WriteLine("Err: Send scu[" + fi.FullName +"]");
break;
}
}
if (!scu.StopAssociation())
{ Console.WriteLine("\r\nErr: suc Stop Association\n"); return; }
Console.WriteLine("\r\nEnd");
scu.Dispose();
g.Dispose();
ft.Dispose();
0 件のコメント :
コメントを投稿