DicomObjects.NET.8.48 Documentation
DicomObjects Namespace / DicomDataSet Class / SetPixelFile Method

The name of the external file

Input Transfer Syntax of the Pixel Data

The offset in the file of the start of the first frame

The offset in the file between the start of one frame, and the start of the next

Example

In This Topic
    SetPixelFile Method (DicomDataSet)
    In This Topic
    Maps an external file as the pixel data
    Syntax
    'Declaration
     
    
    Public Sub SetPixelFile( _
       ByVal FileName As System.String, _
       ByVal TransferSyntax As System.String, _
       ByVal InitialOffset As System.Long, _
       ByVal FrameOffset As System.Long _
    ) 
    public void SetPixelFile( 
       System.string FileName,
       System.string TransferSyntax,
       System.long InitialOffset,
       System.long FrameOffset
    )

    Parameters

    FileName

    The name of the external file

    TransferSyntax

    Input Transfer Syntax of the Pixel Data

    InitialOffset

    The offset in the file of the start of the first frame

    FrameOffset

    The offset in the file between the start of one frame, and the start of the next

    Remarks
    The PixelData attribute (7FE0, 0010) is set after calling this method and Pixel data is read from the specified external file only when image rendering is about to happen.
    Example
    DicomDataSet ds = new DicomDataSet();
                         
    string filename = "dataset.data";
    string transferSyntax = TransferSyntaxes.ExplicitVRLittleEndian;
    long initialOffset = 0;
    long frameOffset = 0; 
                         
    ds.Add(Keyword.SamplesPerPixel, 1);
    ds.Add(Keyword.PhotometricInterpretation, "MONOCHROME2");
    ds.Add(Keyword.Rows, 512);
    ds.Add(Keyword.Columns, 512);
    ds.Add(Keyword.PixelSpacing, new float[] { 0.684f, 0.684f });
    ds.Add(Keyword.BitsAllocated, 16);
    ds.Add(Keyword.BitsStored, 12);
    ds.Add(Keyword.HighBit, 11);
    ds.Add(Keyword.PixelRepresentation, 0);
    ds.Add(Keyword.WindowCenter, new int[] { 35, 50 });
    ds.Add(Keyword.WindowWidth, new int[] { 350, 150 });
    ds.Add(Keyword.RescaleIntercept, -1200);
    ds.Add(Keyword.RescaleSlope, 1);
                         
    ds.SetPixelFile(filename, transferSyntax, initialOffset, frameOffset);
    Requirements

    Target Platforms: .NET CLR 4.8 or higher

    See Also