DicomObjects.NET.8.48 Documentation
DicomObjects Namespace / DicomImage Class / Read Method / Read(Stream,ReadBehaviours) Method

The Stream from which to read.

ReadBehavioursObject to control individual read operation
Example

In This Topic
    Read(Stream,ReadBehaviours) Method
    In This Topic
    Reads from a system IO stream
    Syntax
    'Declaration
     
    
    Public Overloads Sub Read( _
       ByVal Stream As System.IO.Stream, _
       Optional ByVal readBehaviours As ReadBehaviours _
    ) 
    public void Read( 
       System.IO.Stream Stream,
       ReadBehaviours readBehaviours
    )

    Parameters

    Stream

    The Stream from which to read.

    readBehaviours
    ReadBehavioursObject to control individual read operation
    Remarks

    This method can read streams in either official "Part10" format, with the 128 byte header, or unofficial "Part5" format, without a header. Detection of the type is automatic.

    The stream may have been written by the Write method or by other DICOM software.

    Example
    using (FileStream fs = new FileStream("your_dicom_image.dcm", FileMode.Open, FileAccess.Read))
    {
        // Default call
        DicomImage image = new DicomImage();
        image.Read(fs); // Default call
        Viewer.Images.Add(image);
        
        // Specified read behaviours 
        DicomImage imageBehaviour = new DicomImage();
        imageBehaviour.Read(fs, new ReadBehaviours() { IgnoreAfterPixels = true, DontReadPixels = true }); // ReadBehaviour option
        Viewer.Images.Add(imageBehaviour);
    }
    Requirements

    Target Platforms: .NET CLR 4.8 or higher

    See Also