LEADTOOLS Medical (Leadtools.Dicom assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
Load(Stream,DicomDataSetLoadFlags) Method
See Also 
Leadtools.Dicom Namespace > DicomDataSet Class > Load Method : Load(Stream,DicomDataSetLoadFlags) Method



stream
A stream contains the Data Set to be loaded.
flags
Meta-header flags and Transfer Syntax flags that indicate the file characteristics to use when loading the file.
stream
A stream contains the Data Set to be loaded.
flags
Meta-header flags and Transfer Syntax flags that indicate the file characteristics to use when loading the file.
Loads a Data Set from a stream. Supported in Silverlight, Windows Phone 7.

Syntax

Visual Basic (Declaration) 
Overloads Public Overridable Sub Load( _
   ByVal stream As Stream, _
   ByVal flags As DicomDataSetLoadFlags _
) 
Visual Basic (Usage)Copy Code
Dim instance As DicomDataSet
Dim stream As Stream
Dim flags As DicomDataSetLoadFlags
 
instance.Load(stream, flags)
C# 
public virtual void Load( 
   Stream stream,
   DicomDataSetLoadFlags flags
)
C++/CLI 
public:
virtual void Load( 
   Stream^ stream,
   DicomDataSetLoadFlags flags
) 

Parameters

stream
A stream contains the Data Set to be loaded.
flags
Meta-header flags and Transfer Syntax flags that indicate the file characteristics to use when loading the file.

Example

This example will load a DICOM Dataset from a file, save to a stream, load from a stream, and save to another file.

Visual BasicCopy Code
Public Sub LoadFromStreamSample()
    Dim dicomFileNameInput As String = LeadtoolsExamples.Common.ImagesPath.Path & "IMAGE3.dcm"
    Dim dicomFileNameOutput As String = LeadtoolsExamples.Common.ImagesPath.Path & "Image3_copy.dcm"
    DicomEngine.Startup()

    Using ds As New DicomDataSet()
        Using streamInput As New FileStream(dicomFileNameInput, FileMode.Open)
            ' Load a DICOM data set from a stream
            ds.Load(streamInput, DicomDataSetLoadFlags.None)

            ' Save to another output stream
            Using streamOutput As New FileStream(dicomFileNameOutput, FileMode.Create)
                ds.Save(streamOutput, DicomDataSetSaveFlags.None)
            End Using

        End Using
    End Using
    DicomEngine.Shutdown()
End Sub
C#Copy Code
public void LoadFromStreamSample()
{
   string dicomFileNameInput = LeadtoolsExamples.Common.ImagesPath.Path + "IMAGE3.dcm";
   string dicomFileNameOutput = LeadtoolsExamples.Common.ImagesPath.Path + "Image3_copy.dcm";
   DicomEngine.Startup();

   using (DicomDataSet ds = new DicomDataSet())
   {
      using (FileStream streamInput = new FileStream(dicomFileNameInput, FileMode.Open))
      {
         // Load a DICOM data set from a stream
         ds.Load(streamInput, DicomDataSetLoadFlags.None);

         // Save to another output stream
         using (FileStream streamOutput = new FileStream(dicomFileNameOutput, FileMode.Create))
         {
            ds.Save(streamOutput, DicomDataSetSaveFlags.None);
         }

      }
   }
   DicomEngine.Shutdown();
}
SilverlightCSharpCopy Code
SilverlightVBCopy Code

Remarks

If you know certain characteristics of the file, you can set those in flags. Any characteristic that you do not set will be automatically determined. For example, if you know that the Meta-header is present, but you do not know the byte order, or whether the Value Representation is Implicit or Explicit, you can set only DicomDataSetLoadFlags.MetaHeaderPresent in flags. During loading, LEADTOOLS will determine the byte order and whether the byte order is Implicit or Explicit.

If you do not know any of the characteristics of the file, set flags to DicomDataSetLoadFlags.None and LEADTOOLS will automatically determine all the file characteristics and load the file accordingly.

In this overload, the DicomDataSetLoadFlags.LoadAndClose is always used internally, even if not included in the flags

To load a Data Set from memory, you can also use DicomDataSet.Load(IntPtr, long, DicomDataSetFlags). To load a Data Set from a file, you can use DicomDataSet.Load(string, DicomDataSetLoadFlags).

Requirements

Target Platforms: Silverlight 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only)

See Also

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