Table of Contents

Class BitDepth

Namespace
FellowOakDicom.Imaging
Assembly
fo-dicom.core.dll

Extract image bit depth infomation from dataset and provide information for image rendering process

public class BitDepth
Inheritance
BitDepth
Inherited Members
Extension Methods

Constructors

BitDepth(int, int, int, bool)

Initialize the bit depth information using passed parameters

public BitDepth(int allocated, int stored, int highBit, bool signed)

Parameters

allocated int

Number of bits allocated per pixel sample (8,16,32)

stored int

Number of bits stored per pixel sample (from LSB to MSB)

highBit int

The high bit zero based index

signed bool

True if pixel data signed (sign will be stored in the high bit)

Properties

BitsAllocated

Number of bits allocated per sample. Generally 1, 4, 8, or 16.

public int BitsAllocated { get; }

Property Value

int

BitsStored

Number of bits stored per sample.

public int BitsStored { get; }

Property Value

int

HighBit

Highest value bit in sample.

public int HighBit { get; }

Property Value

int

IsSigned

Samples are signed values if true.

public bool IsSigned { get; }

Property Value

bool

MaximumValue

The maximum possible pixel value from stored bits

public int MaximumValue { get; }

Property Value

int

MinimumValue

The minimum possible pixel value from stored bits

public int MinimumValue { get; }

Property Value

int

Methods

FromDataset(DicomDataset)

Create new instance of BitDepth from input dataset

public static BitDepth FromDataset(DicomDataset dataset)

Parameters

dataset DicomDataset

Input dataset to extract bit depth information from

Returns

BitDepth

New BitDepth instance

GetHighBit(int, bool)

Return the high data bit index (excluding sign bit if data is signed)

public static int GetHighBit(int bitsStored, bool isSigned)

Parameters

bitsStored int

Number of bits

isSigned bool

True if signed

Returns

int

Index of high data bit (excluding sign bit if data is signed)

GetMaximumValue(int, bool)

Calculate the maximum value for specified bits and sign

public static int GetMaximumValue(int bitsStored, bool isSigned)

Parameters

bitsStored int

Number of bits

isSigned bool

True if signed

Returns

int

The maximum value

GetMinimumValue(int, bool)

Calculate the minimum value for specified bits and sign

public static int GetMinimumValue(int bitsStored, bool isSigned)

Parameters

bitsStored int

Number of bits

isSigned bool

True if signed

Returns

int

The minimum value

GetNextPowerOf2(int)

Rounds up to the next power of 2.

public static int GetNextPowerOf2(int value)

Parameters

value int

Returns

int

Next power of 2 or current value if already power of 2.

ToString()

public override string ToString()

Returns

string