Sends a C-STORE-REQ message to a peer member of a connection defined by Scp.
Syntax
Visual Basic (Usage) | Copy Code |
---|
Dim instance As StoreScu
Dim Scp As DicomScp
Dim DicomFile As String
instance.Store(Scp, DicomFile)
|
Parameters
- Scp
- The peer connection to send the C-STORE-REQ to.
- DicomFile
- The DICOM file to send.
Exceptions
Example
Stores a local file to a remote DICOM server.
Visual Basic | Copy Code |
---|
Public Sub StoreFile()
DicomEngine.Startup()
DicomNet.Startup()
Dim cstore As StoreScu = New StoreScu()
Dim scp As DicomScp = New DicomScp()
scp.AETitle = "MI_SERVER"
scp.Port = 104
scp.Timeout = 60
scp.PeerAddress = IPAddress.Parse("10.1.1.96")
AddHandler cstore.ReceiveBuffer, AddressOf cstore_ReceiveBuffer
AddHandler cstore.BeforeCStore, AddressOf cstore_BeforeCStore
AddHandler cstore.AfterCStore, AddressOf cstore_AfterCStore
cstore.Compression = Compression.Lossless
cstore.Store(scp, LeadtoolsExamples.Common.ImagesPath.Path + "Image1.dic")
DicomNet.Shutdown()
DicomEngine.Shutdown()
End Sub
Private Sub cstore_ReceiveBuffer(ByVal sender As Object, ByVal e As ReceiveBufferEventArgs)
Console.WriteLine("{0} bytes of data received", e.BufferSize)
End Sub
Private Sub cstore_BeforeCStore(ByVal sender As Object, ByVal e As BeforeCStoreEventArgs)
If Not e.Error Is Nothing Then
e.Skip = SkipMethod.AllFiles
End If
End Sub
Private Sub cstore_AfterCStore(ByVal sender As Object, ByVal e As AfterCStoreEventArgs)
Dim msg As String
msg = String.Format("{0} store complete. Status: {1}", e.FileInfo.FullName, e.Status)
Console.WriteLine(msg)
End Sub |
C# | Copy Code |
---|
public void StoreFile() { DicomEngine.Startup(); DicomNet.Startup(); StoreScu storeFile = new StoreScu(); DicomScp scp = new DicomScp(); // // Change these parameters to reflect your Dicom server. // scp.AETitle = "MI_SERVER"; scp.Port = 104; scp.Timeout = 60; scp.PeerAddress = IPAddress.Parse("10.1.1.96"); storeFile.ReceiveBuffer += new ReceiveBufferDelegate(storeFile_ReceiveBuffer); storeFile.BeforeCStore += new BeforeCStoreDelegate(storeFile_BeforeCStore); storeFile.AfterCStore += new AfterCStoreDelegate(storeFile_AfterCStore); storeFile.Compression = Compression.Lossless; string fileName = LeadtoolsExamples.Common.ImagesPath.Path + "Image1.dic"; storeFile.Store(scp, fileName); DicomNet.Shutdown(); DicomEngine.Shutdown(); } void storeFile_ReceiveBuffer(object sender, ReceiveBufferEventArgs e) { Console.WriteLine("{0} bytes of data received", e.BufferSize); } 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) { string msg; msg = string.Format("{0} store complete. Status: {1}", e.FileInfo.FullName, e.Status); Console.WriteLine(msg); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also