DicomObjects.NET.8.48 Documentation
DicomObjects Namespace / DicomImage Class / SetPixelDataAndImport Method
The transfer syntax of the data provided via the GetData function
Number of frames that would get imported
User defined function to return the correct data stream to be imported
Example

In This Topic
    SetPixelDataAndImport Method
    In This Topic
    Method to import pixel data directly from a non-DICOM data
    Syntax
    'Declaration
     
    
    Public Sub SetPixelDataAndImport( _
       ByVal TransferSyntax As System.String, _
       ByVal FrameCount As System.Integer, _
       ByVal GetData As System.Func(Of Integer,Stream) _
    ) 
    public void SetPixelDataAndImport( 
       System.string TransferSyntax,
       System.int FrameCount,
       System.Func<int,Stream> GetData
    )

    Parameters

    TransferSyntax
    The transfer syntax of the data provided via the GetData function
    FrameCount
    Number of frames that would get imported
    GetData
    User defined function to return the correct data stream to be imported
    Example
    DicomImage image = new DicomImage();
    image.DataSet.Add(Keyword.SamplesPerPixel, 1);
    image.DataSet.Add(Keyword.PhotometricInterpretation, "MONOCHROME2");
    image.DataSet.Add(Keyword.Rows, 512);
    image.DataSet.Add(Keyword.Columns, 512);
    image.DataSet.Add(Keyword.PixelSpacing, new float[] { 0.684f, 0.684f });
    image.DataSet.Add(Keyword.BitsAllocated, 16);
    image.DataSet.Add(Keyword.BitsStored, 12);
    image.DataSet.Add(Keyword.HighBit, 11);
    image.DataSet.Add(Keyword.PixelRepresentation, 0);
    image.DataSet.Add(Keyword.WindowCenter, new int[] { 35, 50 });
    image.DataSet.Add(Keyword.WindowWidth, new int[] { 350, 150 });
    image.DataSet.Add(Keyword.RescaleIntercept, -1200);
    image.DataSet.Add(Keyword.RescaleSlope, 1);
    image.SetPixelDataAndImport(TransferSyntaxes.ExplicitVRLittleEndian, 1, getData);
    Viewer.Images.Add(image);
    private Stream getData(int arg)
    {
        return new FileStream("your_non_dicom_image", FileMode.Open);
    }
    Requirements

    Target Platforms: .NET CLR 4.8 or higher

    See Also