DicomObjects.NET.8.48 Documentation
DicomObjects Namespace / DicomDataSet Class / GetPixelStream Method
Requested pixel data for the frame
Example

In This Topic
    GetPixelStream Method
    In This Topic
    Returns the raw pixel data as a Stream object for a specific frame
    Syntax
    'Declaration
     
    
    Public Function GetPixelStream( _
       ByVal Frame As System.Integer _
    ) As System.IO.Stream
    public System.IO.Stream GetPixelStream( 
       System.int Frame
    )

    Parameters

    Frame
    Requested pixel data for the frame

    Return Value

    PixelData of the specified frame or null if it is uncompressed data or it encounters any failure during conversion
    Remarks
    Specify requested frame as 1 for MPEG data (mpeg 1,2,4) as they are defined/handled as 1 frame in DICOM
    Example
    DicomDataSet ds = new DicomDataSet("Compressed_Dataset.dcm");
    int frame = 10;
    var frameStream = ds.GetPixelStream(frame);
                        
    if (frameStream != null)
    {
        using (FileStream fs = new FileStream("frame10.data", FileMode.Create, FileAccess.Write))
        {
            frameStream.CopyTo(fs);
        }
    }
    Requirements

    Target Platforms: .NET CLR 4.8 or higher

    See Also