Class PixelData

Class PixelData

Namespace: Aspose.Medical.Dicom.Imaging
Assembly: Aspose.Medical.dll (25.11.0)

Encapsulated base functionality for reading and writing DICOM images pixel data according to the specified transfer syntax.

public abstract class PixelData

Inheritance

object PixelData

Inherited Members

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Constructors

PixelData(Dataset)

Encapsulated base functionality for reading and writing DICOM images pixel data according to the specified transfer syntax.

protected PixelData(Dataset dataset)

Parameters

dataset Dataset

Properties

BitDepth

The Aspose.Medical.Dicom.Imaging.PixelData.BitDepth information for image rendering. Read-only Aspose.Medical.Dicom.Imaging.PixelData.BitDepth.

public BitDepth BitDepth { get; }

Property Value

BitDepth

BitsAllocated

The number of bits allocated per pixel sample (0028,0100). Read-only System.UInt16.

public ushort BitsAllocated { get; }

Property Value

ushort

BitsStored

The number of bits stored per pixel sample (0028,0101). Read/Write System.UInt16.

public ushort BitsStored { get; set; }

Property Value

ushort

Exceptions

MedicalApiException

Value > Bits Allocated.

BytesAllocated

The number of bytes allocated per pixel sample. Read-only System.Int32.

public int BytesAllocated { get; }

Property Value

int

Dataset

The DICOM Dataset containing the pixel data. Read-only Aspose.Medical.Dicom.Imaging.PixelData.Dataset.

public Dataset Dataset { get; }

Property Value

Dataset

Height

The DICOM image height (rows) in pixels. Read/Write System.UInt16.

public ushort Height { get; set; }

Property Value

ushort

HighBit

The index of the most significant bit (MSB) of pixel sample (0028,0102). Read/Write System.UInt16.

public ushort HighBit { get; set; }

Property Value

ushort

Exceptions

MedicalApiException

Value > Bits Allocated.

IsLossy

The lossy image compression (0028,2110) status (true if stored value is “01”). Read-only System.Boolean.

public bool IsLossy { get; }

Property Value

bool

LossyCompressionMethod

The lossy image compression method (0028,2114). Read-only System.String.

public string LossyCompressionMethod { get; }

Property Value

string

LossyCompressionRatio

The lossy image compression ratio (0028,2112). Read-only System.Decimal.

public decimal LossyCompressionRatio { get; }

Property Value

decimal

Remarks

Default value is System.Decimal.MinValue.

NumberOfFrames

The DICOM image Number of frames. This value usually equals 1 for single frame images. Read/Write System.Int32.

public int NumberOfFrames { get; set; }

Property Value

int

PaletteColorLut

The palette color LUT, valid for PALETTE COLOR Aspose.Medical.Dicom.Imaging.PixelData.PhotometricInterpretation. Read-only Aspose.Medical.Imaging.PixelFormats.Bgra32 array.

public Bgra32[] PaletteColorLut { get; }

Property Value

Bgra32 []

Exceptions

MedicalApiException

Invalid photometric interpretation or palette color LUT is missing in dataset.

PhotometricInterpretation

The photometric Interpretation. Read/Write Aspose.Medical.Dicom.Imaging.PhotometricInterpretation.

public PhotometricInterpretation? PhotometricInterpretation { get; set; }

Property Value

PhotometricInterpretation ?

PixelRepresentation

The pixel Representation (0028,0103), represents signed/unsigned data of the pixel samples. Read/Write Aspose.Medical.Dicom.Imaging.PixelRepresentation.

public PixelRepresentation PixelRepresentation { get; set; }

Property Value

PixelRepresentation

PlanarConfiguration

The planar Configuration (0028,0006), indicates whether the color pixel data are sent color-by-plane or color-by-pixel. Read/Write Aspose.Medical.Dicom.Imaging.PixelRepresentation.

public PlanarConfiguration PlanarConfiguration { get; set; }

Property Value

PlanarConfiguration

SamplesPerPixel

The number of samples per pixel (0028,0002), usually 1 for grayscale and 3 for color for RGB and YBR. Read/Write System.UInt16.

public ushort SamplesPerPixel { get; set; }

Property Value

ushort

Syntax

The transfer syntax used to encode the DICOM image pixel data. Read-only Aspose.Medical.Dicom.TransferSyntax.

public TransferSyntax Syntax { get; }

Property Value

TransferSyntax

UncompressedFrameSize

The uncompressed frame size in bytes. Read-only System.Int32.

public int UncompressedFrameSize { get; }

Property Value

int

Width

The DICOM image width (columns) in pixels. Read/Write System.UInt16.

public ushort Width { get; set; }

Property Value

ushort

Methods

AddFrame(Span<byte>)

Adds new frame into pixel data. New frame will be appended to existing frames.

public abstract void AddFrame(Span<byte> data)

Parameters

data Span < byte &gt;

Frame System.Byte buffer to be added.

Create(Dataset)

Creates a new instance of the Aspose.Medical.Dicom.Imaging.PixelData and creates Pixel Data element for the given dataset.

public static PixelData Create(Dataset dataset)

Parameters

dataset Dataset

The DICOM dataset.

Returns

PixelData

The Aspose.Medical.Dicom.Imaging.PixelData.

Exceptions

MedicalApiException

Unable to create Pixel Data.

GetFrame(int)

Extracts byte frame at the specified position (index).

public abstract Span<byte> GetFrame(int index)

Parameters

index int

The index of a frame to be extracted.

Returns

Span < byte &gt;

The System.Byte’s array frame.

GetPhotometricInterpretation()

Returns Aspose.Medical.Dicom.Imaging.PhotometricInterpretation stored in the Aspose.Medical.Dicom.Imaging.PixelData.Dataset (if specified). If ‘Photometric Interpretation’ isn’t explicitly specified in the Dataset, the calculates default Aspose.Medical.Dicom.Imaging.PhotometricInterpretation for the given Aspose.Medical.Dicom.Imaging.PixelData.Dataset based on the Aspose.Medical.Dicom.Tags.Tag.SamplesPerPixel and Aspose.Medical.Dicom.Tags.Tag.RedPaletteColorLookupTableData.

public PhotometricInterpretation GetPhotometricInterpretation()

Returns

PhotometricInterpretation

The Aspose.Medical.Dicom.Imaging.PixelData.PhotometricInterpretation applicable for this pixel data.

GetRawData()

Returns raw pixel data in internal format.

public abstract Span<byte> GetRawData()

Returns

Span < byte &gt;

The raw pixel data in internal format.

Read(Dataset)

Creates a new instance of the Aspose.Medical.Dicom.Imaging.PixelData by reading existing Pixel Data element from the given dataset.

public static PixelData Read(Dataset dataset)

Parameters

dataset Dataset

The DICOM dataset.

Returns

PixelData

The Aspose.Medical.Dicom.Imaging.PixelData.

Exceptions

MedicalApiException

Unable to create Pixel Data. </byte>