LEADTOOLS Support
Medical
Medical SDK FAQ
How to store a DICOM file using C-STORE to Storage Server?
#1
Posted
:
Thursday, April 20, 2017 12:19:21 PM(UTC)
Groups: Tech Support
Posts: 366
Thanks: 1 times
Was thanked: 4 time(s) in 4 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);
}
Edited by moderator Wednesday, December 27, 2023 4:09:28 PM(UTC)
| Reason: Updated
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
Medical
Medical SDK FAQ
How to store a DICOM file using C-STORE to Storage Server?
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.