DicomObjects.NET.8.48 Documentation
DicomObjects Namespace / DicomDataSet Class / ImportPixelData Method
The data fragments
The transfer synatax corresponding to the data
Example

In This Topic
    ImportPixelData Method
    In This Topic
    Direct import of compressed pixel data
    Syntax
    'Declaration
     
    
    Public Sub ImportPixelData( _
       ByVal CompressedData As System.Collections.Generic.IEnumerable(Of Byte()), _
       ByVal TransferSyntax As System.String _
    ) 
    public void ImportPixelData( 
       System.Collections.Generic.IEnumerable<byte[]> CompressedData,
       System.string TransferSyntax
    )

    Parameters

    CompressedData
    The data fragments
    TransferSyntax
    The transfer synatax corresponding to the data
    Remarks

    This is an advanced technique, as no validation or data extraction is performed by DicomObjects, so those using it are responsible for setting all related attributes directly, including:

    • Rows and columns
    • Photometric Interpretation
    • Frame Count
    • The bit depth values (0028,0100-0028,0103)

    For MPEG, there must only be one fragment, covering all frames. For other transfer syntaxes, there is normally one fragment per frame.

    This method should not normally be used to import JPEG images, as most "normal" JPEG images have a JFIF header which is not permitted in DICOM - use the DicomImage.Import method instead.

    Example
    DicomDataSet ds = new DicomDataSet();
     
     byte[] compressedData = File.ReadAllBytes("image.raw");
     var transferSyntax = TransferSyntaxes.JPEGLossless;
     
    //  add all relevant group 28 attributes to image to tell DicomObjects how to display
    ds.Add(Keyword.SamplesPerPixel, 1);
    ds.Add(Keyword.Rows, 512);
    ds.Add(Keyword.Columns, 512);
    ds.Add(Keyword.BitsAllocated, 8);
    ds.Add(Keyword.BitsStored, 8);
    ds.Add(Keyword.HighBit, 7);
    ds.Add(Keyword.PixelRepresentation, 0); // PixelRepresentation 0=unsigned, 1=signed
    ds.Add(Keyword.NumberOfFrames, 1);
                        
    ds.ImportPixelData(new List<byte[]> { compressedData }, transferSyntax);
    Requirements

    Target Platforms: .NET CLR 4.8 or higher

    See Also