Store(DicomScp,string) Method

Summary
Sends a C-STORE-REQ message to a peer member of a connection defined by Scp.
Syntax
C#
C++/CLI
public void Store( 
   DicomScp Scp, 
   string 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 does not 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

Stores a local file to a remote DICOM server.

C#
using Leadtools; 
using Leadtools.Dicom.Scu; 
using Leadtools.Dicom.Scu.Common; 
using Leadtools.Dicom; 
using Leadtools.Dicom.Common.DataTypes; 
using Leadtools.Dicom.Common.DataTypes.Status; 
 
 
 
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 = Dns.GetHostEntry(Dns.GetHostName()).AddressList.FirstOrDefault(ip => ip.AddressFamily == AddressFamily.InterNetwork); 
 
   // 
   // 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, "DICOM", "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); 
 
   if (e.Status != DicomCommandStatusType.Success) 
   { 
      string statusAllString = e.StatusAll.ToString(StatusFormatFlags.IgnoreStatus, "\n", "\t"); 
      Console.WriteLine(statusAllString); 
   } 
} 
 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 22.0.2023.1.24
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom.Scu Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.