Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, April 20, 2017 12:24:21 PM(UTC)

Walter  
Walter

Groups: Tech Support, Administrators
Posts: 319

Was thanked: 3 time(s) in 3 post(s)

You can use the high-level .NET StoreScu class. With this class, you can store a DICOM file or DICOMDIR with a single method call. The class handles the connection, association, changing the transfer syntax and sending the request to the DICOM server.

Here is some simple code illustrating this:

Code:

private void StoreFile()
{
   DicomEngine.Startup();
   DicomNet.Startup();

   IPAddress machineAddress = Dns.GetHostEntry(Dns.GetHostName()).AddressList.FirstOrDefault(ip => ip.AddressFamily == AddressFamily.InterNetwork);

   StoreScu clientScu = new StoreScu() { AETitle = "L19_CLIENT64", HostPort = 1000, HostAddress = machineAddress };
   DicomScp scp = new DicomScp() { AETitle = "L19_PACS_SCP64", Port = 534, Timeout = 60, PeerAddress = machineAddress };

   clientScu.BeforeCStore += new BeforeCStoreDelegate(storeFile_BeforeCStore);
   clientScu.AfterCStore += new AfterCStoreDelegate(storeFile_AfterCStore);
   clientScu.Compression = Compression.Lossless;
   clientScu.Store(scp, @"C:\Users\Public\Documents\LEADTOOLS Images\Image2.dcm");

   DicomNet.Shutdown();
   DicomEngine.Shutdown();
}

void storeFile_BeforeCStore(object sender, BeforeCStoreEventArgs e)
{
   // Stop storing if we received an error 
   if (e.Error != null)
      e.Skip = SkipMethod.AllFiles;
}

void storeFile_AfterCStore(object sender, AfterCStoreEventArgs e)
{
   Console.WriteLine("{0} store complete. Status: {1}", e.FileInfo.FullName, e.Status);
}

Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2017, Yet Another Forum.NET
This page was generated in 0.117 seconds.