LEADTOOLS Medical (Leadtools.Dicom.Scu assembly)
LEAD Technologies, Inc

Store(DicomScp,String) Method

Example 





The peer connection to send the C-STORE-REQ to.
The DICOM file to send.
Sends a C-STORE-REQ message to a peer member of a connection defined by Scp.
Syntax
public void Store( 
   DicomScp Scp,
   string DicomFile
)
'Declaration
 
Public Overloads Sub Store( _
   ByVal Scp As DicomScp, _
   ByVal DicomFile As String _
) 
'Usage
 
Dim instance As StoreScu
Dim Scp As DicomScp
Dim DicomFile As String
 
instance.Store(Scp, DicomFile)
public void Store( 
   DicomScp Scp,
   string DicomFile
)
 function Leadtools.Dicom.Scu.StoreScu.Store(DicomScp,String)( 
   Scp ,
   DicomFile 
)
public:
void Store( 
   DicomScp^ Scp,
   String^ DicomFile
) 

Parameters

Scp
The peer connection to send the C-STORE-REQ to.
DicomFile
The DICOM file to send.
Exceptions
ExceptionDescription
System.IO.FileNotFoundException Thrown when DicomFile doesn't exist
System.ArgumentNullException Thrown when SCP is null.
Remarks
The file can be a single DICOM file or a DICOMDIR file. If the file is a DICOMDIR all files in the DICOM will be sent.
Example
 
Public Sub StoreFile()
         DicomEngine.Startup()
         DicomNet.Startup()

         Dim cstore As StoreScu = New StoreScu()
         Dim scp As DicomScp = New DicomScp()

         '
         ' Change these parameters to reflect the calling AETitle.
         '
         cstore.AETitle = "LEAD_CLIENT"
         cstore.HostPort = 1000
         cstore.HostAddress = IPAddress.Parse(Dns.GetHostByName(Dns.GetHostName()).AddressList(0).ToString())

         '
         ' Change these parameters to reflect the called AETitle (server).
         '
         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, Path.Combine(LEAD_VARS.ImagesDir, "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)
         '
         ' Stop storing if we received an error
         '
         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


Public NotInheritable Class LEAD_VARS
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
public void StoreFile()
     {
         DicomEngine.Startup();
         DicomNet.Startup();

         StoreScu storeFile = new StoreScu();
         DicomScp scp = new DicomScp();

         //
         // Change these parameters to reflect the calling AETitle.
         //


         storeFile.AETitle = "LEAD_CLIENT";
         storeFile.HostPort = 1000;
         storeFile.HostAddress = IPAddress.Parse(Dns.GetHostByName(Dns.GetHostName()).AddressList[0].ToString());

         //
         // Change these parameters to reflect the called AETitle (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 = Path.Combine(LEAD_VARS.ImagesDir, "Image1.dcm");
         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);
     }


static class LEAD_VARS
{
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

StoreScu Class
StoreScu Members
Overload List

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.

Leadtools.Dicom.Scu requires a Medical toolkit license and unlock key. For more information, refer to: LEADTOOLS Toolkit Features