LEADTOOLS Medical (Leadtools.Dicom.Scu assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
Store(DicomScp,String,String,Boolean) Method
See Also 
Leadtools.Dicom.Scu Namespace > StoreScu Class > Store Method : Store(DicomScp,String,String,Boolean) Method




Scp
The peer connection to send the C-MOVE-REQ to.
Dir
The file directory to search for DICOM files.
SearchPattern
The search pattern.
Recurse
If set to true recurse the directory.
Scp
The peer connection to send the C-MOVE-REQ to.
Dir
The file directory to search for DICOM files.
SearchPattern
The search pattern.
Recurse
If set to true recurse the directory.
Sends a C-STORE-REQ message to a peer member of a connection defined by Scp.

Syntax

Visual Basic (Declaration) 
Overloads Public Sub Store( _
   ByVal Scp As DicomScp, _
   ByVal Dir As String, _
   ByVal SearchPattern As String, _
   ByVal Recurse As Boolean _
) 
Visual Basic (Usage)Copy Code
Dim instance As StoreScu
Dim Scp As DicomScp
Dim Dir As String
Dim SearchPattern As String
Dim Recurse As Boolean
 
instance.Store(Scp, Dir, SearchPattern, Recurse)
C# 
public void Store( 
   DicomScp Scp,
   string Dir,
   string SearchPattern,
   bool Recurse
)
Managed Extensions for C++ 
public: void Store( 
   DicomScp* Scp,
   string* Dir,
   string* SearchPattern,
   bool Recurse
) 
C++/CLI 
public:
void Store( 
   DicomScp^ Scp,
   String^ Dir,
   String^ SearchPattern,
   bool Recurse
) 

Parameters

Scp
The peer connection to send the C-MOVE-REQ to.
Dir
The file directory to search for DICOM files.
SearchPattern
The search pattern.
Recurse
If set to true recurse the directory.

Example

Stores all DICOM files in the specified directory to a DICOM server.

Visual BasicCopy Code
Public Sub StoreDirectory()
         DicomEngine.Startup()
         DicomNet.Startup()

         Dim cstoreFolder As StoreScu = New StoreScu()
         Dim scp As DicomScp = 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")

         AddHandler cstoreFolder.BeforeAssociateRequest, AddressOf cstoreFolder_BeforeAssociateRequest
         AddHandler cstoreFolder.AfterAssociateRequest, AddressOf cstoreFolder_AfterAssociateRequest
         AddHandler cstoreFolder.BeforeCStore, AddressOf cstoreFolder_BeforeCStore
         AddHandler cstoreFolder.AfterCStore, AddressOf cstoreFolder_AfterCStore
         cstoreFolder.Compression = Compression.Native
      cstoreFolder.Store(scp, LEAD_VARS.ImagesDir, "*.*", False)

         DicomNet.Shutdown()
         DicomEngine.Shutdown()
     End Sub

     Private Sub cstoreFolder_BeforeAssociateRequest(ByVal sender As Object, ByVal e As BeforeAssociateRequestEventArgs)
         Console.WriteLine("Before AssociateRequest")
     End Sub

     Private Sub cstoreFolder_AfterAssociateRequest(ByVal sender As Object, ByVal e As AfterAssociateRequestEventArgs)
         Dim scu As StoreScu = TryCast(sender, StoreScu)

         Console.WriteLine("After AssociateRequest")
         Dim i As Integer = 0
         Do While i < e.Associate.PresentationContextCount
             Dim pid As Byte = e.Associate.GetPresentationContextID(i)
             Dim absSyntax As String = e.Associate.GetAbstract(pid)
             Dim result As DicomAssociateAcceptResultType = e.Associate.GetResult(pid)
             Dim uid As DicomUid = DicomUidTable.Instance.Find(absSyntax)

             Console.WriteLine(Constants.vbTab & "PresentationContext ({0})", pid)
             Console.WriteLine(Constants.vbTab + Constants.vbTab & "AbstractSyntax: {0}", absSyntax)
             If Not uid Is Nothing Then
                 Console.WriteLine(Constants.vbTab + Constants.vbTab & "Description: {0}", uid.Name)
             End If
             Console.WriteLine(Constants.vbTab + Constants.vbTab & "Result: {0}", result)
             i += 1
         Loop
     End Sub

     Private Sub cstoreFolder_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 cstoreFolder_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
C#Copy Code
public void StoreDirectory()
     {
         DicomEngine.Startup();
         DicomNet.Startup();

         StoreScu storeDirectory = 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");

         storeDirectory.BeforeAssociateRequest += new BeforeAssociationRequestDelegate(storeDirectory_BeforeAssociateRequest);
         storeDirectory.AfterAssociateRequest += new AfterAssociateRequestDelegate(storeDirectory_AfterAssociateRequest);
         storeDirectory.BeforeCStore += new BeforeCStoreDelegate(storeDirectory_BeforeCStore);
         storeDirectory.AfterCStore += new AfterCStoreDelegate(storeDirectory_AfterCStore);
         storeDirectory.Compression = Compression.Native;            
         storeDirectory.Store(scp, LEAD_VARS.ImagesDir, "*.*", false);

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

     void storeDirectory_BeforeAssociateRequest(object sender, BeforeAssociateRequestEventArgs e)
     {
         Console.WriteLine("Before AssociateRequest");
     }

     void storeDirectory_AfterAssociateRequest(object sender, AfterAssociateRequestEventArgs e)
     {
         StoreScu scu = sender as StoreScu;

         Console.WriteLine("After AssociateRequest");
         for (int i = 0; i < e.Associate.PresentationContextCount; i++)
         {
             byte pid = e.Associate.GetPresentationContextID(i);
             string absSyntax = e.Associate.GetAbstract(pid);
             DicomAssociateAcceptResultType result = e.Associate.GetResult(pid);
             DicomUid uid = DicomUidTable.Instance.Find(absSyntax);

             Console.WriteLine("\tPresentationContext ({0})", pid);
             Console.WriteLine("\t\tAbstractSyntax: {0}", absSyntax);
             if (uid != null)
                 Console.WriteLine("\t\tDescription: {0}", uid.Name);
             Console.WriteLine("\t\tResult: {0}", result);
         }
     }

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

     void storeDirectory_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: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also

Leadtools.Dicom.Scu requires a Medical toolkit license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features